Jump to content

Setting Cookies


havox

Recommended Posts

Well this isn't all about cookies or maybe it is, I'm not to sure. On top of this my script has suddenly broke and stops at check.php

 

I'm also not sure how I should go about checking the cookie to identify the user and how to keep other from viewing the output page(s).

 

 

<html>
<head>
<title>Deadnode.com</title>
   <style type="text/css">
img {
	position:absolute;
	left:300px;
	top:130px;
	z-index:-1; }
form {
	position:absolute;
	left:365px;
	top:248px;
	z-index:0; }
   </style>
</head>
<body>
<img src="iL0bw.png" />

<form method="post" action="check.php">
<center><table>
<tr><td><font face="verdana,arial" size=-1>Username:</td><td><input type="text" size="25" name="user"></td>
<tr><td><font face="verdana,arial" size=-1>Password:</td><td><input type="password" size="25" name="pwd"></td>
<tr><td><font face="verdana,arial" size=-1> </td><td><font face="verdana,arial" size=-1><input type="submit" value="Login"></td></tr>
</table></center>
</form>

</body>
</html>

 

<?php
function check() {

$admin="test";
$pass="test";

if (isset($_POST["user"]) && $_POST["user"] == $admin && isset($_POST["pwd"]) && $_POST["pwd"] == $pass) {
  header('Location: output.php'); 
  setcookie("usr", "test", time()+3600);
else {
  header('Location: index.html'); }

}
?>

 

<?php
require('function.php');

check();

?>

 

<?php
require('check.php');


?>
<html>
<body>

<p>Congrats!</p>

</body>
</html> 

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.