commenti automatici

joelle

Nuovo Utente
13 Gen 2009
19
0
0
Premetto che sono una newby e mi intendo zero di php. Il mio problema deriva dal fatto che avendo necessita di un sistema di commenti automatici per il mio sito, ho provato ad installare uno script già predisposto che ho modificato in base hai dati (database mysql) fornitimi da server sul quale c'è il mio sito.
Attualmente il sistema sembra funzionare (es. http://www.donn-cosi.org/crisi.htm ) ma all'atto dell'INVIO invece di visualizzare la pagina dei commenti, mi porta direttamente all'INDEX del sito.
Sono giorni che ci combatto, potreste darmi una mano???:crying:
Grazie.
 

joelle

Nuovo Utente
13 Gen 2009
19
0
0
Come faccio a mostrarvi lo script?
E poi un altra domanda: Creando un collegamento alla pagina dei commenti, occorre crearne una per ogni pagina in cui vogliamo l'iterattività? Cioè creare altre pagine comment, comment1, comment2....ecc, per ogni pagina diversa?:confused:
 

joelle

Nuovo Utente
13 Gen 2009
19
0
0
...Dallibro </span></font></p><p class=\\\"MsoNormal\\\" style=\\\"text-align:justify\\\"><font face=\\\"Arial\\\"><span style=\\\"mso-bidi-font-style: normal; font-size: 12.0pt; mso-bidi-font-size: 10.0pt\\\"><i>AusiliaRiggi Pignata, Da donna a donne, Il&nbsp; Segno dei Gabrielli, Negarine(VR) 2000</i></span><i><span style=\\\"font-size:12.0pt;mso-bidi-font-size:10.0pt\\\"><o:p></o:p></span></i></font></p> <p>&nbsp;</td> </tr> </table> </center></div> <?php require("http//www.donne-cosi.org/public/comments/comments.php"); ?><div class="foot"> <form method=POST action='http://www.donne-cosi.org/public/comments/comments.php'> <input type=hidden name="action" value="add"> <input type=hidden name="href" value=""> <table width="290" border="0" cellspacing="1" cellpadding="2" align="center"> <tr> <td width="83" align="right"><font color="red">*</font>Nome: </td> <td width="196" align="left"> <input type=text name="disc_name" maxlength=40 size=30> <input type=hidden name="r_disc_name" value="Il campo 'Nome' deve essere compilato"> </td> </tr> <tr> <td width="83" align="right">Email:</font></td> <td width="196" align="left"> <input type="Text" name="disc_email" size="30" maxlength="70"> </td> </tr> <tr> <td width="83"></td> <td width="196" align="left"> <input type="checkbox" name="email_me"><font size=2><nobr>Notifica di nuovi commenti a questo articolo</nobr></font><br> <input type="checkbox" name="dont_show_email" CHECKED><font size=2><nobr>Nascondi la mia email</nobr></font><br> </td> </tr> <tr> <td valign="top" width="83" align="right"> <font color="red">*</font>Commento: </td> <td valign="top" width="196" align="left"> <textarea name="disc_body" cols="40" rows="13" wrap="VIRTUAL"></textarea> <input type=hidden name="r_disc_body" value="Il campo 'Commento' deve essere compilato"> </td> </tr> <tr> <td valign="top" width="83" align="right">&nbsp; </td> <td valign="top" width="196"> <div align="center"> <input type="submit" name="Submit" value="Invia"> </div> </td> </tr> </table> </form>
 

joelle

Nuovo Utente
13 Gen 2009
19
0
0
Il forum non permette più di tante parole...dove posso eventualmente inviarti ste pagine per un okkio???
 

Giangy94

Nuovo Utente
7 Gen 2009
26
0
0
Scrivi più post e racchiudi in TAG che mi è venuto il mal di testa a leggerli così
 

joelle

Nuovo Utente
13 Gen 2009
19
0
0
questa è la pagina COMMENTS

<?
$COM_CONF['full_path'] = dirname(__FILE__);

include("{$COM_CONF['full_path']}/config.php");
if (! $COM_CONF['dbhost']) {
echo 'It seems that comments script is not properly installed. See readme.txt for more info.';
}

require("{$COM_CONF['full_path']}/lang/lang_{$COM_CONF['lang']}.php");
require("{$COM_CONF['full_path']}/akismet-class.php");

$comments_db_link = mysql_connect($COM_CONF['dbhost'],$COM_CONF['dbuser'],$COM_CONF['dbpassword']);
mysql_select_db($COM_CONF['dbname'], $comments_db_link);

smcom_main();

function smcom_main()
{
if ($_REQUEST['action'] == 'add'){
smcom_add();
}
elseif ($_REQUEST['action'] == 'unsub'){
smcom_unsub();
}
elseif (1) {
smcom_view();
}
}

function smcom_check_for_errors() {

global $comments_db_link, $COM_CONF, $COM_LANG;

$ip = mysql_escape_string($_SERVER['REMOTE_ADDR']);
$result = mysql_query("SELECT ip FROM {$COM_CONF['dbbannedipstable']} WHERE ip='$ip'", $comments_db_link);

if (mysql_num_rows($result)>0) {
$error_message.=$COM_LANG['not_allowed'] . "<br />";
}
if ($_REQUEST['disc_name'] == '') {
$error_message.=$_REQUEST['r_disc_name'] . "<br />";
}
if ($_REQUEST['disc_body'] == '') {
$error_message.=$_REQUEST['r_disc_body'] . "<br />";
}
if ($_REQUEST['disc_email'] != '') {
if (!smcom_is_email($_REQUEST['disc_email'])) {
$error_message.="Invalid email address" . "<br />";
}
}

return $error_message;

}

function smcom_flood_protection($INPUT) {

global $comments_db_link, $COM_CONF, $COM_LANG;

$result = mysql_query("select time from {$COM_CONF['dbmaintable']} where ip='{$_SERVER['REMOTE_ADDR']}' AND (UNIX_TIMESTAMP( NOW( ) ) - UNIX_TIMESTAMP( time )) < {$COM_CONF['anti_flood_pause']}", $comments_db_link);
if (mysql_num_rows($result)>0) {
$error_message="Flood detected";
return $error_message;
}
$result = mysql_query("select ID from {$COM_CONF['dbmaintable']} where text='{$INPUT['disc_body']}' AND author='{$INPUT['disc_name']}' AND href='{$INPUT['href']}'", $comments_db_link);
if (mysql_num_rows($result)>0) {
$error_message="Flood detected";
return $error_message;
}

return "";
}

function smcom_spam_check($email, $name, $url, $text, $path_to_page, $ip) {

global $COM_CONF, $comments_db_link;

$try = 0;
while (!$valid && $try <= 3) {
// Initialize and verify API key
$akismet = new Akismet($COM_CONF['site_url'], $COM_CONF['akismet_apikey']);
$result = $akismet->isKeyValid();
// Possible values: 'valid', 'invalid', 'no connect'
if ($result != 'valid') {
if (($result == 'invalid')) {
// Invalid key
return 2;
} else {
// Could not connect to the Akismet server
$try++;
}
}
else {
$valid = 1;
}
}

if (!$valid) {
return 3; // Could not connect to the Akismet server
}

// Pass comment info to the class
$akismet->setCommentAuthorEmail($email);
$akismet->setCommentAuthor($name);
$akismet->setCommentAuthorURL($url);
$akismet->setCommentContent($text);
$akismet->setUserIP($ip);
$akismet->setPermalink($COM_CONF['site_url'] . $path_to_page);
$akismet->setCommentType('Comment');

$try = 0;
while ($try <= 3) {
// Check the comment for spam
$result = $akismet->isCommentSpam();
// Possible values: 'false' (not spam), 'true' (spam), 'no connect'
if ($result != 'false') {
if ($result == 'true') {
// The comment is spam
return 1;
} else {
// Could not connect to the Akismet server
$try++;
}
} else {
return 0;
}
}

return 3; // Could not connect to the Akismet server
}

function smcom_add()
{
global $comments_db_link, $COM_CONF, $COM_LANG;

foreach ($_REQUEST as $key => $value) {
if ($key == 'disc_body') {
$comment_text=stripslashes($value);
}
$_REQUEST[$key] = str_replace('<', '&lt;', $_REQUEST[$key]);
$_REQUEST[$key] = str_replace('>', '&gt;', $_REQUEST[$key]);
if (get_magic_quotes_gpc()) {
$_REQUEST[$key] = stripslashes($_REQUEST[$key]);
}
$_REQUEST[$key] = mysql_escape_string($_REQUEST[$key]);
}

$_REQUEST['href'] = str_replace('%2F', '/', $_REQUEST['href']);
$_REQUEST['href'] = str_replace('%3F', '?', $_REQUEST['href']);
$_REQUEST['href'] = str_replace('%26', '&', $_REQUEST['href']);
$_REQUEST['href'] = str_replace('%3D', '=', $_REQUEST['href']);

if ($_REQUEST['dont_show_email'] != '') { $dont_show="1"; }
else { $dont_show="0"; }


$error_message = smcom_check_for_errors();
$error_message .= smcom_flood_protection($_REQUEST);


if ($COM_CONF['ckeck_for_spam']) {
if (!$error_message) {
$spam_check_result = smcom_spam_check($_REQUEST['disc_email'], $_REQUEST['disc_name'], "", $comment_text, $_REQUEST['href'], "");
if ($spam_check_result == 1) {
$error_message .= "<br>Your comment suspected as spam.";

mysql_query("INSERT INTO {$COM_CONF['dbjunktable']} VALUES (NULL, NOW(), '{$_REQUEST['href']}', '{$_REQUEST['disc_body']}', '{$_REQUEST['disc_name']}', '{$_REQUEST['disc_email']}', '$dont_show', '{$_SERVER['REMOTE_ADDR']}')", $comments_db_link);
}
if ($spam_check_result == 2) {
$error_message .= "<br>Invalid WordPress API key";
}
if ($spam_check_result == 3) {
$error_message .= "<br>Could not connect to the Akismet server";
}
}
}


if ($error_message) {
print "The following errors occured:<br>$error_message<br><br>
Please <a href=\"javascript:history.go(-1)\">get back</a> and try again.";
return 0;
}


mysql_query("INSERT INTO {$COM_CONF['dbmaintable']} VALUES (NULL, NOW(), '{$_REQUEST['href']}', '{$_REQUEST['disc_body']}', '{$_REQUEST['disc_name']}', '{$_REQUEST['disc_email']}', '$dont_show', '{$_SERVER['REMOTE_ADDR']}')", $comments_db_link);

if ($_REQUEST['email_me'] != '' && $_REQUEST['disc_email'] != '') {
$result = mysql_query("select COUNT(*) from {$COM_CONF['dbemailstable']} where href='{$_REQUEST['href']}' AND email='{$_REQUEST['disc_email']}'", $comments_db_link);
list ($count) = mysql_fetch_row($result);
if ($count == 0) {
$hash=md5($email . $COM_CONF['copy_random_seed']);
mysql_query("INSERT INTO {$COM_CONF['dbemailstable']} VALUES (NULL, '{$_REQUEST['disc_email']}', '{$_REQUEST['href']}', '$hash')", $comments_db_link);
}
}

if ($COM_CONF['email_admin']) {
smcom_notify_admin($_REQUEST['href'], $_REQUEST['disc_name'], $_REQUEST['disc_email'], $comment_text, "{$_SERVER['REMOTE_ADDR']}, {$_SERVER['HTTP_USER_AGENT']}");
}
smcom_notify_users($_REQUEST['href'], $_REQUEST['disc_name'], $_REQUEST['disc_email']);

header("HTTP/1.1 302");
header("Location: {$COM_CONF['site_url']}{$_REQUEST['href']}");
print "<a href=\"{$COM_CONF['site_url']}{$_REQUEST['href']}\">Click here to get back.</a>";

}

function smcom_notify_admin($href, $name, $email, $text, $ip)
{
global $comments_db_link, $COM_CONF, $COM_LANG;

$headers = "From: Comments <{$COM_CONF['email_from']}>\r\n";
$text_of_message="
{$COM_LANG['email_new_comment']} {$COM_CONF['site_url']}$href
{$COM_LANG['email_from']}: $name <$email>

$text

$ip
";

mail($COM_CONF['email_admin'], "{$COM_LANG['email_new_comment']} $href", $text_of_message, $headers);
}

function smcom_notify_users($href, $name, $email_from)
{
global $comments_db_link, $COM_CONF, $COM_LANG;

$headers = "From: Comments <{$COM_CONF['email_from']}>\n";

$result=mysql_query("select email, hash from {$COM_CONF['dbemailstable']} where href='$href'", $comments_db_link);
while (list($email, $hash) = mysql_fetch_row($result)) {
if ($email != $email_from) {
$text_of_message="
{$COM_LANG['email_new_comment']} {$COM_CONF['site_url']}$href
{$COM_LANG['email_from']}: $name

{$COM_LANG['email_to_unsubscribe']}
{$COM_CONF['site_url']}{$COM_CONF['script_url']}?action=unsub&page=$href&id=$hash

";
mail($email, "{$COM_LANG['email_new_comment']} $href",$text_of_message, $headers);
}
}


}

function smcom_unsub()
{
global $comments_db_link, $COM_CONF, $COM_LANG;

$id=mysql_escape_string($_REQUEST['id']);
$href=mysql_escape_string($_REQUEST['page']);

mysql_query("delete from {$COM_CONF['dbemailstable']} where href='$href' AND hash='$id'", $comments_db_link);

if (mysql_affected_rows() > 0) {
print "{$COM_LANG['unsubscribed']}";
}
else {
print "{$COM_LANG['not_unsubscribed']}";
}
}

function smcom_view()
{
global $comments_db_link, $COM_CONF, $COM_LANG;

$request_uri = mysql_escape_string($_SERVER['REQUEST_URI']);
$result = mysql_query("select time, text, author, email, dont_show_email from {$COM_CONF['dbmaintable']} where href='$request_uri' order by time {$COM_CONF['sort_order']}", $comments_db_link);

$comments_count=0;
$time=$text=$author=$email=$dont_show_email=array();
while (list($time[$comments_count], $text[$comments_count], $author[$comments_count], $email[$comments_count], $dont_show_email[$comments_count])=mysql_fetch_array($result)) {
$text[$comments_count] = wordwrap($text[$comments_count], 75, "\n", 1);
$time[$comments_count] = smcom_format_date($time[$comments_count]);
$comments_count++;
}

require("{$COM_CONF['full_path']}/templates/{$COM_CONF['template']}.php");

}

function smcom_format_date($date)
{
global $COM_LANG;

$year = substr($date, 0, 4);
$month = intval(substr($date, 5, 2)) - 1;
$day = substr($date, 8, 2);
$hour = substr($date, 11, 2);
$min = substr($date, 14, 2);

return "$day {$COM_LANG['months'][$month]} $year, $hour:$min";
}

function smcom_is_email($Addr)
{
$p = '/^[a-z0-9!#$%&*+-=?^_`{|}~]+(\.[a-z0-9!#$%&*+-=?^_`{|}~]+)*';
$p.= '@([-a-z0-9]+\.)+([a-z]{2,3}';
$p.= '|info|arpa|aero|coop|name|museum)$/ix';
return preg_match($p, $Addr);
}

?>[/QUOTE]
 

joelle

Nuovo Utente
13 Gen 2009
19
0
0
Questa è la ADMIN

<?

/*

Admin panel v1.04

Copyright (C) 2005-2006 ScriptsMill

E-Mail: [email protected]
URL: http://www.scriptsmill.com
Author: Stanislav Perederiy

This file is part of ScriptsMill Comments.

ScriptsMill Comments is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

ScriptsMill Comments is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with ScriptsMill Comments; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA


*/

ob_start();

include("./config.php");
include("./lang/lang_{$COM_CONF['lang']}.php");


$comments_db_link = mysql_connect($COM_CONF['dbhost'],$COM_CONF['dbuser'],$COM_CONF['dbpassword']);
mysql_select_db($COM_CONF['dbname'], $comments_db_link);

$auth = is_auth();
main();

ob_end_flush();

function main() {

global $auth;

if ($_REQUEST['action'] == 'delete' && $auth){
delete();
}
elseif ($_REQUEST['action'] == 'list' && $auth){
view_list();
}
elseif ($_REQUEST['action'] == 'banip' && $auth){
banip();
}
elseif ($_REQUEST['action'] == 'search' && $auth){
search();
}
elseif ($_REQUEST['action'] == 'bannedlist' && $auth){
bannedlist();
}
elseif ($_REQUEST['action'] == 'unbanip' && $auth){
unbanip();
}
elseif ($_REQUEST['action'] == 'junk_list' && $auth){
view_junk_list();
}
elseif ($_REQUEST['action'] == 'not_junk' && $auth){
mark_as_not_junk();
}
elseif ($_REQUEST['action'] == 'clear_junk' && $auth){
clear_junk();
}
elseif ($_REQUEST['action'] == 'logout'){
logout();
}
elseif (1) {
login_screen();
}

}

function is_auth() {

global $COM_CONF;

if ($_COOKIE['login']) {
$login = $_COOKIE['login'];
}
if ($_POST['login']) {
$login = $_POST['login'];
}
if ($_COOKIE['passw']) {
$passw = $_COOKIE['passw'];
}
if ($_POST['passw']) {
$passw = $_POST['passw'];
}

if ($login == $COM_CONF['admin_name'] && $passw == $COM_CONF['admin_passw'] && $_REQUEST['action'] != 'logout') {
setcookie("login", $login, time()+999999, "{$COM_CONF['script_dir']}/");
setcookie("passw", $passw, time()+999999, "{$COM_CONF['script_dir']}/");
return 1;
}
else {
return 0;
}

}

function login_screen() {

global $auth, $COM_CONF, $COM_LANG;

if ($auth) {
search();
return 0;
}
else {
require("./templates/admin/default_login.php");
}

}

function make_pages_string ($all_count, $records_per_page, $cur_page, $base_url) {

if ($all_count > $records_per_page) {
if ($cur_page > 0) { $cur_page=$cur_page-1; }
$first_record = ($cur_page) * $records_per_page;
$limit_string = "LIMIT $first_record, $records_per_page";
$pages=$all_count/$records_per_page;
if ($pages > (int) $pages) { $pages=(int)$pages+1; }
}
if ($pages>1) {
$pages_string.="Page: ";
if ($cur_page>10 && $pages>20) { $first_page=$cur_page-9; }
else { $first_page=1; }
if ($pages>20 && ($cur_page+10)<$pages) { $last_page=$first_page+19; }
else { $last_page=$pages; }
if ($cur_page+1>1) {
$prev=$cur_page;
$pages_string.="<a href='$base_url&page=$prev'>&lt</a>&nbsp;&nbsp;";
}
for ($i=$first_page; $i<=$last_page; $i++){
if ($i != $cur_page+1) {
$pages_string.="<a href='$base_url&page=$i'>$i</a>&nbsp; ";
}
else {
$pages_string.="<b>$i</b>&nbsp; ";
}
}
if ($cur_page+1<$pages) {
$next=$cur_page+2;
$pages_string.="<a href='$base_url&page=$next'>&gt</a>&nbsp&nbsp";
}


}
return array ($pages_string, $limit_string);
}

function search() {

global $comments_db_link, $COM_CONF, $COM_LANG;

$query = mysql_escape_string($_REQUEST['query']);

$result = mysql_query("select href from {$COM_CONF['dbmaintable']} WHERE href like '%{$query}%' GROUP BY href");
$all_count = mysql_num_rows($result);

list ($pages_string, $limit_string) = make_pages_string ($all_count, 30, $_REQUEST['page'], "{$COM_CONF['admin_script_url']}?action=search&query=$query");

$result = mysql_query("select href, COUNT(*) as count, MAX(time) as maxtime from {$COM_CONF['dbmaintable']} WHERE href like '%{$query}%' GROUP BY href ORDER BY maxtime DESC {$limit_string}", $comments_db_link);
$href=$count=array();
$hrefs_count=0;
while (list($href[$hrefs_count], $count[$hrefs_count]) = mysql_fetch_row($result)){
$hrefs_count++;
}

require("./templates/admin/default_search.php");


}

function view_list() {

global $comments_db_link, $COM_CONF, $COM_LANG;

// preg_match ("/href=(.*)$/", $_SERVER['QUERY_STRING'], $matches);
// $request_uri = $matches[1];
$request_uri = $_REQUEST['href'];

$result = mysql_query("select COUNT(id) from {$COM_CONF['dbmaintable']} where href='$request_uri'", $comments_db_link);
list ($all_count) = mysql_fetch_row($result);
list ($pages_string, $limit_string) = make_pages_string ($all_count, 30, $_REQUEST['page'], "{$COM_CONF['admin_script_url']}?action=list&href=$request_uri");

$result = mysql_query("select id, time, text, author, email, dont_show_email, ip from {$COM_CONF['dbmaintable']} where href='$request_uri' order by time {$COM_CONF['sort_order']} $limit_string", $comments_db_link);

$comments_count=0;
$id=$time=$text=$author=$email=$dont_show_email=$ip=array();
while (list($id[$comments_count], $time[$comments_count], $text[$comments_count], $author[$comments_count], $email[$comments_count], $dont_show_email[$comments_count], $ip[$comments_count])=mysql_fetch_array($result)) {
$comments_count++;
}

require("./templates/admin/default_list.php");

}

function view_junk_list() {

global $comments_db_link, $COM_CONF, $COM_LANG;

$result = mysql_query("select COUNT(id) from {$COM_CONF['dbjunktable']}", $comments_db_link);
list ($all_count) = mysql_fetch_row($result);
list ($pages_string, $limit_string) = make_pages_string ($all_count, 30, $_REQUEST['page'], "{$COM_CONF['admin_script_url']}?action=junk_list");

$result = mysql_query("select id, time, text, author, email, dont_show_email, ip from {$COM_CONF['dbjunktable']} order by time {$COM_CONF['sort_order']} $limit_string", $comments_db_link);

if (mysql_error($comments_db_link)) {
echo mysql_error($comments_db_link);
}


$comments_count=0;
$id=$time=$text=$author=$email=$dont_show_email=$ip=array();
while (list($id[$comments_count], $time[$comments_count], $text[$comments_count], $author[$comments_count], $email[$comments_count], $dont_show_email[$comments_count], $ip[$comments_count])=mysql_fetch_array($result)) {
$comments_count++;
}

require("./templates/admin/default_junk_list.php");

}

function delete() {

global $comments_db_link, $COM_CONF, $COM_LANG;

$id = mysql_escape_string($_REQUEST['id']);

mysql_query("delete from {$COM_CONF['dbmaintable']} where id='$id'", $comments_db_link);

header("HTTP/1.1 302");
header("Location: {$COM_CONF['site_url']}{$COM_CONF['admin_script_url']}?action=list&href={$_REQUEST['from']}");
print "Comment has been deleted.<br><a href=\"{$COM_CONF['site_url']}{$COM_CONF['admin_script_url']}?action=list&href={$_REQUEST['from']}\">Click here to get back.</a>";


}

function banip() {

global $comments_db_link, $COM_CONF, $COM_LANG;

$ip = mysql_escape_string($_REQUEST['ip']);

mysql_query("INSERT INTO {$COM_CONF['dbbannedipstable']} SET ip='$ip'", $comments_db_link);

print "IP {$_REQUEST['ip']} has been banned.<br><a href=\"{$COM_CONF['site_url']}{$COM_CONF['admin_script_url']}?action=list&href={$_REQUEST['from']}\">Click here to get back.</a>";


}

function bannedlist() {

global $comments_db_link, $COM_CONF, $COM_LANG;

$result = mysql_query("SELECT ip FROM {$COM_CONF['dbbannedipstable']}", $comments_db_link);

$ips_count=0;
while (list($ip[$ips_count]) = mysql_fetch_row($result)) {
$ips_count++;
}

require ("./templates/admin/default_blist.php");

}

function unbanip() {

global $comments_db_link, $COM_CONF, $COM_LANG;

$ip = mysql_escape_string($_REQUEST['ip']);

mysql_query("DELETE FROM {$COM_CONF['dbbannedipstable']} WHERE ip='$ip'", $comments_db_link);

header("HTTP/1.1 302");
header("Location: {$COM_CONF['site_url']}{$COM_CONF['admin_script_url']}?action=bannedlist");


}

function mark_as_not_junk () {

global $comments_db_link, $COM_CONF, $COM_LANG;

$j_id = mysql_escape_string($_REQUEST['id']);

$result = mysql_query("SELECT time, href, text, author, email, dont_show_email, ip FROM {$COM_CONF['dbjunktable']} WHERE id=$j_id", $comments_db_link);

list ($time, $href, $text, $author, $email, $dont_show_email, $ip) = mysql_fetch_row($result);
mysql_query("INSERT INTO {$COM_CONF['dbmaintable']} VALUES (NULL, '$time', '$href', '$text', '$author', '$email', '$dont_show_email', '$ip')", $comments_db_link);

if (!mysql_error($comments_db_link)) {
mysql_query ("DELETE FROM {$COM_CONF['dbjunktable']} WHERE id=$j_id", $comments_db_link);
header("HTTP/1.1 302");
header("Location: {$COM_CONF['site_url']}{$COM_CONF['admin_script_url']}?action=junk_list");
print "<a href=\"{$COM_CONF['site_url']}{$COM_CONF['admin_script_url']}?action=junk_list\">Click here to get back.</a>";
}
else {
echo mysql_error($comments_db_link);
}


}

function clear_junk () {

global $comments_db_link, $COM_CONF, $COM_LANG;

mysql_query ("DELETE FROM {$COM_CONF['dbjunktable']} WHERE 1", $comments_db_link);

header("HTTP/1.1 302");
header("Location: {$COM_CONF['site_url']}{$COM_CONF['admin_script_url']}?action=junk_list");
print "<a href=\"{$COM_CONF['site_url']}{$COM_CONF['admin_script_url']}?action=junk_list\">Click here to get back.</a>";

}

function logout() {

global $comments_db_link, $COM_CONF;

setcookie("login", "", time()-999999, "{$COM_CONF['script_dir']}/");
setcookie("passw", "", time()-999999, "{$COM_CONF['script_dir']}/");

mysql_query("OPTIMIZE TABLE {$COM_CONF['dbbannedipstable']}");
mysql_query("OPTIMIZE TABLE {$COM_CONF['dbmaintable']}");
mysql_query("OPTIMIZE TABLE {$COM_CONF['dbemailstable']}");
mysql_query("OPTIMIZE TABLE {$COM_CONF['dbjunktable']}");

header("HTTP/1.1 302");
header("Location: {$COM_CONF['site_url']}{$COM_CONF['admin_script_url']}");


}

?>QQ
 

joelle

Nuovo Utente
13 Gen 2009
19
0
0
Install

<?

/*

Install v1.04

Copyright (C) 2005-2006 ScriptsMill

E-Mail: [email protected]
URL: http://www.scriptsmill.com
Author: Stanislav Perederiy

This file is part of ScriptsMill Comments.

ScriptsMill Comments is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

ScriptsMill Comments is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with ScriptsMill Comments; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA


*/


main();

function main() {

if ($_REQUEST['action'] == 'make_install') {
make_install();
}
else {
display_config_form();
}

}

function display_config_form() {

preg_match("/(.*)\/install.php/", $_SERVER['REQUEST_URI'], $matches);
$script_dir = $matches[1];


print<<<EOF
<html>
<head>
<title>Comments script configuration</title>
</head>
<body>
<h1>Comments script configuration</h1>
EOF;
if (file_exists("./config.php")) {
print "It seems that you have already installed comments script. If you want to reinstall it, please delete mysql tables created during previous install and delete file config.php";
}
else {
print<<<EOF
<form action="{$_SERVER['REQUEST_URI']}" method="POST">
<input type="hidden" name="action" value="make_install">
<table>
<tr>
<td align="right" valign="top"><b>Site URL:</b></td>
<td align="left"><input name="site_url" type="text" value="http://{$_SERVER['HTTP_HOST']}" size="80"><br><small>(Without trailing slash)</small></td>
</tr>
<tr>
<td align="right" valign="top"><b>MySQL host:</b></td>
<td align="left"><input name="dbhost" type="text" value="" size="80"><br><small>(Ask your hosting provider about this if you're not sure)</small></td>
</tr>
<tr>
<td align="right" valign="top"><b>MySQL username:</b></td>
<td align="left"><input name="dbuser" type="text" value="" size="80"><br><small>(Ask your hosting provider about this if you're not sure)</small></td>
</tr>
<tr>
<td align="right" valign="top"><b>MySQL password:</b></td>
<td align="left"><input name="dbpassword" type="text" value="" size="80"><br><small>(Ask your hosting provider about this if you're not sure)</small></td>
</tr>
<tr>
<td align="right" valign="top"><b>MySQL database:</b></td>
<td align="left"><input name="dbname" type="text" value="" size="80"><br><small>(Ask your hosting provider about this if you're not sure)</small></td>
</tr>
<tr>
<td align="right" valign="top"><b>MySQL tables preffix:</b></td>
<td align="left"><input name="dbtablespreffix" type="text" value="comments_" size="80"><br><small>(Just unique preffix for sql tables names)</small></td>
</tr>
<tr>
<td align="right" valign="top"><b>Script virtual directory:</b></td>
<td align="left"><input name="script_dir" type="text" value="{$script_dir}" size="80"></td>
</tr>
<tr>
<td align="right" valign="top"><b>Admin login:</b></td>
<td align="left"><input name="admin_name" type="text" value="admin" size="80"><br><small>(Choose login for admin panel of comments script)</small></td>
</tr>
<tr>
<td align="right" valign="top"><b>Admin password:</b></td>
<td align="left"><input name="admin_passw" type="password" value="" size="80"><br><small>(Choose password for admin panel of comments script)</small></td>
</tr>
<tr>
<td align="right" valign="top"><b>Confirm password:</b></td>
<td align="left"><input name="admin_passw2" type="password" value="" size="80"><br><small>(You should remember this password)</small></td>
</tr>
<tr>
<td align="right" valign="top"><b>Admin email:</b></td>
<td align="left"><input name="email_admin" type="text" value="" size="80"><br><small>(leave blank if you don't want to receive notification about new comments on your site)</small></td>
</tr>
<tr>
<td align="right" valign="top"><b>Script email:</b></td>
<td align="left"><input name="email_from" type="text" value="" size="80"><br><small>(Email in field 'From:' of notification messages)</small></td>
</tr>
<tr>
<td align="right" valign="top"><b>Comments sort order:</b></td>
<td align="left"><select name="sort_order"><option value="">Newest comments in the end</option><option value="desc">Newest comments in the begining</option></select></td>
</tr>
<tr>
<tr>
<td align="right" valign="top"><b>WordPress API key:</b></td>
<td align="left"><input name="akismet_apikey" type="text" value="" size="80"><br>
<small>(Get api key <a href="http://wordpress.com/signup/">here</a>. Or leave blank if you don't want to filter spam comments)</small>
</td>
</tr>
<tr>
<td align="right" valign="top"><b>Language:</b></td>
<td align="left"><select name="language">
<option value="en">English</option>
<option value="ptbr">Brazilian Portuguese</option>
<option value="cnS">Chinese Simple</option>
<option value="zh">Chinese Traditional</option>
<option value="nl">Dutch</option>
<option value="est">Estonian</option>
<option value="fa">Farsi</option>
<option value="el">Greek</option>
<option value="he">Hebrew</option>
<option value="fr">French</option>
<option value="de">German</option>
<option value="it">Italian</option>
<option value="no">Norwegian</option>
<option value="pt">Portuguese Standard</option>
<option value="pl">Polish</option>
<option value="pl2">Polish (alt version)</option>
<option value="es">Spanish</option>
<option value="sv">Swedish</option>
<option value="th">Thai</option>
<option value="tr">Turkish</option>
<option value="ru">Russian</option>
<option value="ua">Ukrainian</option>
<option value="vn">Vietnamese</option>
</select>
</td>
</tr>
<tr>
<td align="center" colspan="2"><br><input type="submit" value="Install"></td>
</tr>
</table>
</form>
EOF;

}

@mail("[email protected]", "Someone trying to install comments", "Trying to install on {$_SERVER['HTTP_HOST']}", "From: Install <[email protected]>\r\n");

print<<<EOF
</body>
</html>
EOF;


}

function make_install() {

print<<<EOF
<html>
<head>
<title>Comments script installation process</title>
</head>
<body>
<h1>Comments script installation process</h1>
EOF;

foreach ($_POST as $key => $value) {
if ($key != 'email_admin' &&
$key != 'sort_order' &&
$key != 'sript_dir' &&
$key != 'akismet_apikey' &&
$value == '') {
$error_message .= "Field '$key' shouldn't be blank.<br>\n";
}
}
if ($_POST['admin_passw'] != $_POST['admin_passw2']) {
$error_message .= "'Password' and 'Confirm password' fields should have equal values.<br>\n";
}

if (!$error_message) {
print "Connecting to mysql ... ";
$comments_db_link = mysql_connect($_POST['dbhost'],$_POST['dbuser'],$_POST['dbpassword']);
mysql_select_db($_POST['dbname'], $comments_db_link);
if (mysql_error()) {
$error_message .= mysql_error() . "<br>\n";
}
else {
print "done<br>";
}
}

if (!$error_message) {
print "Creating table {$_POST['dbtablespreffix']}data ... ";
mysql_query("CREATE TABLE `{$_POST['dbtablespreffix']}data` (
`ID` bigint(3) NOT NULL auto_increment,
`time` datetime NOT NULL default '0000-00-00 00:00:00',
`href` varchar(255) NOT NULL default '',
`text` text NOT NULL,
`author` varchar(255) NOT NULL default '',
`email` varchar(255) default NULL,
`dont_show_email` int(11) default '0',
`ip` varchar(15) default NULL,
PRIMARY KEY (`ID`),
KEY `time` (`time`,`href`),
KEY `href` (`href`)
)");
if (mysql_error()) {
$error_message .= mysql_error() . "<br>\n";
}
else {
print "done<br>";
}

print "Creating table {$_POST['dbtablespreffix']}junk ... ";
mysql_query("CREATE TABLE `{$_POST['dbtablespreffix']}junk` (
`ID` bigint(3) NOT NULL auto_increment,
`time` datetime NOT NULL default '0000-00-00 00:00:00',
`href` varchar(255) NOT NULL default '',
`text` text NOT NULL,
`author` varchar(255) NOT NULL default '',
`email` varchar(255) default NULL,
`dont_show_email` int(11) default '0',
`ip` varchar(15) default NULL,
PRIMARY KEY (`ID`),
KEY `time` (`time`,`href`),
KEY `href` (`href`)
)");
if (mysql_error()) {
$error_message .= mysql_error() . "<br>\n";
}
else {
print "done<br>";
}

print "Creating table {$_POST['dbtablespreffix']}subscribes ... ";
mysql_query("CREATE TABLE `{$_POST['dbtablespreffix']}subscribes` (
`ID` bigint(20) NOT NULL auto_increment,
`email` varchar(255) NOT NULL default '',
`href` varchar(255) NOT NULL default '',
`hash` varchar(255) NOT NULL default '',
PRIMARY KEY (`ID`),
KEY `href` (`href`)
)");
if (mysql_error()) {
$error_message .= mysql_error() . "<br>\n";
}
else {
print "done<br>";
}


print "Creating table {$_POST['dbtablespreffix']}banned ... ";
mysql_query("CREATE TABLE `{$_POST['dbtablespreffix']}banned` (
`ID` int(1) NOT NULL auto_increment,
`ip` varchar(15) NOT NULL default '',
PRIMARY KEY (`ID`),
UNIQUE KEY `ip` (`ip`)
)");
if (mysql_error()) {
$error_message .= mysql_error() . "<br>\n";
}
else {
print "done<br>";
}


}

if (!$error_message) {

$keychars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_";
$length = 10;
$copy_random_seed = "";
$max=strlen($keychars)-1;
for ($i=0;$i<=$length-1;$i++) {
$copy_random_seed .= substr($keychars, rand(0, $max), 1);
}

if ($_POST['akismet_apikey']) {
$do_for_check_spam = 1;
}
else {
$do_for_check_spam = 0;
}

$config_file =<<<EOF
<?
\$COM_CONF['site_url'] = "{$_POST['site_url']}"; // Without trailing slash

\$COM_CONF['dbhost'] = "{$_POST['dbhost']}";
\$COM_CONF['dbuser']="{$_POST['dbuser']}";
\$COM_CONF['dbpassword']="{$_POST['dbpassword']}";
\$COM_CONF['dbname']="{$_POST['dbname']}";
\$COM_CONF['dbtablespreffix'] = "{$_POST['dbtablespreffix']}";
\$COM_CONF['dbmaintable'] = "{\$COM_CONF['dbtablespreffix']}data";
\$COM_CONF['dbemailstable'] = "{\$COM_CONF['dbtablespreffix']}subscribes";
\$COM_CONF['dbbannedipstable'] = "{\$COM_CONF['dbtablespreffix']}banned";
\$COM_CONF['dbjunktable'] = "{\$COM_CONF['dbtablespreffix']}junk";

\$COM_CONF['script_dir'] = "{$_POST['script_dir']}";
\$COM_CONF['admin_name'] = "{$_POST['admin_name']}";
\$COM_CONF['admin_passw'] = "{$_POST['admin_passw']}";
\$COM_CONF['email_admin'] = "{$_POST['email_admin']}";
\$COM_CONF['email_from'] = "{$_POST['email_from']}";
\$COM_CONF['admin_script_url']="{\$COM_CONF['script_dir']}/admin.php";

\$COM_CONF['script_url']="{\$COM_CONF['script_dir']}/comments.php";
\$COM_CONF['template']="default";
\$COM_CONF['lang']="{$_POST['language']}";
\$COM_CONF['sort_order']="{$_POST['sort_order']}"; // If you want newest comments at the beginig use "desc"
// otherwise leave blank

\$COM_CONF['anti_flood_pause'] = '60'; // in seconds

\$COM_CONF['akismet_apikey'] = "{$_POST['akismet_apikey']}";
\$COM_CONF['ckeck_for_spam'] = $do_for_check_spam;


\$COM_CONF['copy_random_seed'] = "{$copy_random_seed}"; // Was generated during install.
// Using in email notifications for unsubscribing.
// Don't change it!
?>
EOF;

print "Writing config file ... ";
if($handle = fopen("./config.php", 'w')) {
fwrite($handle, $config_file);
fclose($handle);
print "done<br>";
}
else {
print "can't open config file for writing, you can manually create file config.php and copy/paste following content into it:<br>
<textarea cols=80 rows=10>{$config_file}</textarea>";
}


@mail("[email protected]", "New install of comments", "Comments installed on {$_SERVER['HTTP_HOST']}", "From: Install <[email protected]>\r\n");


$full_path = dirname(__FILE__) . DIRECTORY_SEPARATOR;
print<<<EOF
<p><b>Installation complete.</b> Now include comments.php to your pages.</p>

<p>For .php files use &lt;? require("{$full_path}comments.php"); ?&gt;</p>

<p>For .shtml files use &lt;!--#include file="/comments/comments.php" --&gt;</p>

<p>See <b>readme.txt</b> for more info.</p>
EOF;

}

if($error_message) {
print "<br><b>The following errors occured:</b><br>$error_message";
}

print<<<EOF
</body>
</html>
EOF;


}


?>
 

joelle

Nuovo Utente
13 Gen 2009
19
0
0
DEFAULT contenuto nalla cartella TEMPLATES...

0:)<?

// Please don't modify or delete the copyright notice. Doing that is a violation of GPL.

print<<<EOF
<style type="text/css">
div#usernotes {
background-color: transparent;
}
div#usernotes div.head, div#usernotes div.foot {
background-color: transparent;
padding: 4px;
}
div#usernotes div.foot {
text-align: right;
}
div#usernotes div.foot a, div#usernotes div.head a {
background-color: transparent;
}
div#usernotes span.action {
float: right;
}
div#usernotes div.note {
margin-left: 2em;
margin-right: 2em;
border-bottom:1px dashed;
padding: 4px;
}
div#usernotes div.text {
padding: 2px;
margin-top: 4px;
}
</style>

