session error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    session error

    Pls Friends what happy to this below code, it keep on telling me session expire lol

    [php]<?php
    define('WAP',true);
    require('db.php');
    session_start();
    $ses = $_SESSION['ses'];
    $sessions = mysql_fetch_array(mysql_query("SELECT * FROM sessions WHERE ses = '$ses'"));
    $time = time();
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
    <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
    <html xmlns=\"http://www.w3.org/1999/xhtml\">
    <head>
    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>
    <meta http-equiv=\"Cache-Control\" content=\"no-cache\"/>
    <meta http-equiv=\"Cache-Control\" content=\"must-revalidate\"/>
    <meta http-equiv=\"Cache-Control\" content=\"max-age=30\"/>
    <title>Home</title>
    </head>
    <body>";
    if (mysql_num_rows(mysql_query("SELECT * FROM sessions WHERE ses = '$ses'")) == 1)
    {
    if ((time()-$sessions['time']) < 300) mysql_query("UPDATE sessions SET time = $time WHERE uid = $sessions[uid]");
    }
    else
    {
    echo "Your session has expired<br/>
    <form action=\"index.php\" method=\"get\">
    <input type=\"submit\" value=\"Index\"/>
    </form>
    </body>
    </html>";
    exit();
    }
    mysql_query("UPDATE members SET lastseen = $time WHERE id = $sessions[uid]")or die(mysql_errno()." - ".mysql_error());
    echo "welcome please feel free to look around.<br/>
    <br/>
    <form action=\"logout.php\" method=\"get\">
    <input type=\"submit\" value=\"Logout\"/>
    </form>
    </body>
    </html>";
    ///////////////////////////database
    CREATE TABLE `sessions` (
    `uid` int(100) unsigned NOT NULL auto_increment,
    `user` varchar(50) default NULL,
    `ses` varchar(50) default NULL,
    PRIMARY KEY (`uid`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=7
    [php]

    #2
    there is no time field in your database table
    Code:
    if ((time()-$sessions['time']) < 300) mysql_query("UPDATE sessions SET time = $time WHERE uid = $sessions[uid]");
    Wapchat4u


    Topsites4u

    Comment


      #3
      Maybe... Or Check ur login php. Maybe there's problem..
      sigpic
      Visit my WEBSITE Project: http://www.aspirewap.net

      Comment

      Working...
      X