Hi. I started a thread in sql forum thinking this was my issue. please see it here.
I am starting to believe this is a "bug" of sorts... I have merged the two databases into one. I have also put all of the contents into one page (removing the need for "require") to help source the problem.
I originally ran the following script with the first line setting "exists" to 2 rather than 4. after changing it to 4 and saving, I ran the page again by hitting F5
output is
if the
at the bottom runs, output is three. stop it, and back to 2.
why is session-exist coming up as 2???
I am starting to believe this is a "bug" of sorts... I have merged the two databases into one. I have also put all of the contents into one page (removing the need for "require") to help source the problem.
I originally ran the following script with the first line setting "exists" to 2 rather than 4. after changing it to 4 and saving, I ran the page again by hitting F5
Code:
<?php session_start(); ?>
<?php
$_SESSION[exists] = "4";
if(($_SESSION[exists] <> "1") && ($_SESSION[passes] == "0") && (!empty ($_SESSION[user])) && (!empty ($_SESSION[email])) && (!empty ($_SESSION[userpass]))
&& (!empty ($_SESSION[squestion])) && (!empty ($_SESSION[sanswer])) && (!empty ($_SESSION[terms])))
{
$_SESSION[exists] = "4";
require("pwinfo.php");
$con = mysql_connect($servername,$username,$password);
if (!$con)
{ die('Could not connect: ' . mysql_error()); }
mysql_select_db("metcoldb", $con);
$result = mysql_query("SELECT email FROM apply
WHERE email = '$_SESSION[email]' LIMIT 1");
while($row = mysql_fetch_array($result))
{
$_SESSION[exists] = "4";
}
mysql_close($con);
if($_SESSION[exists] = "2")
{
require("pwinfo.php");
$con = mysql_connect($servername,$username,$password);
if (!$con)
{ die('Could not connect: ' . mysql_error()); }
mysql_select_db("metcoldb", $con);
$sql = "INSERT INTO members (email, password, squestion, sanswer, joindate, usertitle)
VALUES
('$_SESSION[email]','$_SESSION[userpass]','$_SESSION[squestion]','$_SESSION[sanswer]','$_SESSION[date]','$_SESSION[user]')";
if (!mysql_query($sql,$con))
{ die('Error: ' . mysql_error()); }
mysql_close($con);
require("pwinfo.php");
$con = mysql_connect($servername,$username,$password);
if (!$con)
{ die('Could not connect: ' . mysql_error()); }
mysql_select_db("metcoldb", $con);
mysql_query("DELETE FROM apply WHERE email = '$_SESSION[email]' LIMIT 1");
mysql_close($con);
/* $_SESSION[exists] = "3"; */
echo "added";
}
}
else
{
echo"not added";
}
?>
<p>currently registered info is as follows:</p>
<?php echo "registered email is ".$_SESSION[email];?><br/>
<?php echo "registered exists is ".$_SESSION[exists]; ?><br/>
output is
added
currently registered info is as follows:
registered email is fgfg@sdds
registered exists is 2
if the
Code:
/* $_SESSION[exists] = "3"; */
why is session-exist coming up as 2???