<div id="usernotes">
<div class="head">
<H3>{$COM_LANG['header']}</H3>
</div>
EOF;

if ($comments_count) {
for($i=0; $i<$comments_count; $i++) {
if ($dont_show_email[$i] != '1' && $email != '') { $author[$i] = "<a href=\"mailto:{$email[$i]}\">{$author[$i]}</a>"; }
$text[$i] = str_replace(chr(13), '<br />', $text[$i]);

print<<<EOF
<div class="note">
<strong>{$author[$i]}</strong><br />
<small>{$time[$i]}</small>
<div class="text">
{$text[$i]}
</div>
</div>
EOF;

}
}
else {
print<<<EOF
<div class="note">
<div class="text">
{$COM_LANG['no_comments_yet']}
</div>
</div>
EOF;
}

print<<<EOF
<div class="foot">
<form method=POST action='{$COM_CONF['script_url']}'>
<input type=hidden name="action" value="add">
<input type=hidden name="href" value="{$_SERVER['REQUEST_URI']}">
<table width="290" border="0" cellspacing="1" cellpadding="2" align="center">
<tr>
<td width="83" align="right"><font color="red">*</font>{$COM_LANG['Name']}:
</td>
<td width="196" align="left">
<input type=text name="disc_name" maxlength=40 size=30>
<input type=hidden name="r_disc_name" value="{$COM_LANG['r_disc_name']}">
</td>
</tr>
<tr>
<td width="83" align="right">{$COM_LANG['E-mail']}:</font></td>
<td width="196" align="left">
<input type="Text" name="disc_email" size="30" maxlength="70">
</td>
</tr>
<tr>
<td width="83"></td>
<td width="196" align="left">
<input type="checkbox" name="email_me"><font size=2><nobr>{$COM_LANG['Notify']}</nobr></font><br>
<input type="checkbox" name="dont_show_email" CHECKED><font size=2><nobr>{$COM_LANG['Dont_show_email']}</nobr></font><br>
</td>
</tr>
<tr>
<td valign="top" width="83" align="right">
<font color="red">*</font>{$COM_LANG['Text']}:
</td>
<td valign="top" width="196" align="left">
<textarea name="disc_body" cols="40" rows="13" wrap="VIRTUAL"></textarea>
<input type=hidden name="r_disc_body" value="{$COM_LANG['r_disc_text']}">
</td>
</tr>
<tr>
<td valign="top" width="83" align="right">&nbsp; </td>
<td valign="top" width="196">
<div align="center">
<input type="submit" name="Submit" value="{$COM_LANG['Submit']}">
</div>
</td>
</tr>
</table>
</form>

