Jump to content

ravisan1

New Members
  • Posts

    4
  • Joined

  • Last visited

ravisan1's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks that helped, not having consistent www format was the problem. After consistently changing the url across all php fixed the issue. Thanks to both of you for providing feedback and helping me fix the issue. Have been breaking my head for the last two days :-)
  2. Thanks for all your help, will make sure to follow the right tags, i did print the session array and below is the observation ... when printed at the top of the php file which is responsible for setting the email session i get the following Array () After setting the email session variable i get the following Array( [Email] => r@10.com) it is very clear that the $_SESSION ['patchurl'] is not being set ...i want to provide a little bit on the flow .. user click on a link http://xxx.com, if he is not signed and not a register user i do the below I set the $_SESSION [patchurl] in a php called sessionsaver.php After setting this it goes to a registration.php where people enter all the details and click register clicking on register takes to the next php file where i insert all the data from the previous form, it is here i check if the $SESSION[patchurl] is available, if it there i basically redirect them to the page http://xxx where they were trying to go before the registration ..
  3. Thanks for the quick response ..below is the code that sets the patchurl session and redirect the user to register or login. <?php session_start(); ?> <?php echo '<script type="text/javascript">' . "\n"; if(isset($_SESSION["Email"])){ echo 'window.location="http://www.xxx";'; } else{ $_SESSION['patchurl'] = "true"; echo 'window.location="http://yyy";'; } echo '</script>';?> If the user is not registered he provides all the information and submits the information and that runs the below php file below is the code where i set the email session variable and not able to get the patchurl session variable.. <?phpsession_start(); ?> <html><head></head> <body> <?php // Create connection $con=mysql_connect("db","yyyy","xxxx"); // Check connection if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("yyyy", $con); $Email = mysql_real_escape_string($_POST['Email']); $pwd1 = mysql_real_escape_string($_POST['pwd1']); $pwd2 = mysql_real_escape_string($_POST['pwd2']); $Cname = mysql_real_escape_string($_POST['Cname']); $ques1 = mysql_real_escape_string($_POST['ques1']); $ques2 = mysql_real_escape_string($_POST['ques2']); if(isset($Email)){ $result = mysql_query("SELECT * FROM customer WHERE Email = '$Email'"); $get_rows = mysql_affected_rows($con); if($get_rows >=1){ //echo "user exists"; die(); } } //THIS IS WERE I AM SETTING THE EMAIL SESSION VARIABLE $_SESSION["Email"] = $Email; //inserting all the required value to register the customer $sql = "INSERT INTO `customer` (`Email`,`pwd1`,`pwd2`,`Cname`,`ques1`,`ques2`,`Identity`) VALUES ('$_POST[Email]', '$_POST[pwd1]', '$_POST[pwd2]', '$_POST[Cname]','$_POST[ques1]', '$_POST[ques2]','$numb')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } if(isset($_SESSION["Email"])) {?> // This is were the problem is after some troubleshooting i feel that once the session email is set this "patchurl session is doesn't seem to be live , i don't think i am getting in to the below if statement <?php if(isset($_SESSION["patchurl"])){ echo '<script type="text/javascript">' . "\n"; echo 'window.location="http://www.zzzz.com";'; echo '</script>'; } else{?> <?php echo '<script type="text/javascript">' . "\n"; echo 'window.location="http://www.kkkk.com";'; echo '</script>'; ?> <?php } ?> </body> </html>
  4. I have a session variable called $_SESSION['patchurl'] in a php file , if i get in to an else statement this session variable gets set and i go to http://yyy page. below is the snippet of the code <?php session_start(); ?> <?php echo '<script type="text/javascript">' . "\n"; if(isset($_SESSION["Email"])){ echo 'window.location="http://www.xxx";'; } else{ $_SESSION['patchurl'] = "true"; echo 'window.location="http://yyy";'; } echo '</script>';?> once the patchurl session variable is set i call a php file which sets an other session variable called $_SESSION["Email"]. now what happens is the $_SESSION['patchurl'] is gone and ONLY the $_SESSION["Email"] is accessible ...can i not set two session variables? why does creating a new session varible overwrites an other one even though they are called different ? am i doing something wrong ?
×
×
  • 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.