okay listen;
i have 3 logins
2 different files
root/index.php 1x login
&&
root/000/index.php 2x login
no matter the fact is in this function or either of them.
function check_login($formdata){
// This section queries the users table and searches for
// the username and password that were supplied. If the
// user is not found, an error is returned. If the user
// details are correct the users status is returned.
// Get Form Data
$trimmeddata=trim_data($formdata);
$user=$trimmeddata['input_username'];
$password = encryptpass($trimmeddata['input_password'],1000);
// Connect to the MySQL Server
global $dbarfxadmin;
// $connection=mysql_connect(HOSTADMIN,USERADMIN,PASSWORDADMIN);
if(!$dbarfxadmin){$error="Cannot Connect to Database Host";return $error;}
// Open the MySQL Database
$mysqldb=mysql_select_db(DBADMIN,$dbarfxadmin);
if(!mysqldb){$error="Cannot open Database";return $error;}
if(__FILE___=='D:\Hosting\addy\html\index.php'){
// Query Database with username and encrypted password
$myquery="SELECT * FROM tbl_registration WHERE col_username='$user' AND col_password='$password'";
}
// if the constant __FILE__ equals to http://www.addy.com/000/index.php
else{
// Get the correct table name in database depending on form submitted
$form_appadmin=$formdata['input_signin'];
$form_siteadmin=$formdata['input_login'];
if(isset($form_appadmin)){$tbl_name="tbl_appadmin";}else{$tbl_name="tbl_siteadmin";}
// Query Database with username and encrypted password
$myquery="SELECT * FROM $tbl_name WHERE username='$user' AND password='$password'";
}
$result=mysql_query($myquery,$dbarfxadmin);
if(!$result){$error[1]="Cannot Run Query";$error[2]=$myquery;return $error;}
// Check that we have a record returned
$numrows=mysql_num_rows($result);
if($numrows < 1){$error="User name or password not recognized";return $error;}
// Get user status from returned record
$userrecord=mysql_fetch_array($result);
// set up 2 variables for different status's
if(__FILE___=='D:\Hosting\addy\html\index.php'){
$status=$userrecord['authorized'];
$validuser=array("username"=>$user,"authorized"=>$status);
}
else{
$status=$userrecord['status'];
$validuser=array("username"=>$user,"status"=>$status);
}
return $validuser; }
function pick_right_login(){
// This section is only run when the form has been submitted
if($_POST['input_signin']=="Sign In" || $_POST['input_login']=="App Log In" || $_POST['input_submit']=="Log In")
{
// check whether the login details are correct, and put the user status into a session variable
global $statuscheck;
$statuscheck=check_login($_POST);
$_SESSION['username']=$statuscheck['username'];
if ($statuscheck['authorized'] == "authorized" || $statuscheck['authorized'] == "not")
{
$_SESSION['authorized']=$statuscheck['authorized'];
header("Location: http://www.addy.com/002/?pn=20101&l=en&b=1");
}
if ($statuscheck['status'] == "admin" || $statuscheck['status'] == "staff")
{
$_SESSION['status']=$statuscheck['status'];
if($_POST['input_signin']=="Sign In")
{
header("Location: http://www.addy.com/003/?pn=030001&l=" . $_POST['select_language']);
}
if ($_POST['input_login']=="App Log In") {
header("Location: http://www.addy.com/004/00/?pn=040004&l=" . $_POST['select_language']);
}
}
}
}
the problem i am having is that it does not compare FILE ==
I was trying to say if(FILE==suchfile on server){exute the following}
but i doest work what i am not seeing please i dont want to look stupid but i dont see it its either one page or the other cant get both to work why ??