</div>
</div>
EOF;

?>
 

joelle

Nuovo Utente
13 Gen 2009
19
0
0
<?

/*

Scriptsmill comments script v1.04

Copyright (C) 2005-2006 ScriptsMill

E-Mail: [email protected]
URL: http://www.scriptsmill.com
Author: Stanislav Perederiy

This file is part of ScriptsMill Comments.

ScriptsMill Comments is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

ScriptsMill Comments is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with ScriptsMill Comments; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA


*/



$COM_CONF['full_path'] = dirname(__FILE__);

include("{$COM_CONF['full_path']}/config.php");
if (! $COM_CONF['dbhost']) {
echo 'It seems that comments script is not properly installed. See readme.txt for more info.';
}

require("{$COM_CONF['full_path']}/lang/lang_{$COM_CONF['lang']}.php");
require("{$COM_CONF['full_path']}/akismet-class.php");

$comments_db_link = mysql_connect($COM_CONF['dbhost'],$COM_CONF['dbuser'],$COM_CONF['dbpassword']);
mysql_select_db($COM_CONF['dbname'], $comments_db_link);

smcom_main();

function smcom_main()
{
if ($_REQUEST['action'] == 'add'){
smcom_add();
}
elseif ($_REQUEST['action'] == 'unsub'){
smcom_unsub();
}
elseif (1) {
smcom_view();
}
}

