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 ... 23
1
Discussion & Troubleshooting / Re: PHP 5.3 issue
« on: May 12, 2012, 10:55:34 PM »
Hi V@no,

Thanks for your reply..

This is a new code added by me to record friends block hit.. Here is the code details..

Code: [Select]
  function start_session($user_id = GUEST, $login_process = 0) {
    global $site_db;

    $this->user_info = $this->load_user_info($user_id);
    if ($this->user_info['user_id'] != GUEST && !$login_process) {
      if ($this->read_cookie_data("userpass") == $this->user_info['user_password'] && $this->user_info['user_level'] > USER_AWAITING) {
        $this->set_cookie_data("userpass", $this->user_info['user_password']);
      }
      else {
        $this->set_cookie_data("userpass", "", 0);
        $this->user_info = $this->load_user_info(GUEST);
      }
    }

    //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;

//**** 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 (!$check_day)
{
$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);
}
}
}


//**********************************************************
    if ($this->user_info['user_id'] != GUEST) {
      $this->user_info['user_lastvisit'] = (!empty($this->user_info['user_lastaction'])) ? $this->user_info['user_lastaction'] : $this->current_time;
      $sql = "UPDATE ".USERS_TABLE."
              SET ".get_user_table_field("", "user_lastaction")." = $this->current_time, ".get_user_table_field("", "user_location")." = '$this->user_location', ".get_user_table_field("", "user_lastvisit")." = ".$this->user_info['user_lastvisit']."
              WHERE ".get_user_table_field("", "user_id")." = ".$this->user_info['user_id'];
      $site_db->query($sql);
    }
    $this->set_cookie_data("lastvisit", $this->user_info['user_lastvisit']);
    $this->set_cookie_data("userid", $this->user_info['user_id']);
    return true;
  }


2
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.. :)

3
It can be done my using some jquery and css .. I have done it long back .. will post it if I will find it in my old hard drive..


4
Chit Chat / Re: Anti-Spam page like 4images forum.
« on: April 12, 2011, 12:48:38 PM »
Hi V@no,
               I have implemented httpBL in my website for 4images..  by getting some help from other websites.. but don't know how far it will stop the spammers.. because.. after implementing httpbl also I can see few spam comments..  :(


Thank you
batu544





5
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

6
Templates & Styles (Releases & Support) / Re: [MOD] reCAPTCHA
« on: March 18, 2011, 03:23:20 PM »
HI,
     I am using this mod.. but its bit surprising that.. still some spammer can add spam comments on my website..

V@no .. Do you have any idea why its happening ??

Thank you
batu

7
Thanks budduke... I will test this code within 2-3 days and let you know the result..



Thank you
batu544

8
Hi,
     Yes, you are correct. This mod applies the water mark to the original image.   

Now the question is..   without applying the watermarks to the original image.. is it possible to apply the watermark to the resized images ? 

9
Mods & Plugins (Releases & Support) / Re: MOD WIKIPEDIA
« on: March 01, 2011, 12:39:09 PM »
Hi osnapicture,
                         It works.. You can see the demo here also ==> http://www.bhwallpapers.com/k-louise-glover-114.htm   ( at the bottom of the page "About Louise Glover.." section )


Thanks
batu544

10
Hi
    I am using the watermark MOD which is done by V@no.. ==>   http://www.4homepages.de/forum/index.php?topic=13719.0




Thanks
batu544

11
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

12
Hi budduke

                           I am back again with one more request with your MOD..  :) 

Here is the question.. Is it possible to add the watermark to all resized images ?

May be you can use the existing annotate.php file so that, the annotation setting can be controlled by the admin panel.


Thank you.
batu544

13
Discussion & Troubleshooting / Re: New Captcha system integration - Help.
« on: February 23, 2011, 06:49:51 AM »
Hi,
     Could anyone please look into this issue..  :roll: ??

Thank you
batu544

14
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

15
Hello, I guess you did something wrong.. because this is the same code what I am running in my website. Also, I have tested this in my test server with a fresh copy of 4images script..

can you provide your link, so that I can see it ?...


I added one more file changes in my previous post .. please check it, may be it will help you...


Thank you
batu544

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