Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - batu544

Pages: [1] 2 3 4
1
Discussion & Troubleshooting / PHP 5.3 issue
« on: May 11, 2012, 11:26:55 PM »
Hi,

Recently I moved into a server where PHP 5.3 is available.. and  I am getting following error message.  .

Could anyone please suggest me how can I fix it.. ?

Error:
Code: [Select]
Warning: strpos() expects parameter 1 to be string, array given in /home/batu544/public_html/includes/sessions.php on line 234

Code on 234 line :

Code: [Select]
if ($ref_url==false) return false;
$ref_domain = str_replace("www.", "", $ref_url['host']);
if ($ref_domain=='') $ref_domain = $ref_url ;
if (strpos($ref_domain, $domain_name)===false)
{
$sql = "SELECT * FROM ".FRIENDS_TABLE." WHERE `url` REGEXP 'http(s)*://(([^/\.])*(/|\.){0,1}){0,1}$ref_domain(/){0,1}.*' ";
$result = $site_db->query($sql);

234 line ==> if (strpos($ref_domain, $domain_name)===false)


Any help will be appreciated.. :)

2
Chit Chat / Anti-Spam page like 4images forum.
« on: March 19, 2011, 04:24:56 AM »
Hi V@no..
                 If you have some free time.. could you please let me know how to implement the antispam page like this forum on my website ?

Thank you
batu544

3
Programming / Script for Unrar one file in server
« on: February 25, 2011, 05:53:02 PM »
HI,
        I am trying to unrar one file which is located in my server. I don't have access to SSH. so I think a php script is another way.. Could anyone please help me to get this script or any other possible way to unrar the file in server ?

Thank you
batu544

4
Discussion & Troubleshooting / New Captcha system integration - Help.
« on: February 19, 2011, 12:14:07 PM »
Hi,
     I would like to integrate a new captcha script with 4image. This new captcha uses session.. so I am not able to integrate it with 4image..

I guess, the changes will not be much..  Could anyone please let me know what changes should I make to integrate it..

I am attaching the new captcha file and one working form.php  ..  I need to integrate it in my contact.php page..


1. CaptchaSecurityImages.php   file..
Code: [Select]
<?php
session_start
();

/*
* File: CaptchaSecurityImages.php
* Author: Simon Jarvis
* Copyright: 2006 Simon Jarvis
* Date: 03/08/06
* Updated: 07/02/07
* Requirements: PHP 4/5 with GD and FreeType libraries
* Link: http://www.white-hat-web-design.co.uk/articles/php-captcha.php

* 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: 
* http://www.gnu.org/licenses/gpl.html
*
*/

class CaptchaSecurityImages {

var $font 'monofont.ttf';

function generateCode($characters) {
/* list all possible characters, similar looking characters and vowels have been removed */
$possible '23456789bcdfghjkmnpqrstvwxyz';
$code '';
$i 0;
while ($i $characters) { 
$code .= substr($possiblemt_rand(0strlen($possible)-1), 1);
$i++;
}
return $code;
}

function CaptchaSecurityImages($width='120',$height='40',$characters='6') {
$code $this->generateCode($characters);
/* font size will be 75% of the image height */
$font_size $height 0.75;
$image = @imagecreate($width$height) or die('Cannot initialize new GD image stream');
/* set the colours */
$background_color imagecolorallocate($image255255255);
$text_color imagecolorallocate($imagerand(140,180), rand(140,180), rand(140,180));
$noise_color imagecolorallocate($image180180180);
/* generate random dots in background */
for( $i=0$i<($width*$height)/3$i++ ) {
imagefilledellipse($imagemt_rand(0,$width), mt_rand(0,$height), 11$noise_color);
}
/* generate random lines in background */
for( $i=0$i<($width*$height)/150$i++ ) {
imageline($imagemt_rand(0,$width), mt_rand(0,$height), mt_rand(0,$width), mt_rand(0,$height), $noise_color);
}
/* create textbox and add text */
$textbox imagettfbbox($font_size0$this->font$code) or die('Error in imagettfbbox function');
$x = ($width $textbox[4])/2;
$y = ($height $textbox[5])/2;
imagettftext($image$font_size0$x$y$text_color$this->font $code) or die('Error in imagettftext function');
/* output captcha image to browser */
header('Content-Type: image/jpeg');
imagejpeg($image);
imagedestroy($image);
$_SESSION['security_code'] = $code;
}

}

