so i am trying to write a script that redirects you to a members page after you login....
i have been very unsucessful with this so far, I am using the VBulletin forums, as is phpbuilder 🙂,
and I wanted to use sessions. Did a bit of research on the idea
and found a great article on here by Ying Zhang, and that pretty
much is gonan work out as far as sessions work, however, my
question is... in my script i have
if(isset($username) && isset($password)) {
//then i have this, where submitted is my submit button name
if($submitted) {
my script runs fine, no errors are given, however, when i run submitted,
it just refreshes the page with nothing changing, but it should be as you can see below....
//above here i ahve run the qeury and set $count = mysql_num_rows($result)
if(isset($count)) {
header("Location: member.gallery.php");
} else {
echo "Your username and/or password is incorrect, pleaset go back and try again";
}
what could be my problem there? what i need to also is something like
//where loggedin is yes, your logged, if it's not your not logged
if($loggedin == "yes") {
echo "Your logged in";
} else {
echo "You are not logged in";
}
now, with my sessions i should be able to just say this...(this will be with use of sessions in a database btw.....
//so i would use, sess_open to open my session as follows...
$sess_open($sess_path, $session_name);
/*now apparently, i should make make my database settings global
my problem with this is that, well i dont' know what global actually does
i'd imagine it let's the info be more open? some help on what global is please*/
global $dbhost, $dbsuer, $dbpass, $dbname;
//now i'm running a session, how can i check to see if i'm running
//a session or i am logged out? using $loggedin of yes or no
sorry if that's confusing, i'm confused a little bit here myself.... lol... figures 🙂
thanks alot!
i'm going to php.net to look up global too, so i should know this by the time someone responds 😃
EDIT DID MY RESEARCH ON GLOBAL... still some what lost
/*
global References
When you declare variable as global $var
you are in fact creating reference to a global variable.
That means, this is the same as: */
$var =& $GLOBALS["var"];
/*
That means, for example, that unsetting $var won't unset global variable. */
$this
/*
In an object method, $this is always reference to the caller object. */
that is what hte manual says abotu global references.... so if your making it global, you just saying that it can be used without passing it through your script?!
thanks again! 🙂