Re: [PHP] RE: Unable to get the values in next page
Thanks for the reply.Actually I don't know that I have to include the start_session in every page. I GOT it ATLAST. Regards -murugesan. - Original Message - From: Cody Phanekham [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, August 25, 2003 12:26 PM Subject: [PHP] RE: Unable to get the values in next page main.php - echo $failed;// this is null here - did you start the session in main.php before echo $failed;? eg ? session_name(mysessionname); session_start(); ? -Original Message- From: murugesan [mailto:[EMAIL PROTECTED] Sent: Monday, 25 August 2003 16:46 To: Cody Phanekham; [EMAIL PROTECTED] Subject: Unable to get the values in next page I did as what you said. But the problem now is that I am not able to get the values in the next page. index.php -- session_name(mysessionname); session_start(); --- auth.php - $failed=yes; session_register('failed'); header (Location: /main.php); - main.php - echo $failed;// this is null here - What might be the problem ? Thanks in advance, Murugesan. Murugesan, I'll assume your redirecting the user to main.php because (s)he has passed the authentication routine... in that case just store the username and password as a session variable that way you wont need to pass the username and password via the url. auth.php, [just before the call to header()]: ? session_register('empid'); session_register('pwd'); header (Location: /main.php); ? then in main.php you need to start your session to access the session variables ? session_name(yoursessionname); session_start(); // you now have access to $empid and $pwd echo bryour employee id = $empid and the password you typed was $pwd; ? -Original Message- From: murugesan [mailto:[EMAIL PROTECTED] Sent: Monday, 25 August 2003 15:18 To: Cody Phanekham; [EMAIL PROTECTED] Subject: Re: [PHP] How to open random Flash page with hyperlink? Thanks for the information. In the code you provided if ((!$passwd) || (!$username)) // user hasnt logged in { . Actually I have implemented this in a separate page. That is upon sign up of the form in the index page I call a new page auth.php In that file I have done this authentication and called the function header (Location: /main.php?empid=$empidpwd=$pwd); Actually when passing this URL the password appears in the address bar. How to over come this? It will be very much usefull if I get the answer. Thanks in advance -Murugesan -- -- -- -- - Ok lets say you want every user to login before they can access other parts of your site. index.php: ? session_name(mysessionname); session_start(); session_register(s_authed); $s_authed = 0; // initialize session flag if ((!$passwd) || (!$username)) // user hasnt logged in { // display login form ... } else { // retrieve database username and password here ... // check if they match if (($db_passwd == $passwd) ($db_username == $username)) { $s_authed = 1; // user has been authorised // redirect to real page echo script window.location='main.php' /script; } } ? main.php: ? session_name(mysessionname); session_start(); if (!$s_authed) // check access { // user hasnt been authorised, therefore redirect to login page echo script window.location='index.php' /script; } else { // display page ... } ? if a user tries to access main.php directly without logging in they will be redirected to index.php checkout http://www.php.net/manual/en/ref.session.php for more information Thanks for the message. Can you please tell me how to do session authentication?. -murugesan * This e-mail, including any attachments to it, may contain confidential and/or personal information. If you have received this e-mail in error, you must not copy, distribute, or disclose it, use or take any action based on the information contained within it. Please notify the sender immediately by return e-mail of the error and then delete the original e-mail. The information contained within this e-mail may be solely the opinion of the sender and may not necessarily reflect the position, beliefs or opinions of Salmat on any issue. This email has been swept for the presence of computer viruses known to Salmat's anti-virus systems. For more
RE: [PHP] RE: Unable to get the values in next page
NP. You only have to start a session if you want to access any session variable. You could always including the code in a header.inc file that gets included in every php script, that way you wont forget to start the session. -Original Message- From: murugesan [mailto:[EMAIL PROTECTED] Sent: Monday, 25 August 2003 17:14 To: Cody Phanekham; [EMAIL PROTECTED] Subject: Re: [PHP] RE: Unable to get the values in next page Thanks for the reply.Actually I don't know that I have to include the start_session in every page. I GOT it ATLAST. Regards -murugesan. - Original Message - From: Cody Phanekham [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, August 25, 2003 12:26 PM Subject: [PHP] RE: Unable to get the values in next page main.php - echo $failed;// this is null here - did you start the session in main.php before echo $failed;? eg ? session_name(mysessionname); session_start(); ? -Original Message- From: murugesan [mailto:[EMAIL PROTECTED] Sent: Monday, 25 August 2003 16:46 To: Cody Phanekham; [EMAIL PROTECTED] Subject: Unable to get the values in next page I did as what you said. But the problem now is that I am not able to get the values in the next page. index.php -- session_name(mysessionname); session_start(); --- auth.php - $failed=yes; session_register('failed'); header (Location: /main.php); - main.php - echo $failed;// this is null here - What might be the problem ? Thanks in advance, Murugesan. Murugesan, I'll assume your redirecting the user to main.php because (s)he has passed the authentication routine... in that case just store the username and password as a session variable that way you wont need to pass the username and password via the url. auth.php, [just before the call to header()]: ? session_register('empid'); session_register('pwd'); header (Location: /main.php); ? then in main.php you need to start your session to access the session variables ? session_name(yoursessionname); session_start(); // you now have access to $empid and $pwd echo bryour employee id = $empid and the password you typed was $pwd; ? -Original Message- From: murugesan [mailto:[EMAIL PROTECTED] Sent: Monday, 25 August 2003 15:18 To: Cody Phanekham; [EMAIL PROTECTED] Subject: Re: [PHP] How to open random Flash page with hyperlink? Thanks for the information. In the code you provided if ((!$passwd) || (!$username)) // user hasnt logged in { . Actually I have implemented this in a separate page. That is upon sign up of the form in the index page I call a new page auth.php In that file I have done this authentication and called the function header (Location: /main.php?empid=$empidpwd=$pwd); Actually when passing this URL the password appears in the address bar. How to over come this? It will be very much usefull if I get the answer. Thanks in advance -Murugesan -- -- -- -- - Ok lets say you want every user to login before they can access other parts of your site. index.php: ? session_name(mysessionname); session_start(); session_register(s_authed); $s_authed = 0; // initialize session flag if ((!$passwd) || (!$username)) // user hasnt logged in { // display login form ... } else { // retrieve database username and password here ... // check if they match if (($db_passwd == $passwd) ($db_username == $username)) { $s_authed = 1; // user has been authorised // redirect to real page echo script window.location='main.php' /script; } } ? main.php: ? session_name(mysessionname); session_start(); if (!$s_authed) // check access { // user hasnt been authorised, therefore redirect to login page echo script window.location='index.php' /script; } else { // display page ... } ? if a user tries to access main.php directly without logging in they will be redirected to index.php checkout http://www.php.net/manual/en/ref.session.php for more information Thanks for the message. Can you please tell me how to do session authentication?. -murugesan ** ** * This e
Re: [PHP] RE: Unable to get the values in next page
I thought of including the script in all the files.Thanks for the message. Regards, Murugesan - Original Message - From: Cody Phanekham [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, August 25, 2003 12:50 PM Subject: RE: [PHP] RE: Unable to get the values in next page NP. You only have to start a session if you want to access any session variable. You could always including the code in a header.inc file that gets included in every php script, that way you wont forget to start the session. -Original Message- From: murugesan [mailto:[EMAIL PROTECTED] Sent: Monday, 25 August 2003 17:14 To: Cody Phanekham; [EMAIL PROTECTED] Subject: Re: [PHP] RE: Unable to get the values in next page Thanks for the reply.Actually I don't know that I have to include the start_session in every page. I GOT it ATLAST. Regards -murugesan. - Original Message - From: Cody Phanekham [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, August 25, 2003 12:26 PM Subject: [PHP] RE: Unable to get the values in next page main.php - echo $failed;// this is null here - did you start the session in main.php before echo $failed;? eg ? session_name(mysessionname); session_start(); ? -Original Message- From: murugesan [mailto:[EMAIL PROTECTED] Sent: Monday, 25 August 2003 16:46 To: Cody Phanekham; [EMAIL PROTECTED] Subject: Unable to get the values in next page I did as what you said. But the problem now is that I am not able to get the values in the next page. index.php -- session_name(mysessionname); session_start(); --- auth.php - $failed=yes; session_register('failed'); header (Location: /main.php); - main.php - echo $failed;// this is null here - What might be the problem ? Thanks in advance, Murugesan. Murugesan, I'll assume your redirecting the user to main.php because (s)he has passed the authentication routine... in that case just store the username and password as a session variable that way you wont need to pass the username and password via the url. auth.php, [just before the call to header()]: ? session_register('empid'); session_register('pwd'); header (Location: /main.php); ? then in main.php you need to start your session to access the session variables ? session_name(yoursessionname); session_start(); // you now have access to $empid and $pwd echo bryour employee id = $empid and the password you typed was $pwd; ? -Original Message- From: murugesan [mailto:[EMAIL PROTECTED] Sent: Monday, 25 August 2003 15:18 To: Cody Phanekham; [EMAIL PROTECTED] Subject: Re: [PHP] How to open random Flash page with hyperlink? Thanks for the information. In the code you provided if ((!$passwd) || (!$username)) // user hasnt logged in { . Actually I have implemented this in a separate page. That is upon sign up of the form in the index page I call a new page auth.php In that file I have done this authentication and called the function header (Location: /main.php?empid=$empidpwd=$pwd); Actually when passing this URL the password appears in the address bar. How to over come this? It will be very much usefull if I get the answer. Thanks in advance -Murugesan -- -- -- -- - Ok lets say you want every user to login before they can access other parts of your site. index.php: ? session_name(mysessionname); session_start(); session_register(s_authed); $s_authed = 0; // initialize session flag if ((!$passwd) || (!$username)) // user hasnt logged in { // display login form ... } else { // retrieve database username and password here ... // check if they match if (($db_passwd == $passwd) ($db_username == $username)) { $s_authed = 1; // user has been authorised // redirect to real page echo script window.location='main.php' /script; } } ? main.php: ? session_name(mysessionname); session_start(); if (!$s_authed) // check access { // user hasnt been authorised, therefore redirect to login page echo script window.location='index.php' /script; } else { // display page ... } ? if a user tries to access main.php directly without logging in they will be redirected to index.php checkout http://www.php.net/manual/en