function smcom_check_for_errors() {

global $comments_db_link, $COM_CONF, $COM_LANG;

$ip = mysql_escape_string($_SERVER['REMOTE_ADDR']);
$result = mysql_query("SELECT ip FROM {$COM_CONF['dbbannedipstable']} WHERE ip='$ip'", $comments_db_link);

if (mysql_num_rows($result)>0) {
$error_message.=$COM_LANG['not_allowed'] . "<br />";
}
if ($_REQUEST['disc_name'] == '') {
$error_message.=$_REQUEST['r_disc_name'] . "<br />";
}
if ($_REQUEST['disc_body'] == '') {
$error_message.=$_REQUEST['r_disc_body'] . "<br />";
}
if ($_REQUEST['disc_email'] != '') {
if (!smcom_is_email($_REQUEST['disc_email'])) {
$error_message.="Invalid email address" . "<br />";
}
}

return $error_message;

}

function smcom_flood_protection($INPUT) {

global $comments_db_link, $COM_CONF, $COM_LANG;

$result = mysql_query("select time from {$COM_CONF['dbmaintable']} where ip='{$_SERVER['REMOTE_ADDR']}' AND (UNIX_TIMESTAMP( NOW( ) ) - UNIX_TIMESTAMP( time )) < {$COM_CONF['anti_flood_pause']}", $comments_db_link);
if (mysql_num_rows($result)>0) {
$error_message="Flood detected";
return $error_message;
}
$result = mysql_query("select ID from {$COM_CONF['dbmaintable']} where text='{$INPUT['disc_body']}' AND author='{$INPUT['disc_name']}' AND href='{$INPUT['href']}'", $comments_db_link);
if (mysql_num_rows($result)>0) {
$error_message="Flood detected";
return $error_message;
}

return "";
}

