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 - zhono

Pages: 1 2 [3] 4
31
Mods & Plugins (Releases & Support) / Re: [MOD] Ajax Username Checker
« on: December 06, 2010, 04:10:21 PM »
Sorry about that. Forgot to use code tags instead of php tags. Should be fixed now.

32
Mods & Plugins (Releases & Support) / Re: [MOD] Ajax Username Checker
« on: December 06, 2010, 02:36:55 PM »
The above post has been updated to allow the Submit button to be disabled until all fields are entered correctly.

33
Mods & Plugins (Releases & Support) / Re: [MOD] Ajax Username Checker
« on: December 02, 2010, 12:32:47 PM »
And here is my final contribution to this great mod. Here's what it does:

  • Check username to see if it exists
  • Require username to be between X and X characters long
  • Warns user if the username field is left blank
  • Require the password to be between X and X characters long
  • Warns user if the password field is left blank
  • Make sure the email is someone@domain.com
  • Make sure the email isn't already registed in your gallery.
  • Warns user if the email field is left blank
  • Submit button says "Disabled" and can't be clicked, until all items are entered correctly, then changes to "Register" and can be clicked.


After installing the original mod from Lucifix:

In page_header.php REPLACE:
Code: [Select]
 "url_user_availability" => $site_sess->url(ROOT_PATH."user_availability.php", "&"),
With:
Code: [Select]
 "url_user_availability" => $site_sess->url(ROOT_PATH."user_availability.php?check=username", "&"),
  "url_user_email" => $site_sess->url(ROOT_PATH."user_availability.php?check=email", "&"),
  "url_user_password" => $site_sess->url(ROOT_PATH."user_availability.php?check=password", "&"),

In register_form.html

REPLACE the original javascript at the top with this:
Code: [Select]
<script language="javascript">
//<!---------------------------------+
//  Developed by Roshan Bhattarai
//  Visit http://roshanbh.com.np for this script and more.
//  This notice MUST stay intact for legal use
//  Extensive additions by Zhono
// --------------------------------->

