Gå til innhold

Noen feil med gjesteboka mi.


Anbefalte innlegg

Her er den :)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>index</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<link href="style.css" type="text/css" rel="stylesheet" />
</head>
<body style="background-color: #000000">

<div id="container">
<div id="banner">
<div id="text">
<h1>            
<span style="font-style: normal"><font size="5"> </font></span></h1>
</div>
<div id="text3">
<br />
</div>
</div>
<ul class="menu">
  <li><font face="Sylfaen" size="2"><a href="index.html">HOME</a></font></li>
  <li><font face="Sylfaen" size="2"><a href="gigs.htm">GIGS</a></font></li>
  <li><font face="Sylfaen" size="2"><a href="media.htm">MEDIA</a></font></li>
  <li><font face="Sylfaen" size="2"><a href="guestbook.php">GUESTBOOK</a> </font></li>
  <li><font face="Sylfaen" size="2"><a href="links.htm">LINKS</a></font></li>
  <li></li>

</ul>
<p> </p>
<p><font color="#C0C0C0">  <font size="5">Guestbook:</font></font><body style="background-color: #000000">

<!-- 123456 --><?php
// Set these to get the guestbook more personal.
// ========================================
$gbfile = "guestbook.txt"; // The file that all guestbook entrys should be saved in.
$thisfile = "guestbook.php"; // The name of this file.
$dateshow = "Y-m-d - H:i:s"; // Decides how the date should be shown. [url="http://www.w3schools.com/php/func_date_date.asp"]http://www.w3schools.com/php/func_date_date.asp[/url]
$username = "Cmi"; // Admin username.
$password = "555555"; // Admin password.
$wrongpass = "Not logged in!"; // Text to show when the wrong password has been entered.
$wrongname = "Not logged in!"; // Text to show when the wrong username has been entered.
$thankstxt = "<meta http-equiv='refresh' content='3;URL=$thisfile'><p>Takk for at du tok deg tid til og skrive i gjesteboken!
<br>Du vil bli sent tilbake innen 3 sekunder. Hvis ikke klikk <a href='$thisfile'>her</a></p>";
$errornoname = "<meta http-equiv='refresh' content='3;URL=$thisfile'>
<p style="color: #ffffff">You have to enter a name!<br>You will be sent back in 3 seconds. If not click <a href='$thisfile'>here</a></p>";

$errornomsg = "<meta http-equiv='refresh' content='3;URL=$thisfile'>
<p style="color: #ffffff">You have to enter a message!<br>You will be sent back in 3 seconds. If not click <a href='$thisfile'>here</a></p>";

$gbedited = "<meta http-equiv='refresh' content='3;URL=$thisfile'>
<p style="color: #ffffff">Guestbook has been edited!<br>You will be sent back in 3 seconds. If not click <a href='$thisfile'>here</a></p>"; // Text to print out when guestbook has been edited.
// ========================================

// Do not change under here
// ========================================
$gbpage = "$_SERVER[PHP_SELF]";
$date = date("$dateshow");
$name = htmlentities(strip_tags($_POST['name']));
$email = htmlentities(strip_tags($_POST['email']));
$homepage = htmlentities(strip_tags($_POST['homepage']));
$message = nl2br(htmlentities(strip_tags($_POST['message'])));
$message = str_replace(array("\r", "\n"), '', $message);
$message = wordwrap($message, 75, "<br />", true);
$printfull = "<table width=\"400\" border=\"1\" align=\"center\" bordercolor=\"#CCCCCC\"><tr><td width=\"80\"><strong>Date:</strong></td><td width=\"320\">$date</td></tr><tr><td><strong>Name:</strong></td><td>$name</td></tr><tr><td><strong>Email:</strong></td><td><a href=\"mailto:$email\">$email</a></td></tr><tr><td><strong>Homepage:</strong></td><td><a href=\"$homepage\" target=\"_blank\">$homepage</a></td></tr><tr><td><strong>Message:</strong></td><td>$message</td></tr></table><br> \n";
$printnoemail = "<table width=\"400\" border=\"1\" align=\"center\" bordercolor=\"#CCCCCC\"><tr><td width=\"80\"><strong>Date:</strong></td><td width=\"320\">$date</td></tr><tr><td><strong>Name:</strong></td><td>$name</td></tr><td><strong>Homepage:</strong></td><td><a href=\"$homepage\" target=\"_blank\">$homepage</a></td></tr><tr><td><strong>Message:</strong></td><td>$message</td></tr></table><br> \n";
$printnopage = "<table width=\"400\" border=\"1\" align=\"center\" bordercolor=\"#CCCCCC\"><tr><td width=\"80\"><strong>Date:</strong></td><td width=\"320\">$date</td></tr><tr><td><strong>Name:</strong></td><td>$name</td></tr><tr><td><strong>Email:</strong></td><td><a href=\"mailto:$email\">$email</a></td></tr><tr><td><strong>Message:</strong></td><td>$message</td></tr></table><br> \n";
$printnoemailpage = "<table width=\"400\" border=\"1\" align=\"center\" bordercolor=\"#CCCCCC\"><tr><td width=\"80\"><strong>Date:</strong></td><td width=\"320\">$date</td></tr><tr><td><strong>Name:</strong></td><td>$name</td></tr><tr><td><strong>Message:</strong></td><td>$message</td></tr></table><br> \n";
// ========================================