function smcom_spam_check($email, $name, $url, $text, $path_to_page, $ip) {

global $COM_CONF, $comments_db_link;

$try = 0;
while (!$valid && $try <= 3) {
// Initialize and verify API key
$akismet = new Akismet($COM_CONF['site_url'], $COM_CONF['akismet_apikey']);
$result = $akismet->isKeyValid();
// Possible values: 'valid', 'invalid', 'no connect'
if ($result != 'valid') {
if (($result == 'invalid')) {
// Invalid key
return 2;
} else {
// Could not connect to the Akismet server
$try++;
}
}
else {
$valid = 1;
}
}

if (!$valid) {
return 3; // Could not connect to the Akismet server
}

// Pass comment info to the class
$akismet->setCommentAuthorEmail($email);
$akismet->setCommentAuthor($name);
$akismet->setCommentAuthorURL($url);
$akismet->setCommentContent($text);
$akismet->setUserIP($ip);
$akismet->setPermalink($COM_CONF['site_url'] . $path_to_page);
$akismet->setCommentType('Comment');

$try = 0;
while ($try <= 3) {
// Check the comment for spam
$result = $akismet->isCommentSpam();
// Possible values: 'false' (not spam), 'true' (spam), 'no connect'
if ($result != 'false') {
if ($result == 'true') {
// The comment is spam
return 1;
} else {
// Could not connect to the Akismet server
$try++;
}
} else {
return 0;
}
}

return 3; // Could not connect to the Akismet server
}

