Help In multiple if else
Posted: Mon Nov 29, 2010 9:22 am
Hello frnds i am using mutiple and conditions in if.but i am having problem.i have in adminaproval variable=0;but it doesnt chek its condition.its still goes to last if else.which has adminapproval=1;
<?php
include('../../includes/DB.class.php');
$name = $_POST['txt_name'];
$password = $_POST['txt_password'];
//echo "$name";
//echo "$password";
//getch();
//public function user_Exist($name,$pswd){
require('Login_DAO.class.php');
$login_dao=new LoginDAO();
$returnarray=$login_dao -> user_Exist($name,$password);
$i=$returnarray[0];
$usertype=$returnarray[1];
$adminApproval=$returnarray[2];
echo "usertype=$usertype \t";
echo "adminApproval=$adminApproval\t";
if($i == 0)
{
$_SESSION['msg'] = "Wrong Username or Password";
getch();
header("Location:../index.php");
}
else if($i == 1 && $usertype == 'Admin')
{
session_start();
$sessionid=session_id();
echo "$sessionid";
//$maxRegId = mysql_fetch_array($result);
$_SESSION['id'] = $sessionid;
header("Location:../../../../in-admin-panel/index.php");
}
else if($i == 1 && ( $adminApproval='0' && $usertype == 'Seller'))
{
echo "Wait For Admin Aproval";
getch();
}
else if($i == 1 && ($usertype == 'Seller' && $adminApproval='1'))
{
session_start();
$sessionid=session_id();
echo "$sessionid";
getch();
header("Location:../../Seller/myshop.php");
}
//}
//}
?>
////////////////////////////////////////////////////////////////////
OutPut
usertype=Seller adminApproval=0 6t50e31cf3em7l8np4cth47791
Fatal error: Call to undefined function getch() in C:\wamp\www\architecturedataforebazaradminviewscreenshot\Final_EBazar\Final_EBazar\admin\classes\Login_BL.class.php on line 70
its going on 4th else if.it should be in 3rd.
Help me.
<?php
include('../../includes/DB.class.php');
$name = $_POST['txt_name'];
$password = $_POST['txt_password'];
//echo "$name";
//echo "$password";
//getch();
//public function user_Exist($name,$pswd){
require('Login_DAO.class.php');
$login_dao=new LoginDAO();
$returnarray=$login_dao -> user_Exist($name,$password);
$i=$returnarray[0];
$usertype=$returnarray[1];
$adminApproval=$returnarray[2];
echo "usertype=$usertype \t";
echo "adminApproval=$adminApproval\t";
if($i == 0)
{
$_SESSION['msg'] = "Wrong Username or Password";
getch();
header("Location:../index.php");
}
else if($i == 1 && $usertype == 'Admin')
{
session_start();
$sessionid=session_id();
echo "$sessionid";
//$maxRegId = mysql_fetch_array($result);
$_SESSION['id'] = $sessionid;
header("Location:../../../../in-admin-panel/index.php");
}
else if($i == 1 && ( $adminApproval='0' && $usertype == 'Seller'))
{
echo "Wait For Admin Aproval";
getch();
}
else if($i == 1 && ($usertype == 'Seller' && $adminApproval='1'))
{
session_start();
$sessionid=session_id();
echo "$sessionid";
getch();
header("Location:../../Seller/myshop.php");
}
//}
//}
?>
////////////////////////////////////////////////////////////////////
OutPut
usertype=Seller adminApproval=0 6t50e31cf3em7l8np4cth47791
Fatal error: Call to undefined function getch() in C:\wamp\www\architecturedataforebazaradminviewscreenshot\Final_EBazar\Final_EBazar\admin\classes\Login_BL.class.php on line 70
its going on 4th else if.it should be in 3rd.
Help me.