It looks like you're using an Ad Blocker.
Please white-list or disable AboveTopSecret.com in your ad-blocking tool.
Thank you.
Some features of ATS will be disabled while you continue to use an ad-blocker.
< ?php
?>
< html>
< head>
< title>My Login
< /head>
< body>
< form action="" method="post">
Username:< input name="username" type="text" />
Password:< input name="password" type="password" />
< input type="submit" />
< /form>
< /body>
< /html>
< ?php
//remember we used method = 'post'//
$username = $_POST ['username'];
$password = $_POST ['password'];
?>
< ?php
//remember we used method = 'post'//
$username = $_POST ['username'];
$password = $_POST ['password'];
if ($username == 'jim' and $password == '123')
[
echo 'Login Successful';
//and some welcome text//
echo 'Welcome' . $username;
]
else
[
echo '< span style="color: red"> Login Failed ';
//and some fail text//
echo $username . 'does not exist';
]
?>
< ?php
//start a session//
session_start();
$username = $_POST ['username'];
$password = $_POST ['password'];
if ($username == 'jim' and $password == '123')
[
echo 'Login Successful';
echo 'Welcome' . $username;
]
else
[
echo '< span style="color: red"> Login Failed ';
echo $username . 'does not exist';
]
?>
< ?php
session_start();
$username = $_POST ['username'];
$password = $_POST ['password'];
if (isset($_POST['username']))
[
if ($username == 'jim' and $password == '123')
[
echo 'Login Successful';
echo 'Welcome' . $username;
]
else
[
echo '< span style="color: red"> Login Failed ';
echo $username . 'does not exist';
]
]
?>
< ?php
session_start();
$username = $_POST ['username'];
$password = $_POST ['password'];
if (isset($_POST['username']))
[
if ($username == 'jim' and $password == '123')
[
$_SESSION['username'] = $username;
echo 'Login Successful';
echo 'Welcome' . $username;
]
else
[
echo '< span style="color: red"> Login Failed ';
echo $username . 'does not exist';
]
]
?>
< html>
< head>
< title>My login< /title>
< /head>
< body>
< div>< /div>
< ?php if (isset($_SESSION['username'])) [ ?>
You are now logged in
< ?php ] else [ ?>
< form action="" method="post">
username:
password: < input name="password" type="password" />
< input type="submit" />
< ?php ] ?>
< /body>
< /html>
< ?php
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', True);
session_start();
if (isset($_GET['logout']))
[
$_SESSION = array();
if ($_COOKIE[session_name()])
[
setcookie(session_name(), '', time()-42000, '/');
]
session_destroy();
header('Location: test3.php');
]
if (isset($_POST['username']))
[
$username = htmlentities($_POST['username']);
$password = htmlentities($_POST['password']);
if ($username == 'jim' and $password == '123')
[
$_SESSION['username'] = $username;
echo 'Login Successful';
echo 'Welcome, ' . $username;
]
else
[
echo 'Login Failed';
echo $username . ', does not exsit';
]
]
?>
< html>
< head>
< title>My login< /title>
< /head>
< body>
< div>< /div>
< ?php if (isset($_SESSION['username'])) [ ?>
You are now logged in
< a href="test3.php?logout=1">Logout
< ?php ] else [ ?>
< form action="" method="post">
username: < input name="username" type="text" />
password: < input name="password" type="password" />
< nput type="submit" />
< /form>
< ?php ] ?>
< /body>
< /html>
Originally posted by DaMod
... maybe include a cool little do dad or wiz wam ...
Originally posted by cartenz
reply to post by Wingz
I seriously hope you do not use this language in a professional environment, if one of my devs or macmonkeys said that, they would be looking for a new job by the end of the day. But then again I am quick to anger when it comes to newbies... "GET OFF MY LAWN" is now a meme with the Australian Web Industry Association. But thanks for starting this thread, there are a few people here who have sites, so its good to support them.
Originally posted by cartenz
"GET OFF MY LAWN"