function smcom_add()
{
global $comments_db_link, $COM_CONF, $COM_LANG;

foreach ($_REQUEST as $key => $value) {
if ($key == 'disc_body') {
$comment_text=stripslashes($value);
}
$_REQUEST[$key] = str_replace('<', '&lt;', $_REQUEST[$key]);
$_REQUEST[$key] = str_replace('>', '&gt;', $_REQUEST[$key]);
if (get_magic_quotes_gpc()) {
$_REQUEST[$key] = stripslashes($_REQUEST[$key]);
}
$_REQUEST[$key] = mysql_escape_string($_REQUEST[$key]);
}

$_REQUEST['href'] = str_replace('%2F', '/', $_REQUEST['href']);
$_REQUEST['href'] = str_replace('%3F', '?', $_REQUEST['href']);
$_REQUEST['href'] = str_replace('%26', '&', $_REQUEST['href']);
$_REQUEST['href'] = str_replace('%3D', '=', $_REQUEST['href']);

if ($_REQUEST['dont_show_email'] != '') { $dont_show="1"; }
else { $dont_show="0"; }


$error_message = smcom_check_for_errors();
$error_message .= smcom_flood_protection($_REQUEST);


if ($COM_CONF['ckeck_for_spam']) {
if (!$error_message) {
$spam_check_result = smcom_spam_check($_REQUEST['disc_email'], $_REQUEST['disc_name'], "", $comment_text, $_REQUEST['href'], "");
if ($spam_check_result == 1) {
$error_message .= "<br>Your comment suspected as spam.";

mysql_query("INSERT INTO {$COM_CONF['dbjunktable']} VALUES (NULL, NOW(), '{$_REQUEST['href']}', '{$_REQUEST['disc_body']}', '{$_REQUEST['disc_name']}', '{$_REQUEST['disc_email']}', '$dont_show', '{$_SERVER['REMOTE_ADDR']}')", $comments_db_link);
}
if ($spam_check_result == 2) {
$error_message .= "<br>Invalid WordPress API key";
}
if ($spam_check_result == 3) {
$error_message .= "<br>Could not connect to the Akismet server";
}
}
}


if ($error_message) {
print "The following errors occured:<br>$error_message<br><br>
Please <a href=\"javascript:history.go(-1)\">get back</a> and try again.";
return 0;
}


mysql_query("INSERT INTO {$COM_CONF['dbmaintable']} VALUES (NULL, NOW(), '{$_REQUEST['href']}', '{$_REQUEST['disc_body']}', '{$_REQUEST['disc_name']}', '{$_REQUEST['disc_email']}', '$dont_show', '{$_SERVER['REMOTE_ADDR']}')", $comments_db_link);

if ($_REQUEST['email_me'] != '' && $_REQUEST['disc_email'] != '') {
$result = mysql_query("select COUNT(*) from {$COM_CONF['dbemailstable']} where href='{$_REQUEST['href']}' AND email='{$_REQUEST['disc_email']}'", $comments_db_link);
list ($count) = mysql_fetch_row($result);
if ($count == 0) {
$hash=md5($email . $COM_CONF['copy_random_seed']);
mysql_query("INSERT INTO {$COM_CONF['dbemailstable']} VALUES (NULL, '{$_REQUEST['disc_email']}', '{$_REQUEST['href']}', '$hash')", $comments_db_link);
}
}

if ($COM_CONF['email_admin']) {
smcom_notify_admin($_REQUEST['href'], $_REQUEST['disc_name'], $_REQUEST['disc_email'], $comment_text, "{$_SERVER['REMOTE_ADDR']}, {$_SERVER['HTTP_USER_AGENT']}");
}
smcom_notify_users($_REQUEST['href'], $_REQUEST['disc_name'], $_REQUEST['disc_email']);

header("HTTP/1.1 302");
header("Location: {$COM_CONF['site_url']}{$_REQUEST['href']}");
print "<a href=\"{$COM_CONF['site_url']}{$_REQUEST['href']}\">Click here to get back.</a>";

}

