mysql - PHP Coding Logic -
i have code returning $aid=1 within else/if statement. can me figure out why may happening within logic?
<?php session_start(); require('includes/config.php'); if(!$user->is_logged_in()){ header('location: login.php'); } include_once("config.php"); if(isset($_session['account_id'])) { $aid = $_session['account_id']; } else if(isset($_post['aid'])) { $aid = $_post['aid']; } else if(isset($_get['aid'])) { $aid = $_get['aid']; } else {$aid='1';} include_once('includes/top.php');?>
quick background (if helps)... login. once client signs in trying data within database show. have of correct data being pulled, cannot logged in user call in correct account_id. if change last $aid=1 $aid=2, correctly pull of account_id=2 information, every logged in person.
any advice appreciated.
thanks!
below login function
<?php require_once('includes/config.php'); if( $user->is_logged_in() ){ header('location: main.php'); } if(isset($_post['submit'])){ $username = $_post['username']; $password = $_post['password']; if($user->login($username,$password)){ $_session['username'] = $username; header('location: main.php'); exit; } else { $error[] = 'invalid username/password or account has not been activated.'; } } $title = 'login'; require('layout/header.php'); ?>
there html below php calls in form. can load if helps too. thanks!
also, account_id's managed within admin section. there associated account_id within clients table of database specifies account each user has.
if else condition page not post , data's post , method not work. u need make sure session set or not. after u can able find out exact value of $aid.
Comments
Post a Comment