Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]Problem z komentarzem..., Mam mały problem z komentarzami na stronie.
-Pillgrim-
post
Post #1





Goście







Jak w opisie tematu, mam mały problem z komentarzem na stronie...
A więc po kolei: ściągnąłem sobie gotowy system komentarzy (Jestem jeszcze zielony i nie potrafię napisać sam), z początku działał, ale później, gdy trochę go "stuningowałem" wyskoczył błąd:
Cytat
Parse error: syntax error, unexpected T_STRING in /home/b/u/x/buxporadnik/www/koment.php on line 7


Ten skrypt wygląda tak:
  1. <!-- początek scryptu php //-->
  2. <?
  3. $im=$_POST['imie']; $message=$_POST['message']; $e=$_POST['email']; $gg=$_POST['gg']; $site=$_POST['site'];
  4. if ($message && $im)
  5.  {
  6.  $date = date("Y-m-d H:i:s");
  7.  $message = "<center><table width=450px height=auto border=1 cellpadding=5><tr><td width=100px>$im<br />$date<br /><a href="mailto:$email"><img src="images/mail.gif"></a> <a href="gg:$gg"><img src="images/gg1.gif"></a> <a href="$site"><img src="images/site.gif"></a></td><td width=350px>$message</td></tr></center>";
  8.  $fp = fopen (basename($_SERVER['PHP_SELF']).".text", "a");
  9.  fwrite ($fp, $message);
  10.  fclose ($fp);
  11.  }
  12. @readfile(basename(($_SERVER['PHP_SELF'].".text")));
  13. $message ="";
  14. ?>
  15. <!-- koniec scryptu php //-->
  16. <center>
  17. <table cellpadding=5>
  18. <FORM method="post">
  19. <tr><td><center>Nick:</center><INPUT name="imie" type="text" size="25"></td><td><center>E-mail:</center><INPUT name="email" type="text" size="25"></td></tr>
  20. <tr><td><center>Numer GG:</center><INPUT name="gg" type="text" size="25"></td><td><center>Strona WWW:</center><INPUT name="email" type="text" size="25"></td></tr>
  21. </table>
  22. Komentarz:<br /><TEXTAREA name="message" rows=7 cols=41 wrap=virtual></TEXTAREA><br />
  23. <INPUT name="submit" type="submit" value="Dodaj komentarz">
  24. </FORM>
  25. </center>


Czy ktoś mógłby sprawdzić gdzie popełniłem błąd i powiedzieć mi jak go naprawić?

Ps.
Przy okazji chciałbym się zapytać jak ustawić cookie, żeby komentarze można było dodawać najczęściej co 5minut?
Go to the top of the page
+Quote Post
wipo
post
Post #2





Grupa: Zarejestrowani
Postów: 856
Pomógł: 19
Dołączył: 30.08.2005
Skąd: 100lica

Ostrzeżenie: (0%)
-----


W tej linii
  1. <?php
  2. $message = "<center><table width=450px height=auto border=1 cellpadding=5><tr><td width=100px>$im<br />$date<br /><a href="mailto:$email"><img src="images/mail.gif"></a> <a href="gg:$gg"><img src="images/gg1.gif"></a> <a href="$site"><img src="images/site.gif"></a></td><td width=350px>$message</td></tr></center>";
  3. ?>


Jak stringa zamykasz w cudzysłów to potem w linkach musisz stosować \"

Ten post edytował wipo 24.06.2008, 19:30:10


--------------------
Go to the top of the page
+Quote Post
matx132
post
Post #3





Grupa: Zarejestrowani
Postów: 243
Pomógł: 19
Dołączył: 12.09.2005

Ostrzeżenie: (0%)
-----


zmień
  1. <?php
  2. $message = "<center><table width=450px height=auto border=1 cellpadding=5><tr><td width=100px>$im<br />$date<br /><a href="mailto:$email"><img src="images/mail.gif"></a> <a href="gg:$gg"><img src="images/gg1.gif"></a> <a href="$site"><img src="images/site.gif"></a></td><td width=350px>$message</td></tr></center>";
  3. ?>


na
  1. <?php
  2. $message = '<center><table width=450px height=auto border=1 cellpadding=5><tr><td width=100px>$im<br />$date<br /><a href="mailto:$email"><img src="images/mail.gif"></a> <a href="gg:$gg"><img src="images/gg1.gif"></a> <a href="$site"><img src="images/site.gif"></a></td><td width=350px>$message</td></tr></center>';
  3. ?>



ponieważ po kazdym znaku "
zamykasz i otwierasz nowy string a tak nie moze być chyba ze dodajesz zmienna lecz musza byc wtedy ..

Ten post edytował matx132 24.06.2008, 19:33:41
Go to the top of the page
+Quote Post
Cysiaczek
post
Post #4





Grupa: Moderatorzy
Postów: 4 465
Pomógł: 137
Dołączył: 26.03.2004
Skąd: Gorzów Wlkp.




Poczytaj o tym, jak się umieszcza zmienne w typach string.
http://pl2.php.net/manual/pl/language.type....string.parsing

i jescze:
  1. <?php
  2. print ''cos''; // źle
  3. print ''cos''; //dobrze
  4. ?>

Pozdrawiam.


--------------------
To think for yourself you must question authority and
learn how to put yourself in a state of vulnerable, open-mindedness;
chaotic, confused, vulnerability, to inform yourself.
Think for yourself. Question authority.
Go to the top of the page
+Quote Post
-Pillgrim-
post
Post #5





Goście







Zmieniłem tą linijkę na:
  1. <?php
  2. $message = "<center><table width=450px height=auto border=1 cellpadding=5><tr><td width=100px>$im<br />$date<br /><a href='mailto:$e'><img src='images/mail.gif'></a><a href='gg:$gg'><img src='images/gg1.gif'></a><a href='$site'><img src='images/site.gif'></a></td><td width=350px>$message</td></tr></center><br />";
  3. ?>


Dzięki wam za pomoc, miło mi było yahoo.gif
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 19.08.2025 - 10:55