PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
if a person is logged in all the session variables will be set otherwise not.
so if person is not logged in. the above code should not show any mistake because
isset($_SESSION['UserType']) will return false.
and therefore further checking is not done.
but to my surprise it shows the following error: Notice: Undefined index: UserName in D:\htdocs\temp.php on line 144
Last edited by claws on Mon Sep 24, 2007 3:09 pm, edited 1 time in total.
should workfine if a person is not logged in ( session variables are not set) but it shows the error
Notice: Undefined index: UserName in D:\htdocs\temp.php on line 79
You should slightly modify your code to use braces while using compulsory conditions. Your previous code was checking condition as whether $_SESSION['UserType'] is set or not AND $_SESSION['UserType'] is administrator OR $_SESSION['UserName'] is $reply_arr['user_name']. Means conditions within if block was AND and OR, so it was executing the if block. Modify your code with following code and i think you could get the required results..