Forum Webmastera, HTML, CSS, PHP, MySQL, Hosting, Domeny - Forum dla Webmasterów
skrypt PHP na stronę - Wersja do druku

+- Forum Webmastera, HTML, CSS, PHP, MySQL, Hosting, Domeny - Forum dla Webmasterów (
+-- Dział: Technologie internetowe - tworzenie stron WWW (
+--- Dział: CMSy, Systemy Forów (
+---- Dział: PHP Fusion (
+---- Wątek: skrypt PHP na stronę (/thread-2705.html)

skrypt PHP na stronę - parsi - 06-11-2009

Faktycznie są komentarze, ale gdy napisze gość to będzie widoczny dopiero po moim zatwierdzeniu. Chyba, że można to zmienić?

A pytanie o wgranie skryptu jest uniwersalne, gdyż mam z tym problem na EF i mysql.

No więc mam skrypt z ocenianiem i komentarzami ze strony,recenzje-i-ocenianie,unique-rate-and-review.html
W readme jest napisane:

Cytat:This script is very easy to install, requires no configuration
Just upload review.php into your server's home directory and then
make a directory named "review" chmod 777 this directory.
If your webpages are also in the homedirectory then add th following
line in your webpage where you want the Rate & Review to be appeared.
<?php include "review.php"; ?>
Donot add <?php include ""; ?>
Because it may show rate & review script but it will not be
able to record the reviews.
Change the extension of your webpage to .php
Number of latest reviews to show is set to 10
You can change the value of this variable according to your need.

Zgrywam reaviw.php do katalogu "public html". W TC zmieniam na 777 atrybut pliku.
No i wklejam w PA na podstronie:
Cytat:<?php include "review.php"; ?>

Oto co mi się pokazuje:

Cytat:Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/parsi/domains/ : eval()'d code on line 1

Parse error: syntax error, unexpected $end in /home/parsi/domains/ : eval()'d code on line 1

Gdzie zrobiłem błąd?

RE: skrypt PHP na stronę - KowR - 06-11-2009

Pokaż nam kod tego skryptu, bo inaczej nikt Ci nie pomoże.

RE: skrypt PHP na stronę - parsi - 06-11-2009

<SCRIPT language=JavaScript>
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit)
field.value = field.value.substring(0, maxlimit);
countfield.value = maxlimit - field.value.length;
<script language="JavaScript">
function emo(emo){
document.all.comment.value += emo;
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;}

//Copyright Cgixp Team
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>
$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);
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];
if(sizeof($list) != "0") {
for($y=0;$y<sizeof($list);$y++) {
$temp = explode(";",$list[$y]);
$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");
if(file_exists($mfile)) {
$m_compteur=fopen($mfile, "w");
$compt=fopen($mfile, "r");
$am = count($old_stats)-1;
$stats=explode("|~|", $old_stats[$am]);
//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");
    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"){
      }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>";
      $abd = count($lp);
      if ($abd > $maximum) {
      $fw = fopen ("review/".$ficdest[0].".tmp", "w");
      $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);
      $fz = fopen ($mfile, "w");
      fwrite ($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);
      $fz = fopen ("review/".$ficdest[0].".tmp", "w");
      fwrite ($fz, "");
      <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
      ?></td><tr><td><font size=1>
      <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>
      <input type='submit' value='Add Review' style="background:#f5f9fd;border-width:1;Border-color:#3a4f6c;"></td></tr>
      </font><HR><FONT face=arial SIZE="1" COLOR="#00000">Powered By: <A HREF="" 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: