0

:confused:

what will be the code for log-in using PHP code in server and client website....

pls... reply immediately.........

4
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by 19Santi25
2

....immediate response...

Yes sir, yes sir, three bags full sir. We are your slaves.

Can I suggest you go away and learn some manners and then read the forum posting guidelines.

0

....immediate response...

Yes sir, yes sir, three bags full sir. We are your slaves.

Can I suggest you go away and learn some manners and then read the forum posting guidelines.

I guess he was just talking out of frustration :)

0

:confused:

what will be the code for log-in using PHP code in server and client website....

pls... reply immediately.........

What sort of login are you doing?

script for example will do a little trick.
:-/
call this test.php for example

<?php

session_start(); //start a session

define("TEST_USER", "demo"); //test username
define("TEST_PASS", "demo"); //test password 

if(!@$_SESSION['logged_in']){ //check if a logged_in variable has been set in the session

if($_POST['username']){ //check if username is posted
    //do your login algorithm wether from database or file lor hardcoded values
    //i am using hard coded values:
    if($_POST['username'] == TEST_USER && $_POST['password'] == TEST_PASS){
        //login was successful, set the session variable and redirect
        $_SESSION['logged_in'] = true;
        //redirect to test.php
        header("Location: test.php");
        exit;
    }
}
?>
<h1>Login</h1>
<form method="post" name="login_form">
Username: <input type="text" name="username" /><br />
Password: <input type="password" name="password"/><br />
<input type="submit" value="log in"/>
</form>
<?php
}else{
?>
<h1>You are Logged In</h1>
<p><a href="logout.php">Logout</a> </p>
<?php
}
?>

On Logout.php you can do the following:

<?php

session_start();
unset($_SESSION['logged_in']);
header("Location: test.php");
exit;
?>
0

Tnx For The code It helps me a lot in my study..THank You!!! :)

Edited by 19Santi25: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.