Page 1 of 1

[solve] need help to undertand session

Posted: Sat Jun 11, 2005 1:23 am
by unix77
Hi all

I use session_register($variable) in menu.php and try to catch to another file addmoviestar.php

menu.php

Code: Select all

include "authentic.inc";

	session_start();

	if(!empty($_POST['user']))
		$sesi_user = $_POST['user'];

	if(!empty($_POST['paswd']))
		$sesi_paswd = $_POST['paswd'];
	
	if(!authentic($sesi_user,$sesi_paswd)){
		$msg = "Please enter correct user and id";
		header("Location: http://localhost/loginbin.php?msg=$msg");
		exit();
	}

	session_register("$sesi_user");
	session_register("$sesi_paswd");
authentic.inc just have one function to catch varible user and password from login.php, and also in menu.php i put one hyper-link to addmoviestar.php

moviestar.php

Code: Select all

<?php
	include "authentic.inc";
	session_start();
	if(!authentic($sesi_user,$sesi_paswd)){
		$msg = "Please enter correct user and id";
		header("Location: http://localhost/loginbin.php?msg=$msg");
		exit();
	}

?>
My problem is why in moviestar.php i cannot catch value from variable $sesi_user and $sesi_passwd from menu.php. Every time i click hyper-link, my coding always run the "if statement" and automatic header will be called.

Posted: Sat Jun 11, 2005 2:08 am
by hongco