Jump to content

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
https://forums.phpfreaks.com/topic/80207-solved-sessions-help/#findComment-406540
Share on other sites

when i use

 

 

$_SESSION['variable'] = TRUE;

it works but when i click on a link in admin panel it sas my pass and username arent correct?

 

<?php
elseif (mysql_num_rows($result) == 0) {
unset($_SESSION["aid"]);
unset($_SESSION["apass"]);?>

Link to comment
https://forums.phpfreaks.com/topic/80207-solved-sessions-help/#findComment-406545
Share on other sites

when i use

 

 

$_SESSION['variable'] = TRUE;

it works but when i click on a link in admin panel it sas my pass and username arent correct?

 

<?php
elseif (mysql_num_rows($result) == 0) {
unset($_SESSION["aid"]);
unset($_SESSION["apass"]);?>

 

We need more code than that.

Link to comment
https://forums.phpfreaks.com/topic/80207-solved-sessions-help/#findComment-406547
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
https://forums.phpfreaks.com/topic/80207-solved-sessions-help/#findComment-406551
Share on other sites

Look

 

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

 

Your not actually giving the sessions the value of the password and whatever "aid" is. How do you expect it to find any results in the DB to match? When they log in you need to give those sessions the correct values.

Link to comment
https://forums.phpfreaks.com/topic/80207-solved-sessions-help/#findComment-406556
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.