|
-
Sep 21st, 2007, 02:44 PM
#1
Thread Starter
Addicted Member
[RESOLVED] what's wrong hare
PHP Code:
<?
session_start();
//if Null T1 and T2
if((!$T1) || (!$T2)){
echo "<div id=\"Login_message\" style=\"color:red\">Invalid User or Password!</div>";
include ('index.html');
exit;
}
?>
it returns
Invalid User or Password!
"; include ('index.html'); exit; } else echo aaa; ?>
why it returns the last line?
Please Help
-
Sep 22nd, 2007, 07:23 AM
#2
Re: what's wrong hare
A session does not make ordinary variables persist, but only the variables in the $_SESSION array. To fix, change your assignments to this:
PHP Code:
$_SESSION['T1'] = 'whatever';
$_SESSION['T2'] = 'whatever';
and access them like this:
PHP Code:
session_start();
if (!isset($_SESSION['T1']) || !isset($_SESSION['T2']))
// do whatever
Note that the opening <? tag is deprecated, and you should use <?php instead.
Also, you shouldn't ever use echo to output HTML in a production environment. There are much neater ways of doing it, such as templates.
-
Sep 22nd, 2007, 09:54 AM
#3
Thread Starter
Addicted Member
Re: what's wrong hare
Oh!
no problem now
It's working
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|