$(document).ready(function()
{
var userOk = 0;
var passOk = 0;
var emailOk = 0;
$("#submitButton").attr("value", "Disabled");
$("#submitButton").attr("disabled", "true");
$("#username").blur(function()
{
//remove all the class add the messagebox classes and start fading
$("#msgbox").removeClass().addClass('messagebox').text('Checking...').fadeIn("slow");
//check the username exists or not from ajax
$.post("{url_user_availability}",{ user_name:$(this).val() } ,function(data)
        {
     if(data=='userblank') //if username not entered
 {
  $("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
{
 //add message and change the class of the box and start fading
 $(this).html('{lang_ajax_username_empty}').addClass('messageboxerror').fadeTo(900,1);
 
});
userOk = 0;
          }
 else if(data=='userlength') //if username is less than 6 or more than 20 characters
 {
  $("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
{
 //add message and change the class of the box and start fading
 $(this).html('{lang_ajax_username_length}').addClass('messageboxerror').fadeTo(900,1);
 
});
userOk = 0;
          }
 else if(data=='userno') //if username not avaiable
 {
  $("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
{
 //add message and change the class of the box and start fading
 $(this).html('{lang_ajax_username_taken}').addClass('messageboxerror').fadeTo(900,1);
 
});
userOk = 0;
          }
 else
 {
  $("#msgbox").fadeTo(200,0.1,function()  //start fading the messagebox
{
 //add message and change the class of the box and start fading
 $(this).html('{lang_ajax_username_good}').addClass('messageboxok').fadeTo(900,1);
 
});
userOk = 1;
 if (userOk==1 && passOk==1 && emailOk==1) {
 $("#submitButton").attr("value", "Register");
 $('#submitButton').removeAttr('disabled');
 } else {
$("#submitButton").attr("disabled", "true");
$("#submitButton").attr("value", "Disabled");
}
 }

        });
});
$("#userpassword").blur(function()
{
//remove all the class add the messagebox classes and start fading
$("#msgboxpass").removeClass().addClass('messagebox').text('Checking...').fadeIn("slow");
//check the username exists or not from ajax
$.post("{url_user_password}",{ user_password:$(this).val() } ,function(data)
        {
     if(data=='passblank') //if username not entered
 {
  $("#msgboxpass").fadeTo(200,0.1,function() //start fading the messagebox
{
 //add message and change the class of the box and start fading
 $(this).html('{lang_ajax_password_empty}').addClass('messageboxerror').fadeTo(900,1);
 
});
passOk = 0;
          }
 else if(data=='passlength') //if username is less than 6 or more than 20 characters
 {
  $("#msgboxpass").fadeTo(200,0.1,function() //start fading the messagebox
{
 //add message and change the class of the box and start fading
 $(this).html('{lang_ajax_password_length}').addClass('messageboxerror').fadeTo(900,1);
 
});
passOk = 0;
          }
 else
 {
  $("#msgboxpass").fadeTo(200,0.1,function()  //start fading the messagebox
{
 //add message and change the class of the box and start fading
 $(this).html('{lang_ajax_password_good}').addClass('messageboxok').fadeTo(900,1);
 
});
passOk = 1;
 if (userOk==1 && passOk==1 && emailOk==1) {
 $("#submitButton").attr("value", "Register");
 $('#submitButton').removeAttr('disabled');
 } else {
$("#submitButton").attr("disabled", "true");
$("#submitButton").attr("value", "Disabled");
}
 }

        });
});
$("#useremail").blur(function()
{
//remove all the class add the messagebox classes and start fading
$("#msgboxemail").removeClass().addClass('messagebox').text('Checking...').fadeIn("slow");
//check the username exists or not from ajax
$.post("{url_user_email}",{ user_email:$(this).val() } ,function(data)
        {
     if(data=='emailblank') //if username not entered
 {
  $("#msgboxemail").fadeTo(200,0.1,function() //start fading the messagebox
{
 //add message and change the class of the box and start fading
 $(this).html('{lang_ajax_email_empty}').addClass('messageboxerror').fadeTo(900,1);
 
});
emailOk = 0;
          }
 else if(data=='emailinvalid') //if username is less than 6 or more than 20 characters
 {
  $("#msgboxemail").fadeTo(200,0.1,function() //start fading the messagebox
{
 //add message and change the class of the box and start fading
 $(this).html('{lang_ajax_email_invalid}').addClass('messageboxerror').fadeTo(900,1);
 
});
emailOk = 0;
          }
 else if(data=='emailno') //if username not avaiable
 {
  $("#msgboxemail").fadeTo(200,0.1,function() //start fading the messagebox
{
 //add message and change the class of the box and start fading
 $(this).html('{lang_ajax_email_taken}').addClass('messageboxerror').fadeTo(900,1);
 
});
emailOk = 0;
          }
 else
 {
  $("#msgboxemail").fadeTo(200,0.1,function()  //start fading the messagebox
{
 //add message and change the class of the box and start fading
 $(this).html('{lang_ajax_email_good}').addClass('messageboxok').fadeTo(900,1);
 
});
emailOk = 1;
 if (userOk==1 && passOk==1 && emailOk==1) {
 $("#submitButton").attr("value", "Register");
 $('#submitButton').removeAttr('disabled');
 } else {
$("#submitButton").attr("disabled", "true");
$("#submitButton").attr("value", "Disabled");
}
 }

        });
 
});
});
</script>

REPLACE:
Code: [Select]
<input type="password" name="user_password" size="30" class="input" />
With:
Code: [Select]
<input type="password" name="user_password" size="30" class="input"  id="userpassword" /><span id="msgboxpass" style="display:none"></span>
REPLACE:
Code: [Select]
<input type="text" name="user_email" size="30" class="input" value="{user_email}" />
With:
Code: [Select]
<input type="text" name="user_email" size="30" class="input" value="{user_email}" id="useremail" /><span id="msgboxemail" style="display:none"></span>
REPLACE:
Code: [Select]
<input type="submit" value="{lang_submit}" class="button" />
With:
Code: [Select]
<input type="submit" value="{lang_submit}" class="button" id="submitButton" />
In lang/english/main.php

