Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP][HTML]Problem ze skryptem php, Jak sprawić aby skrypt komentarzy pojawił się w oknie przeglądarki?
-Gośc01-
post
Post #1





Goście







///////////////////////////////////////////////////////////////////////////////
// talkback v1.12 //
// created by James Maglo //
// Download: http://php.umbagu.net/files/talkback.zip //
// Support: http://php.umbagu.net/support //
// //
///////////////////////////////////////////////////////////////////////////////


$address = "http://php.umbagu.net/scripts/php/"; //Full URL to where the talkback.php script is installed
$file = "comment.dat"; //name of the file where data will be stored. the default comment.dat value is recommended
$path = "/usr/home/u/m/umbagu/public_html/scripts/php/";// Finally, the full path to the script directory
$img = "1"; // 1 - user can post images 0 - images are disabled
$title_colour = "#0066AA"; //background colour of the part where user's name is displayed
$message_colour = "#CECEFF"; //background colour of the message displayed

// CHMOD THE DIRECTORY WHICH YOU SPECIFIED IN $address TO 0777!!!
//THATS ALL YOU NEED TO EDIT, PLEASE STOP NOW. TO USE THE SCRIPT, USE include("path/to/script/talkback.php");
$version = "1.1";
$maxlen = 30;
$route = "true";
if($img){
$imgnfo = "enabled. \\n\\n[img=http://imageaddress.com/image.jpg][/img]";
}
else{
$imgnfo = "disabled";
}

function reWriteDataInFile($fileData,$fileName = "talkback.tb")
{
if(!file_exists($fileName))
{
@$createFile = fopen($fileName, "w") or die ("Can't create file ".$fileName."");
fwrite ($createFile,"",0);
@chmod($fileName, 0666);
fclose($createFile);
}
@$openFile = fopen($fileName,"w+") or die ("Access is denied. Set permission to ".$fileName." by command in console \"chmod 666 ".$fileName."\"");
if ($openFile && flock($openFile,LOCK_EX)) {
@fwrite($openFile,$fileData);
}
fclose($openFile);
}

function createFile($fileName)
{
if(!file_exists($fileName))
{
@$createFile = fopen($fileName, "w") or die ("Can't create file ".$fileName."");
fwrite ($createFile,"",0);
@chmod($fileName, 0666);
fclose($createFile);
}
}

function convertLink($content)
{
global $constant;
$content = preg_replace('/(http|ftp|news|https)(:\/\/)([^<> ])+/i', "<a href='\\' class='messagelink'>\</a>", $content);
$content = preg_replace('/([\w-?&;#~=\.\/]+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?))/i', "<a href='mailto:\\1'>\\1</a>", $content);
return $content;
}

function divideWord($content,$maxWordLength = "30")
{
return wordwrap($content, $maxWordLength, " ", 1);
}


$back = "$HTTP_REFERER";
$time = date("d M, Y - H:i");
//############
//start of the script for adding
//############
if($action){
if($name){
if($comment){

$id = date("dMYHis");

if (file_exists("${file}"))
include("${file}");
else
createFile("${file}");

$comment = ereg_replace("[ ]{2,}", " ", $comment);
$comment = convertLink($comment);
$comment = str_replace("\"", "&quot;", $comment);
$comment = str_replace("\n", " <br/>", $comment);
$comment = str_replace("\$", " $", $comment);
$comment = strip_tags($comment, '');
if($img){
$comment = str_replace("[img=", "<img src='", $comment);
$comment = str_replace("][/img]", "'>", $comment);
}
$comment = trim($comment);
$comment = stripslashes($comment);


$cnt = 0;
$addContent = "<?php\n";

$addContent .= "\t\$content[0]['page'] = \"".$page."\";\n";
$addContent .= "\t\$content[0]['delete'] = \"".$id."\";\n";
$addContent .= "\t\$content[0]['name'] = \"".$name."\";\n";
$addContent .= "\t\$content[0]['comment'] = \"".$comment."\";\n";
$addContent .= "\t\$content[0]['time'] = \"".$time."\";\n";



$contentCnt = sizeof($content);
if ($contentCnt != 0)
$addContent .= "\n";
for($i = 0; $i < $contentCnt; $i++)
{
$cnt++;
while(list($key, $value) = each($content[$i]))
{
$addContent .= "\t\$content[".$cnt."]['".$key."'] = \"".$value."\";\n";
}
if ($i != $contentCnt-1)
$addContent .= "\n";
}
$addContent .= "?>";
reWriteDataInFile ($addContent, "$file");





}}
header ("location: $back");
exit;}
//#############
//end of script for adding
//#############
//show the entry form if nothing has been added
//#############
$page = "${HTTP_HOST}${PHP_SELF}";
if (file_exists("${path}${file}"))
include("${path}${file}");

