:confused:

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

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

Recommended Answers

All 4 Replies

Member Avatar for diafol

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

....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 :)

: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;
?>

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.