jakebur01 Posted October 24, 2007 Share Posted October 24, 2007 I installed this hesk ticket submission deal for a website. I am having trouble with the session and was hoping someone could help me figure it out. It is telling me: Your session has expired, please login using the form below. Here is the code: define('IN_SCRIPT',1); /* Get all the required files and functions */ require_once('hesk_settings.inc.php'); require_once('language/'.$hesk_settings['language'].'.inc.php'); require_once('inc/common.inc.php'); hesk_session_start(); require_once('inc/database.inc.php'); hesk_dbConnect() or hesk_error("$hesklang[cant_connect_db] $hesklang[contact_webmsater] $hesk_settings[webmaster_mail]!"); /* What should we do? */ $action=hesk_input($_REQUEST['a']) or $action='login'; if ($action == 'login') {print_login();} elseif ($action == 'do_login') {do_login();} elseif ($action == 'logout') {logout();} else {hesk_error($hesklang['invalid_action']);} /* Print footer */ require_once('inc/footer.inc.php'); exit(); /*** START FUNCTIONS ***/ function do_login() { global $hesklang; $user=hesk_isNumber($_POST['user'],$hesklang['select_username']); $pass=hesk_input($_POST['pass'],$hesklang['enter_pass']); $sql = "SELECT * FROM `hesk_users` WHERE `id`=$user LIMIT 1"; $result = hesk_dbQuery($sql) or hesk_error("$hesklang[cant_sql]: $sql</p><p>$hesklang[mysql_said]:<br>".mysql_error()."</p><p>$hesklang[contact_webmsater] $hesk_settings[webmaster_mail]"); $res=hesk_dbFetchAssoc($result); foreach ($res as $k=>$v) { $_SESSION[$k]=$v; } /* Check password */ if ($pass != $_SESSION['pass']) { hesk_session_stop(); hesk_error($hesklang['wrong_pass']); } /* Regenerate session ID (security) */ hesk_session_regenerate_id(); /* Get allowed categories */ if (empty($_SESSION['isadmin'])) { $cat=substr($_SESSION['categories'], 0, -1); $_SESSION['categories']=explode(",",$cat); } session_write_close(); if ($url=hesk_input($_REQUEST['goto'])) { $url = str_replace('&','&',$url); Header('Location: '.$url); } else { Header('Location: admin_main.php'); } exit(); } // End do_login() function print_login() { global $hesk_settings, $hesklang; require_once('inc/header.inc.php'); ?> <p class="smaller"><a href="<?php echo $hesk_settings['site_url']; ?>" class="smaller"><?php echo $hesk_settings['site_title']; ?></a> > <?php echo $hesklang['admin_login']; ?><br> </p> </td> </tr> <tr> <td> <p> </p> <h3 align="center"><?php echo $hesklang['login']; ?></h3> <?php if ($_REQUEST['notice']) { echo '<p align="center" class="important">'.$hesklang['session_expired'].'</p>'; } ?> <form action="admin.php" method="POST"> <div align="center"> <center> <table border="0" cellspacing="1" cellpadding="5"> <tr> <td align="right"><?php echo $hesklang['user']; ?>: </td> <td><select name="user"> <?php $sql = "SELECT * FROM `hesk_users`"; $result = hesk_dbQuery($sql) or hesk_error("$hesklang[cant_sql]: $sql</p><p>$hesklang[mysql_said]:<br>".mysql_error()."</p><p>$hesklang[contact_webmsater] $hesk_settings[webmaster_mail]"); while ($row=hesk_dbFetchAssoc($result)) { echo '<option value="'.$row['id'].'">'.$row['user'].'</option>'; } ?> </select></td> </tr> <tr> <td align="right"><?php echo $hesklang['pass']; ?>: </td> <td><input type="password" name="pass"></td> </tr> </table> </center> </div> <p align="center"><input type="hidden" name="a" value="do_login"> <?php if ($url=hesk_input($_REQUEST['goto'])) { echo '<input type="hidden" name="goto" value="'.$url.'">'; } ?> <input type="submit" value="<?php echo $hesklang['login']; ?>" class="button"></p> </form> <?php } // End print_login() function logout() { global $hesk_settings, $hesklang; require_once('inc/header.inc.php'); hesk_session_stop(); ?> <p class="smaller"><a href="<?php echo $hesk_settings['site_url']; ?>" class="smaller"><?php echo $hesk_settings['site_title']; ?></a> > <?php echo $hesklang['logged_out']; ?><br> </p> </td> </tr> <tr> <td> <p> </p> <h3 align="center"><?php echo $hesklang['logout']; ?></h3> <p> </p> <p align="center"><?php echo $hesklang['logout_success']; ?></p> <p> </p> <p align="center"><a href="admin.php"><?php echo $hesklang['click_login']; ?></a></p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <?php require_once('inc/footer.inc.php'); exit(); } // End logout() I can't figure out what's wrong. I know that my sessions are working ok. I created a session on a test page and then I displayed that session on a second test page. Quote Link to comment https://forums.phpfreaks.com/topic/74647-solved-session-problem/ Share on other sites More sharing options...
MadTechie Posted October 24, 2007 Share Posted October 24, 2007 it would probably be better to move this to third party also do you have the latest version? Version: 0.94 from 23rd April 2007 Quote Link to comment https://forums.phpfreaks.com/topic/74647-solved-session-problem/#findComment-377356 Share on other sites More sharing options...
jakebur01 Posted October 25, 2007 Author Share Posted October 25, 2007 Yes, this is the latest. Thanks. I will try phpjunkyard.com. Quote Link to comment https://forums.phpfreaks.com/topic/74647-solved-session-problem/#findComment-377543 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.