[PHP] Sessions + Variables + includes

2001-07-19 Thread dosenbrei



Hi

Sorry for my bad english ;-)

I'm writing an application using php and sessions.
In the first include file i'm writing something like this

session_start();
session_register(loggedin);

The i have another include file with the functions.
When i'm submitting the username and passwort to the function
which checks them i'd like to set loggedin to 1 how does this work?

function CheckLogin($username,$password)
{
if($username=='test'  $password=='user')
{
$loggedin=1;
header(location:secretpage.php);
}
else
{
$loggedin =0;
header(location:login.php)
}

Can i user include with sessions or doe i have to use requiere?
I also tried to set the $loggedin to 1 this way:

$HTTP_SESSION_VARS[loggedin]=1;

This doesn't work too.

Please help me


THX

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Sessions + Variables + includes

2001-07-19 Thread Slavomir Slizik

On the title page:

session_register(loggedin);
then:
session_start(); on every page
better to test session availability on every page:
if (!session_is_registered(loggedin)) {
// redirect user to title page where the session is registered
}

But your method of handling sessions and logins is very strange and
insecure :)

slavko


On Thu, 19 Jul 2001, dosenbrei wrote:



 Hi

 Sorry for my bad english ;-)

 I'm writing an application using php and sessions.
 In the first include file i'm writing something like this

 session_start();
 session_register(loggedin);

 The i have another include file with the functions.
 When i'm submitting the username and passwort to the function
 which checks them i'd like to set loggedin to 1 how does this work?

 function CheckLogin($username,$password)
 {
 if($username=='test'  $password=='user')
 {
 $loggedin=1;
 header(location:secretpage.php);
 }
 else
 {
 $loggedin =0;
 header(location:login.php)
 }

 Can i user include with sessions or doe i have to use requiere?
 I also tried to set the $loggedin to 1 this way:

 $HTTP_SESSION_VARS[loggedin]=1;

 This doesn't work too.

 Please help me


 THX

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Sessions + Variables + includes

2001-07-19 Thread ReDucTor

?php
   $loginpass = test;
   $loginuser = test;
   $locationof403 = error.php?403;
   session_start();
   session_register(user,pass);
   if(isset($user))
  $username = $user;
   if(isset($pass))
  $password = $pass;
   if(isset($username))
  $user = $username;
   if(isset($password))
  $pass = $password;
   if((isset($password))  (isset($username)))
  {
  if(($loginpass != $password)  ($loginuser != $username))
  header(location: .$locationof403);
  else
  $loggedin = 1;
  }
  else
   $loggedin = 0;
?htmlbody
 ?php if(loggedin != 1){ ?
 form
   Username : input type=text name=usernamebr
   Password : input type=password name=passwordbr
  input type=submit value=Logininput type=reset value=Reset
/form
?php }
   else
   { ?
   a href=profile.phpProfile/abr
a href=moo.phpMoo/a?php
 }
   ?/body/html
   
- Original Message - 
From: dosenbrei [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, July 19, 2001 10:01 PM
Subject: [PHP] Sessions + Variables + includes


 
 
 Hi
 
 Sorry for my bad english ;-)
 
 I'm writing an application using php and sessions.
 In the first include file i'm writing something like this
 
 session_start();
 session_register(loggedin);
 
 The i have another include file with the functions.
 When i'm submitting the username and passwort to the function
 which checks them i'd like to set loggedin to 1 how does this work?
 
 function CheckLogin($username,$password)
 {
 if($username=='test'  $password=='user')
 {
 $loggedin=1;
 header(location:secretpage.php);
 }
 else
 {
 $loggedin =0;
 header(location:login.php)
 }
 
 Can i user include with sessions or doe i have to use requiere?
 I also tried to set the $loggedin to 1 this way:
 
 $HTTP_SESSION_VARS[loggedin]=1;
 
 This doesn't work too.
 
 Please help me
 
 
 THX
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]