Autor Zpráva
JanoF
Profil
Vedel by mi niekto pomoct pridat overovaci kod(retazec) na odosielanie do guestbooku?

                        <?php

$gbfile = "includes/kniha-navstev.dat";
$thisfile = "kniha-navstev.html";
$dateshow = "Y-m-d - H:i:s";
$date = date("$dateshow");
$thankstxt = "<meta http-equiv='refresh' content='1;URL=$thisfile'><p>Thank you for writing in my guestbook!<br>You will be sent back in 3 seconds. If not click <a href='$thisfile'>here</a></p>";
$errornoname = "<meta http-equiv='refresh' content='1;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>";
$errornomsg = "<meta http-equiv='refresh' content='1;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>";
$name = htmlentities(strip_tags($_POST['name']));
$message = nl2br(htmlentities(strip_tags($_POST['message'])));
$message = str_replace(array("\r", "\n"), '', $message);
$message = wordwrap($message, 75, "<br />", true);
$printpage = "<table width=\"400\" border=\"0\" align=\"center\" bordercolor=\"#CCCCCC\"><tr><td width=\"80\"><strong>Dátum:</strong></td><td width=\"320\">$date</td></tr><tr><td><strong>Meno:</strong></td><td>$n ame</td></tr><tr><td><strong>Správa:</strong></td><td>$message</td></ tr></table><br> \n";
switch($_GET['id'])
{
default:
?>
<table align="center"><form action="kniha-navstev.html?id=submit" method="post" name="submitform">
<tr><td><strong>Meno:</strong></td><td><input type="text" name="name" size="30" maxlength="50"></td></tr>
<tr><td valign="top"><strong>Správa:</strong></td><td><textarea name="message" cols="30" rows="7"></textarea></td></tr>
<tr><td></td><td><input type="submit" name="submit" value="PoslaĹĄ"></td></tr>
</form></table><br>
<?php
$gb = file($gbfile);
$gb = array_reverse($gb);
foreach ($gb as $guestbook) { echo stripslashes($guestbook); }
break;
case submit:
if($name == "")
{
echo $errornoname;
}
elseif($message == "")
{
echo $errornomsg;
}
elseif($email == "")
{
$writeinfo = $printpage;
$printer = fopen($gbfile,"a");
fwrite($printer,$writeinfo);
fclose($printer);
echo $thankstxt;
}
break;
}
?>


Popripade ak by poznal niekto este jednoduchsi guestbook s overovacim kodom by som bol este radsej.... :)
pavel prochazka.zde.cz
Profil *
co treba muj na www.prochazka.zde.cz
JanoF
Profil
no to by mohlo tiez byt, nemusi byt len overovaci kod, staci aj nejake slovo, proste aby mi tam roboti neoxidovali :)
pavel prochazka.zde.cz
Profil *
no pokud mate zajem staci napsat a kod poslu....
JanoF
Profil
tak kod by som uz mal.... ale mam iny problem, snad bude niekto vediet s tymto helfnut


mam subor kniha-navstev.php ktora obsahuje


<?php

session_start();
if (!isset($_GET['code'])) {
for ($i=0;$i<5;$i++)
{
while(strlen($str[$i])!=1){
$random=rand(48,123);
if( ($random>47 && $random<58) || ($random>96 && $random<123) ||
($random>64 && $random<91) ){
$str[$i] = chr($random);
}
}
$text .= $str[$i];
}
$_SESSION['string']= $text;
$GLOBALS['text'] = $text;
}
elseif (isset($_GET['code'])){
$GLOBALS['text'] = $_SESSION['string'];
$obrazek = imagecreatefromgif("kniha-navstev/pozadie.gif");
for ($i=0; $i<5; $i++){
$textcolor = imagecolorallocate($obrazek,rand(0,130),rand(0,130),rand(0,130));
$pismenko = substr($GLOBALS['text'],0+$i,1);
imagettftext ($obrazek,rand(15,25),rand(-45,45),15+($i*38),35, $textcolor,"kniha-navstev/font.ttf",$pismenko) ;
}
header("Content-type: image/png");
imagepng($obrazek);
imagedestroy ($obrazek);
exit();
};
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Kniha návštev</title>
<?php
@include ('includes/meta.inc');
@include ('includes/header.inc');
@include ('includes/menu.inc');
@include ('includes/kniha-navstev.inc');
@include ('includes/footer.inc');
?>
</html>