Find
Code: [Select]
?>
Before ADD:
Code: [Select]
//----------------------------------------------------------
//-- Mod Ajax Registration Checker --
//----------------------------------------------------------
$lang['ajax_username_empty'] = "Please enter a username";
$lang['ajax_username_length'] = "Username must be between 6 and 20 characters long";
$lang['ajax_username_taken'] = "This User name already exists";
$lang['ajax_username_good'] = "Username available to register";
$lang['ajax_password_empty'] = "Please enter a password";
$lang['ajax_password_length'] = "Password must be between 6 and 20 characters long";
$lang['ajax_password_good'] = "Password is good";
$lang['ajax_email_empty'] = "Please enter an email address";
$lang['ajax_email_invalid'] = "This email address is invalid!";
$lang['ajax_email_taken'] = "This email address is already registered";
$lang['ajax_email_good'] = "Email address is good to go";

In register.php

Find:
Code: [Select]
      "captcha_registration" => (bool)$captcha_enable_registration
Replace with:
Code: [Select]
     "captcha_registration" => (bool)$captcha_enable_registration,
      "lang_ajax_username_empty" => $lang['ajax_username_empty'],
      "lang_ajax_username_length" => $lang['ajax_username_length'],
      "lang_ajax_username_taken" => $lang['ajax_username_taken'],
      "lang_ajax_username_good" => $lang['ajax_username_good'],
      "lang_ajax_password_empty" => $lang['ajax_password_empty'],
      "lang_ajax_password_length" => $lang['ajax_password_length'],
      "lang_ajax_password_good" => $lang['ajax_password_good'],
      "lang_ajax_email_empty" => $lang['ajax_email_empty'],
      "lang_ajax_email_invalid" => $lang['ajax_email_invalid'],
      "lang_ajax_email_taken" => $lang['ajax_email_taken'],
      "lang_ajax_email_good" => $lang['ajax_email_good']

And finally, REPLACE you entire user_availability.php with this:
Code: [Select]
<?php
//  Developed by Roshan Bhattarai 
//  Visit http://roshanbh.com.np for this script and more.
//  This notice MUST stay intact for legal use
//  Extensive additions by Zhono

define('ROOT_PATH''./');
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');