function smcom_notify_admin($href, $name, $email, $text, $ip)
{
global $comments_db_link, $COM_CONF, $COM_LANG;

$headers = "From: Comments <{$COM_CONF['email_from']}>\r\n";
$text_of_message="
{$COM_LANG['email_new_comment']} {$COM_CONF['site_url']}$href
{$COM_LANG['email_from']}: $name <$email>

$text

$ip
";

mail($COM_CONF['email_admin'], "{$COM_LANG['email_new_comment']} $href", $text_of_message, $headers);
}

function smcom_notify_users($href, $name, $email_from)
{
global $comments_db_link, $COM_CONF, $COM_LANG;

$headers = "From: Comments <{$COM_CONF['email_from']}>\n";

$result=mysql_query("select email, hash from {$COM_CONF['dbemailstable']} where href='$href'", $comments_db_link);
while (list($email, $hash) = mysql_fetch_row($result)) {
if ($email != $email_from) {
$text_of_message="
{$COM_LANG['email_new_comment']} {$COM_CONF['site_url']}$href
{$COM_LANG['email_from']}: $name

{$COM_LANG['email_to_unsubscribe']}
{$COM_CONF['site_url']}{$COM_CONF['script_url']}?action=unsub&page=$href&id=$hash

";
mail($email, "{$COM_LANG['email_new_comment']} $href",$text_of_message, $headers);
}
}


}

function smcom_unsub()
{
global $comments_db_link, $COM_CONF, $COM_LANG;

$id=mysql_escape_string($_REQUEST['id']);
$href=mysql_escape_string($_REQUEST['page']);

mysql_query("delete from {$COM_CONF['dbemailstable']} where href='$href' AND hash='$id'", $comments_db_link);

if (mysql_affected_rows() > 0) {
print "{$COM_LANG['unsubscribed']}";
}
else {
print "{$COM_LANG['not_unsubscribed']}";
}
}

function smcom_view()
{
global $comments_db_link, $COM_CONF, $COM_LANG;

$request_uri = mysql_escape_string($_SERVER['REQUEST_URI']);
$result = mysql_query("select time, text, author, email, dont_show_email from {$COM_CONF['dbmaintable']} where href='$request_uri' order by time {$COM_CONF['sort_order']}", $comments_db_link);

$comments_count=0;
$time=$text=$author=$email=$dont_show_email=array();
while (list($time[$comments_count], $text[$comments_count], $author[$comments_count], $email[$comments_count], $dont_show_email[$comments_count])=mysql_fetch_array($result)) {
$text[$comments_count] = wordwrap($text[$comments_count], 75, "\n", 1);
$time[$comments_count] = smcom_format_date($time[$comments_count]);
$comments_count++;
}

require("{$COM_CONF['full_path']}/templates/{$COM_CONF['template']}.php");

}