// SCRIPT START !
// ========================================
switch($_GET['id'])
{
default:
?>
</p>
<table border="0" width="80%">
<tr>
	<td align="left">
	<table>
		<form action="<?php echo $gbpage; ?>?id=1" method="post" name="submitform0">
			<tr>
				<td><strong>Name:</strong></td>
				<td><input type="text" name="name" size="40" maxlength="50"></td>
			</tr>
			<tr>
				<td><strong>Email:</strong></td>
				<td>
				<input type="text" name="email" size="40" maxlength="50"></td>
			</tr>
			<tr>
				<td><strong>Homepage:</strong></td>
				<td>
				<input type="text" name="homepage" size="40" maxlength="50" value="http://"></td>
			</tr>
			<tr>
				<td valign="top"><strong>Message:</strong></td>
				<td><textarea name="message" cols="30" rows="7"></textarea></td>
			</tr>
			<tr>
				<td></td>
				<td><input type="submit" name="submit1" value="Submit"></td>
			</tr>
		</form>
	</table></td>
</tr>
<tr>
	<td align="left"><span style="font-style: normal"><br>
<?php
$gb = file($gbfile);
$gb = array_reverse($gb);
foreach ($gb as $guestbook) { echo stripslashes($guestbook); }
break;

case 1:
if($name == "")
	{ echo $errornoname; }
elseif($message == "")
	{ echo $errornomsg; }
elseif($email == "")
{
	if($homepage == "" || $homepage == "http://")
	{
	$writeinfo = $printnoemailpage;
	$printer = fopen($gbfile,"a");
	fwrite($printer,$writeinfo);
	fclose($printer);
	echo $thankstxt;
	}
	else
	{
	$writeinfo = $printnoemail;
	$printer = fopen($gbfile, 'a');
	fwrite($printer,$writeinfo);
	fclose($printer);
	echo $thankstxt;
	}
}
elseif($homepage == "" || $homepage == "http://")
{
$writeinfo = $printnopage;
$printer = fopen($gbfile, 'a');
fwrite($printer,$writeinfo);
fclose($printer);
echo $thankstxt;
}
else
{
$writeinfo = $printfull;
$printer = fopen($gbfile, 'a');
fwrite($printer,$writeinfo);
fclose($printer);
echo $thankstxt;
}
break;
case 2:
?></span><table align="center">
		<form action="<?php echo $gbpage; ?>?id=3" method="post" name="submitform">
			<tr>
				<td>
				<address><span style="font-style: normal"><strong>Username:</strong></span></address>
				</td>
				<td>
				<address><span style="font-style: normal">
					<input type="text" name="adminname" size="20"></span></address>
				</td>
			</tr>
			<tr>
				<td>
				<address><span style="font-style: normal"><strong>Password:</strong></span></address>
				</td>
				<td>
				<address><span style="font-style: normal">
					<input type="password" name="adminpass" size="20"></span></address>
				</td>
			</tr>
			<tr>
				<td>
				<address>
				</address></td>
				<td>
				<address><span style="font-style: normal">
					<input type="submit" name="submit" value="Login"></span></address>
				</td>
			</tr>
		</form>
	</table>
	<address><span style="font-style: normal">
<?php
break;
case 3:
if($_POST["adminname"] == $username) { if($_POST["adminpass"] == $password) {
?>
<a href="<?php echo $gbpage; ?>?id=2">Admin</a></span></address>
	<table align="center">
		<form name="guestbookedit" method="post" action="<?php echo $gbpage; ?>?id=4">
			<tr>
				<td>
				<address>
					<textarea name="gbedit" cols="65" rows="30" wrap="off">
<?php
$gb = file("$gbfile");
$gb = array_values($gb);
foreach ($gb as $guestbook) { echo stripslashes($guestbook); }
?>
</textarea></address></td>
			</tr>
			<tr>
				<td>
				<address><span style="font-style: normal">Enter admin 
					password to edit entrys: 
						<input type="password" name="psw" size="20"></span></address>
				</td>
			</tr>
			<tr>
				<td>
				<address><span style="font-style: normal">
					<input type="submit" name="Submit" value="Save"><input type="reset" name="Reset" value="Reset"></span></address>
				</td>
			</tr>
		</form>
	</table><span style="font-style: normal">
<?php
} else { echo "$wrongpass"; } }
else { echo "$wrongname"; }
break;
case 4:
if($_POST["psw"] == $password)
{
	$writeinfo = $_POST['gbedit'];
	$writeinfo = stripslashes($writeinfo);
	$printer = fopen($gbfile, 'w');
	fwrite($printer,$writeinfo);
	fclose($printer);
	echo $gbedited;
}
else { echo "$wrongpass"; }
break;
}
// ========================================
// SCRIPT END !
?>
<!-- 654321 -->
		</span>
	<address> </address></td>
