Jump to content

I think it is a session Problem


Joesavage

Recommended Posts

Some of my users are having problems with their accounts. Not everyone is having these same problems, only some people. I have asked them what browser and operating system they are using, and that does not seem to be an issue, but some people have gotten it to work by changing from FireFox to IE. Here is the script that is not executing correclty:

 

All comments have been posted for your use and are not part of the actual script.

 

<?php

// This if statement is for security reasons, making so that users cannot bypass directly to this script

session_start();

if (empty($_SESSION['Ad']))

{

echo "no";

}

 

else

{

echo "<html><body bgcolor = '#ffffcc'>";

// $timeslot represents a column in my database that will be used to pull information later.

$timeslot = One;

if ($_SESSION['Ad'] == 1)

$timeslot = One;

if ($_SESSION['Ad'] == 2)

$timeslot = Two;

if ($_SESSION['Ad'] == 3)

$timeslot = Three;

if ($_SESSION['Ad'] == 4)

$timeslot = Four;

if ($_SESSION['Ad'] == 5)

$timeslot = Five;

if ($_SESSION['Ad'] == 6)

$timeslot = Six;

if ($_SESSION['Ad'] == 7)

$timeslot = Seven;

if ($_SESSION['Ad'] == 8)

$timeslot = Eight;

if ($_SESSION['Ad'] == 9)

$timeslot = Nine;

if ($_SESSION['Ad'] == 10)

$timeslot = Ten;

 

$t=time();

$con = mysql_connect("localhost","XXX","XXX");

mysql_select_db("XXX", $con);

 

//$_SESSION[username] is set at the login page and I am sure that it functions correctly.

 

$result = mysql_query("select * FROM normalusers where Username = '$_SESSION[username]'");

while($row = mysql_fetch_array($result))

//This is another security measure. $_SESSION[verify] was set on a previous page, making it so that you

//have to go to that page before this one. $row[$timeslot] matches $_SESSION[verify].

//This IF statement could be where my problem is, if I have some syntax or something wrong.

//But I still dont understand why it would work for some people and not others.

{

if ($_SESSION[verify] == $row[$timeslot])

{

//THis if statement is correct.

if ($t - $row[$timeslot] >= 86400)

{

//None of the rest of this code is being executed for some users, which is why I think there

//is some problem with the above IF statement.

mysql_query("UPDATE normalusers SET $timeslot = '$t'

WHERE Username = '$_SESSION[username]'");

 

 

$calc = mysql_query("select * FROM normalusers where Username = '$_SESSION[Referrer]'");

while($ness = mysql_fetch_array($calc))

{

$Newtotal = $ness['TotalEarnings']+.01;

mysql_query("UPDATE normalusers SET TotalEarnings = '$Newtotal'

WHERE Username = '$_SESSION[Referrer]'");

}

 

$calc = mysql_query("select * FROM referredusers where Username = '$_SESSION[username]' && Referrer = '$_SESSION[Referrer]'");

while($ness = mysql_fetch_array($calc))

{

$refcash = $ness['Cash']+.01;

mysql_query("UPDATE referredusers SET Cash = '$refcash'

WHERE Username = '$_SESSION[username]' && Referrer = '$_SESSION[Referrer]'");

}

 

mysql_select_db("clixfouc_Advertising", $con);

$jam = mysql_query("select * FROM Currentads where Ad = '$_SESSION[Adnum]'");

while($cow = mysql_fetch_array($jam))

{

$Payout = $cow['Payout'];

$views = $cow['Currentviews']+1;

mysql_query("UPDATE Currentads SET Currentviews = '$views'

WHERE Ad = '$_SESSION[Adnum]'");

}

mysql_select_db("clixfouc_Bettermoney", $con);

$money = $row['Cash']+ $Payout;

$TotalEarnings = $row['TotalEarnings'] + $Payout;

 

mysql_query("UPDATE normalusers SET TotalEarnings = '$TotalEarnings'

WHERE Username = '$_SESSION[username]'");

 

mysql_query("UPDATE normalusers SET Cash = '$money'

WHERE Username = '$_SESSION[username]'");

$_SESSION['Count'] = $_SESSION['Count'] + 1;

}

}

}

}

?>

</body>

</html>

 

 

If you want me to post the scripts which set some of my other session variables that are in this script I can do that. Please help!

 

Link to comment
Share on other sites

And you don't even state what problems users are having.  If it has to deal with Sessions, then you need to make sure when you go from page to page, that the domain is the same.  IE, www.mydomain.com is not the same as mydomain.com when it comes to sessions and cookies.

Link to comment
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.