Ocena wątku:
  • 0 głosów - średnia: 0
  • 1
  • 2
  • 3
  • 4
  • 5
skrypt PHP na stronę
#3
Cytat:<html>
<head>
<SCRIPT language=JavaScript>
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit)
field.value = field.value.substring(0, maxlimit);
else
countfield.value = maxlimit - field.value.length;
}
</SCRIPT>
<script language="JavaScript">
<!--
function emo(emo){
document.all.comment.value += emo;
document.all.comment.focus();
return;
}
//-->
</script>
<style>
TD {font-family: Verdana; color: #000000; font-size: 8pt;}
INPUT {font-family:Verdana;font-size:10pt;background:#FFFFFF;color:#000000;}
TEXTAREA {font-family:Verdana;font-size:10pt;background:#FFFFFF;color:#000000;}
hr {color: #f5f9fd; height: 1px;}
</style>

</head>
<body>
<?php
//Copyright Cgixp Team
//http://www.cgixp.tk
extract($HTTP_GET_VARS);
extract($HTTP_POST_VARS);
function smile(){
?>
<a href="javascript:emo(' Smile ')"><img src="images/smile.gif" border=0 alt="Smile"></a>
<a href="javascript:emo(' Sad' ) "><img src="images/sad.gif" border=0 alt="Sad"></a>
<a href="javascript:emo(' :C ')"><img src="images/mad.gif" border=0 alt=":C"></a>
<a href="javascript:emo(' ;Y ')"><img src="images/thumbsup.gif" border=0 alt=";Y"></a>
<a href="javascript:emo(' :i) ')"><img src="images/info.gif"border=0 alt=":i)"></a>
<a href="javascript:emo(' :Q) ')"><img src="images/question.gif"border=0 alt=":Q)"></a>
<?php
}
$ip = getenv(REMOTE_ADDR);
$name = str_replace ("|~|","", $name);
$comment = str_replace ("\n", "<br>", $comment);
$comment = str_replace ("|~|", "", $comment);
$comment = str_replace ("Smile", "<img src='images/smile.gif' border=0>", $comment);
$comment = str_replace ("Sad", "<img src='images/sad.gif' border=0>", $comment);
$comment = str_replace (":C", "<img src='images/mad.gif' border=0>", $comment);
$comment = str_replace (";Y", "<img src='images/thumbsup.gif' border=0>", $comment);
$comment = str_replace (":i)", "<img src='images/info.gif' border=0>", $comment);
$comment = str_replace (":Q)", "<img src='images/question.gif' border=0>", $comment);
$name = stripslashes ($name);
$comment = stripslashes ($comment);
$lis="0";
$user=file("badwords.txt");
for($x=0;$x<sizeof($user);$x++) {
$comment = str_replace($temp[0],"-",$comment);
$jemp = explode(";",$user[$x]);
$opp[$x] = "$jemp[0];";
$list[$lis] = $opp[$x];
$lis++;
}
if(sizeof($list) != "0") {
for($y=0;$y<sizeof($list);$y++) {
$temp = explode(";",$list[$y]);
$temq=ucwords($temp[0]);
$temr=ucfirst($temp[0]);
$tems=strtoupper($temp[0]);
$comment = str_replace ($temp[0],"-", $comment);
$comment = str_replace ($tep,"-", $comment);
$comment = str_replace ($temq,"-", $comment);
$comment = str_replace ($temr,"-", $comment);
$comment = str_replace ($tems,"-", $comment);
$name = str_replace ($temp[0],"-",$name);
$name = str_replace ($temq,"-",$name);
$name = str_replace ($temr,"-",$name);
$name = str_replace ($tems,"-",$name);
}
}
$today = date("M:d:Y");
$ficdest=explode(".",basename($PHP_SELF));
$mfile="review/".$ficdest[0].".txt";
if(file_exists($mfile)) {
}else{
$m_compteur=fopen($mfile, "w");
fclose($m_compteur);
}
$compt=fopen($mfile, "r");
$old_stats=file($mfile);
$am = count($old_stats)-1;
$stats=explode("|~|", $old_stats[$am]);
fclose($compt);
//echo "$stats[4]";
if (strlen($name)>="1" && strlen($comment)>="1" && strlen($rate)>="1" && $stats[4]!=$ip){
if(file_exists($mfile)) {
$compteur=fopen($mfile, "a+");
fputs ($compteur, "
  • |~|");
    fputs ($compteur, "$name");
    fputs ($compteur, "|~|");
    fputs ($compteur, "$comment");
    fputs ($compteur, "|~|");
    fputs ($compteur, "$today");
    fputs ($compteur, "|~|");
    fputs ($compteur, "$ip");
    fputs ($compteur, "|~|");
    fputs ($compteur, "$rate");
    fputs ($compteur, "|~|");
    fputs ($compteur, "\n");
    fclose($compteur);
    echo "<CENTER><FONT COLOR=\"#0000FF\" face=arial>Your Review has been added.</FONT></CENTER>";
    }
    }
    elseif(strlen($name)>="1" && strlen($comment)>="1" && strlen($rate)>="1" && $stats[4]==$ip){
    echo "<CENTER><FONT COLOR='red' face=arial>You have already reviewed</FONT></CENTER>";
    }elseif(strlen($name)>="1" && strlen($comment)>="1" && strlen($rate)=="0") {
    echo "<CENTER><FONT COLOR='red' face=arial>Please select rating</FONT></CENTER>";
    }
    $main_file_m = $mfile;
    $latest_rev = 10; //Number of latest reviews to show
    $lines_review = file($main_file_m);
    $abc = count($lines_review);
    $uli = $abc - $latest_rev;
    echo "<center><table width=90% border=1 cellspacing=0 cellpadding=2 bordercolor=#3a4f6c>";
    for($cv = $abc; $cv >= $uli ;$cv--){
    if(substr($lines_review[$cv], 0, 6 )=="
    • "){
      $lpop = explode("|~|",$lines_review[$cv]);
      if ($lpop[5]=="10"){
      $img="images/b10.jpg";
      }elseif ($lpop[5]>="9"){
      $img="images/b9.jpg"; }
      elseif ($lpop[5]>="8"){
      $img="images/b8.jpg"; }elseif ($lpop[5]>="7"){
      $img="images/b7.jpg"; }elseif ($lpop[5]>="6"){
      $img="images/b6.jpg"; }elseif ($lpop[5]>="5"){
      $img="images/b5.jpg"; }elseif ($lpop[5]>="4"){
      $img="images/b4.jpg"; }elseif ($lpop[5]>="3"){
      $img="images/b3.jpg"; }elseif ($lpop[5]>="2"){
      $img="images/b2.jpg"; }elseif ($lpop[5]>="1"){
      $img="images/b1.jpg"; }
      $bar="<img src='$img'>";
      $mesi=wordwrap($lpop[2], 50, "\n", 1);
      echo "<tr><td bgcolor=#c2cfdf>$lpop[1] Reviewed on $lpop[3] $bar</td></tr><tr><td bgcolor=#f5f9fd>$mesi </td></tr>";
      }
      }
      $maximum="10";
      $lp=file($mfile);
      $abd = count($lp);
      if ($abd > $maximum) {
      $fw = fopen ("review/".$ficdest[0].".tmp", "w");
      fclose($fw);
      $folename = $mfile;
      $fd = fopen ($folename, "r");
      $puff = fread ($fd, filesize($folename));
      fclose ($fd);
      $last_file = fopen ("review/".$ficdest[0].".tmp", "a+");
      fwrite ($last_file, $puff);
      fclose($last_file);
      $fz = fopen ($mfile, "w");
      fwrite ($fz, "");
      fclose($fz);
      $lines14 = file("review/".$ficdest[0].".tmp");
      $a1 = count($lines14);
      $u = $a1 - $maximum;
      for($i1 = $a1; $i1 > $u;$i1--){
      $msg_old = $lines14[$i1] . $msg_old;
      }
      $fz = fopen ($mfile, "a+");
      fwrite ($fz,$msg_old);
      fclose($fz);
      }
      $fz = fopen ("review/".$ficdest[0].".tmp", "w");
      fwrite ($fz, "");
      fclose($fz);
      ?>
      </td></table>
      <form method='post'>
      <table width='90%' border='1' cellspacing='0' bordercolor=#3a4f6c bgcolor=#f5f9fd>
      <tr><b><font size=1>
      <td bgcolor=#c2cfdf><b>Add a Review</b></td></tr>
      <tr><td><table border='0'cellspacing='0' align=middle bgcolor=#f5f9fd>
      <tr><td><font size=1>
      Name: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR></font></b></td><td><input type='text' maxlength="50" name='name' size=20 style="font-weight:10"></td><td>Rating: <select name=rate><option value="">Select<option value="10">10 (Good)<option value="9">9<option value="8">8<option value="7">7<option value="6">6<option value="5">5<option value="4">4<option value="3">3<option value="2">2<option value="1">1 (Bad)</select></td></tr></table><table>
      <tr valign='top'><td></td><td align=middle><?php
      smile();
      ?></td><tr><td><font size=1>
      Comment:<BR></b></td>
      <td><textarea cols='35' rows='3' name='comment' onkeydown=textCounter(this.form.comment,this.form.descriptionleft,400); onkeyup=textCounter(this.form.comment,this.form.descriptionleft,400);></textarea><br>Characters Left&nbsp;<INPUT maxLength=3 name=descriptionleft readOnly size=3 tabIndex=400 value=400 style='BORDER-RIGHT: 0px; BORDER-TOP:0px;BORDER-LEFT:0px; BORDER-BOTTOM:0px;BACKGROUND-COLOR: #f5f9fd;'></td></tr>
      <tr><td></td><td>
      <input type='submit' value='Add Review' style="background:#f5f9fd;border-width:1;Border-color:#3a4f6c;"></td></tr>
      </table>
      </table>
      </form>
      </font><HR><FONT face=arial SIZE="1" COLOR="#00000">Powered By: <A HREF="http://www.cgixp.tk" target=_new>Unique Rate and Review</A></FONT></center>

Mój pierwszy bład związany z błędnym przetłumaczeniem instrukcji naprawiłem, wrzuciłem review.php do głównego katalogu i nie zmieniłem mu chmod, następnie stworzyłem w katalogu folder "review" i jemu zmieniłem chmod na 777.

Teraz wyświetla się na stronie taki błąd: http://newsy18.unl.pl/viewpage.php?page_id=4
Odpowiedz


Wiadomości w tym wątku
skrypt PHP na stronę - przez parsi - 06-11-2009, 03:07
RE: skrypt PHP na stronę - przez KowR - 06-11-2009, 03:48
RE: skrypt PHP na stronę - przez parsi - 06-11-2009, 17:22

Skocz do:


Użytkownicy przeglądający ten wątek: 1 gości
Sponsorzy i przyjaciele
SeoHost.pl