php
ok I am going to show you this script that is from my site and the issue that I am having is the fact that when you go to the site and hit enter it actuially shows you its own source
<form> <form action="home.php" method="GET"> <b>Username:</b><input type="text" name="username" id="username" /> <b>password:</b><input type="password" name="password" id="password" /> <input type="submit" value="submit" id="submit" /> </form> <?php if ($_GET['username'] == "krystal" && $_GET['password'] =="vineland") { setcookie("krystal", "krystal", time()+3600); } ?>
<?php if (isset($_COOKIE["krystal"])) echo "Welcome " . $_COOKIE["krystal"] . "!<br />"; else echo "Welcome guest!<br />"; ?>
mastergamer wrote: Is your webserver set up correctly to execute PHP?
Also, you might wanna look at using sessions for that kind of login, and using POST instead of GET for logins. Basing your authentication solely on whether a cookie is set is bad.
the php is executing fine the only issue i am having now is the fact that it is showing the source code.
try
if ($_GET['username'] == "krystal" && $_GET['password'] =="vineland")
{
setcookie("krystal", "krystal", time()+3600);
}
?>
<form action="home.php" method="GET">
<b>Username:</b><input type="text" name="username" id="username" />
<b>password:</b><input type="password" name="password" id="password" />
<input type="submit" value="submit" id="submit" />
</form>
<?php
if (isset($_COOKIE['krystal']))
echo "Welcome " . $_COOKIE['krystal'] . "!<br />";
else
echo "Welcome guest!<br />";
?>```