print<<<END
<p><b><font size="3" face="Verdana, Arial, Helvetica, sans-serif">Talkback</font></b><br><font size="1" face="verdana">the smart way to voice your opinion</font></p>
<form action="${address}talkback.php" name="f" method="post">
<table width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="64">
<div align="right"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">name:</font></b></div>
</td>
<td width="436"><b><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><font color="#000000">
<input type="text" maxlength="40" name="name" style="width: 300;font-size: 7pt; font-family: Arial; background-color: #FFFFFF; color: black; border: 1 solid #000000" size="10">
</font></font></b></td>
</tr>
<tr>
<td width="64" valign="top"> <script language="Javascript">
function help(){
alert("INFORMATION\\n\\n Images are $imgnfo\\n\\n talkback - http://php.umbagu.net");
}
</script>
<div align="right"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">comment:</font></b></div><div align="center"><font face="verdana" size="1"> <a href="java script:help()"><font color="blue">help</font></a></font></div>
</td>
<td width="436"><b><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><font color="#000000">
<textarea name="comment" style="width: 300;font-size: 7pt; font-family: Arial; background-color: #FFFFFF; color: black; border: 1 solid #000000" cols="10" rows="4"></textarea>
</font></font></b></td>
</tr>
<tr>
<td width="64">
<div align="right"><font face="Verdana, Arial, Helvetica, sans-serif"><font face="Verdana, Arial, Helvetica, sans-serif"><font size="2"><font size="2"><b></b></font></font></font></font></div>
</td>
<td width="436"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">
<input type="submit" name="Submit" value="Submit" style="width: 300;font-size: 7pt;" ><input type="hidden" name="action" value="yeah_baby"><input type="hidden" name="page" value="$page">
</font></b></td>
</tr>
</table>
</form>

END;



?>
</font></font><br>
<table width="500" border="0" cellspacing="0" cellpadding="0">
<?
$now = "${HTTP_HOST}${PHP_SELF}";


$currentContent = $content;
for ($i = 0; $i < sizeof($currentContent); $i++)
{
$try = $currentContent[$i]['page'];
$message = $currentContent[$i]['comment'];
$message = str_replace("java script:", "[talkback JS filter]", $message);
if($try == $now){
?>
<tr>
<td bgcolor="<?echo $title_colour;?>"><font face="Verdana, Arial, Helvetica, sans-serif"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><font color='navy'><font color='black'>
<font size="2" color="#FFFFFF"> <b>
<?=$currentContent[$i]['name']?>
</b></font></font></font></font><b><font size="2" color="#FFFFFF">commented
at </font></b></font><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">
<?=$currentContent[$i]['time']?>
</font></b><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><font color='navy'><font color='black'>
</font></font></font></td>
</tr>
<tr>
<td bgcolor="<?echo $message_colour;?>"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><font color='navy'><font color='black'>
&nbsp;<?=$message?>&nbsp;
</font></font></font></td>
</tr><?}}?>
</table>
<p align="center"><font face="Verdana, Arial, Helvetica, sans-serif" color="blue" size="1">
<a href="http://php.umbagu.net">&copy; James Maglo - umbagu </a>
</font></p>[/code]
Pytanie pierwsze
Co muszę zrobić aby ten skrypt pojawił się w oknie przęglądarki?
Owszem,jest instrukcja,ale po angielsku. Jak wkleję ją w tłumacza wychodzi masło maślane.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 9)
-Gość-
post
Post #2





Goście







Kod
Thank you for downloading talkback v1.12 from http://php.umbagu.net
This script is copyright James Maglo 2002.  If you have any problems then visit http://php.umbagu.net/support

============
INSTALLATION
============
1. Before uploading, open talkback.php and edit the 6 variables at the top.
2. Upload
3. Can't think of anything to add here.  I wanted to make this complicated but it just isn't.  Oh well.

============
INSTRUCTIONS
============
1. Simply add
<? include("path/to/script/talkback.php");?>
to wherever you want the form and results to appear.  It must be used on pages with the .PHP extension!!! (an HTML version will be coming soon!)
2. That is all

=======
HISTORY
=======
v1.12   -  javascript filtered out so user can't call it via the image link

v1.11    -  option to change table colour

v1.1    -  404 error bug fix.
    -  html filter installed, prevents <iframes>
    -  [img] non-html quick tag, can be disabled

v1.0 -     Basic interface allows user to input name and comment.  Stored in a flat file database for simplicity.  No plans to     change to mySQL in the near or distant future.
Go to the top of the page
+Quote Post
f1xer
post
Post #3





Grupa: Zarejestrowani
Postów: 403
Pomógł: 68
Dołączył: 20.03.2008

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


Tłumaczenie:

Instalacja

1. Zanim wgrasz plik na serwer otwórz plik talkback.php i zmień wartości 6 zmiennych na górze skryptu
2. Wgraj plik na serwer
3. Nie wiem co tu napisać chciałem to bardziej skomplikować ale po prostu się nie da

Wysiliłbyś się trochę chociaż.

Żeby dodać skrypt wystarczy że wstawisz w kod strony
  1. <?php
  2. include("sciezka/do/skryptu/talkback.php");
  3. ?>