$width 160;//isset($_GET['width']) ? $_GET['width'] : '160';
$height 40;//isset($_GET['height']) ? $_GET['height'] : '40';
$characters 5;//isset($_GET['characters']) && $_GET['characters'] > 1 ? $_GET['characters'] : '6';

$captcha = new CaptchaSecurityImages($width,$height,$characters);

?>



2. Form.php ( works fine with this above script)
Code: [Select]
<?php 
session_start
();

if( isset(
$_POST['submit'])) {
   if( 
$_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) ) {
// Insert you code for processing the form here, e.g emailing the submission, entering it into a database. 
echo 'Thank you. Your message said "'.$_POST['message'].'"';
unset($_SESSION['security_code']);
   } else {
// Insert your code for showing an error message here
echo 'Sorry, you have provided an invalid security code';
   }
} else {
?>


<form action="form.php" method="post">
<label for="name">Name: </label><input type="text" name="name" id="name" /><br />
<label for="email">Email: </label><input type="text" name="email" id="email" /><br />
<label for="message">Message: </label><textarea rows="5" cols="30" name="message" id="message"></textarea><br />
<img src="CaptchaSecurityImages.php?width=100&height=40&characters=5" /><br />
<label for="security_code">Security Code: </label><input id="security_code" name="security_code" type="text" /><br />
<input type="submit" name="submit" value="Submit" />
</form>

<?php
}
?>



3. My contact.php file which needs to be modified to integrate it..
Code: [Select]
<?php 
/************************************************************************** 
 *                                                                        * 
 *    4images - A Web Based Image Gallery Management System               * 
 *    ----------------------------------------------------------------    * 
 *                                                                        * 
 *             File: contact.php                                          * 
 *        Copyright: (C) 2002  - 2010 Jan Sorgalla                        * 
 *            Email: jan@4homepages.de                                    * 
 *              Web: http://www.4homepages.de                             * 
 *    Scriptversion: 1.7.7                                                * 
 *                                                                        * 
 *    Never released without support from: Nicky (http://www.nicky.net)   * 
 *                                                                        * 
 ************************************************************************** 
 *                                                                        * 
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       * 
 *    bedingungen (Lizenz.txt) für weitere Informationen.                 * 
 *    ---------------------------------------------------------------     * 
 *    This script is NOT freeware! Please read the Copyright Notice       * 
 *    (Licence.txt) for further information.                              * 
 *                                                                        * 
 *************************************************************************/ 

$main_template "contact"

define('GET_CACHES'1); 
define('ROOT_PATH''./'); 
define('MAIN_SCRIPT'__FILE__);
include(
ROOT_PATH.'global.php'); 
require(
ROOT_PATH.'includes/sessions.php'); 
$user_access get_permission();
include(
ROOT_PATH.'includes/page_header.php'); 
$txt_clickstream "Contact"

