您的位置:IT教程网首页>网络编程教程>php教程>PHP新手上路(十一)

PHP新手上路(十一)


$offset=0; }

$counter=$offset-$lpp;

if ($counter $#@60; 0)
$counter=0;
$num=$counter $lpp; }

else {
$num=$total; } }

while ($counter $#@60; $num) {
$j=0;
$j=$counter 1;

/* now really grab the data */
$i1=mysql_result($result,$counter,"name");
$i2=mysql_result($result,$counter,"email");
$i3=mysql_result($result,$counter,"job");
$i4=mysql_result($result,$counter,"comments");

$i4 = stripslashes ("$i4");

/* print it in a nice layout */
print "$#@60;CENTER$#@62;\n";
print "$#@60;TABLE WIDTH=400 BORDER=0 ALIGN=CENTER VALIGN=TOP$#@62;$#@60;TR$#@62;$#@60;TD$#@62;$#@60;FONT FACE=\"Verdana\" SIZE=\"-2\"$#@62;\n";
print "$#@60;HR$#@62;\n";
print "$#@60;BR$#@62;$#@60;B$#@62;Name:$#@60;/B$#@62; $i1\n";
print "$#@60;BR$#@62;$#@60;B$#@62;email:$#@60;/B$#@62;$#@60;A HREF=\"mailto:$i2\" onMouseOver=\"window.status=Email $i2;return true\" onMouseOut=\"window.status=;return true\" TITLE=\"Email $i2\"$#@62;$i2$#@60;/A$#@62;\n";
print "$#@60;BR$#@62;$#@60;B$#@62;Job:$#@60;/B$#@62; $i3\n";
print "$#@60;BR$#@62;$#@60;B$#@62;Comment:$#@60;/B$#@62;\n";
print "$#@60;BR$#@62;$i4\n";
print "$#@60;/FONT$#@62;$#@60;/TD$#@62;$#@60;/TR$#@62;$#@60;/TABLE$#@62;\n";
print "$#@60;/CENTER$#@62;\n";
$counter ;
}
}
mysql_close();
}

/* execute the function */
search_it($name);

/* See if we need to put on the NEXT or PREVIOUS buttons */
if ($total $#@62; $lpp) {
echo("$#@60;form action=\"$PHP_SCRIPT\" method=\"POST\"$#@62;\n");

/* See if we need a PREVIOUS button */
if ($offset $#@62; $lpp) {
echo("$#@60;input type=\"submit\" value=\"Previous\" name=dir$#@62;\n"); }

/* See if we need a NEXT button */
if ($offset $#@60; $total) {
echo("$#@60;input type=\"submit\" value=\"Next\" name=dir$#@62;\n"); }

echo("$#@60;input type=hidden name=\"offset\" value=\"$offset\"$#@62;\n");
echo("$#@60;input type=hidden name=\"name\" value=\"$name\"$#@62;\n");
echo("$#@60;/form$#@62;");
}
}

