xoops forums

ipwgc

Quite a regular
Posted on: 2011/12/2 8:13
ipwgc
ipwgc (Show more)
Quite a regular
Posts: 216
Since: 2005/8/13
#1

Please help me with MyGuestbook


Please help me,
I installed the module MyGuestbook (Narga) Version 1.5
https://xoops.org/modules/repository/singlefile.php?cid=35&lid=1407

1. I translate the module in Spanish
2. I cannot delete and install other, because people already posted info.
3. The particular module I prepare for people make a prayer covenant

Now, my problems is the spam injection people,
I need delete manually, and I need stop this now.
The protect module stop a lot spammer and helps a lot.
but the spammer continue on the myguestbook module

I make the bellow changes, in the robot.txt

Disallow: /modules/myguestbook/
Disallow: /modules/myguestbook/sign.php

I belive that I need a capchat on the sing.php page.

You are welcome with any Idea to fixe my problem.

see the module working here
http://www.iglesiainternacional.cl/ch ... les/myguestbook/index.php

Regard
David

Roby73

Friend of XOOPS
Posted on: 2011/12/2 16:18
Roby73
Roby73 (Show more)
Friend of XOOPS
Posts: 262
Since: 2011/6/15
#2

Re: Please help me with MyGuestbook

That xoops version you use?
Would be possible add captcha/recaptcha code.

ipwgc

Quite a regular
Posted on: 2011/12/2 16:35
ipwgc
ipwgc (Show more)
Quite a regular
Posts: 216
Since: 2005/8/13
#3

Re: Please help me with MyGuestbook

Hi Roby73,
I used the xoops 2.5.3

to add captcha/recaptcha code
how I add?
Thank for help
David

Roby73

Friend of XOOPS
Posted on: 2011/12/2 17:21
Roby73
Roby73 (Show more)
Friend of XOOPS
Posts: 262
Since: 2011/6/15
#4

Re: Please help me with MyGuestbook

I can try add it, tonight install in local the module to test.

ipwgc

Quite a regular
Posted on: 2011/12/2 18:01
ipwgc
ipwgc (Show more)
Quite a regular
Posts: 216
Since: 2005/8/13
#5

Re: Please help me with MyGuestbook

Thank you, together we will solve this problem,
otrer can used too,
David

Roby73

Friend of XOOPS
Posted on: 2011/12/2 22:19
Roby73
Roby73 (Show more)
Friend of XOOPS
Posts: 262
Since: 2011/6/15
#6

Re: Please help me with MyGuestbook

The module is very old, have much deprecated functions.

This is a simple code to add captcha code.

Replace sign.php file with:
<?php

###############################################################################

#                  Narga's Guestbook v.1.0 for Xoops 2.x                      #

#             Writen by  Nguyen Dinh Quan (webmaster@narga.tk)                #

#      :: Narga Vault :-: The Land Of Dreams ::(http://www.narga.tk)          #

#   ------------------------------------------------------------------------- #

#       A produce of [:: Narga Laboratory ::] (http://www.nargalab.info)      #

#   ------------------------------------------------------------------------- #

#   This program 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 of the License, or         #

#   (at your option) any later version.                                       #

#                                                                             #

#   This program 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 this program; if not, write to the Free Software               #

#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA  #

#   ------------------------------------------------------------------------  #

###############################################################################

// $Id: sign.php,v 1.2.1 Date: 8/30/2004 10:37 PM, Author: Nguyen Dinh Quan Exp $

include_once "header.php";