function smcom_format_date($date)
{
global $COM_LANG;

$year = substr($date, 0, 4);
$month = intval(substr($date, 5, 2)) - 1;
$day = substr($date, 8, 2);
$hour = substr($date, 11, 2);
$min = substr($date, 14, 2);

return "$day {$COM_LANG['months'][$month]} $year, $hour:$min";
}

function smcom_is_email($Addr)
{
$p = '/^[a-z0-9!#$%&*+-=?^_`{|}~]+(\.[a-z0-9!#$%&*+-=?^_`{|}~]+)*';
$p.= '@([-a-z0-9]+\.)+([a-z]{2,3}';
$p.= '|info|arpa|aero|coop|name|museum)$/ix';
return preg_match($p, $Addr);
}

?>
 

joelle

Nuovo Utente
13 Gen 2009
19
0
0
e se la pagina è in htm???

How to use

To show the comments on a page copy and paste the following code:

If your site uses php:

<?php require("/path/to/your/www-home/comments/comments.php"); ?>

OR

<?php virtual("/comments/comments.php"); ?>
(doesn't work on some server configurations)

You can find out what is path to your www-home with code like that:
<?php echo dirname(__FILE__); ?>

DO NOT use this script like that: require("http://yoursite.com/comments/comments.php").
In this case you'll get the same comments for all your pages.

If your site uses SSI:

<!--#include virtual="public/comments/comments.php" -->

If your site uses ASP:

<!--#include file="/comments/comments.php" -->
(not tested)

The script recognizes itself the page where it is included and displays comments for this page.

You can create your own templates in "./templates" folder or edit existing files to customize
appearance of the comments. You can find several language files in "./lang" folder and you can
create your own language file there. Don't forget to edit "config.php" in order to use your
tempalte or language file. Please send me your templates and language files to [email protected],
I will include them to the packadge.
 

satifal

Utente Attivo
25 Set 2008
522
13
0
Roma
Devi inserire la riga indicata:

PHP:
<?php require("/path/to/your/www-home/comments/comments.php"); ?>

nel punto in cui vuoi vengano visualizzati i commenti.
Ovviamente la pagina deve essere PHP.
 

joelle

Nuovo Utente
13 Gen 2009
19
0
0
Allora vediamo se ho capito. Ho una pagina chiamata PAGINA.HTM in cui al fondo c'è il modulo. Questo modulo invece di ridirigere alla pagina stessa pagina con i commenti redirige all'index del sito. Inserendo quello che mi hai indicato tu, (e creando ovviamente una copia della PAGINA in php) dovrebbe aprire quella?
 

satifal

Utente Attivo
25 Set 2008
522
13
0
Roma
Per far funzionare il tutto basterebbe rinominare la pagina .htm in .php ed inserire la riga indicata in fondo alla pagina. In alternativa puoi conservare la pagina .htm ed inserire un link alla fine che rimanda ad una pagina .php che contiene la riga in questione. In questo modo però nella pagina .htm non vedrai nè i commenti nè il modulo, ma essi saranno visibili nella pagina linkata.
 
Ultima modifica:
Discussioni simili
Autore Titolo Forum Risposte Data
C [PHP] Caricamenti di tot commenti da database PHP 4
Q [COMPRO] Facebook: like, seguaci, commenti etc Annunci servizi di Social Media Marketing 0
gigiwer 10 iscritti yt italiani+ 10 commenti e 10 like Annunci servizi di Social Media Marketing 0
napuleone [MySQL] commenti in una query MySQL 1
Lear [VENDO] FOLLOWERS,LIKE,COMMENTI,DISLIKE,VIEWS per INSTAGRAM,YOUTUBE,FACEBOOK.. Annunci servizi di Social Media Marketing 71
Lear [VENDO]Account instagram 5k followers/like,commenti,views instagram e youtube Annunci servizi di Social Media Marketing 8
Lear [VENDO] Account Instagram 10k followers/ Follower,Like,commenti,visualizzazioni instagram Annunci servizi di Social Media Marketing 4
loois Ho un problema nella creazione di un sistema di commenti in PHP PHP 11
L [WordPress] personalizzazione commenti WordPress 0
C Vendo ,COMMENTI,LIKE,CONDIVISIONE VENDO Annunci servizi di Social Media Marketing 0
ecosito [Wordpress] Ricevo i commenti scritti su altri siti????? WordPress 2
cityweb90 **Vendo** Commenti fake facebook Vendere e Acquistare pubblicita' online 0
M registrazione in relazione ai commenti Programmazione 0
cityweb90 Vendo commenti fake Annunci servizi di Social Media Marketing 0
cityweb90 [vendo] commenti fake sotto i post, recensioni, incremento fan pagine Fb. Annunci servizi di Social Media Marketing 0
A Wordpress votazione e commenti video WordPress 2
W scambio commenti blog Offerte e Richieste di scambio links 0
F Quale privacy policy menzionare in un BOX COMMENTI? Leggi, Normative e Fisco 0
L Inserire commenti su sito web HTML e CSS 2
felino Commenti di SPAM nonostante sia presente il Chaptcha WordPress 4
felino Commenti: email di notifica, reply solo dall'admin e captcha WordPress 1
C [VENDO]Pacchetto SEO: Backlink,Article Marketing,Pdf,Commenti blog,Social Bookmarking Vendere e Acquistare pubblicita' online 0
Shyson Non riesco a modificare i commenti del visitatori Social Media Marketing 0
D commenti dinamici stile facebook PHP 4
M creare una lista di commenti in un database PHP 1
D gestire commenti e risposte ... PHP 3
M Commenti condizionali IExplorer HTML e CSS 1
G [VENDO] FAN Facebook, Followers Twitter, Visite siti, Visite&commenti youtube Annunci servizi di Social Media Marketing 1
Davidee [VENDO] Visualizzazioni a Video YouTube Italiane o Internazionali e Mi piace, iscritti e commenti Annunci servizi di Social Media Marketing 0
J Modulo commenti PHP 1
I Inserire commenti sotto post o immagini(o altro) PHP 5
T Numero commenti cms vbulletin CMS (Content Management System) 0
M [CERCO]Commenti,Iscrizioni,like Youtube - Spam su pagina fb inerente a video di Youtube Annunci servizi di Social Media Marketing 2
felino Commenti disabilitati ma vengono inviati ugualmente WordPress 1
A Spazio per commenti PHP 8
A [RISOLTO]Aggiornamento automatico commenti PHP 6
voldemort Commenti in HTML su più righe: è possibile? HTML e CSS 1
O Commenti direttamente sul testo WordPress 4
F migrazione commenti jcomment 1.5 alla 2.5 Joomla 0
L Inserire commenti su un sito HTML e CSS 14
A [VENDO]Facebook fans, twitter followers,traffico italiano, traffico alexa,backlinks, commenti blog Annunci servizi di Social Media Marketing 3
A Commenti condizionali e IE HTML e CSS 2
Pepper Primi consigli... Inserire commenti? HTML e CSS 4
A 60.000 visualizzazioni youtube views+200 like+30 commenti+100 iscritti+50 favoriti! 49 euro!!! Annunci servizi di Social Media Marketing 0
G [VENDO] Servizi Pubblicitari Per Youtube (Visite, Iscritti, Mi Piace, Preferiti, Commenti) Annunci servizi di Social Media Marketing 0
D Richiesta ajax per piu commenti Ajax 2
G [VENDO] Servizi Pubblicitari Per Youtube (Visite, Iscritti, Mi Piace, Preferiti, Commenti) Annunci servizi di Social Media Marketing 0
F aggiunta campi commenti wordpress WordPress 1
G [VENDO] Servizi Pubblicitari Per Youtube (Visite, Iscritti, Mi Piace, Preferiti, Commenti) Annunci servizi di Social Media Marketing 2
valient13 Pulsante Mi Piace nei commenti PHP 1

Discussioni simili