</tr>
<tr>
	<td align="center"> </td>
</tr>
</table>
<p> </p>

</body>
</html>
</body>
<p>
</html>
</p>
<div id="MainText">
<div id="Footer">
	<h4><font color="#C0C0C0" size="2">Design ©: Christoffer Mikalsen</font></h4>
</div>
</body>
</div>

</html>

Lenke til kommentar
Videoannonse
Annonse

Nå er det fikset!

 

Klikk for å se/fjerne innholdet nedenfor
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>index</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<link href="style.css" type="text/css" rel="stylesheet" />
</head>
<body style="background-color: #000000">

<div id="container">
<div id="banner">
<div id="text">
<h1>            
<span style="font-style: normal"><font size="5"> </font></span></h1>
</div>
<div id="text3">
<br />
</div>
</div>
<ul class="menu">
<li><font face="Sylfaen" size="2"><a href="index.html">HOME</a></font></li>
<li><font face="Sylfaen" size="2"><a href="gigs.htm">GIGS</a></font></li>
<li><font face="Sylfaen" size="2"><a href="media.htm">MEDIA</a></font></li>
<li><font face="Sylfaen" size="2"><a href="guestbook.php">GUESTBOOK</a> </font></li>
<li><font face="Sylfaen" size="2"><a href="links.htm">LINKS</a></font></li>
<li></li>

</ul>
<p> </p>
<p><font color="#C0C0C0">  <font size="5">Guestbook:</font></font><body style="background-color: #000000">

<!-- 123456 --><?php
// Set these to get the guestbook more personal.
// ========================================
$gbfile = "guestbook.txt"; // The file that all guestbook entrys should be saved in.
$thisfile = "guestbook.php"; // The name of this file.
$dateshow = "Y-m-d - H:i:s"; // Decides how the date should be shown. [url="http://www.w3schools.com/php/func_date_date.asp"]http://www.w3schools.com/php/func_date_date.asp[/url]
$username = "Cmi"; // Admin username.
$password = "555555"; // Admin password.
$wrongpass = "Not logged in!"; // Text to show when the wrong password has been entered.
$wrongname = "Not logged in!"; // Text to show when the wrong username has been entered.
$thankstxt = "<meta http-equiv='refresh' content='3;URL=$thisfile'><p>Takk for at du tok deg tid til og skrive i gjesteboken!<br>Du vil bli sent tilbake innen 3 sekunder. Hvis ikke klikk <a href='$thisfile'>her</a></p>";
$errornoname = "<meta http-equiv='refresh' content='3;URL=$thisfile'>
<p style='color: #ffffff'>You have to enter a name!<br>You will be sent back in 3 seconds. If not click <a href='$thisfile'>here</a></p>";

