I have the following registration.php file:
<?php
include_once("QueryNew.php");
if (!get_magic_quotes_gpc()) {
$email=addslashes($_POST["email"]);
$password=addslashes($_POST["password"]);
$confirmpassword=addslashes($_POST["confirmpassword"]);
$uid=uniqid();
}
if (trim($email," ") == "" || trim($password," ") == "" && trim($confirmpassword," ") == ""){
echo "<script type='text/javascript'>window.location='logintips.php?regErr=All fields are mandatory'</script>";
}
if (trim($password," ") != trim($confirmpassword," ")){
echo "<script type='text/javascript'>window.location='logintips.php?regErr=Passwords didnot match'</script>";
}
if (trim($email," ") != "" || trim($password," ") != "" && trim($confirmpassword," ") != ""){
$insertQuery = "INSERT INTO user VALUES('".$uid."','".$email."','".$password."','',1,".CURRENT_TIMESTAMP.")";
$qry = new QueryNew();
$insert = $qry->executeSelect($insertQuery);
$SELECT_STAR = "select uid, email, timezone from ";
$selectQuery = $SELECT_STAR . "user" . " where email = '".$email."'";
$qry = new QueryNew();
$select = $qry->executeSelect($selectQuery);
while($row = mysql_fetch_assoc($select)) {
$uidS = $row['uid'];
$emailS = $row['email'];
}
**//store $uidS and $emailS in a session variable and redirect to a (home) page**
}
?>
Once I am done with the insert and select queries, I want to create a session and redirect to someother page..
I tried session_start() as below:
session_start();
$_SESSION[uid] = $uidS;
$_SESSION[email] = $emailS;
echo $_SESSION[uid];
echo $_SESSION[email];
Which gives an error:
**Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\website\try\MAIN\HOME\QueryNew.php:43) in C:\xampp\htdocs\website\try\MAIN\HOME\register.php on line 45**
If there is a better way than the above, please suggest.