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.


Messages - batu544

Pages: 1 [2] 3 4 5 6 ... 23
16
Installation, Update & Configuration / Re: Mysql Usage
« on: February 11, 2011, 01:44:02 PM »
Thank you V@no... I was thinking I have already installed the optimized version of that MOD.. but when I verified today.. it's not installed.. so I did it and the results are here... :)



Code: [Select]
Page generated in 1.177956 seconds with 52 queries, spending 0.458000 seconds doing MySQL queries and 0.719956 doing PHP things. GZIP compression enabled
Page generated in 1.124450 seconds with 52 queries, spending 0.410000 seconds doing MySQL queries and 0.714450 doing PHP things. GZIP compression enabled
Page generated in 1.208340 seconds with 55 queries, spending 0.467000 seconds doing MySQL queries and 0.741340 doing PHP things. GZIP compression enabled
Page generated in 1.052096 seconds with 55 queries, spending 0.407000 seconds doing MySQL queries and 0.645096 doing PHP things. GZIP compression enabled


Thank you

17
Installation, Update & Configuration / Re: Mysql Usage
« on: February 11, 2011, 06:19:29 AM »
Well guys.. when I checked my statistics for my home page, I got surprised..

my homepage is doing 200 sql queries for a single display..  8O

Code: [Select]
Page generated in 1.066121 seconds with 223 queries, spending 0.461000 seconds doing MySQL queries and 0.605121 doing PHP things. GZIP compression enabled
Page generated in 1.290053 seconds with 223 queries, spending 0.477000 seconds doing MySQL queries and 0.813053 doing PHP things. GZIP compression enabled
Page generated in 1.028376 seconds with 225 queries, spending 0.393000 seconds doing MySQL queries and 0.635376 doing PHP things. GZIP compression enabled
Page generated in 1.248478 seconds with 222 queries, spending 0.499000 seconds doing MySQL queries and 0.749478 doing PHP things. GZIP compression enabled


18
Discussion & Troubleshooting / Re: 301 Permanent Redirect The Whole Site
« on: February 09, 2011, 07:10:44 AM »
Hi - try this..


Code: [Select]
RedirectMatch 301 /.* http://yourdomain.com/

19
Mods & Plugins (Releases & Support) / Re: [MOD] Contact Form
« on: January 30, 2011, 05:17:56 PM »
Hi,
    I have installed this mod recently.. but unable to make it work as expected.. Whenever I am trying to send an email, it's always showing me "Please enter the verification code." error message..

Could anyone please let me know what mistake I have done ?   here is my contact page ==> www.bhwallpapers.com/contact.htm


FYI.. I have installed recaptcha mod of V@no and it works well in my other pages..like www.bhwallpapers.com/top_friends.htm  and register page.

Here is my contact.php code..
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['captcha'])) ? un_htmlspecialchars(trim($HTTP_POST_VARS['captcha'])) : "";


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
   }
  
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.htm"),
      
"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'); 
?>



Here is my contactmailform.html
Code: [Select]
<table width="100%" class="row2" border="0" cellpadding="4" cellspacing="0">
  <form name="contactform" action="{url_form}" method="post" onsubmit="postbutton.disabled=true;">
<input type="hidden" name="action" value="emailSiteOwner">
<input type="hidden" name="user_id" value="{user_id}">
    <tr>
      <td align="right" valign="middle"><b>{lang_your_name}</b></td>
      <td align="left"><input class="input" name="sender_name" type="text"  tabindex="1" value="{sender_name}" size="40" maxlength="50">
      </td>
    </tr>
    <tr>
      <td align="right" valign="middle"><b>{lang_your_mail}</b></td>
      <td align="left"><input  class="input" name="sender_email" type="text"  tabindex="2" value="{sender_email}" size="40" maxlength="50">
      </td>
    </tr>
    <tr>
      <td align="right" valign="middle"><b>{lang_subject}</b></td>
      <td align="left"><input  class="input" name="subject" type="text"  tabindex="3" value="{subject}" size="40" maxlength="50"></td>
    </tr>
    <tr>
      <td align="right" valign="top"><b>{lang_message}</b></td>
      <td align="left" valign="top"><textarea name="message" cols="50" rows="10" wrap="VIRTUAL"  tabindex="4">{message}</textarea> </td>
    </tr>
    {if captcha_contact}
<tr>
        <td width="80" valign="top"><b>{lang_captcha}</b></td>
         <td>{recaptcha}</td>
    </tr>
   {endif captcha_contact}
    <tr>
      <td align="right" valign="middle">&nbsp;</td>
      <td align="left">
        <input type="submit" name="postbutton" value="{lang_submit}" class="button" style="margin-right:13px; " />
        <input tabindex="6" type="reset" name="reset" value="{lang_reset}" class="button" />
      </td>
    </tr>
</form>
</table>



Any clue or help will be greatly appreciated.. :)

Thank you
batu544

20
Discussion & Troubleshooting / Re: How i can call instead *.htm *.php
« on: January 29, 2011, 08:27:04 PM »
Hi Rembrandt -
                        Yes, I have installed that mod in my website and I know it will work if I will add following line in my .htaccess file. but I thought may be there would be something else I am missing so I need to add this line in my .htaccess file.. Also, do you want to say, If I would not have installed this mod then both .htm and .php extension pages return same result ??



Code: [Select]
RewriteRule ^contact.htm$ contact.php


Thank you.
batu544

21
Discussion & Troubleshooting / Re: How i can call instead *.htm *.php
« on: January 29, 2011, 04:37:54 PM »
Hi,
    I just created one contact.php file..   but here also the same issue..


registered variables in contact.php file only works when I am accessing this the php file .. like   www.bhwallpapers.com/contact.php   


but when I am accessing the same contact page like   www.bhwallpapers.com/contact.htm , then no contact.php variables are working...


If anyone can look into it.. it will be really great..

Thank you
batu544

22
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

23
Installation, Update & Configuration / Re: Mysql Usage
« on: January 19, 2011, 05:29:55 PM »
Hi,
     Need some experts comment on this.. My website's traffic is not so huge.. just 2000 -3000 page view per day.. suddenly my host suspended by database saying that my queries are overloading the mySQL database..  I don't see any wrong query , all are just simple select and update queries .. but no idea how it created high load on the server...  I am in process of changing my host..

   Is really 4images queries takes much CPU ??

Thanks
batu544

24
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


25
Mods & Plugins (Requests & Discussions) / Re: Search page modification
« on: January 14, 2011, 05:26:26 AM »
Thanks v@no..  went thru that topic and found that its not possible, because this format is required so that paging should work for search result also..


26
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

27
Chit Chat / Re: My website layout changes
« on: January 05, 2011, 03:55:34 AM »
wow, that is fantastic.  I had no idea you could do that.  I really want to do something like that for our gallery.

congrats man!

Thanks  :mrgreen:

28
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



30
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 ..


Pages: 1 [2] 3 4 5 6 ... 23