$errornomsg = "<meta http-equiv='refresh' content='3;URL=$thisfile'>
<p style='color: #ffffff'>You have to enter a message!<br>You will be sent back in 3 seconds. If not click <a href='$thisfile'>here</a></p>";

$gbedited = "<meta http-equiv='refresh' content='3;URL=$thisfile'>
<p style='color: #ffffff'>Guestbook has been edited!<br>You will be sent back in 3 seconds. If not click <a href='$thisfile'>here</a></p>";
// ========================================

// Do not change under here
// ========================================
$gbpage = "$_SERVER[PHP_SELF]";
$date = date("$dateshow");
$name = htmlentities(strip_tags($_POST['name']));
$email = htmlentities(strip_tags($_POST['email']));
$homepage = htmlentities(strip_tags($_POST['homepage']));
$message = nl2br(htmlentities(strip_tags($_POST['message'])));
$message = str_replace(array("\r", "\n"), '', $message);
$message = wordwrap($message, 75, "<br />", true);
$printfull = "<table width=\"400\" border=\"1\" align=\"center\" bordercolor=\"#CCCCCC\"><tr><td width=\"80\"><strong>Date:</strong></td><td width=\"320\">$date</td></tr><tr><td><strong>Name:</strong></td><td>$name</td></tr><tr><td><strong>Email:</strong></td><td><a href=\"mailto:$email\">$email</a></td></tr><tr><td><strong>Homepage:</strong></td><td><a href=\"$homepage\" target=\"_blank\">$homepage</a></td></tr><tr><td><strong>Message:</strong></td><td>$message</td></tr></table><br> \n";
$printnoemail = "<table width=\"400\" border=\"1\" align=\"center\" bordercolor=\"#CCCCCC\"><tr><td width=\"80\"><strong>Date:</strong></td><td width=\"320\">$date</td></tr><tr><td><strong>Name:</strong></td><td>$name</td></tr><td><strong>Homepage:</strong></td><td><a href=\"$homepage\" target=\"_blank\">$homepage</a></td></tr><tr><td><strong>Message:</strong></td><td>$message</td></tr></table><br> \n";
$printnopage = "<table width=\"400\" border=\"1\" align=\"center\" bordercolor=\"#CCCCCC\"><tr><td width=\"80\"><strong>Date:</strong></td><td width=\"320\">$date</td></tr><tr><td><strong>Name:</strong></td><td>$name</td></tr><tr><td><strong>Email:</strong></td><td><a href=\"mailto:$email\">$email</a></td></tr><tr><td><strong>Message:</strong></td><td>$message</td></tr></table><br> \n";
$printnoemailpage = "<table width=\"400\" border=\"1\" align=\"center\" bordercolor=\"#CCCCCC\"><tr><td width=\"80\"><strong>Date:</strong></td><td width=\"320\">$date</td></tr><tr><td><strong>Name:</strong></td><td>$name</td></tr><tr><td><strong>Message:</strong></td><td>$message</td></tr></table><br> \n";
// ========================================

