Warning: Cannot modify header information - headers already sent by (output started at /login.php:9)
este es el codigo
login.php
Código
<form name=login action=login.php method=post> Usuario: <input type=text name=user size=20><br> contraseña: <input type=password name=pass size=20> <input type=submit name=entrar value=conectar> </form> <?php if(@$_COOKIE[USER_COOKIE] == $clave) { echo "Bienvenido"; echo "<a href='paginaprivada.php'><br><br>Go to</a>"; }else{ if(@$_REQUEST['entrar']=="conectar") { $user = $_POST['user']; $password = $_POST['pass']; if($passwordsha1 == $clave) { echo "Bienvenido $user"; echo "<a href='paginaprivada.php'><br><br>Go to</a>"; }else{ echo "<br>Contraseña incorrecta</p>"; } } } ?>
el error solo me lo da en el web hosting ya lo probe localmente y funciona bien, tambien eh probado cambiandole nombre a la cookie y igual subi al hosting un blog que utilizaba cookies y no tira ningun error entonces me fije en el codigo de el blog y veo que hace como una estructura para la cookie y no entiendo muy bien el codigo de el blog alguien me prodria explicar algo al respecto.
este es el codigo de el blog que subi para probar y no tiene ningun problema
Código
<?php function cookie_setup() { global $fp_config; // md5(BLOG_BASEURL); } function wp_get_cookie_login() { return false; } endif; function cookie_set($username, $password, $already_md5 = false, $home = '', $siteurl = '', $remember = false) { if ( !$already_md5 ) $cookiepath = COOKIEPATH; else $sitecookiepath = SITECOOKIEPATH; $cookiehash = COOKIEHASH; } else { } if ( $remember ) else $expire = 0; if ( $cookiepath != $sitecookiepath ) { } } function cookie_clear() { } function wp_login($username, $password, $already_md5 = false) { global $wpdb, $error; $username = sanitize_user($username); if ( '' == $username ) return false; if ( '' == $password ) { $error = __('<strong>ERROR</strong>: The password field is empty.'); return false; } $login = get_userdatabylogin($username); //$login = $wpdb->get_row("SELECT ID, user_login, user_pass FROM $wpdb->users WHERE user_login = '$username'"); if (!$login) { $error = __('<strong>ERROR</strong>: Invalid username.'); return false; } else { // If the password is already_md5, it has been double hashed. // Otherwise, it is plain text. return true; } else { $error = __('<strong>ERROR</strong>: Incorrect password.'); $pwd = ''; return false; } } } endif; function is_user_logged_in() { $user = wp_get_current_user(); if ( $user->id == 0 ) return false; return true; } endif; function auth_redirect() { // Checks if a user is logged in, if not redirects them to the login page !wp_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true)) || nocache_headers(); wp_redirect(get_option('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI'])); } } endif; ?>
espero me ayuden.