Cr0w1
-
Posts
3 -
Joined
-
Last visited
Never
Posts posted by Cr0w1
-
-
hey the182guy,
if I add
<?php // set the expiration date to one hour ago setcookie ("MyLoginPage", "", time() - 3600); ?>
on top of my code I get:
Warning: Cannot modify header information - headers already sent by (output started at /home/zenzenl/public_html/projecten/index.php:6) in /home/zenzenl/public_html/projecten/index.php on line 34
Warning: Cannot modify header information - headers already sent by (output started at /home/zenzenl/public_html/projecten/index.php:6) in /home/zenzenl/public_html/projecten/index.php on line 35
Thanks,
Crow
-
Hello
A few days back I searched for a (very) easy php login script, basicly just to show hidden content that's not for everyone.
This is the script I found (and it works):
<?php $username = "Username"; $password = "Password"; $randomword = "one"; if (isset($_COOKIE['MyLoginPage'])) { if ($_COOKIE['MyLoginPage'] == md5($password.$randomword)) { ?> <?php include 'projecten_.php'; $name = "0"; ?> <?php exit; } else { echo "<p>Bad cookie. Clear please clear them out and try to login again.</p>"; exit; } } if (isset($_GET['p']) && $_GET['p'] == "login") { if ($_POST['name'] != $username) { echo "<p>Sorry, that username does not match. Use your browser back button to go back and try again.</p>"; exit; } else if ($_POST['pass'] != $password) { echo "<p>Sorry, that password does not match. Use your browser back button to go back and try again.</p>"; exit; } else if ($_POST['name'] == $username && $_POST['pass'] == $password) { setcookie('MyLoginPage', md5($_POST['pass'].$randomword)); header("Location: $_SERVER[php_SELF]"); } else { echo "<p>Sorry, you could not be logged in at this time. Refresh the page and try again.</p>"; } } ?> <body style="background:url(images/repeat.gif) repeat-x #0a0a09; height:106px; margin:0px; padding:0px; text-align: center;"> <div style="margin-left: auto; margin-right: auto; position: relative; top: 120px; width: 250px; text-align: left; line-height: 28px;"> <img src="images/zenze.png" alt="Zenze" style="position: absolute; top: -100px; left: -375px;" /> <h5 style=" font-weight: none; font-size: 18px; font-family: verdana; margin: 0px; margin-bottom: 20px; color: #96ff00">Login</h5> <form action="<?php echo $_SERVER['PHP_SELF']; ?>?p=login" method="post"> <label><input type="text" name="name" id="name" /><span style="color: #999999; font-size: 12px; font-family:verdana"> Name</span></label><br /> <label><input type="password" name="pass" id="pass" /><span style="color: #999999; font-size: 12px; font-family:verdana"> Password</span></label><br /> <input type="submit" id="submit" value="Login" style="margin-top: 10px;" /></form> </div> </body>
The only problem is, there is no log out fuction. I see this script works with cookies and I gave it a try, and I ended up with nothing but errors.
Does anyone one has an idea to how a logout script would look like for this script?
Thanks in advance,
Crow
A cookie problem
in PHP Coding Help
Posted
I dont completely understand what I have to do to edit it. My PHP knowledge is very minimum. I dont think I can throw this php stuff around without causing errors
Thanks,
Crow