Jump to content

[SOLVED] Sessions Help


darkfreaks

Recommended Posts

If you are using a session for a login script you should assign it some value for you to check. such as

 

page 1:

session_start();

// if the user is authorised and has just logged in create session

$_SESSION['auth']= TRUE;
$_SESSION['user_id'] = "mememe";
$_SESSION['password_key']="THINGIMIJIG";

header("LOCATION:nextpage.php");

 

 

page2:

 

session_start();
#check user is logged in

if (isset($_SESSION['auth'])) {

//dazel them with your website

}

 

 

Hope that helps

Link to comment
Share on other sites

<?php

session_start();
include_once "../configuration.inc.php";
require_once "../main.php";

if(!isset($aid)) {
  ?>

<center>
<br><p align="right"><font color="#FF6600"><strong><br>
  Site Admin Area</strong></font>
<hr width="100%" size="1" color=#FF6600></p>
<table width="278" align="center">
<form method="post" action="<?=$PHP_SELF?>">
<tr>
<td>Admin ID:</td>
<td> <input type="text" name="aid" size="15"></td>
</tr>

<tr>
<td><?=$PASSWORD1?></td>
<td><input type="password" name="apass" size="15"></td>
</tr>

<tr>
<td colspan=2 align=center><input type="submit" value="Login"></td>
</tr>
<tr><td colspan=2 align=center> <a class=TN href=forgot.php> Forgot your password?</a></td></tr>
  </form>
</table>
  <?php
include "../footer.php";
  exit;
}

$_SESSION["aid"] =TRUE;
$_SESSION["apass"] =TRUE;




$sql = "SELECT * FROM job_admin_login WHERE
        aid = '$aid' AND apass = '$apass'";
$result = mysql_query($sql);
if (!$result)
{
  echo "A database error occurred while checking your login details. <br>If this error persists, please contact $contactemail";
}

elseif (mysql_num_rows($result) == 0) {
unset($_SESSION["aid"]);
unset($_SESSION["apass"]);?>
  <h1> <?=$ACCDENIED?> </h1>
  <p>Your user ID or password is incorrect, or you are not a
     registered user on this site. To try logging in again, click
     <a href="<?=$PHP_SELF?>">here</a>. </p>
  <?php
  	include "../footer.php";
  exit;
}

?>

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.