[solve] need help to undertand session

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!

Moderator: General Moderators

Post Reply
unix77
Forum Newbie
Posts: 7
Joined: Tue Jun 07, 2005 6:13 am
Location: south korea

[solve] need help to undertand session

Post 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.
Last edited by unix77 on Sat Jun 11, 2005 2:39 am, edited 1 time in total.
hongco
Forum Contributor
Posts: 186
Joined: Sun Feb 20, 2005 2:49 pm

Post by hongco »

Post Reply