check variable in mysql table with php -
i want check variable in mysql table , action done if fits. want check whether logged in account has type = d. if so, should redirected, if not normal html code should appear. now, gets completly ignored.
this code
<?php require_once("./include/membersite_config.php"); session_start(); if(!$fgmembersite->checklogin()) { $fgmembersite->redirecttourl("login.php"); exit; } else { $now = time(); // checks time, homepage gets loaded if ($now > $_session['expire']) { session_destroy(); header("location: http://www.uni-landau.de/vivian/source/expiredlogin/expiredloginlayout.php"); exit(); } else { ?> <?php include "connect.php"?> <?php include "functions.php"?> <?php $check_login = mysql_query("select type users username='$username'"); $run = mysql_fetch_array($check_login); $type = $run ['type']; if ($type == 'd'){ header("location: http://www.blubb.php"); } else { //starts html area ?>
the code in beginning time check , session_destroy
works fine. after else { $check_login = mysql_query
[...] gets ignored , page loads if account log in $type == 'd'
. can push me in right direction?
ps: variables in mysql table correct.
thanks in advance.
edit:
the value $username
in included function.php:
<?php session_start(); function loggedin() { if(isset($_session['id_user']) && !empty($_session['id_user'])){ return true; } else { return false; } } if(loggedin()){ $user_query = mysql_query("select username, user_level users id='$my_id'"); $run_user = mysql_fetch_array($user_query); $username = $run_user['username']; $user_level = $run_user ['user_level']; ?>
this connect.php db connection:
<?php mysql_connect ("host" , "name", "psw"); mysql_select_db("users"); ?>
here in section make sure if condition satisfied.no errors in code
if ($type == 'd'){ header("location: http://www.blubb.php"); }
Comments
Post a Comment