if (
$action == "") {
  
$action "mailform"



$content ""

$sendprocess 0

if (
$action == "emailSiteOwner") { 
 
  
$error 0
  
  
$mail_to = (isset($_POST['emails'])) ? $_POST['emails'] : $config['site_email'];
  
$sender_name stripslashes(trim($_POST['sender_name'])); 
  
$sender_email stripslashes(trim($_POST['sender_email'])); 

  
$subject un_htmlspecialchars(trim($HTTP_POST_VARS['subject'])); 
  
$message un_htmlspecialchars(trim($HTTP_POST_VARS['message'])); 
  
  
$captcha = (isset($HTTP_POST_VARS['security_code'])) ? un_htmlspecialchars(trim($HTTP_POST_VARS['security_code'])) : "";


if (
$sender_name == "" || $sender_email == "" || $subject == "" || $message == "") { 
    
$msg $lang['lostfield_error']; 
    
$sendprocess 1
    
$error 1
  } 
  
 
$check "/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@([a-zA-Z0-9-]+\.)+([a-zA-Z]{2,4})$/";

if(!isset(
$sender_email) OR $sender_email == "" OR !preg_match($check,$sender_email))
   {
   
$msg .= (($msg != "") ? "<br />" "").$lang['invalid_email_format']; 
    
$sendprocess 1
    
$error 1
   }

echo 
"eststtstss ==> " .$session_info['security_code'];
  
if (
$captcha_enable_contact && !captcha_validate($captcha)) {
  $msg .= (($msg != "") ? "<br />" "").$lang['captcha_required'];
  $error 1;
    }

if (!
$error) { 
    
$sender_user_name $sender_name
    
$sender_user_email $sender_email

    
// Start Emailer 
    
include(ROOT_PATH.'includes/email.php'); 
    
$site_email = new Email(); 
    
$site_email->set_from($sender_user_email$sender_user_name); 
    
$site_email->set_to($mail_to); 
    
$site_email->set_subject($subject);
    
$site_email->register_vars(array( 
    
"sender_user_name" => $sender_user_name
    
"sender_user_email" => $sender_user_email
    
"message" => $message
    
"site_name" => $config['site_name'
    )); 
    
    
$site_email->set_body("mailform_message"$config['language_dir']); 
    
$site_email->send_email(); 
    
$msg 'Email has been sent. I will contact you as soon as possible. Thank you !!' 

  } 
  else { 
    
$action "mailform"
  } 


if (
$action == "mailform") { 
  if (!
$sendprocess) { 
    
$subject ""
    
$message ""
  } 
  
  
$sender_name = ($user_info['user_level'] != GUEST) ? $user_info['user_name'] : ""
  
$sender_email = ($user_info['user_level'] != GUEST) ? $user_info['user_email'] : ""
  
    
$site_template->register_vars(array( 
      
"sender_name" => $sender_name
      
"sender_email" => $sender_email,
      
"url_form" => $site_sess->url(ROOT_PATH."contact.php"),
      
"subject" => htmlspecialchars($subject), 
      
"message" => htmlspecialchars($message), 
      
"captcha_contact" => (bool)$captcha_enable_contact,
      
"lang_captcha" => $lang['captcha'],
      
"lang_captcha_desc" => $lang['captcha_desc'],
      
"lang_mail_to" => $lang['mail_to'],
      
"lang_your_name" => 'Name:'
      
"lang_your_mail" => 'Email:'
      
"lang_subject" => 'Subject:'
      
"lang_message" => 'Message:'
      
"lang_submit" => $lang['submit'], 
      
"lang_reset" => $lang['reset'],
    )); 
    
$content $site_template->parse_template("contact_mailform"); 


//----------------------------------------------------- 
//--- Clickstream ------------------------------------- 
//----------------------------------------------------- 
$clickstream "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].$txt_clickstream."</span>"


//----------------------------------------------------- 
//--- Print Out --------------------------------------- 
//----------------------------------------------------- 
$site_template->register_vars(array( 
  
"content" => $content
  
"msg" => $msg
  
"clickstream" => $clickstream
)); 

$site_template->print_template($site_template->parse_template($main_template)); 

include(
ROOT_PATH.'includes/page_footer.php'); 
?>


I have already modified my contact_form.html template file to include this..
Code: [Select]
    {if captcha_contact}
<tr>
        <td width="80" valign="top"><b><!--{lang_captcha}--><label for="security_code">Security Code: </label></b></td>
<!--         <td>{recaptcha}</td> -->
<td><img src="CaptchaSecurityImages.php?width=100&height=40&characters=5" /><br /><br />
<input id="security_code" name="security_code" type="text" /><br />
</td>
    </tr>
   {endif captcha_contact}


I have also attached required .ttf file here.

Any help will be appreciated..

Thank you
batu544

5
Mods & Plugins (Requests & Discussions) / paging url changes..
« on: January 29, 2011, 11:24:54 AM »
Hi,
    I have installed paging on my homepage.. so now I can view pages like  www.domain.com  , www.domain.com/?page=2 , www.domain.com/?page=3 , etc..


is it possible to do some changes in paging.php or .htaccess so that the pages will become like this.. ==> www.domain.com , www.domain.com/page/2 , www.domain.com/page/3 , etc etc..


Thank you
Batu

6
Discussion & Troubleshooting / How i can call instead *.htm *.php
« on: January 14, 2011, 07:17:21 PM »
Hi,
     I just created one custom page by using this mod.. but for me its not working properly..

My  .php file is displaying all the things correctly.. but when I am using .htm file, no template variables are working except {clickstream} ..


Is there anything I need to mentions..

Thanks
batu544


7
Mods & Plugins (Requests & Discussions) / Search page modification
« on: January 13, 2011, 04:42:03 AM »
Hi,
      Here is one example of my normal image page    ==>  www.test.com/r-batu-200.htm   

While coming to this same by using search feature this link will become  ==>   www.test.com/r100.search.htm 



Is not it possible for  search.php  to return actual url of the image ??


Thank you
batu544

8
Chit Chat / My website layout changes
« on: January 04, 2011, 07:58:52 PM »
Hi All-
           I have changed my website design. Removed all the tables and coded using only div's ( right now only home page has been changed .. slowly I will change all other pages..

   Please visit my website here ==> Celebrity Wallpapers  and let me know your comments  :mrgreen:


Thank you
batu544



9
Mods & Plugins (Requests & Discussions) / [MOD] - Top Friends - Referrers
« on: January 04, 2011, 07:00:57 AM »
Hi All,

What is this MOD ?
        ....This mod will enable the users to list the top referrers to your website which are added in your friends list.
        ....This list also ordered based on the incoming traffic from your friends website.


Demo : http://www.bhwallpapers.com/

If you like this feature, then here is the steps..

Following files are required for this changes..

1. includes/sessions.php   - change
2. includes/page_header.php   - change
3. includes/constants.php     - change
4. top_friends.php    - New file
5. config.php   - change

Template files

5. top_friends.html   - new
6. top_friends_form.html  - new

Admin Plugin to manager friends

7. Friends.php  - new



Step 1 :

      Please download the attached installer and run it . This installer will create 2 new tables in database. ( 4images_friends and 4images_friends_referrals ). 
   
Step 2: includes/constants.php  changes

   search for
Code: [Select]
define('WORDMATCH_TABLE', $table_prefix.'wordmatch');

Insert after
Code: [Select]
define('FRIENDS_TABLE', $table_prefix.'friends');
define('FRIENDS_REF_TABLE', $table_prefix.'friends_referrals');

Step 3: includes/sessions.php changes

1. Search for
Code: [Select]
    //if (!$login_process) {
      $sql = "REPLACE INTO ".SESSIONS_TABLE."
              (session_id, session_user_id, session_lastaction, session_location, session_ip)
              VALUES
              ('".addslashes($this->session_id)."', ".$this->user_info['user_id'].", $this->current_time, '$this->user_location', '$this->user_ip')";
      $site_db->query($sql);
    //}

    $this->session_info['session_user_id'] = $this->user_info['user_id'];
    $this->session_info['session_lastaction'] = $this->current_time;
    $this->session_info['session_location'] = $this->user_location;
    $this->session_info['session_ip'] = $this->user_ip;

Insert AFTER
Code: [Select]
//**** added for recording friends referal ***************/
$hour = date('H');
if ($hour==0)
{
$sql = "UPDATE ".FRIENDS_TABLE." SET
`daily_visits`=0, `reset_flag`=0
WHERE `reset_flag`=1";
$site_db->query($sql);
}
if ($hour==1)
{
$sql = "UPDATE ".FRIENDS_TABLE." SET
`reset_flag`=1";
$site_db->query($sql);
}

$arr_dom = explode(".", $_SERVER['SERVER_NAME']);
if (count($arr_dom)>2)
{
if (strlen($arr_dom[count($arr_dom)-2])<=3 and strlen($arr_dom[count($arr_dom)-1])==2)
{
$domain_name = $arr_dom[count($arr_dom)-3].".".$arr_dom[count($arr_dom)-2].".".$arr_dom[count($arr_dom)-1];
}
else  {
$domain_name = $arr_dom[count($arr_dom)-2].".".$arr_dom[count($arr_dom)-1];
}
}
else {
$domain_name = $arr_dom[0].".".$arr_dom[1];
}
$ref_url = parse_url(urldecode($_SERVER['HTTP_REFERER'])) ;

if ($ref_url==false) return false;
$ref_domain = str_replace("www.", "", $ref_url['host']);
if ($ref_domain=='') $ref_domain = $ref_url ;
if (strpos($ref_domain, $domain_name)===false)
{
$sql = "SELECT * FROM ".FRIENDS_TABLE." WHERE `url` REGEXP 'http(s)*://(([^/\.])*(/|\.){0,1}){0,1}$ref_domain(/){0,1}.*' ";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);
$friend = array();
while ($row = $site_db->fetch_array($result)) {
if (preg_match("'http(s)*://(([^/\.])*([/|\.]){1}){0,1}".$ref_domain."(/){0,1}.*'i", $row['url'])==1)
{
$friend = $row;
}

}
if (count($friend)>0) {

$sql = "SELECT * FROM ".FRIENDS_REF_TABLE." WHERE
`ip`='".$_SERVER['REMOTE_ADDR']."'
AND `friend_id`='".$friend['id']."'
AND NOW()<DATE_ADD(`created`, INTERVAL 1 DAY) ";
$check_day = $site_db->query_firstrow($sql);

// if (count($check_day)==0)
if (!$check_day)
{
/*
* Add the ip to the referrer table
*/
$sql = "INSERT INTO ".FRIENDS_REF_TABLE." SET
`ip`='".$_SERVER['REMOTE_ADDR']."',
`host`='".gethostbyaddr($_SERVER['REMOTE_ADDR'])."',
`created`=NOW(),
`friend_id`='".$friend['id']."'
";
$site_db->query($sql);

$sql = "UPDATE ".FRIENDS_TABLE." SET
`total_visits`=`total_visits`+1,
`daily_visits`=`daily_visits`+1
WHERE `id`='".$friend['id']."'
";
$site_db->query($sql);
}
}
}


//**********************************************************


Step 4: top_friends.php

 1. Download the attached top_friends.php file and upload it in your root directory..

Here is the code for your reference
Code: [Select]
<?php 
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: top_friends.php                                      *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7.6                                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) f&#252;r weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/
$main_template 'top_friends';
define('GET_CACHES'1);
define('ROOT_PATH''./');
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
$user_access get_permission();
include(
ROOT_PATH.'includes/page_header.php');


//-----------------------------------------------------
//--- Save New Friends --------------------------------
//-----------------------------------------------------
$error 0;

if (
$action == "add" && isset($HTTP_POST_VARS[URL_ID])) {
  
$id intval($HTTP_POST_VARS[URL_ID]);

    
$title un_htmlspecialchars(trim($HTTP_POST_VARS['title']));
    
$host un_htmlspecialchars(trim($HTTP_POST_VARS['host']));

$captcha = (isset($HTTP_POST_VARS['captcha'])) ? un_htmlspecialchars(trim($HTTP_POST_VARS['captcha'])) : "";

preg_match("/^(http:\/\/)?([^\/]+)/i","$host"$matches);
$dom $matches[2];
preg_match("/[^\.\/]+\.[^\.\/]+$/"$dom$matches);
$domain $matches[0] ; 

    
// Check already in the friends table..
//    $sql = "SELECT * FROM ".FRIENDS_TABLE." WHERE `url` REGEXP 'http(s)*://(([^/\.])*(/|\.){0,1}){0,1}$domain(/){0,1}.*' ";
    
$sql "SELECT * FROM ".FRIENDS_TABLE." WHERE `url` = '".$dom."' ";
    
$exist_row $site_db->query_firstrow($sql);



    if (
$exist_row)  {
      
$msg .= (($msg != "") ? "<br />" "")."Url already Exist";
      
$error 1;
    }

    if (
$title == "")  {
      
$msg .= (($msg != "") ? "<br />" "").$lang['name_required'];
      
$error 1;
    }
    if (
$captcha_enable_friends && !captcha_validate($captcha)) {
      
$msg .= (($msg != "") ? "<br />" "").$lang['captcha_required'];
      
$error 1;
    }

    if (!
$error)  {
    
if ($user_info['user_level'] != ADMIN) {

      
$sql "INSERT INTO ".FRIENDS_TABLE."
        (title, url, `created`, `modified`, `enabled`, `sort_order`, `display`, `daily_visits`, `reset_flag`, `total_visits`, `ip`, `hostname`)
        VALUES ( '"
.$title."','".$host."', NOW(),NOW(),'0', '1', '0', '0', '0', '0', '".$session_info['session_ip']."','".$dom."' )";
    

    
} else {

      
$sql "INSERT INTO ".FRIENDS_TABLE."
        (title, url, `created`, `modified`, `enabled`, `sort_order`, `display`, `daily_visits`, `reset_flag`, `total_visits`, `ip`, `hostname`)
        VALUES ( '"
.$title."','".$host."', NOW(),NOW(),'1', '1', '1', '0', '0', '0', '".$session_info['session_ip']."','".$dom."' )";

}

      
$site_db->query($sql);
      
$friendid $site_db->get_insert_id();
      
$msg "Your link will be activated after admin review" ;
/****     if ($user_info['user_level'] != ADMIN) {

include(ROOT_PATH.'includes/email.php');
$site_email = new Email();

$config['upload_emails'] = str_replace(" ", "", $config['upload_emails']);
$emails = explode(",", $config['upload_emails']);


$site_email->set_to($config['site_email']);
$site_email->set_subject($lang['new_upload_emailsubject']);
$site_email->register_vars(array(
  "image_name" => stripslashes($image_name),
  "file_name" => $new_name,
  "cat_name" => $cat_cache[$cat_id]['cat_name'],
  "validation_url" => $validation_url,
  "site_name" => $config['site_name']
));
$site_email->set_body("upload_notify", $config['language_dir_default']);
$site_email->set_bcc($emails);
$site_email->send_email();
     }   ***/

 }
  }



  
//-----------------------------------------------------
  //--- Form -----------------------------------
  //-----------------------------------------------------
    
$title = (isset($HTTP_POST_VARS['title']) && $error) ? format_text(trim(stripslashes($HTTP_POST_VARS['title'])), 2) : (($user_info['user_level'] != GUEST) ? format_text($user_info['title'], 2) : "");
    
$host = (isset($HTTP_POST_VARS['host']) && $error) ? format_text(trim(stripslashes($HTTP_POST_VARS['host'])), 2) : "";

    
$site_template->register_vars(array(
      
"title" => $title,
      
"host" => $host,
      
"url_form" => $site_sess->url(ROOT_PATH."top_friends.php"),
      
"lang_add_new_friend" => $lang['post_comment'],
      
"lang_captcha" => $lang['captcha'],
      
"lang_captcha_desc" => $lang['captcha_desc'],
      
"captcha_friends" => (bool)$captcha_enable_friends
    
));
    
$top_friends_form $site_template->parse_template("top_friends_form");
  
$site_template->register_vars("top_friends_form"$top_friends_form);
  unset(
$top_friends_form);

//---------------------------------------------------------
//----All the friends list---------------------------------
//---------------------------------------------------------
$sql "SELECT title, url, hostname,  `daily_visits` , `total_visits`
 FROM "
.FRIENDS_TABLE."
 WHERE `enabled` = '1' AND `display` = '1'  OR `total_visits` > 5
         ORDER BY `daily_visits` DESC, `total_visits` DESC "
;
$result $site_db->query($sql);
$friend_rows $site_db->get_numrows($result);

$top_friends "<tr class=\"row1\"><td>Description</td><td> Url</td><td>Daily Visit</td><td>Total Visit</td></tr><br />"
if (
$friend_rows)  {
  while (
$friend_rows $site_db->fetch_array($result)){
   
$top_friends .= "<tr class=\"row1\"><td>$friend_rows[title]</td><td><a href=\"$friend_rows[url]\" rel=\"nofollow\" target=\"_blank\" title=\"$friend_rows[title]\">".$friend_rows[hostname]."</a></td><td>".$friend_rows[daily_visits]."</td><td>".$friend_rows[total_visits]."</td></tr>\n"
  }
// end else


//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  
"msg" => $msg,
  
"clickstream" => $clickstream,
  
"top_friends" => $top_friends

));

  
$site_template->print_template($site_template->parse_template($main_template));
include(
ROOT_PATH.'includes/page_footer.php');
?>


Step 5: - includes/page_header.php changes

1. Open page_header.php file and find
Code: [Select]
?>

Insert ABOVE
Code: [Select]
//*********************************************************
// top 20 friends
$sql = "SELECT title, url
FROM ".FRIENDS_TABLE."
WHERE `enabled` = '1' AND `display` = '1' 
         ORDER BY `daily_visits` DESC, `total_visits` DESC
         LIMIT 20 ";
$result = $site_db->query($sql);
$friend_rows = $site_db->get_numrows($result);

$top_20 ="<ul class=\"categories_nav\">\n";
$top_20 .="    <li class=\"categories_header_new\" >Top Friends </li>\n";
if ($friend_rows)  {
  while ($friend_rows = $site_db->fetch_array($result)){
   $top_20 .= "    <li><a href=\"$friend_rows[url]\" target=\"_blank\" rel=\"nofollow\" title=\"$friend_rows[title]\">".$friend_rows[title]."</a></li>\n";
  }
} // end else
$top_20 .= "    <li><strong><a href=\"top_friends.htm\" >All Friends</a></strong></li>\n";
$top_20 .= "</ul>\n";


$site_template->register_vars(array(
"top_20" => $top_20
));
unset($top_20);
unset($top_friends);
//*********************************************

Step 6: - New file   top_friends_form.html

Create a new file called top_friends_form.html in your templates/your directory and put below code inside it..
Code: [Select]
<table border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td valign="top" class="head1" >
      <table  border="0" cellpadding="3" cellspacing="0">
        <tr>
          <td valign="top" class="head1">Add Your Link</td>
        </tr>
        <tr>
          <td valign="top" class="row1" >
            <form name="commentform" action="{url_form}" method="post" onsubmit="postbutton.disabled=true;">
                    <input type="hidden" name="id" value="{image_id}" />
                    <input type="hidden" name="action" value="add" />
              <table cellpadding="4" cellspacing="0" border="0">
                <tr>
                  <td ><b>Desc :</b></td>
                  <td><input type="text" name="title" size="30" value="{title}" class="commentinput" /></td>
                </tr>
                <tr>
                  <td ><b>Url :</b></td>
                  <td><input type="text" name="host" size="30" value="{host}" class="commentinput" /></td>
                </tr>
                 {if captcha_friends}
          <tr>
            <td class="row1" valign="top"><b>{lang_captcha}</b></td>
            <td class="row1">
  <a href="javascript:new_captcha_image();"><img src="{url_captcha_image}" border="0" alt="" id="captcha_image" /></a> <br />
              <input type="text" name="captcha" size="30" value="" class="captchainput" id="captcha_input" />
              <br />
              <table cellpadding="0" cellspacing="0" width="210">
                            <tr>
                                <td>{lang_captcha_desc}</td>
                            </tr>
                        </table>
</td>
          </tr>
                {endif captcha_friends}
               <tr>
                  <td  valign="top">&nbsp;</td>
                  <td><input type="submit" name="postbutton" value="Submit Link" class="button" /></td>
               </tr>
              </table>
            </form>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>

Step 7: - top_friends.html

Create  a new file in your templates/your directory directory and name it as top_friends.html . Design is yours..You need to use below tags to get the list of top friends and top friends form
Code: [Select]
{top_friends_form}
<table width="100%">{top_friends}</table>

I have mentioned the complete top_friends.html file for reference
Code: [Select]
{header}
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td>
      <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tablehead">
        <tr>
          <td width="100%" colspan="4"><table cellpadding="0" cellspacing="0" width="100%">
    <tr>
        <td width="6"><img src="{template_url}/images/header_top_left.gif" width="6" height="6" alt="" /></td>
        <td width="100%"><img src="{template_url}/images/header_top.gif" width="100%" height="6" alt="" /></td>
<td width="6"><img src="{template_url}/images/header_top_right.gif" width="6" height="6" alt="" /></td>
    </tr>
</table>
</td>
        </tr>
        <tr>
          <td width="6"><img src="{template_url}/images/header_left.gif" width="6" height="60" alt="" /></td>
          <td width="100%"><img src="{template_url}/images/header_logo.gif" width="405" height="60" alt="" /></td>
          <td width="225" align="right">
            <form method="post" action="{url_search}">
              <table border="0" cellspacing="0" cellpadding="1">
                <tr>
                  <td>
                    <input type="text" name="search_keywords" size="15" class="searchinput" />
                  </td>
                  <td>
                    <input type="submit" value="{lang_search}" class="button" name="submit" />
                  </td>
                </tr>
                <tr valign="top">
                  <td colspan="2"><a href="{url_search}" class="smalltext">{lang_advanced_search}</a></td>
                </tr>
              </table>
            </form>
          </td>
          <td align="right" width="6"><img src="{template_url}/images/header_right.gif" width="6" height="60" alt="" /></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td class="bordercolor">
      <table width="100%" border="0" cellspacing="1" cellpadding="0">
        <tr>
          <td class="tablebgcolor">
            <table width="100%" border="0" cellspacing="1" cellpadding="0">
              <tr>
                <td class="navbar" height="23">
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td><img src="{template_url}/images/spacer.gif" width="4" height="4" alt="" />{clickstream}</td>
                      <td align="right">
<a href="{url_top_images}"><b>{lang_top_images}</b></a>&nbsp;
<a href="{url_new_images}"><b>{lang_new_images}</b></a>&nbsp;
  </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="150" valign="top" class="row2">
                  <table width="150" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head2" height="20"><img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_registered_user}</td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                    <tr>
                      <td align="center" class="row1">{user_box} </td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                  </table>
                  {if random_image}
                  <table width="150" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head2" height="20"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_random_image}</td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                    <tr>
                      <td align="center" class="row1">
    <br />
                        {random_image}
<br />
                        <br />
                      </td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                  </table>
                  {endif random_image}
                </td>
                <td width="1" class="bordercolor" valign="top"><img src="{template_url}/images/spacer.gif" width="1" height="1" alt="" /></td>
                <td width="18" valign="top"><img src="{template_url}/images/spacer.gif" width="18" height="18" alt="" /></td>
                <td width="450" valign="top"><br />
                  <b class="title"><b>{msg}</b></b>
                  <hr size="1" />
{top_friends_form}
<table width="100%">{top_friends}</table>

                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td>{category_dropdown_form}</td>
                      <td align="right">{setperpage_dropdown_form}</td>
                    </tr>
                  </table>
                  <p>&nbsp;</p>
                </td>
                <td width="20" valign="top"><img src="{template_url}/images/spacer.gif" width="19" height="19" alt="" /></td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td>
      <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tablebottom">
        <tr>
          <td width="6" nowrap><img src="{template_url}/images/footer_left.gif" width="6" height="19" alt="" /></td>
          <td width="100%"></td>
          <td width="6" nowrap><img src="{template_url}/images/footer_right.gif" width="6" height="19" alt="" /></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
{footer}

Step 8:

  .. Now you can list your top 20 friends in any other pages by using {top_20} tag.


Step 9:
   Download the attached plugin and place it in your admin/plugins/ folder.

Step 10: config.php file changes
   
Open your config.php file and find for
Code: [Select]
?>
and insert above ..
Code: [Select]
$captcha_enable_friends=1;


I hope, I am done .. :)   For me email notification part is not working so, I have commented it in my code.. may be some PHP gurus can improve this code also ..


10
Hi,
     Happy new year to all... I have been designed a mod for my website. Top friends. You can see the demo on my website. The order of the links is based on the incoming traffic . By using this you can increase your galleries traffic :)


   Please let me know, if anyone is interested in this mod..  I will put the required changes in words...


Thank you.
batu544

11
Chit Chat / Google listing with 4image script
« on: December 24, 2010, 10:48:49 AM »
Hi All -
               Its Christmas time.. So.. happy Christmas to all.. :)  One more good news.. I have been using 4image for my website for a long time and now for couple of keywords my website is on the first page of major search engines..For couple of words its on the first place also.. I don't believe it...  :lol:


