PHP session NOT captured -
i developed own login.php, however, login success session not being captured. every time proceed link, bring me login.php , demand me re-login again. did try using $_session (as commented) come out login page unable login entirely.
thank in advance
below code
<?php error_reporting(e_all); ini_set("display_errors", 1); if ($_server["request_method"] == "post") { $uid = $_post["uid"]; $password = $_post["password"]; } include("src/db.php"); session_start(); if(!isset($uid)) { //if(!isset($_session['$uid'])){ ?> <my html code -- let me know if need check html well> <?php exit; } dbconnect("mydb"); $sql = "select * sys_user username = '$uid' , password = '$password'"; $result = pg_exec($sql); $dept_id = pg_result($result,0,"dept_id"); if (pg_num_rows($result) == 1) { $_session['uid'] = $uid; $_session['password'] = $password; $_session['dept_id'] = $dept_id; } ?> <? // ** new section ** //if ((pg_numrows($result) == 1) , ($access != 'y')) { // ** end of new section ** ?> <? if (pg_num_rows($result) == 0) { //session_unregister("uid"); //session_unregister("password"); // session_unregister("dept_id"); unset($_session["uid"]); unset($_session["password"]); unset($_session["dept_id"]); ?>
session_start() move top of file.
Comments
Post a Comment