// SCRIPT START !
// ========================================
switch($_GET['id'])
{
default:
?>
</p>
<table border="0" width="80%">
<tr>
<td align="left">
<table>
<form action="<?php echo $gbpage; ?>?id=1" method="post" name="submitform0">
<tr>
<td><strong>Name:</strong></td>
<td><input type="text" name="name" size="40" maxlength="50"></td>
</tr>
<tr>
<td><strong>Email:</strong></td>
<td>
<input type="text" name="email" size="40" maxlength="50"></td>
</tr>
<tr>
<td><strong>Homepage:</strong></td>
<td>
<input type="text" name="homepage" size="40" maxlength="50" value="http://"></td>
</tr>
<tr>
<td valign="top"><strong>Message:</strong></td>
<td><textarea name="message" cols="30" rows="7"></textarea></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submit1" value="Submit"></td>
</tr>
</form>
</table></td>
</tr>
<tr>
<td align="left"><span style="font-style: normal"><br>
<?php
$gb = file($gbfile);
$gb = array_reverse($gb);
foreach ($gb as $guestbook) { echo stripslashes($guestbook); }
break;

case 1:
if($name == "")
{ echo $errornoname; }
elseif($message == "")
{ echo $errornomsg; }
elseif($email == "")
{
if($homepage == "" || $homepage == "http://")
{
$writeinfo = $printnoemailpage;
$printer = fopen($gbfile,"a");
fwrite($printer,$writeinfo);
fclose($printer);
echo $thankstxt;
}
else
{
$writeinfo = $printnoemail;
$printer = fopen($gbfile, 'a');
fwrite($printer,$writeinfo);
fclose($printer);
echo $thankstxt;
}
}
elseif($homepage == "" || $homepage == "http://")
{
$writeinfo = $printnopage;
$printer = fopen($gbfile, 'a');
fwrite($printer,$writeinfo);
fclose($printer);
echo $thankstxt;
}
else
{
$writeinfo = $printfull;
$printer = fopen($gbfile, 'a');
fwrite($printer,$writeinfo);
fclose($printer);
echo $thankstxt;
}
break;
case 2:
?></span><table align="center">
<form action="<?php echo $gbpage; ?>?id=3" method="post" name="submitform">
<tr>
<td>
<address><span style="font-style: normal"><strong>Username:</strong></span></address>
</td>
<td>
<address><span style="font-style: normal">
<input type="text" name="adminname" size="20"></span></address>
</td>
</tr>
<tr>
<td>
<address><span style="font-style: normal"><strong>Password:</strong></span></address>
</td>
<td>
<address><span style="font-style: normal">
<input type="password" name="adminpass" size="20"></span></address>
</td>
</tr>
<tr>
<td>
<address>
</address></td>
<td>
<address><span style="font-style: normal">
<input type="submit" name="submit" value="Login"></span></address>
</td>
</tr>
</form>
</table>
<address><span style="font-style: normal">
<?php
break;
case 3:
if($_POST["adminname"] == $username) { if($_POST["adminpass"] == $password) {
?>
<a href="<?php echo $gbpage; ?>?id=2">Admin</a></span></address>
<table align="center">
<form name="guestbookedit" method="post" action="<?php echo $gbpage; ?>?id=4">
<tr>
<td>
<address>
<textarea name="gbedit" cols="65" rows="30" wrap="off">
<?php
$gb = file("$gbfile");
$gb = array_values($gb);
foreach ($gb as $guestbook) { echo stripslashes($guestbook); }
?>
</textarea></address></td>
</tr>
<tr>
<td>
<address><span style="font-style: normal">Enter admin 
password to edit entrys: 
<input type="password" name="psw" size="20"></span></address>
</td>
</tr>
<tr>
<td>
<address><span style="font-style: normal">
<input type="submit" name="Submit" value="Save"><input type="reset" name="Reset" value="Reset"></span></address>
</td>
</tr>
</form>
</table><span style="font-style: normal">
<?php
} else { echo "$wrongpass"; } }
else { echo "$wrongname"; }
break;
case 4:
if($_POST["psw"] == $password)
{
$writeinfo = $_POST['gbedit'];
$writeinfo = stripslashes($writeinfo);
$printer = fopen($gbfile, 'w');
fwrite($printer,$writeinfo);
fclose($printer);
echo $gbedited;
}
else { echo "$wrongpass"; }
break;
}
// ========================================
// SCRIPT END !
?>
<!-- 654321 -->
</span>
<address> </address></td>
</tr>
<tr>
<td align="center"> </td>
</tr>
</table>
<p> </p>

</body>
</html>
</body>
<p>
</html>
</p>
<div id="MainText">
<div id="Footer">
<h4><font color="#C0C0C0" size="2">Design ©: Christoffer Mikalsen</font></h4>
</div>
</body>
</div>

</html>

Lenke til kommentar

Opprett en konto eller logg inn for å kommentere

Du må være et medlem for å kunne skrive en kommentar

Opprett konto

Det er enkelt å melde seg inn for å starte en ny konto!

Start en konto

Logg inn

Har du allerede en konto? Logg inn her.

Logg inn nå
×
×
  • Opprett ny...