PHP: test session
2 answers
I would be inclined to assign the variable before testing it, and maybe clean up the formatting a bit too:
$original_hash = get_original_passhash();
if ($original_hash != ""){
set_login_session(get_original_passhash());
} else {
print("Please Log In");
}
You also need to make sure you get_original_passhash()
return the correct type of the variable - interger, string, boolean, etc.
Edit:
function get_original_passhash(){
$dbconn = pg_connect("host=localhost port=5432 dbname=heoa user=heoa password=123");
if(!empty($passhash_session)){
return $passhash_session;
} else {
return $passhash_post;
}
}
What should this code do? It connects to the database and then checks for a variable that just appears out of nowhere? Your code doesn't work because from the example you provided us, nothing gets installed. Is this the complete source code for this feature?
+2
source to share