Jump to content

Recommended Posts

first off, you do not want to send information like the user's name and password through the url.

but, assuming that you have no html output before the validation, you can use the header function (example):

[code]
<?php
   session_start();
   if ($_POST['user'] and $_POST['pass']) {
       $results = mysql_query('select * from table where username='".$_POST['user']."' and password = '".$_POST['pass']."'");
      if (mysql_fetch_rows($results) == 1) {
         $_SESSION['info'] = mysql_fetch_array($results);
         header ('location: blah.php'); exit;
      } else {
         echo 'login failed';
   }
[/code]

i added in session_start(); and then creating a session variable that holds the user's info as an alternative method of passing the information via url. on your target page (blah.php) you would start it off with session_start(); as well. then you can access the information through the info session variable.
Link to comment
https://forums.phpfreaks.com/topic/9900-reload-to-new-page/#findComment-36806
Share on other sites

ya i coded the pass, also say i wanted to retrieve the pass...what would i use?(never used a session before)

thanks
Matt

[!--quoteo(post=374863:date=May 17 2006, 11:39 PM:name=Crayon Violent)--][div class=\'quotetop\']QUOTE(Crayon Violent @ May 17 2006, 11:39 PM) [snapback]374863[/snapback][/div][div class=\'quotemain\'][!--quotec--]
first off, you do not want to send information like the user's name and password through the url.

but, assuming that you have no html output before the validation, you can use the header function (example):

[code]
<?php
   session_start();
   if ($_POST['user'] and $_POST['pass']) {
       $results = mysql_query('select * from members where username='".$_POST['user']."' and password = '".$_POST['pass']."'");
      if (mysql_fetch_rows($results) == 1) {
         $_SESSION['info'] = mysql_fetch_array($results);
         header ('location: blah.php'); exit;
      } else {
         echo 'login failed';
   }
[/code]

i added in session_start(); and then creating a session variable that holds the user's info as an alternative method of passing the information via url. on your target page (blah.php) you would start it off with session_start(); as well. then you can access the information through the info session variable.
[/quote]
Link to comment
https://forums.phpfreaks.com/topic/9900-reload-to-new-page/#findComment-36899
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.