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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.