That's my randSession Function function randSession() { $pass_len=8 ; $allchars = 'abcdefghijklmnopqrstuvwxyz0123456789'; $string = ''; mt_srand((double)microtime()*1000000);
for ($i=0;$i<$pass_len;$i++) { $string .= $allchars{mt_rand(0,strlen($allchars))}; } return $string; } -----Original Message----- From: John Wards [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 15, 2002 5:00 PM To: Reymond Subject: Re: [PHP] create header and redirecting $session_id = randSession(); Think this must be sending out a header John ----- Original Message ----- From: "Reymond " <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, August 15, 2002 11:00 AM Subject: [PHP] create header and redirecting > I have tree pages, we call it first.php, second.php, third.php > On My first.php page, I have form (LOGIN FORM) and I'd action it to > second page. Like this Below > .... <form method="post" action="second.php">...... > > In my second page I'd tried to use header, for redirecting to third.php > after check the session, in my Session table in my Database, (and I've > got the session on my database. > ---------------------------- second.php -------- > .......... > if ($row["result"]=="0") > { > header("location: http://www.blabla/blablba/second.php?message=<font > color=red>Incorrect Password</font>"); > } > elseif ($row["result"]!= 0) > { > $id = $result_data['id']; > mysql_query("Delete from Session where user = '$id'", $cnx); > $session_id = randSession(); > mysql_query("Insert into Session values('$id','$session_id')"); > if ($result_data["level"]==1) > { > header("location: > third.php?id=$id&session_id=$session_id");<--LINE 33 > } > else > { > header("location: third.php?id=$id&session_id=$session_id"); > } > > } > .......... > ------------------------------------------------------- > > doesn't got redirecting to the third.php but I got error message on my > second.php..., like this below. > > Warning: Cannot add header information - headers already sent by (output > started at /home/unri/ketahanan-pangan/second.php:16) in > /home/unri/ketahanan-pangan/second.php on line 32 > > 1. so how to use buffer for redirecting.... ???? > 2. is it right if I give the action(I mean Action Form) in my first.php > page to the second.php page..???, > > note : I have check my Session table On My database (MYSQL), and I got > it... > > Help... > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php