Jump to content

sessions stopped working


rondog

Recommended Posts

for some reason my sessions aren't working anymore. It was working a week ago just fine. I never changed anything, but now nobody can login. I restarted my server and still no luck. I cleared out my tmp folder that holds my sessions..when I try and login, its suppose to take you to art.php and It returns 'you must be logged in to view that page' meaning you aren't logged in. Also there isnt anything in the tmp folder once I try and login which leads me to believe its a session issue. Here is my code for my login page.

<?php
session_start();
?>
<!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=iso-8859-1" />
<title>Datron World Communications :: FCPA Training</title>
<script src="datronform.js" type="text/javascript"></script>
<?php
$username = $_POST['username'];
$password = md5($_POST['password']);
$submit = $_POST['Submit'];
if($submit != "") {
    $con = mysql_connect("localhost","username","pass");
    if (!$con) {
        echo "unable to connect to DB";
        echo mysql_error($con);
        exit();
    }
    $db = mysql_select_db("datron");
    if (!$db) {
        echo "unable to open DB";
        echo mysql_error($db);
        exit();
    }
    $query = "SELECT * FROM users WHERE username = '$username' AND password = '$password';";
    $rs = mysql_query($query);
    if(!mysql_num_rows($rs)){
        die("<b>Bad login. Please <a href=\"javascript:history.go(-1)\">go back</a> and try again.</b>");
     } else {
        while($row = mysql_fetch_assoc($rs)){
          if ( ( strcmp( strtolower( $username ), strtolower( $row['username'] ) ) == 0 ) && ( $password == $row['password'] ) )
            {
        $_SESSION['loggedIn'] = 'yes';
        $_SESSION['username'] = $username;
        header("Location: art.php");
            } 
        }
        echo "<b>Bad login. Pleasd <a href=\"javascript:history.go(-1)\">go back</a> and try again.</b>";
     }
  }
?>
<style type="text/css" media="all">
@import url(style.css);
</style>
</head>
<body onload="initialCheck()">
<div id="wrapper">
  <div id="wrapbg">
    <div id="banner"></div>
    <div id="content">
      <h2>FCPA Training</h2>
      <div id="login">
        <form id="form1" name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
          <table width="200" border="0" cellspacing="0" cellpadding="5" align="center">
            <tr>
              <td><label>Username: </label></td>
              <td><input name="username" type="text" id="username" class="inputtxt" size="40"/></td>
            </tr>
            <tr>
              <td><label>Password: </label></td>
              <td><input name="password" type="password" id="password" class="inputtxt" size="40"/></td>
            </tr>
          </table>
          <table width="405" border="0" cellspacing="0" cellpadding="5" align="center">
            <tr>
              <td width="285"><div align="left">
                  <input type="checkbox" name="userRead" id="haveRead" onclick="checkForm()" />
                  I have printed and reviewed the FCPA Policy.</div></td>
              <td width="100"><div align="right">
                  <input type="submit" name="Submit" value="Login" id="submitbtn" class="submitbtn" />
                </div></td>
            </tr>
          </table>
        </form>
        <p>Please print and review our <a href="docs/anti-bribery_policy.pdf" target="_blank">policy</a> prior to viewing this FCPA Training.</p>
        <p>Please allow 1 hour of uninterrupted time to complete the FCPA Training.</p>
        <p>If you have problems accessing your account, please contact us at <a href="mailto:helpdesk@dtwc.com?subject=FCPA Training">helpdesk@dtwc.com</a>.</p>
      </div>
    </div>
    <div id="footer">
      <p>Copyright © 2007 Datron World Communications, Inc. All rights reserved.</p>
      <!--<div id="signout"><a href="#">Sign Out</a></div>-->
    </div>
  </div>
</div>
</body>
</html>

 

Link to comment
Share on other sites

I think I figured it out..I was looking at my phpinfo file and noticed this:

 

Configuration File (php.ini) Path C:\WINNT

Loaded Configuration File C:\php\php.ini

 

Now a week ago the loaded config file was C:\WINNT\php.ini

 

I have no understanding as to why it randomly changed, but I copied my ini file from the winnt dir and pasted it in the php folder and it started working again. Any reason why it would change the path like that?

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.