a teraz zmienne
$address - wpisuje adres do folderu gdzie jest skrypt razem z http:// np. http://twojastrona.com/skrytpty/
$file - plik gdzie zapisywać dane
$path - pełna ścieżka do skryptu
$img - jeżeli 1 to użytkownik może dodac obrazek
$title_colour, $message_colour - domyśl się

Ten post edytował f1xer 28.08.2008, 14:41:15


--------------------
Pomogłem? wyraź to i kliknij "Pomógł"
Go to the top of the page
+Quote Post
-gość 01-
post
Post #4





Goście







Kod
$address        =   "http://www.piesna6.webpark.pl/artyk4.html"; //Full URL to where the talkback.php script is installed
$file           =   "dane.dat"; //name of the file where data will be stored.  the default comment.dat value is recommended
$path           =   "\Users\Alek\Desktop\Nowy html\talkback.php";// Finally, the full path to the script directory
$img            =   "1"; // 1 - user can post images   0  - images are disabled
$title_colour   =   "#0066AA"; //background colour of the part where user's name is displayed
$message_colour =   "#CECEFF"; //background colour of the message displayed

Zmieniłem tak jak mówiłes i nadal bez efektu. Pisze że nie moze odnaleść określonego modułu. Co jest nie tak?
Go to the top of the page
+Quote Post
f1xer
post
Post #5





Grupa: Zarejestrowani
Postów: 403
Pomógł: 68
Dołączył: 20.03.2008

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


$adress = "http://www.piesna6.webpark.pl/";
$path="/";

Powinno zadziałać


--------------------
Pomogłem? wyraź to i kliknij "Pomógł"
Go to the top of the page
+Quote Post
-Gosc01-
post
Post #6





Goście







Nic z tego,ale pytanie:
Jak podaje ścieżkę dostępu np.
Kod
<?php
include("sciezka/do/skryptu/talkback.php");
?>
to ma być względna czy bezzględna?
Bo ja uzywam względnej scieżki:
Kod
<?php
include("talkback.php");
?>


Ponadto chciałbym zwrócić uwagę na pewien fragment kodu:

Kod
if($img){
$imgnfo = "enabled. \\n\\n[img=http://imageaddress.com/image.jpg][/img]";
}


Co to jest? Czy mam tu coś edytować?

Po prostu- kiedy w edytorze klikam na podgląd pisze że nie może odnaleść określonego modułu.
Go to the top of the page
+Quote Post
-dh-
post
Post #7





Goście







questionmark.gifquestionmark.gifquestionmark.gifquestionmark.gifquestionmark.gifquestionmark.gif
Go to the top of the page
+Quote Post
-Gosc01-
post
Post #8





Goście







CO JEST NIE TAK
Go to the top of the page
+Quote Post
-Gosc01-
post
Post #9





Goście







CZY KTOŚ DO CHOLERY MI W KOŃCU ODPOWIE?questionmark.gifquestionmark.gif
Go to the top of the page
+Quote Post
conel
post
Post #10





Grupa: Zarejestrowani
Postów: 28
Pomógł: 5
Dołączył: 26.08.2008
Skąd: Poznań

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


A może byś tak przestał się pienić i wykazał chociaż najmniejszą próbę rozwiązania SWOJEGO problemu, co?

Wpadasz sobie na forum, wrzucasz jak leci cały skrypt, nie używając nawet odpowiednich znaczników przez co kod staje się całkowicie nieczytelny. Do tego nie chce się Tobie przeczytać komentarzy do skryptu, którego próbujesz użyć. Tutaj nie chodzi o to, że nie umiesz, bo to bzdura. Żyjemy w 21 wieku, gdzie w szkołach angielski jest już obowiązkowym przedmiotem w gimnazjum (może nawet wcześniej). Jakby tego wszystkiego było mało, to jeszcze toczysz pianę o to czy ktoś Ci pomoże. Wybacz człowieku, ale tutaj, jak i na innych forach, nikt nie ma obowiązku Tobie pomagać. To tylko i wyłącznie dobra wola, ale skoro Ty nie potrafisz tego docenić, to trudno spodziewać się jakiejkolwiek pomocy.

http://domena.pl/skrypt/ - URL prowadzący do skryptu.
/skrypt (lub /public_html/skrypt/, lub 150 innych sposobów) - tak to wygląda z FTP.

$address = "http://php.umbagu.net/scripts/php/"; - http://domena.pl/skrypt/
$file = "comment.dat"; - chmod 777 na plik "comment.dat". Jeśli nie istnieje należy go stworzyć i dać mu chmod 777.
$path = "/usr/home/u/m/umbagu/public_html/scripts/php/"; - ścieżka bezwzględna na serwerze prowadząca do skryptu. Nie, to nie jest tak jak wygląda z FTP. Jak uzyskać bezwzględna ścieżkę do swojego katalogu? Manual.

Musi działać.

Ten post edytował conel 1.09.2008, 14:51:16
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 - 05:39