Cize pri pouziti kniha-navstev.php?code sa generuje obrazok

obsah je kniha-navstev.inc v adresari includes a ten obsahuje

												<table class="contentpaneopen">

<tbody>
<tr>
<td class="contentheading"><h1>Kniha návštev</h1></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr><td><br></td></tr>
<tr>
<td align="center">
<?php
$gbfile = "includes/kniha-navstev.dat";
$thisfile = "kniha-navstev.html";
$dateshow = "Y-m-d - H:i:s";
$date = date("$dateshow");
$thankstxt = "<meta http-equiv='refresh' content='1;URL=$thisfile'><p>Thank you for writing in my guestbook!<br>You will be sent back in 3 seconds. If not click <a href='$thisfile'>here</a></p>";
$errornoname = "<meta http-equiv='refresh' content='1;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>";
$errornomsg = "<meta http-equiv='refresh' content='1;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>";
$name = htmlentities(strip_tags($_POST['name']));
$message = nl2br(htmlentities(strip_tags($_POST['message'])));
$message = str_replace(array("\r", "\n"), '', $message);
$message = wordwrap($message, 75, "<br />", true);
$printpage = "<table width=\"400\" border=\"0\" align=\"center\" bordercolor=\"#CCCCCC\"><tr><td width=\"80\"><strong>Dátum:</strong></td><td width=\"320\">$date</td></tr><tr><td><strong>Meno:</strong></td><td>$n ame</td></tr><tr><td><strong>Správa:</strong></td><td>$message</td></t r></table><br> \n";
switch($_GET['id'])
{
default:
?>
<table align="center"><form action="kniha-navstev.html?submit" method="post" name="submitform">
<tr><td><strong>Meno:</strong></td><td><input type="text" name="name" size="30" maxlength="50"></td></tr>
<tr><td valign="top"><strong>Správa:</strong></td><td><textarea name="message" cols="30" rows="7"></textarea></td></tr>
<tr><td valign="top"><strong>Kód:</strong></td><td><img src = "kniha-navstev.html?code" alt="Overovací kód"></td></tr>
<tr><td><strong>Opísať:</strong></td><td><input type="text" name="kod" size="15"></td></tr>
<tr><td></td><td><input type="submit" name="submit" value="Poslať"></td></tr>
</form></table><br>
<?php
$gb = file($gbfile);
$gb = array_reverse($gb);
foreach ($gb as $guestbook) { echo stripslashes($guestbook); }
break;
case submit:
if($name == "")
{
echo $errornoname;
}
elseif($message == "")
{
echo $errornomsg;
}
elseif($done == "")
{
$writeinfo = $printpage;
$printer = fopen($gbfile,"a");
fwrite($printer,$writeinfo);
fclose($printer);
echo $thankstxt;
}
break;
}
?>
</td>
</tr>
</tbody>
</table>


A problem je v tom ze uz som skusil cokolvek ale vobec neviem spravit to aby sla poslat sprava iba ked sa napise spravny kod....
Vedel by mi niekto pomoct s upravou?
Ak by to slo nejak prerobit tak v klude to moze byt aj bez takychto sprav


                        $thankstxt = "<meta http-equiv='refresh' content='1;URL=$thisfile'><p>Thank you for writing in my guestbook!<br>You will be sent back in 3 seconds. If not click <a href='$thisfile'>here</a></p>";

$errornoname = "<meta http-equiv='refresh' content='1;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>";
$errornomsg = "<meta http-equiv='refresh' content='1;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>";
JanoF
Profil
nikto nic? :(
Toto téma je uzamčeno. Odpověď nelze zaslat.

0