Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/02/2012, 15:00
Avatar de cmprte
cmprte
 
Fecha de Ingreso: diciembre-2011
Mensajes: 4
Antigüedad: 13 años
Puntos: 0
Pregunta Warning: Cannot modify header information - headers already sent

Hola soy nuevo en esto y deseo crear una pagina web sobre artes ecenicas donde los artistas mismo puedan ir a registrarse hacerse como uan apgina de perfil donde puedan subir imagenes y publicar links de sus respectivos temas o videos etc..

estoy tratando de crear un sistema de log in y e empezado desde 0 tratando de comprender poco a poco como funciona pero me aparece este error al registarse


You Are Registered And Can Now Login
Warning: Cannot modify header information - headers already sent by (output started at /www/clanteam.com/c/o/m/comparte/htdocs/database.php:17) in /www/clanteam.com/c/o/m/comparte/htdocs/regcheck.php on line 84


--------------------

aki los scripts:






Index.php:


<?php

session_start();

require_once 'database.php';

if (isset($_SESSION['user'])){

echo "Welcome ".$_SESSION['user'];

?>

<form name="logout" method="post" action="logout.php">

<input type="submit" name="logout" id="logout" value="Logout">

</form>

<br /><form name="news" method="post" action="news.php">

<input type="submit" name="news" id="news" value="News">

</form>

<?php

}

elseif(isset($_SESSION['admin'])){

echo"Welcome ".$_SESSION['admin'];

echo"<br><br>You are logged in as an Admin";

?>

<form name="logout" method="post" action="logout.php">

<input type="submit" name="logout" id="logout" value="Logout">

</form>

<br /><form name="news" method="post" action="news.php">

<input type="submit" name="news" id="news" value="News">

</form>

<?php

}else{

?>

<form name="login_form" method="post" action="Login.php">

<label>

<input name="user" type="text" id="user">ID<br />

<input name="pass" type="password" id="pass">Password<br />

</label>

<input type="submit" name="login" id="login" value="Login">

</label>

</p>

</form>

<form name="Register" method="post" action="reg.php">

<input type="submit" name="register" id="register" value="Register">

</form><br />

<form name="news" method="post" action="news.php">

<input type="submit" name="news" id="news" value="News">

</form>

<?php

}

?>



-------------------------

Database.php:



<?

$con = mysql_connect('localhost','641714_comparte','27866 52a');

if (!$con)

{

die('Could not connect: ' . mysql_error());

}

mysql_select_db('comparte_clanteam_1');

?>


-------------

Regcheck.php:



<?php

if(

isset( $_POST['user'] ) &&

isset( $_POST['pass'] )

)

{

if( strlen( $_POST['user'] ) < 4 )

{

echo "Username Must Be More Than 4 Characters.";

}

elseif( strlen( $_POST['pass'] ) < 4 )

{

echo "Passwrod Must Be More Than 4 Characters.";

}

elseif( $_POST['pass'] == $_POST['user'] )

{

echo"Username And Password Can Not Be The Same.";

}

else

{

include( 'database.php' );

$username = mysql_real_escape_string( $_POST['user'] );

$password = md5( $_POST['pass'] );

$sqlCheckForDuplicate = "SELECT username FROM user WHERE username = '". $username
."'";



if( mysql_num_rows( mysql_query( $sqlCheckForDuplicate ) ) == 0 )

{

$sqlRegUser = "INSERT INTO

user( username, password )

VALUES(

'". $username ."',

'". $password ."'

)";

if( !mysql_query( $sqlRegUser ) )

{

echo "You Could Not Register Because Of An Unexpected Error.";

}

else

{

echo "You Are Registered And Can Now Login";

$formUsername = $username;

header ('location: Login.php');

}

}

else

{

echo "The Username You Have Chosen Is Already Being Used By Another User. Please Try Another
One.";

$formUsername = $username;

}

}

}

else

{

echo "You Could Not Be Registered Because Of Missing Data.";

}

?>



---------------------------

gracias por su atencion espero que em puedan ayudar
slds! y gracias