Gå til innhold

Noen feil med gjesteboka mi.


Anbefalte innlegg

Har to feil, regner med det er peace of cake for de som kan det godt.

 

1. Skrifta er svart (#000000) vil ha den grå (#C0C0C0) Finner ikke ut hvor dette skal types inn.

 

2. får skrevet i gjesteboka men den vil ikke save det liksom.

 

TEST HER

 

<!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>"; // The text that the user will see after entering something in the guestbook.
$errornoname = "<meta http-equiv='refresh' content='3;URL=$thisfile'><p>You have to enter a name!<br>You will be sent back in 3 seconds. If not click <a href='$thisfile'>here</a></p>"; // Text to print out when no name has been entered in the entry.
$errornomsg = "<meta http-equiv='refresh' content='3;URL=$thisfile'><p>You have to enter a message!<br>You will be sent back in 3 seconds. If not click <a href='$thisfile'>here</a></p>"; // Text to print out when no message has been entered in the entry.
$gbedited = "<meta http-equiv='refresh' content='3;URL=$thisfile'><p>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

1. Dette gjøres i style.css

 

2. Har aldri sett en så rotete kode. Jeg ville funnet ett annen gjestebok script.

Feilkilde:

Har du CHMOD gjestebok.txt til 777 ?

Det ser ut som at man må være logget inn for å kunne skrive i gjesteboken

PHP

if($_POST["psw"] == $password)

{

$writeinfo = $_POST['gbedit'];

$writeinfo = stripslashes($writeinfo);

$printer = fopen($gbfile, 'w');

fwrite($printer,$writeinfo);

fclose($printer);

echo $gbedited;

}

Lenke til kommentar

Det funker nå, men skrifta er svart :/

 

her er Css koden, tar ikke kjangsen på og tulle med den.

 

body{                            
background-color: #0E0905;
}

#container {
width: 800px;
border: 0px solid white;
margin: 5px;
margin-left: auto;
margin-right: auto;
padding: 5px;
background-color: #;
}

#banner {
color:#843D09;
padding: 5px;
margin-bottom: 0px;
margin-right:0px;
background-color: rgb(#);
background-image:  url(picks/Header.gif);
background-repeat: no-repeat;
height: 249px;
width: 799px;
}
div#text {
color: #843D09;
position: relative;
height: auto;
width: auto;
left: 5.0em;
top: 0.0em;
}

div#text2 {
font-size: 1.9em; color:#843D09;
position: relative;
height: auto;
width: auto;
left: 9.0em;
top: -1.0em;
}

div#text3 {
font-size: 1.3em; color:#843D09;
position: relative;
height: auto;
width: auto;
left: 1.0em;
top: -5.5em;
}

.menu {
width: 90%;
margin-top: 0;
margin-bottom: 0;
margin-left: auto;
margin-right: auto;
padding: 0;
height: 1.0em;
}
.menu li {
width: 12%;
float: left;
display: inline; 
list-style-type: none;
margin: 0; padding: 0;

}
.menu li a {
background: #000;
color: white;
border: solid 0.20em #979694;
display: block;
height: 100%;
padding: 0.2em 0;
text-align: center;
text-decoration: none;
width: 100%;
}
.menu li a:hover {
background: #870609;
color: black;
}
.clear {
visibility: hidden;
clear: both;
font-size: 1px;
}

img.left {
float:left;
padding:1px;
margin-right:6px;
border:0px solid #ffa200;
}



#left {
padding: 5px;
margin-right: 215px;
background-color:  #0E0905;
color:#ADACA7;
}

img.left {
float:left;
padding:1px;
margin-right:6px;
border:0px solid #;
}


p {
font: bold 10pt/18pt ,sans-serif;
}

h1 {
font-size: 3.9em; color: #843D09;
}
H3{
font-size: 1.9em; color: #AE8A56;
}


H3,h2,h4 {text-align: center; color: blue;}



#right {
float: right;
width: 200px;
margin: 5;
margin-left: 5px;
padding: 15px;
background-color: #0E0905;
border-left: 2px solid #AB8D59;
color: #CFE1EB;
}

#footer {
clear: both;
padding: 5px;
margin-top: 0px;
background-color: #0E0905;
border:0px solid blue;
color: white;
}

Endret av cmi
Lenke til kommentar

Hvorfor syns ikke dette:

$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>"; // The text that the user will see after entering something in the guestbook.
$errornoname = "<meta http-equiv='refresh' content='3;URL=$thisfile'><p>You have to enter a name!<br>You will be sent back in 3 seconds. If not click <a href='$thisfile'>here</a></p>"; // Text to print out when no name has been entered in the entry.
$errornomsg = "<meta http-equiv='refresh' content='3;URL=$thisfile'><p>You have to enter a message!<br>You will be sent back in 3 seconds. If not click <a href='$thisfile'>here</a></p>"; // Text to print out when no message has been entered in the entry.
$gbedited = "<meta http-equiv='refresh' content='3;URL=$thisfile'><p>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.
// ========================================

 

Det skal komme opp som ei melding mens den loader det man skriver i gjesteboka.

 

Ser nesten ut som samme meldinga er der 3 ganger??

Endret av cmi
Lenke til kommentar

Det er fordi den teksten er svart..

 

Bytt med denne:

 

$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>";

 

EDIT: Endret litt

Endret av Mr Chief
Lenke til kommentar

sett guestbook.php til

 

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

Når jeg typer inn denne koden som du sa blir hele greia helt fucka:

$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>

Lenke til kommentar

bytt med:

Klikk for å se/fjerne innholdet nedenfor

$thankstxt = "<meta http-equiv='refresh' content='3;URL=$thisfile'>
<p class="msg">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 class="msg">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 class="msg">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 class="msg">Guestbook has been edited!<br>You will be sent back in 3 seconds. 
If not click <a href='$thisfile'>here</a></p>";

 

så legg til i style.css:

.msg {
color: #ffffff;
}

 

Vennligst bruk rediger knappen!! Ikke legg til flere poster etter hverandre!

Endret av Mr Chief
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å
  • Hvem er aktive   0 medlemmer

    • Ingen innloggede medlemmer aktive
×
×
  • Opprett ny...