user sessions
Posted: Wed Aug 16, 2006 1:13 pm
ok....im not quite sure how i got rid of the registration errors but ladies and gents its finally working.....what i want to do now is create user sessions...i know absolutely nothing about this and im not even sure if i need to do thisbut what im trying to do is since the database has already recognized the user how do i get php to direct the user to his/her own personalized page....say to reveiw their own personal info....im guessing what id have to do would be to create some kind of case statement, because as of right now it directs all the users no matter the username to the same page
there are three occurances inwhich the code that im using points to $next_program in the tutorial...where should i place the case statement(assuming that i should or supposed to use a case statement) or am i miles away from home again?
also this line from the tutorial is commented out(i didnt notice it was until after i posted)
and when i ran it without the comment i got 2 errors that said
Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\bla\bla\bla\PHP\Login.php on line 204
Warning: Cannot modify header information - headers already sent by (output started at C:\bla\bla\bla\PHP\Login.php:204) in C:\bla\bla\bla\PHP\Login.php on line 205
and here is the funny thing about it all....the username saves in the database....so the information is saving and everything works perfectly...the only problem is when i try to shoot the email to the customer i get that error....does anyone know why?
Code: Select all
session_start();
include("functions_main.inc");
$table_name = "Customer";
$next_program = "SecretPage.php";//occurance 1Code: Select all
if($num == 1)
{
$sql = "SELECT user_name FROM $table_name
WHERE user_name='$_POST[fusername]'
AND password=md5('$_POST[fpassword]')";
$result2 = mysqli_query($cxn,$sql)
or die("Couldn't execute query 2.");
$row = mysqli_fetch_assoc($result2);
if($row)
{
$_SESSION['auth']="yes";
$_SESSION['logname'] = $_POST['fusername'];
header("Location: $next_program");//occurance 2
}
else
{
$message_1="The Login Name, '$_POST[fusername]'
exists, but you have not entered the
correct password! Please try again.<br>";
extract($_POST);
include("fields_login.inc");
include("double_form.inc");
}
}Code: Select all
else
{
$today = date("Y-m-d");
$fields_str = implode(",",$fields);
$values_str = implode('","',$values);
$fields_str .=",create_date";
$values_str .='"'.",".'"'.$today;
$fields_str .=",password";
$values_str .= '"'.","."md5"."('".$password."')";
$sql = "INSERT INTO $table_name ";
$sql .= "(".$fields_str.")";
$sql .= " VALUES ";
$sql .= "(".'"'.$values_str.")";
mysqli_query($cxn,$sql) or die(mysqli_error($cxn));
$_SESSION['auth']="yes";
$_SESSION['logname'] = $user_name;
/* send email to new Customer */
$emess = "You have successfully registered. ";
$emess .= "Your new user name and password are: ";
$emess .= "\n\n\t$user_name\n\t";
$emess .= "password\n\n";
$emess .= "We appreciate your interest. \n\n";
$emess .= "If you have any questions or problems,";
$emess .= " email service@ourstore.com";
$subj = "Your new customer registration";
#$mailsend=mail("$email","$subj","$emess");
header("Location: $next_program");//occurance 3
}also this line from the tutorial is commented out(i didnt notice it was until after i posted)
Code: Select all
$mailsend=mail("$email","$subj","$emess");Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\bla\bla\bla\PHP\Login.php on line 204
Warning: Cannot modify header information - headers already sent by (output started at C:\bla\bla\bla\PHP\Login.php:204) in C:\bla\bla\bla\PHP\Login.php on line 205
and here is the funny thing about it all....the username saves in the database....so the information is saving and everything works perfectly...the only problem is when i try to shoot the email to the customer i get that error....does anyone know why?