Thanks to all the members who helped me in doing all small or big changes..  also thanks to me for my patient and couple of in-house modification :wink:




Thanks to All,
Batu


 


12
Discussion & Troubleshooting / moving data folder to a sub-domain ??
« on: December 19, 2010, 09:18:29 PM »
Hi All -
          After a long time.. I came up with one more question.. :)

 I would like to move my data folder to a subdomain ( cookie less domain ).

For example now 4image is generating all relative paths to my images.. like   ./data/thumbnails/91/xyz.jpg   

Is it possible to change this image path to something like http://media.domainname.com/thumbnails/91/xyz.jpg ?



Any help or suggestion will be very helpful .. 

Thank you
batu544

13
Discussion & Troubleshooting / Likely Fresh attack.. !!!
« on: September 17, 2010, 09:28:53 PM »
Hi,
     Today I was browsing my website error log and surprised to see couple of below errors..

Code: [Select]
Fri Sep 17 12:15:45 2010] [error] [client 92.243.84.187] File does not exist: /home/xxxxxx/public_html/plugins, referer: http://www.bhwallpapers.com/plugins/editors/tinymce/jscripts/tiny_mce/plugins/tinybrowser/tinybrowser.php?type=file&folder=
Code: [Select]
[Fri Sep 17 10:51:43 2010] [error] [client 92.243.84.187] File does not exist: /home/xxxxxx/public_html/plugins, referer: http://www.bhwallpapers.com/plugins/editors/tinymce/jscripts/tiny_mce/plugins/tinybrowser/tinybrowser.php?type=file&folder=

Is it some hacking attempt ??

Thanks,

14
Mods & Plugins (Requests & Discussions) / Badword List is not working..
« on: September 15, 2010, 08:16:20 AM »
Hi,
    I have added some words in badword list .. but those words are still displaying on comments..  Is there anything needs to be done.. ?

Thanks,
batu544

15
Mods & Plugins (Requests & Discussions) / Top Referrer
« on: August 20, 2010, 03:11:02 PM »
Hi All -
             Is it possible store the referrer's domain name and show it on the home page or in any other page ? I think it can be done by changing the sessions.php file.



Any suggestion  for this approach will be appreciated... :)


Pages: [1] 2 3 4
Post your comments here