/* action=add : show a form where the user can enter data to add to the database */
elseif($action == "add") { ?$#@62;

$#@60;TABLE WIDTH="460" ALIGN="CENTER" VALIGN="TOP"$#@62;
$#@60;TH COLSPAN="2"$#@62;$#@60;P$#@62;请您填写留言$#@60;/TH$#@62;
$#@60;FORM NAME="guestbook" ACTION="guestbook.php3?action=send" METHOD="POST"$#@62;
$#@60;TR$#@62;
$#@60;TD ALIGN="RIGHT" VALIGN="TOP"$#@62;
您的大名:$#@60;/TD$#@62;
$#@60;TD$#@62;$#@60;INPUT TYPE=text NAME=name$#@62;$#@60;/TD$#@62;
$#@60;/TR$#@62;
$#@60;TR$#@62;
$#@60;TD ALIGN="RIGHT" VALIGN="TOP"$#@62;
您的E-mail:$#@60;/TD$#@62;
$#@60;TD$#@62;
$#@60;INPUT TYPE=text NAME=email$#@62;$#@60;/TD$#@62;
$#@60;/TR$#@62;
$#@60;TR$#@62;
$#@60;TD ALIGN="RIGHT" VALIGN="TOP"$#@62;
您的工作:$#@60;/TD$#@62;
$#@60;TD$#@62;
$#@60;INPUT TYPE=text NAME=job$#@62;$#@60;/TD$#@62;
$#@60;/TR$#@62;
$#@60;TR$#@62;
$#@60;TD ALIGN="RIGHT" VALIGN="TOP"$#@62;
您的留言:$#@60;/TD$#@62;
$#@60;TD$#@62;
$#@60;TEXTAREA NAME=comments COLS=40 ROWS=6$#@62;$#@60;/TEXTAREA$#@62;
$#@60;P$#@62;
$#@60;INPUT TYPE=submit VALUE=Submit$#@62; $#@60;INPUT TYPE=Reset VALUE=Reset$#@62;
$#@60;A ALIGN="RIGHT" HREF="guestbook.php3?action=view" onMouseOver="window.status=Read all comments first;return true" onMouseOut="window.status=;return true" TITLE="Read all comments first"$#@62;$#@60;FONT SIZE="-2"$#@62;先观看所有的留言$#@60;/FONT$#@62;$#@60;/A$#@62;
$#@60;/TD$#@62;
$#@60;/TR$#@62;
$#@60;/FORM$#@62;
$#@60;/TABLE$#@62;
$#@60;/CENTER$#@62;

$#@60;?
}

/* action=send : add the data from the user into the database */
elseif($action == "send") {

/* check if a HTML-mail should be send or a plain/text mail */
if($html_mail == "yes") {
mail("$admin_name $#@60;$admin_mail$#@62;","PHP3 Guestbook Addition","$#@60;HTML$#@62;$#@60;BODY$#@62;$#@60;FONT FACE=\"Century Gothic\"$#@62;$#@60;TABLE BORDER=\"0\" WIDTH=\"100%\" CELLSPACING=\"4\"$#@62;$#@60;TR$#@62;$name ($email) schreef het volgende bericht in het gastenboek :$#@60;/TR$#@62;$#@60;TR$#@62;$#@60;TD ALIGN=\"LEFT\"$#@62; $#@60;/TD$#@62;$#@60;TD ALIGN=\"LEFT\" NOWRAP$#@62; $#@60;/TD$#@62;$#@60;/TR$#@62;$#@60;TR$#@62;$#@60;TD ALIGN=\"LEFT\"$#@62;$comments$#@60;/TD$#@62;$#@60;TD ALIGN=\"LEFT\" NOWRAP$#@62; $#@60;/TD$#@62;$#@60;/TR$#@62;$#@60;TR$#@62;$#@60;TD ALIGN=\"LEFT\"$#@62; $#@60;/TD$#@62;$#@60;TD ALIGN=\"LEFT\" NOWRAP$#@62; $#@60;/TD$#@62;$#@60;/TR$#@62;$#@60;TR$#@62;$#@60;TD ALIGN=\"LEFT\"$#@62;您的留言:$#@60;/TD$#@62;$#@60;TD ALIGN=\"LEFT\" NOWRAP$#@62;$name$#@60;/TD$#@62;$#@60;/TR$#@62;$#@60;TR$#@62;$#@60;TD ALIGN=\"LEFT\"$#@62;您的大名:$#@60;/TD$#@62;$#@60;TD ALIGN=\"LEFT\" NOWRAP$#@62;$email$#@60;/TD$#@62;$#@60;/TR$#@62;$#@60;TR$#@62;$#@60;TD ALIGN=\"LEFT\"$#@62;您的email:$#@60;/TD$#@62;$#@60;TD ALIGN=\"LEFT\" NOWRAP$#@62;$job$#@60;/TD$#@62;$#@60;/TR$#@62;$#@60;TR$#@62;$#@60;TD ALIGN=\"LEFT\"$#@62;您的工作:$#@60;/TD$#@62;$#@60;/TR$#@62;$#@60;/TABLE$#@62;$#@60;/BODY$#@62;$#@60;/FONT$#@62;$#@60;/HTML$#@62;", "From: $name $#@60;$email$#@62;\nReply-To: $name $#@60;$email$#@62;\nContent-type: text/html\nX-Mailer: PHP/" . phpversion());