Jump to content

Looking for an small advice on variable cross pages


criostage

Recommended Posts

I been having this small curiosity "how to" for some time hope any one could give me an orientation. I m doing an website (from scratch as a self learning project) to "host" a list of movies and at the moment i m using the $_GET variables as navigation indicators (for example http://server/?go=settings, page will display the user settings) and the $_POST variables to pass all kind of form related data. At the moment i m done with all the authentication part (PHP,MySQL + cookies), but what  m missing is a way to tell the user that "well your username or password is wrong", sounds silly i know ... i looked an fancy way of sending an user the warning and i found this small project of jquery called pnotify, where a small ballon will show on the page an message. My problem is to make the ballon apear upon an error of the authentication (if i just paste the code into the body it works). Besides the $_POST or $_GET is there anyway to pass an error code to an object?

 

This is the code i have for the menu that decides all page navigation:

 

page.php

<?php
	session_start();

	$mysql = new mysql($dbhost,$dbuser,$dbpwd,$dbname,$seckey);
	$auth = new authentication();

	require_once(INCLUDES_PATH.'page.header.php');	
	require_once(INCLUDES_PATH.'inc.actions.php');	
	require_once(INCLUDES_PATH.'page.footer.php');

 

action.php

<?php
$do = isset($_GET["do"])?$_GET["do"]:"";
switch ($do) {
	case "login":
		if( isset( $_POST['usr'] ) && isset( $_POST['pwd'] ) ){
			$login = $auth->login( $_POST['usr'], $_POST['pwd'], $mysql);
			header( "Location:$_PATHS[home]" );
		}
		else{
			require_once(INCLUDES_PATH.'page.login.php');
		}
		break;
	case "logout":
		$auth->logout();
		header("Location:$_PATHS[home]");
		break;
	default:
		require_once(INCLUDES_PATH.'page.body.php');
		break;
	}
?>

 

Thank you in advance.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.