hi im inserting a new feild..
Actually i saw two different mods and tried them combining to work it out.. but not sure why it is not fully working..
I need help regarding this..
1st mod that i used in it ..
http://www.4homepages.de/forum/index.php?topic=26436.msg154676what i did in it is
1. Added two tables in db in users prefix
user_msn
user_cusitboth are varchar(55)
2. In includes/db_field_definitions.php
i added this
$additional_user_fields['user_msn'] = array($lang['user_msn'], "text", 1);
$additional_user_fields['user_cusit'] = array($lang['user_cusit'], "text", 1);before
?>3. in Lang lang/your_lang/main.php
i added this
$lang['msn'] = "MSN:";
$lang['cusit'] = "Cusit Adm No:";4. In lang/your_lang/admin.php
[php]$lang['field_msn'] = "MSN";
$lang['field_cusit'] = "Cusit Adm No";[/php]
5. In register.php
I Added
$user_msn = (isset($HTTP_POST_VARS['user_msn'])) ? ((intval(trim($HTTP_POST_VARS['user_msn']))) ? intval(trim($HTTP_POST_VARS['user_msn'])) : "") : ""; Above
$user_icq = (isset($HTTP_POST_VARS['user_icq'])) ? ((intval(trim($HTTP_POST_VARS['user_icq']))) ? intval(trim($HTTP_POST_VARS['user_icq'])) : "") : "";and
Added
$user_cusit = (isset($HTTP_POST_VARS['user_cusit'])) ? ((intval(trim($HTTP_POST_VARS['user_cusit']))) ? intval(trim($HTTP_POST_VARS['user_cusit'])) : "") : "";above
$user_password = (isset($HTTP_POST_VARS['user_password'])) ? trim($HTTP_POST_VARS['user_password']) : "";5.1
Added
"user_msn" => $user_msn,Above
"user_icq" => $user_icq,and
Added
"user_cusit" => $user_cusit,Above
"user_email" => format_text(stripslashes($user_email), 2),5.2
Added
"lang_msn" => $lang['msn'],Above
"lang_icq" => $lang['icq'],and
Added
"lang_cusit" => $lang['cusit'],Above
"lang_password" => $lang['password'],6 In details.php
Added
$comment_user_cusit = (isset($comment_row[$i][$user_table_fields['user_cusit']])) ? format_url($comment_row[$i][$user_table_fields['user_cusit']]) : "";
if (!empty($comment_user_cusit)) {
$comment_user_cusit_button = "<a href=\"".$comment_user_cusit."\" target=\"_blank\"><img src=\"".get_gallery_image("cusit.gif")."\" border=\"0\" alt=\"".$comment_user_cusit."\" /></a>";
}
$comment_user_msn = (isset($comment_row[$i][$user_table_fields['user_msn']])) ? format_url($comment_row[$i][$user_table_fields['user_msn']]) : "";
if (!empty($comment_user_msn)) {
$comment_user_msn_button = "<a href=\"".$comment_user_msn."\" target=\"_blank\"><img src=\"".get_gallery_image("msn.gif")."\" border=\"0\" alt=\"".$comment_user_msn."\" /></a>";
}
Above
$comment_user_icq = (isset($comment_row[$i][$user_table_fields['user_icq']])) ? format_text($comment_row[$i][$user_table_fields['user_icq']]) : "";
if (!empty($comment_user_icq)) {
$comment_user_icq_button = "<a href=\"http://www.icq.com/people/about_me.php?uin=".$comment_user_icq."\" target=\"_blank\"><img src=\"http://status.icq.com/online.gif?icq=".$comment_user_icq."&img=5\" width=\"18\" height=\"18\" border=\"0\" alt=\"".$comment_user_icq."\" /></a>";
}7. Added
$user_cusit = (isset($user_row['user_cusit'])) ? format_text(format_url($user_row['user_cusit']), 2) : REPLACE_EMPTY;
if (!empty($user_cusit) && $user_cusit != REPLACE_EMPTY) {
$user_cusit_button = "<a href=\"".$user_cusit."\" target=\"_blank\"><img src=\"".get_gallery_image("cusit.gif")."\" border=\"0\" alt=\"".$user_cusit."\" /></a>";
}
else {
$user_cusit_button = REPLACE_EMPTY;
}
$user_msn = (isset($user_row['user_msn'])) ? format_text(format_url($user_row['user_msn']), 2) : REPLACE_EMPTY;
if (!empty($user_msn) && $user_msn != REPLACE_EMPTY) {
$user_msn_button = "<a href=\"".$user_msn."\" target=\"_blank\"><img src=\"".get_gallery_image("msn.gif")."\" border=\"0\" alt=\"".$user_msn."\" /></a>";
}
else {
$user_msn_button = REPLACE_EMPTY;
}
Above
$user_icq = (isset($user_row['user_icq'])) ? $user_row['user_icq'] : REPLACE_EMPTY;
if (!empty($user_icq) && $user_icq != REPLACE_EMPTY) {
$user_icq_button = "<a href=\"http://www.icq.com/people/about_me.php?uin=".$user_icq."\" target=\"_blank\"><img src=\"http://status.icq.com/online.gif?icq=".$user_icq."&img=5\" width=\"18\" height=\"18\" border=\"0\" alt=\"".$user_icq."\" /></a>";
}
else {
$user_icq_button = REPLACE_EMPTY;
}
8. Now did done steps of with html things from the mod.. you can see..
member_profile.html
member_editprofile.html
plus added in
register_form.html the text field for user..
so..after this mod was working fine so..
i mean when some one register his/her id is saved in database also showed on details.php
but that was not enough..
cuz id of our university is in numeric form and are of four digits ...
so i applied maxlength to 5 and also did added javascript file and linked in header and called with in textfiled of id..
what id did that when some one try to type alphabet it dont type alphabets..
only numeric values are accepted..
is working great up to here..
i wanted another thing..with this and also asked here..
i wanted to have javascript add..so when some one try to leave the id place empty it should give message that place is empty. same
check if id already exist. max characters etc..
so the mod i already added for username and pass i did some changes in it..
this is the other mod..which i added..
http://www.4homepages.de/forum/index.php?topic=23848.0
Also many thanks to
zhono who did many more changes to give it a much more better look..
so now see files here which i did editing..after zhono editings
1. In page_header.php
Replaced
"url_user_availability" => $site_sess->url(ROOT_PATH."user_availability.php", "&"),with
"url_user_cusit" => $site_sess->url(ROOT_PATH."user_availability.php?check=cusit", "&"),
"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", "&"),2. In register_form.html (in my templates folder)
Replaced the javascript original on top with this.
<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 idOk = 0;
var passOk = 0;
var emailOk = 0;
$("#submitButton").attr("value", "Disabled");
$("#submitButton").attr("disabled", "true");
$("#cusit").blur(function()
{
//remove all the class add the messagebox classes and start fading
$("#msgbox").removeClass().addClass('messagebox').text('Checking...').fadeIn("slow");
//check the CUSIT ID exists or not from ajax
$.post("{url_user_cusit}",{ user_cusit:$(this).val() } ,function(data)
{
if(data=='idblank') //if cusit id is 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_cusit_empty}').addClass('messageboxerror').fadeTo(900,1);
});
idOk = 0;
}
else if(data=='idlength') //if id is less than 4 or more than 4 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_cusit_length}').addClass('messageboxerror').fadeTo(900,1);
});
idOk = 0;
}
else if(data=='idno') //if CUSIT ID 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_cusit_taken}').addClass('messageboxerror').fadeTo(900,1);
});
idOk = 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_cusit_good}').addClass('messageboxok').fadeTo(900,1);
});
idOk = 1;
if (idOk==1 && passOk==1 && emailOk==1) {
$("#submitButton").attr("value", "Register");
$('#submitButton').removeAttr('disabled');
} else {
$("#submitButton").attr("disabled", "true");
$("#submitButton").attr("value", "Disabled");
}
}
});
});
$("#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>and added feild above username
<td><b>CUSIT ID:</b></td>
<td height="50px">
<input type="text" name="user_cusit" size="5" Maxlength="5" value="{user_cusit}" id="user_cusit" class="text" onKeyPress="return numbersonly(this, event)" /> <br/><span id="msgboxid" style="display:none"></span>
</td>
</tr>3. in main.php
i added
$lang['ajax_cusit_empty'] = "Enter your University ID no of 4 digits";
$lang['ajax_cusit_length'] = "University ID must be of 4 digits";
$lang['ajax_cusit_taken'] = "This ID has already Been Registered";
$lang['ajax_cusit_good'] = "University ID is available and good to register";above
$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";4 in register.php
i added
"lang_ajax_cusit_empty" => $lang['ajax_cusit_empty'],
"lang_ajax_cusit_length" => $lang['ajax_cusit_length'],
"lang_ajax_cusit_taken" => $lang['ajax_cusit_taken'],
"lang_ajax_cusit_good" => $lang['ajax_cusit_good'],above
"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']5. replace user_availability.php
with this code
<?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'] == "cusit") {
if (isset($HTTP_POST_VARS['user_cusit']) && !empty($HTTP_POST_VARS['user_cusit'])) {
$user_cusit = preg_replace("/[ ]{2,}/", " ", un_htmlspecialchars(trim($HTTP_POST_VARS['user_cusit'])));
//CUSIT ID length
$MIN_LENGTH = 4;
$MAX_LENGTH = 4;
if ((strlen($user_cusit) < $MIN_LENGTH) || (strlen($user_cusit) > $MAX_LENGTH)) {
echo "idlength";
} else {
if ($user_cusit != "") {
$sql = "SELECT ".get_user_table_field("", "user_cusit")."
FROM ".USERS_TABLE."
WHERE ".get_user_table_field("", "user_cusit")." = '".strtolower($user_cusit)."'";
if ($site_db->not_empty($sql)) {
//ID is not availble
echo "idno";
} else {
//ID is available
echo "idyes";
}
}
}
} else {
echo "idblank";
}
}
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";
}
}
?>but still no luck getting that ajax message on putting details etc..
like check if id exists or not..
i hope i didnt messed up the code with ajax??
please any coder see and help regarding this issue, will be great favour..
here is my link of website
cusitlibrary.com/register.php
looking forward to your generous help..please loook in to this..