if (
$_GET['check'] == "username") {
if (isset(
$HTTP_POST_VARS['user_name']) && !empty($HTTP_POST_VARS['user_name'])) {
$user_name preg_replace("/[ ]{2,}/"" "un_htmlspecialchars(trim($HTTP_POST_VARS['user_name'])));
//username length
$MIN_LENGTH 6;
$MAX_LENGTH 20;
if ((strlen($user_name) < $MIN_LENGTH) || (strlen($user_name) > $MAX_LENGTH)) {
    
echo "userlength";
  
} else {

if ($user_name != "") {
  $sql "SELECT ".get_user_table_field("""user_name")."
  FROM "
.USERS_TABLE."
  WHERE "
.get_user_table_field("""user_name")." = '".strtolower($user_name)."'";
  if ($site_db->not_empty($sql)) {
//user name is not availble
echo "userno";
  } else {
//user name is available
echo "useryes";   
}
}
  }
} else {
echo "userblank";
}
}

if (
$_GET['check'] == "password") {
if (isset(
$HTTP_POST_VARS['user_password']) && !empty($HTTP_POST_VARS['user_password'])) {
$user_password preg_replace("/[ ]{2,}/"" "un_htmlspecialchars(trim($HTTP_POST_VARS['user_password'])));
//password length
$MIN_LENGTH 6;
$MAX_LENGTH 20;
if ((strlen($user_password) < $MIN_LENGTH) || (strlen($user_password) > $MAX_LENGTH)) {
    
echo "passlength";
  
} else {
   echo "passyes";
  }
} else {
echo "passblank";
}
}

if (
$_GET['check'] == "email") {
if (isset(
$HTTP_POST_VARS['user_email']) && !empty($HTTP_POST_VARS['user_email'])) {

$user_email $HTTP_POST_VARS['user_email'];

if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"$user_email)){
echo "emailinvalid";
} else {

if ($user_email != "") {
  $sql "SELECT ".get_user_table_field("""user_email")."
  FROM "
.USERS_TABLE."
  WHERE "
.get_user_table_field("""user_email")." = '".strtolower($user_email)."'";
  if ($site_db->not_empty($sql)) {
//user name is not availble
echo "emailno";
  } else {
//user name is available
echo "emailyes";   
}
}
  }
} else {
echo "emailblank";
}
}
?>

That should do it. To change the allowed length of the username and password:

In user_availability.php FIND:
Code: [Select]
//username length
$MIN_LENGTH = 6;
$MAX_LENGTH = 20;
and
Code: [Select]
//password length
$MIN_LENGTH = 6;
$MAX_LENGTH = 20;

Change 6 to your desired minimum number of characters, and change 20 the the max allowed characters.

Done!

*EDIT* Oh, and Lucifix, feel free to update your original post with this new version if you want. That way, people won't have to install it, and then update it to this.

34
Mods & Plugins (Releases & Support) / Re: [MOD] Ajax Username Checker
« on: December 02, 2010, 05:37:26 AM »
Good idea. Maybe I can do that one myself too. Also, that last mod that you posted, if a user enters an available name, it will activate the submit button. Then he can go back and change to a name that is taken, and the submit button will still work.

So just do this.

*EDIT* Modified the code one more time, check my next post.

35
Mods & Plugins (Releases & Support) / Re: [MOD] Ajax Username Checker
« on: December 02, 2010, 04:51:34 AM »
Excellent mod. One thing though. If you click away from the username box, but leave it blank, it will say that the username is available. Any way to get it to instead say "Please enter a username"?

*EDIT*

Figured it out myself.

In user_availability.php

Replace:
if (isset($HTTP_POST_VARS['user_name'])) {

With:
if (isset($HTTP_POST_VARS['user_name']) && !empty($HTTP_POST_VARS['user_name'])) {

Replace:
}
?>


With:
} else {
	
echo 
"blank";
}
?>


In register_form.html

Replace:
	
	
  if(
data=='no'//if username not avaiable


With:
	
      if(
data=='blank'//if username not entered
	
	
  {
	
	
  
	
$(
"#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
	
	
	

	
	
	
  
//add message and change the class of the box and start fading
	
	
	
  $(
this).html('Please enter a username').addClass('messageboxerror').fadeTo(900,1);
	
	
	
});
	
	

          }
	
	
  else if(
data=='no'//if username not avaiable


Now if you don't enter a username, it'll tell you so.

36
Well, i edited it a bit, and it works. But now I'm trying to pull the category name of each image, and insert that as the keyword, instead of the image name. I got it to the point where it worked, but only for 1 image at a time. I have over 200,000 images, so that just won't work.

Here's what I'm using:

Code: [Select]
<?php



define
('ROOT_PATH''/home/*********/public_html/');

include(
ROOT_PATH.'config.php');
include(
ROOT_PATH.'includes/db_mysql.php');
include(
ROOT_PATH.'includes/constants.php');

$site_db = new Db($db_host$db_user$db_password$db_name) OR die("Keine Verbindung zum Datenbankserver.");



$sql "SELECT image_id, cat_id, image_name, image_description, image_keywords, image_media_file 
        FROM "
.IMAGES_TABLE.
        WHERE image_keywords = ''"
;

$result $site_db->query($sql);

while (
$row $site_db->fetch_array($result)){
  
$image_id $row['image_id'];
  
$cat_id $row['cat_id'];
  
$image_name $row['image_name'];
  
$image_description $row['image_description'];
  
$image_keywords $row['image_keywords'];
  
$image_media_file $row['image_media_file'];

  
  
$sql2 "SELECT cat_id, cat_name 
        FROM "
.CATEGORIES_TABLE.
        WHERE cat_id = 
$cat_id";

$result2 $site_db->query($sql2);

while (
$row $site_db->fetch_array($result2)){
  
$new_keywords $row['cat_name'];
}
  echo 
"Image ID: ".$image_id."<br>\n";
  echo 
"Image Name: ".$image_name."<br>\n";
  echo 
"Description: ".$image_description."<br>\n";
  echo 
"Keywords: ".$new_keywords."<br>\n";
  echo 
"Filename: ".$image_media_file."<br>\n";
  echo 
"<br><hr>\n";
  
$sql "UPDATE ".IMAGES_TABLE." SET image_keywords = '$new_keywords' WHERE image_id = '$image_id'";
  
$result mysql_query($sql) OR die("Fehler beim Schreiben in Tabelle.");
  }
  @
mysql_close($site_db); 

?>

37
Mods & Plugins (Releases & Support) / Re: [MOD] Support Ticket System
« on: November 12, 2010, 07:38:02 AM »
Great mod. I'm using it on a wallpaper site so people can report "stolen" wallpapers. But I'm having a few problem.

I'm having the problem mentioned by Nicky: "Date Created" will be always "01/01/70 01:00"

And also, when the "View Support Ticket(s)" link in the user info is blinking, you can't click on it. Well you can, but have have to click on it a bunch of times, really fast, and hope it hits one time. Is there an easy way to disable the blinking? I don't really need it. I'm using 4images 1.7.7


*EDIT*

Fixed the blinking thing. Just removed this from the page_header.php:

Code: [Select]
$url_support_check_ticket = "";
if(new_ticket_check($user_info['user_id'],$user_info['user_name'])){
  $url_support_check_ticket .= "<script language=\"JavaScript\">\n<!--\n var flg2=0;\n function new_tick_blink(){\n var myElement=document.getElementById('blnk2');\n flg2^=1;\n if(flg2==1){\n myElement.style.visibility='hidden';\n }\n else{\n myElement.style.visibility='visible';\n }\n timerID = setTimeout( 'new_tick_blink()' , 500 );\n }\n //-->\n</script>\n";
  $url_support_check_ticket .= "<span id=\"blnk2\"><a href=\"".$site_sess->url(ROOT_PATH."support.php")."\">".$lang['support_view']."</a></span></a><script language=\"JavaScript\">new_tick_blink();</script>";
  }

Still need to fix the creation date problem though. Also noticed that when you view a ticket in the admincp, when reading the replies, there's nothing there to tell you which user each message belongs to. It makes it look a little confusing, especially if more than one admin responds to the ticket.

38
I changed the root path, uploaded, and ran it. The first time I ran it, it did some images, from maybe 2 categories. But after that, when I click it to do more, all I get is a blank page.

39
Great job, man. This one finally got my brain working enough for me to figure out how to create a new screensaver mod for my site.

40
I was using the screensaver mod by KurtW, but since I've had to restore an older backup of my sites, it's not working. Since the mod is no longer available for download, I can't fix it.

So now I'm looking for a different screensaver mod, that can automatically make a screensaver from images in my gallery, with a user being able to select which images they want. I've searched around, but I don't think anyone else has made such a mod. Has anyone found another screensaver mod like that? Or is anyone working on one? If not, maybe someone knows of something else that I might be able to modify and make work for 4images.

41
Chit Chat / Re: KurtW MODs and Templates
« on: June 23, 2010, 12:38:42 PM »
Does anyone have the original zip file for the screensaver mod? I just had to restore an old backup of my db, and now I have to run the install for the mod again, and I can't find it.

42
I was going to start a new thread, but found this one on a search, so I'll just ask here.

I'm currently using {width} x {height} to display the size of an image on the details page, but is there a mod to store that info for each image in the database? I want to be able to use the image width and height as search criteria, and possible to limit uploads to certain resolutions.

43
Plugins / Re: [Plugin] Batch Import
« on: January 01, 2009, 12:04:19 AM »
Just tried it out. It works perfectly. Thanks.

44
Plugins / Re: [Plugin] Batch Import
« on: December 31, 2008, 07:09:50 PM »
Read your Pm. All taken care of.

And as for sessions.php, yes, I am going to ask what I need to do to fix it. Can I just add something like

Code: [Select]
RewriteRule ^(includes|sessions\.php) - [L]
to my .htaccess file? Or do I have to make changes to the sessions.php file itself?

45
It was set properly in the ACP. I had to set it to Default in the ACP, and then name the template Default. If I tried to use the template with any other name, and set it in ACP, it didn't work. None of the images in the template were showing up. Just the text.

Pages: 1 2 [3] 4