Jump to content

Functions


xyn

Recommended Posts

Hey.
I have got a list of functions but I have a problem.
the thing is I forgotte how to call a function and
I don't think the functions been created correctly.

function is:
function Test(){
echo 'test';
}

I can't remember how to call it, I tried call_user_function(Test);
and realised it was wrong! :/
Link to comment
Share on other sites

Yeah, I usually do if(isset($_POST['submit'])){
code
}else{
form
}

And i have a logout function which logs out the user
Although my problem is Sessions aren't changing :/.

My function:
function LogOut(){
$_SESSION['LoggedIn'] = false;
$_SESSION['user'] = "";
}

I use:
if( $x = logout ){
LogOut();
}

and nothing, but the redirect in that function works
so does the echo :/
Link to comment
Share on other sites

You'll want to use this comparing x
[code=php:0]if( $x == 'logout' ){
LogOut();
}[/code]

Otherwise you are assigning $x to the constant logout all the time. Also make sure you have session_start() at the top of your script. And use session_destroy to destroy the session when they logout.
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.