if ( empty(
$_POST['submit']) ) {

    
$xoopsOption['template_main'] = 'myguestbook_sign.html';

    include 
XOOPS_ROOT_PATH."/header.php";

    include_once 
XOOPS_ROOT_PATH."/class/xoopsformloader.php";

//Get the user database

    
$company_v "";

    
$name_v = !empty($xoopsUser) ? $xoopsUser->getVar("uname""E") : "";

    
$email_v = !empty($xoopsUser) ? $xoopsUser->getVar("email""E") : "";

    
$url_v = !empty($xoopsUser) ? $xoopsUser->getVar("url""E") : "";

    
$icq_v = !empty($xoopsUser) ? $xoopsUser->getVar("user_icq""E") : "";

    
$msn_v = !empty($xoopsUser) ? $xoopsUser->getVar("user_msnm""E") : "";

    
$aim_v = !empty($xoopsUser) ? $xoopsUser->getVar("user_aim""E") : "";

    
$yim_v = !empty($xoopsUser) ? $xoopsUser->getVar("user_yim""E") : "";

    
$location_v = !empty($xoopsUser) ? $xoopsUser->getVar("user_from""E") : "";

    
$message_v "";

    
$title_v "";

    
//Make form type

    
$name_text = new XoopsFormText(_NAR_NAME"usersName"50100$name_v);

    
$email_text = new XoopsFormText(_NAR_EMAIL"usersEmail"50100$email_v);

    
$gender_select = new XoopsFormSelect(_NAR_SELGEN"userGender",3);

    
$gender_select->addOptionArray(array("3"=>_NAR_SELGEN,"0"=>_NAR_MALE,"1"=>_NAR_FEMALE,"2"=>_NAR_OTHER));

    
$url_text = new XoopsFormText(_NAR_URL"usersSite"50100$url_v);

    
$icq_text = new XoopsFormText(_NAR_ICQ"usersICQ"50100$icq_v);

    
$msn_text = new XoopsFormText(_NAR_MSN"usersMSN"50100$msn_v);

    
$aim_text = new XoopsFormText(_NAR_AIM"usersAIM"50100$aim_v);

    
$yim_text = new XoopsFormText(_NAR_YIM"usersYIM"50100$yim_v);

    
$company_text = new XoopsFormText(_NAR_COMPANY"usersCompanyName"50100$company_v);

    
$location_text = new XoopsFormText(_NAR_LOCATION"usersCompanyLocation"50100$location_v);

    
$title_text = new XoopsFormText(_NAR_TITLE"usersTitle"50100$title_v);

    
$message_textarea = new XoopsFormDhtmlTextArea(_NAR_MESSAGE"usersMessage"$message_v);

    
$submit_button = new XoopsFormButton("""submit"_NAR_SEND"submit");

    
$myguestbook_form = new XoopsThemeForm(_NAR_SIGNGUESTBOOK"myguestbookform""sign.php");

//Fill data to form text

    
$myguestbook_form->addElement($name_texttrue);

    
$myguestbook_form->addElement($gender_select,3);

    
$myguestbook_form->addElement($email_texttrue);

    
$myguestbook_form->addElement($url_text);

    
$myguestbook_form->addElement($icq_text);

    
$myguestbook_form->addElement($msn_text);

    
$myguestbook_form->addElement($aim_text);

    
$myguestbook_form->addElement($yim_text);

    
$myguestbook_form->addElement($company_text);

    
$myguestbook_form->addElement($location_text);

    
$myguestbook_form->addElement($title_text);

    
$myguestbook_form->addElement($message_textareatrue);
    
$myguestbook_form->addElement(new XoopsFormCaptcha(), true);

    
$myguestbook_form->addElement($submit_button);

    
$myguestbook_form->assign($xoopsTpl);

    
//Assign data to smarty tpl

    
$xoopsTpl->assign('lang_index'_NAR_BACKGUESTBOOK);

    
$xoopsTpl->assign('lang_info'_NAR_DESC);

    
$xoopsTpl->assign('lang_copyright'_NAR_COPYRIGHT);

    
$xoopsTpl->assign('lang_writing'_NAR_SIGNGUESTBOOK);

    
$xoopsTpl->assign('lang_gender'_NAR_GENDER);

    
$xoopsTpl->assign('lang_title'_NAR_TITLE);

    
$xoopsTpl->assign('lang_cancel'_CANCEL);

    
$xoopsTpl->assign('lang_nameenter'_NAR_NAMEENTER);

    
$xoopsTpl->assign('lang_msenter'_NAR_MSENTER);

    include 
XOOPS_ROOT_PATH."/footer.php";

} else {
    
extract($_POST);

    
extract($_POST);    

    
$myts =& MyTextSanitizer::getInstance();

    
$name_text $myts->stripSlashesGPC($usersName);

    
$title_text $myts->stripSlashesGPC($usersTitle);

    
$message_textarea $myts->stripSlashesGPC($usersMessage);

    
$date=time();

    
$email $myts->stripSlashesGPC($usersEmail);

    
$url_text $myts->stripSlashesGPC($usersSite);

    
$ip=$GLOBALS['REMOTE_ADDR'];

    
$gender_select $myts->stripSlashesGPC($userGender);

    
$icq_text $myts->stripSlashesGPC($usersICQ);

    
$aim_text $myts->stripSlashesGPC($usersAIM);

    
$yim_text $myts->stripSlashesGPC($usersYIM);

    
$msn_text $myts->stripSlashesGPC($usersMSN);

    
$location_text $myts->stripSlashesGPC($usersCompanyLocation);

    
$company_text $myts->stripSlashesGPC($usersCompanyName);
    
xoops_load('XoopsCaptcha');

        
$xoopsCaptcha XoopsCaptcha::getInstance();

       if (!
$xoopsCaptcha->verify()) {

    
redirect_header('sign.php'3$xoopsCaptcha->getMessage());    
    exit;
    }

//Insert info to database

    
$sqlinsert="INSERT INTO ".$xoopsDB->prefix("myguestbook")." (name,title,message,time,email,url,ip,gender,icq,yim,aim,msn,location,company) VALUES ('".$name_text."','".$title_text."','".$message_textarea."','".$date."','".$email."','".$url_text."','".$ip."','".$gender_select."','".$icq_text."','".$yim_text."','".$aim_text."','".$msn_text."','".$location_text."','".$company_text."')";

    if ( 
$xoopsModuleConfig['sendmail'] == 

    {

    
$subject $xoopsConfig['sitename']." - "._NAR_NEWMESSAGE;

    
$xoopsMailer =& xoops_getMailer();

    
$xoopsMailer->useMail();

    
$xoopsMailer->setToEmails($xoopsConfig['adminmail']);

    
$xoopsMailer->setFromEmail($email);

    
$xoopsMailer->setFromName($xoopsConfig['sitename']);

    
$xoopsMailer->setSubject($subject"-"$conf_subject);

    
$xoopsMailer->setBody($message_textarea);

    
$xoopsMailer->send();

    }

    if ( !
$result $xoopsDB->query($sqlinsert) ) 

            {

                echo 
_NAR_ERRORINSERT;

            }

                    
redirect_header("index.php",2,_NAR_RECEIVED);

    exit();

}

include_once 
XOOPS_ROOT_PATH.'/footer.php';

?>

ipwgc

Quite a regular
Posted on: 2011/12/3 5:30
ipwgc
ipwgc (Show more)
Quite a regular
Posts: 216
Since: 2005/8/13
#7

Re: Please help me with MyGuestbook

Hi Roby73
It working, it working
yes, you dit it.
Is true the module is very old, and have much deprecated functions,
Question: How I solve the deprecated problems?

I add in the index.php the facebook icon, and the twiter icon and it working see it here TO SEE THE WORKING MODULE CLICK HERE

1. The only problem I gave, is the field of the facebook or ICQ field is to small,
I need a big field in the sql database.

2. it is necessary to fix the IP icon, so identifies the IP as text.
you can help to do that?

NEAR LINE 138
Quote:
if ($array_total_entry[$i]['icq'] !=""){
$entry[$i]['icq'] = "<a href='http://www.facebook.com/".$array_total_entry[$i]['icq']."'><img src='./images/icq.gif' alt='"._NAR_ICQ."' /></a>";
}

if ($array_total_entry[$i]['yim'] !=""){
$entry[$i]['yim'] = "<a href=http://edit.yahoo.com/config/send_webmesg?.target=".$array_total_entry[$i]['yim']."&.src=pg><img src='./images/yim.gif' alt='"._NAR_YIM."' /></a>";
}
if ($array_total_entry[$i]['aim'] !=""){
$entry[$i]['aim'] = "<a href=http://twitter.com/#!/".$array_total_entry[$i]['aim']."><img src='./images/aim.gif' alt='"._NAR_AIM."' /></a>";
}
if ($array_total_entry[$i]['msn'] !=""){
$entry[$i]['msn'] = "<a href=http://members.msn.com/?mem=".$array_total_entry[$i]['msn']."><img src='./images/msn.gif' alt='"._NAR_MSN."' /></a>";
}
if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid())) {
$entry[$i]['admin_option'] = "<p align='right'><img src='images/ip.gif' alt='".$array_total_entry[$i]["ip"]."'><a href='admin/index.php?op=editEntry&id=".$array_total_entry[$i]["id"]."'>&nbsp;<img src='images/edit.gif' alt='"._NAR_EDIT."' border='0' /></a><a href='admin/index.php?op=delEntry&id=".$array_total_entry[$i]["id"]."'>&nbsp;<img src='images/del.gif' alt='"._NAR_DELETEPOST."' border='0' /></a></p>";
}


Roby73

Friend of XOOPS
Posted on: 2011/12/4 1:14
Roby73
Roby73 (Show more)
Friend of XOOPS
Posts: 262
Since: 2011/6/15
#8

Re: Please help me with MyGuestbook

Hi, to upgrade the module removing the deprecated functions,watching the code, is easy.

You have modified field icq to facebook, default characters to field icq are 15.
You must modify this value in your database.

In my local copy, number ip don't saved in database.
I modify the file sign.php line 95:

$ip=$GLOBALS['REMOTE_ADDR'];


to

$ip=$_SERVER['REMOTE_ADDR'];


and to display ip in icon server you must modify "alt" to "title" in tag img...

change your code at line 151 (index.php) with:

if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid())) {

        
$entry[$i]['admin_option']  = "<p align='right'><img src='images/ip.gif' title='".$array_total_entry[$i]["ip"]."' /><a href='admin/index.php?op=editEntry&id=".$array_total_entry[$i]["id"]."'>&nbsp;<img src='images/edit.gif' alt='"._NAR_EDIT."' border='0' /></a><a href='admin/index.php?op=delEntry&id=".$array_total_entry[$i]["id"]."'>&nbsp;<img src='images/del.gif' alt='"._NAR_DELETEPOST."' border='0' /></a></p>";

    }


if you want view directly the number ip without icon server, change with:

if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid())) {

        
$entry[$i]['admin_option']  = "<p align='right'>".$array_total_entry[$i]["ip"]."<a href='admin/index.php?op=editEntry&id=".$array_total_entry[$i]["id"]."'>&nbsp;<img src='images/edit.gif' alt='"._NAR_EDIT."' border='0' /></a><a href='admin/index.php?op=delEntry&id=".$array_total_entry[$i]["id"]."'>&nbsp;<img src='images/del.gif' alt='"._NAR_DELETEPOST."' border='0' /></a></p>";

    }

Roby73

Friend of XOOPS
Posted on: 2011/12/4 1:23
Roby73
Roby73 (Show more)
Friend of XOOPS
Posts: 262
Since: 2011/6/15
#9

Re: Please help me with MyGuestbook

I removed some deprecated functions.
Please test it in local http://metalslug.altervista.org/myguestbook.zip

ipwgc

Quite a regular
Posted on: 2011/12/5 22:51
ipwgc
ipwgc (Show more)
Quite a regular
Posts: 216
Since: 2005/8/13
#10

Re: Please help me with MyGuestbook

HI, rody
This is what I doing on this last version,
I desire to continue update this module and go up to the version 2.0
well, in order to go up to other version I make this changes,
1. I add the facebook field
2. I add the twitter field
3. I add a block
4. I add a user menu
5. I change the French logo, for a view English logo viewguestbook.gif
6. I add a sing logo singguestbook.gif
7. I add facebook images icon
8. I add twitter images icon
10. I change the gender_female.gif
11. I change the gender_male.gif
12. I change the email.gif
13. I translate from English to Spanish

If you want to check and test download from here
DOWNLOAD HERE