Vraag over registratie script met ajax

Status
Niet open voor verdere reacties.

Jeboem

Gebruiker
Lid geworden
18 jan 2002
Berichten
178
Hoi,

Heb op internet een registratie script met ajax gevonden.
Nu heb ik hier al het 1 en ander van aangepast voor een website.
Maar nu wou ik de index.php een andere naam geven en dan werkt op eens het script niet meer in ie. Hij werkt grotendeels wel in chrome tot dat je op registreren klikt.
Nu ben ik er achtergekomen dat als je de bestandsnaam veranderd van het script dat hij bij de controle de index.php gaat laden. Ik heb ff een voorbeeldje op internet gezet om te proberen. http://www.trancenetfm.com/test/registratienieuw.php en www.trancenetfm.com/test1/

In de laaste link werkt het script wel. In de eerste link heb ik de bestaandsnaam gewijzigd van index.php naar registratienieuw.php en op index.php heb ik een plaatje gezet.

Ik heb alleen geen flauw idee waar ik dit moet gaan zoeken om dit werkend te krijgen.
Iemand hier toevallig enig idee???

Hieronder nog ff de pagina's gepost.

Alvast bedankt!
Gr jeroen

index.php
HTML:
<?php
 
include('files/class/ajaxRegistrationModule.class.php');
$ajaxRegistrationModule = new ajaxRegistrationModule;

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Registratie Formulier</title>
<link href="files/css/register.css" rel="stylesheet" type="text/css" />
<?php echo $ajaxRegistrationModule->initScript();?>
</head>
<body>
    <!-- container start -->
    <div id="container">
      <div class="title">Registratie</div>
      <div class="ajax_notify"> 
            <!--don't delete this div class="ajax_notify"-->
            <img src="files/img/error.jpg" alt="error" />
             Error : Uw hebt het registratie formulier niet of niet juist ingevuld.<br>Zorg dat alle rode kruisen weg zijn.
      </div>
      <form action="index.php" method="post" class="ajax_form">
        <ul>
          <li class="label"> Email Address <span class="desc"> Vul een geldig email adres in</span> </li>
          <li class="field height45px">
            <input name="user_email" type="text" class="validate_unique_email text" id="user_email"/>
            <div class="ajax_error_user_email">
             Dit email adres bestaat al.
             <!--don't delete this div class="ajax_error_email" -->
            </div>
          </li>
          <li class="label"> Gebruikersnaam <span class="desc"> minimaal 6 karakters lang</span> </li>
          <li class="field height45px">
            <input name="user_gebrnaam" type="text" class="validate_unique_username text" id="user_gebrnaam" />
            <div class="ajax_error_user_gebrnaam">
             Gebruikersnaam bestaat al.
             <!--don't delete this div class="ajax_error_username" -->
            </div>
          </li>
          <li class="label"> Wachtwoord <span class="desc"> minimaal 6 karakters lang</span> </li>
          <li class="field">
            <input name="password" type="password" class="validate_password text"/>
          </li>
          <li class="label"> Controle Wachtwoord <span class="desc"> Herhaal uw wachtwoord</span> </li>
          <li class="field marginb35px">
            <input name="user_pass" type="password" class="validate_password_confirm text"/>
          </li>
          <li class="label"> Voornaam <span class="desc"> verplicht</span> </li>
          <li class="field">
            <input name="user_vnaam" type="text" class="validate_blank text"/>
          </li>
          <li class="label"> Achternaam <span class="desc"> verplicht</span> </li>
          <li class="field">
            <input name="user_anaam" type="text" class="validate_blank text"/>
          </li>
          <li class="label"> Provincie <span class="desc"> verplicht</span> </li>
          <li class="field">
            <select name="user_prov" class="text">
              
						  <option>Noord-Holland</option>
                          <option>Zuid-Holland</option>
                          <option>Overijssel</option>
                          <option>Drente</option>
                          <option>Flevoland</option>
                          <option>Groningen</option>
                          <option>Utrecht</option>
                          <option>Zeeland</option>
                          <option>Friesland</option>
                          <option>Limburg</option>
                          <option>Gelderland</option>
                          <option>Noord-Bradant</option>
                          <option>Belgi&euml;</option>
                          <option>Duitsland</option>
						  <option>Anders</option>
            </select>
          </li>
          <li class="label"> Woonplaats <span class="desc"> verplicht</span> </li>
          <li class="field">
            <input name="user_adres" type="text" class="validate_blank"/>
          </li>
          <li class="label"> Telefoon <span class="desc">  niet verplicht</span> </li>
          <li class="field">
            <input name="user_telefoon" type="text" class="text"/>
          </li>
         
          <!--      
          Please Read : 
          In adding form field element : 
          Doesn't need to add field name for the table and doesn't need also to edit/add php codes. 
          Example :
          1.) Try to remove the html comment below for tag element <li>..</li> then edit the config.php
          2.) Change the defined value of AUTOMATIC_CREATE_FIELDS_FROM_FORM to true 
              i.e define('AUTOMATIC_CREATE_FIELDS_FROM_FORM',true);       
          3.) Save the config.php file and then refresh Registration Module page, new fieldname should now created. 
          4.) Turn off the AUTOMATIC_CREATE_FIELDS_FROM_FORM to stop the automatic creation of field names. 
          5.) And finally, run this module.
          Note in adding fields:
              <input name="zipcode"> - automatically generates field name called zipcode. 
              <input name="#submit"> - with "#" sharp character will be bypass
          -->
          
          <!-- 
              <li class="label"> Zipcode <span class="desc">required</span> </li>
              <li class="field">
                <input name="zipcode" type="text" class="validate_blank text"/>
              </li>
          -->
          
          <li class="label"> </li>
          <li class="field">
            <input name="#agree" type="checkbox" value="1" class="validate_agree" />
            I agree the Terms and Conditions (required) 
          </li>
          <li class="label"> </li>
          <li class="field"> 
            <input name="#submit" type="submit" id="submit" value="Register"/> 
          </li>
          <li class="label wait"> 
            <span class="ajax_wait"><!--don't delete this span class="ajax_wait"--></span> 
          </li>
        </ul>
        <div class="ajax_target"><!--don't delete this div class="ajax_target" --></div> 
      </form>
      <?php 
       echo $ajaxRegistrationModule->initRegistration();
     ?>
    </div>
    <!-- container end -->
    
</body>
</html>

ajaxRegistrationModule.class.php

PHP:
<?php
 
/**
 * include the db class
 */ 
include('files/class/db.class.php');

class ajaxRegistrationModule  {
	
	private $timeout         = null;
	private $target_element  = null;
	private $wait_text       = null;
	private $form_element    = null;
	private $wait_element    = null;
	private $notify_element  = null;
	private $mysql;

/**
 * Loads  configuration and initialize the DB class
 * $this->is_register(); checks if the hml form is submitted
 */ 
  	function __construct() {
     	include('config.php'); 
	 	$this->mysql  = new Db;
	 	$this->mysql->connect();
	 	$this->check_unique();
		$this->is_register();
  	} 
/**
 * Gets ncluded php-jscript file and load to page.
 * @return void
 * @access public
 */ 	  	
	function initRegistration() {
	 	include ('files/inc/registration_script.php'); 	 
  	}
/**
 * Sets  jscript variable for username and password  
 * Echos  jquery.js and validate.js to page
 * @return string
 * @access private
 */ 	
  	function initScript() { 
	 	echo "<script type='text/javascript'>var MINIMUM_PASSWORD = " . VALIDATION_MINIMUM_PASSWORD_LENGTH  . ";" ;
	 	echo "var MINIMUM_USERNAME = " . VALIDATION_MINIMUM_USERNAME_LENGTH  . ";" ;
		echo "var AJAX_TARGET_ELEMENT = '" . AJAX_TARGET_ELEMENT  . "';</script>" ;
	 	$jquery   =  "<script type='text/javascript' src='files/js/jquery-1.3.2.min.js'></script>";
	 	$validate =  "<script type='text/javascript' src='files/js/validate.js'></script>";
	 	return $jquery . $validate;
  	}
/**
 * Checks  form if submitted and then insert values into database
 * @return void
 * @access private
 */ 
	function is_register() {
			if(count($_POST) >= 2 )  {
				$strSQL = " INSERT INTO " . USERS_TABLE_NAME . " SET " . $this->get_set_fields();
				$result = mysql_query($strSQL); 
				$this->jscript_location();
				exit;		
			}
	   	$this->check_formField();   
  	}
/**
 * Checks record if existing in the database and then display the jquery codes for error
 * @return integer
 * @access private
 */ 
	function check_unique($type = 1) {
		if(isset($_POST['ajaxdata'])) {
			$field = $_POST['ajaxtype'];
			$value = $_POST['ajaxdata'];
			$strSQL = " SELECT * FROM " . USERS_TABLE_NAME . " WHERE $field='" . trim($value) . "'";
			$result = mysql_query($strSQL); 
			$fetch  = mysql_fetch_array($result); 
			if($fetch) {
		 		 $exist = 1; 
			} else {
			   	 $exist = 0; 
			}
			if($type == 1) { 
				echo "<script> var exist = $exist; </script>";   		  
			}
			exit;		
	  	}
  	}	
/**
 * Checks $_POST['fields'] if set and call $this->mysql->check_set() for comparing  
 * @return void
 * @access private
 */   
  	function check_formField() {
      	if(isset($_POST['fields'])) {
        	 $this->mysql->check_set();
			 exit; 
	  	}
 	}
/**
 * Returns list of field names from the html form
 * @return string
 * @access private
 */    
  	function get_set_fields() {
    	$array       = array();
	  	$fields      = array_keys($_POST);
	  	$field_array = $this->mysql->get_table_fields();
	  	for ($i = 0; $i < count($fields); $i++)  {
		 	$value    = strip_tags($_POST["$fields[$i]"]);
		 	$exist    = $this->mysql->field_exist($fields[$i], $field_array);
		 	if($exist) { 
		   		$array[] = "`$fields[$i]` = '$value'"; 
		 	}
	  }
	  return implode(",", $array); 
  	}
/**
 * Echos  jquery code to page.This is used for displaying html tag defined in AJAX_NOTIFY_ELEMENT  
 * @return void
 * @access private
 */   
  	function notify_show() {
    	echo "<script>$('." . AJAX_NOTIFY_ELEMENT . "').fadeIn();</script>";
  	}
/**
 * Used for redirecting page that defined in SUCCESS_REGISTRATION_GOTO 
 * @return void
 * @access private
 */    
  	function jscript_location() {
    	$this->set_session();
    	echo "<script> $('#container').fadeOut();window.location.href='" . SUCCESS_REGISTRATION_GOTO . "'</script>";
  	}
/**
 * Sets  session if successful insertion of values in the database
 * @return void
 * @access private
 */   
  	function set_session() {
      	session_start();
	  	$_SESSION['is_successful_registration'] = true;
  	}
	
/**
 * Checks security for valid username,password etc.. in server side
 * will execute before form submitted
 * @return boolean
 * @access private
 */   
  function security_before_submitted() {
	  	/* will available in next version */
  } 	  	 
	  
}  
?>

db.class.php
PHP:
<?php
 
class Db {

/**
 * Connects  mysql and check if the table is existing
 * @return void
 * @access public
 */ 	
	function connect() {
    	$connect      = mysql_connect(MYSQL_HOSTNAME, MYSQL_USERNAME, MYSQL_PASSWORD);
	   	$select_db    = mysql_select_db (MYSQL_DATABASE, $connect); 
		if (!$connect) {
			$errno  = mysql_errno();
		   	switch($errno) {
		    	case 1045 : { 
					$this->error(); 
					break; 
				}
		    }
		}
		elseif(!$select_db) { 
			$this->error(); 
			break;
		}
		
		$strSQL = "SELECT * from " . USERS_TABLE_NAME . " limit 1";
        $result = mysql_query ($strSQL); 
		if($result == null) {
		   $this->create_table();
		   die();
		}
    }
/**
 * Checks  field names from form and compare them with the table field names
 * @return void
 * @access public
 */ 	
    function check_set() {
     	$field_array    = $this->get_table_fields();
	 	$form_fieldname = explode(",", $_POST['fields'][0]);
	 	for ($i = 0; $i < count($form_fieldname); $i++)  {
	   		$form_field   = $form_fieldname[$i];
	   		if(!strstr($form_field, "#")) {
	     		$this->search_add($form_field, $field_array);
	   		}
	 	}
   }
/**
 * Gets  list of field names from a table  
 * @return array
 * @access private
 */    
   	function get_table_fields() {
      	$fields  = mysql_list_fields(MYSQL_DATABASE, USERS_TABLE_NAME);
      	$columns = mysql_num_fields($fields);
      	for ($i = 0; $i < $columns; $i++)  {
	     	$field_array[] = mysql_field_name($fields, $i);
      	}
	  	return $field_array;
   	}
/**
 * Search form field name from an array that contains table field names  
 * @return boolean
 * @access private
 */    
   	function field_exist($fieldname_to_search, $field_array ) {
     	$search = str_replace('"', "", $fieldname_to_search);
	 	if (!in_array(trim($search), $field_array)) {
	   		return false;
     	}
	 	return true;
  	 }
/**
 * Creates table field in the database for variable $fieldname_to_search 
 * @return void
 * @access private
 */ 	 
   	function search_add($fieldname_to_search, $field_array ) {
     	$search = str_replace('"', "", $fieldname_to_search);
	 	if (!in_array(trim($search), $field_array)) {
			$result = mysql_query("ALTER TABLE " . MYSQL_DATABASE . "." . USERS_TABLE_NAME .
		          " ADD COLUMN " . str_replace('"', "`", $fieldname_to_search) . " VARCHAR(200) NULL DEFAULT null;");
     	}
   	}
/**
 * Displays  html in the page with mysql error
 * @return void
 * @access private
 */    
   	function error() {
    	echo "<div style='width:350;margin:auto;text-align:center;font-family:Arial'>
			     <span style='font-size:15px;color:red'>MYSQL SERVER ERROR : " . mysql_error() . "</span> 	
			  </div>";
		echo "<div style='width:350;margin:auto;text-align:center;margin-top:10px;font-family:Arial'>
				 You must edit first the <b>config.php</b> file and input your correct MySQL account, this file 
				 is located under this <b>register</b> folder.
				 <p>Note: if  the database TABLE doesn't exist this module will automatically create one.</p>
				 <p>After done editing the config.php try to refresh this page</p>.
			  </div>";	  
	    die();
   	}
/**
 * Creates table in the database that defined in USERS_TABLE_NAME  
 * @return void
 * @access private
 */      
   	function create_table() {
    	$strSQL = "CREATE TABLE `" . USERS_TABLE_NAME . "` (
				  `id` int(11) NOT NULL AUTO_INCREMENT,
				  `username` varchar(200) NOT NULL DEFAULT '',
				  `password` varchar(200) DEFAULT NULL,
				  `email` varchar(200) DEFAULT NULL,
				  `fname` varchar(200) NOT NULL DEFAULT '',
				  `lname` varchar(200) NOT NULL DEFAULT '',
				  `gender` int(11) DEFAULT '1',
				  `street` varchar(200) DEFAULT NULL,
				  `city` varchar(255) DEFAULT NULL,
				   PRIMARY KEY (`id`)
				  )ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;";
      	$result = mysql_query ($strSQL); 
	  	if(!$result) {
		   die("Couldn't connect to mysql hostname, Please check your configuration");
		}
		echo ('<meta http-equiv="refresh" content="0;">');
   	}
	 
	  
 }  
?>

registration_script.php


PHP:
<script type="text/javascript">
       //<![CDATA[
       $(document).ready(function() { 
           formRegister();
		   <?php if(AUTOMATIC_CREATE_FIELDS_FROM_FORM==true) { echo "check();"; } 
		   ?>
           function	formRegister() {
                $("#container").fadeIn();
				var options = { 
                    target       :  '.<?php echo AJAX_TARGET_ELEMENT; ?>',
                    timeout      :    <?php echo AJAX_TIMEOUT;?>,    
                    beforeSubmit :   request,  
                    success      :   response  
                }; 
               $('.<?php echo AJAX_FORM_ELEMENT;?>').submit(function() {  $(this).ajaxSubmit(options); return false;});  
			     $('.<?php echo AJAX_FORM_ELEMENT;?>').validate(); 
                function request(formData, jqForm, options) { 
                    valid = true;
                    $('.<?php echo AJAX_WAIT_ELEMENT; ?>').hide();
                    var label = "<span class='ajax_spinner'><img src='files/img/ispinner.gif' alt='wait'/><?php echo AJAX_WAIT_TEXT;?></span>";
                    $(".<?php echo AJAX_WAIT_ELEMENT; ?>").after(label);
                    $('.<?php echo AJAX_NOTIFY_ELEMENT; ?>').hide();						
                    var valid = jqForm.valid(); 	
					if(valid) {
                      return true;
                    } else { 
                     $('.<?php echo AJAX_WAIT_ELEMENT; ?>').show();
					 $('.ajax_spinner').fadeOut();
					 $(".ajax_spinner").remove();
					 $('.<?php echo AJAX_NOTIFY_ELEMENT; ?>').fadeIn(); 
                      return false;
                    } 
                } 
                function response(responseText, statusText) {
				   $('.<?php echo AJAX_WAIT_ELEMENT; ?>').show();
                   $('.ajax_spinner').fadeOut();
				   $(".ajax_spinner").remove();	
				 }
            }		
			function check() {
				var $inputs = $('.ajax_form input, .ajax_form textarea, .ajax_form select');
				var values  = '';
				$inputs.each(function(i, el) {
				   values   = values+'"'+this.name+'",'; 
				});
				$.post("index.php", { 'fields[]': [values] });
						  
			}
		    
			   
		}); 
		//]]>		
 </script>
validate.js
[JS]
/**
* Validate
* A plugin to simply validate form fields
*
* Version 1.2.3
* January 2009
*
* Copyright (c) 2009 Christopher M. Natan
* Dual licensed under the MIT and GPL licenses.
*
**/
;(function($) {
var img_e = "files/img/error.jpg";
var img_c = "files/img/checked.jpg";
var img_spin = "files/img/ispinner.gif";
var img_h = "";
var cls = new Array(10);
cls[0] = 'validate_blank';
cls[1] = 'validate_email';
cls[2] = 'validate_username';
cls[3] = 'validate_password';
cls[4] = 'validate_password_confirm';
cls[5] = 'validate_visa';
cls[6] = 'validate_agree';
cls[7] = 'validate_unique_username';
cls[8] = 'validate_unique_email';
var ajaxpost = 0;
$.fn.validate = function() {

for (var i=0; i<cls.length; i++) {
var name = cls;
var cl = $('.'+name);
$(cl).bind('blur', function() {check(this);});
if(i<7) {
$(cl).bind('keypress', function(){check(this);});
$(cl).bind('change', function(){check(this);});
} else {
$(cl).bind('keypress', function(){
$(this).attr("title",'');
});
}
}
return this;
};


$.fn.valid = function() {
return validcheck();
};
function validcheck() {
for (var i=0; i<cls.length; i++) {
var name = cls;
var cl = $('.'+name);
for (var x=0; x<cl.length; x++) {
check(cl[x]);
}
}
var err = count_error();
return err;
}
function count_error() {
var detect = $().find(".validate-error-e");
if(detect.length==0) { return true;}
return false;
}
function check(e) {
var temp = e.className;
var splits = temp.split(' ');
var name = splits[0];

var rnd = Math.round(Math.random() * 9999999999);
if(!e.id) { $(e).attr("id","validate_"+rnd); }
switch(name) {
case cls[0]:{validate_blank(e);break; }
case cls[1]:{validate_email(e);break;}
case cls[2]:{validate_username(e);break;}
case cls[3]:{validate_password(e);break;}
case cls[4]:{validate_password_confirm(e);break;}
case cls[5]:{validate_visa(e);break;}
case cls[6]:{validate_agree(e);break;}
case cls[7]:{
var title = $('#'+e.id).attr("title");
if(title!='chk') {
validate_unique_username(e);
}break;
}
case cls[8]:{
var title = $('#'+e.id).attr("title");
if(title!='chk') {
validate_unique_email(e);
}break;
}

}
};

function add(e){ return html(e,'e');};
function del(e){ return html(e,'c');};
function html(e,t) {
var tl = e.title;
var h = '';
var help = "<span style='padding-left:5px;'><a href='#' class='help' title='"+tl+"'>";
help = help + "<img src='"+img_h+"' border=0/></a></span>";
if(t=='e'){img = img_e; var error = true;}
else {img =img_c; var error = false;}

var classe = "class='validate-error-"+t+"'";
$("#s"+e.id).remove();
$("#"+e.id).after("<span id='s"+e.id+"'"+classe+"style='padding-left:5px;'><img src='"+img+"'/></span>"+h);
$("#"+e.id).fadeIn("slow");
return error;
}
function makeErr(e,t) {
if(t=='e'){img = img_e;}
else {img =img_c;}
var classe = "class='validate-error-"+t+"'";
$("#s"+e.id).remove();
$("#"+e.id).after("<span id='s"+e.id+"' "+classe+"style='padding-left:5px;' ><img src='"+img+"'/></span>");
$("#"+e.id).fadeIn("slow");
};
function validate_blank(e) {
if(e.value.length==0 || e.value==0) {
return add(e);}
else
{ return del(e);}
};
function validate_email(e) {
var emailfmt= /^\w+([.-]\w+)*@\w+([.-]\w+)*\.\w{2,8}$/;
if(!emailfmt.test(e.value) || e.value.length==0) {
return add(e);}
else
{ return del(e);}
};
function validate_username(e) {
var min = MINIMUM_USERNAME;
var len = e.value.length;
if(len < min || e.value.length==0)
{ return add(e);}
else
{ return del(e);}
};
function validate_unique_username(e) {
var is_err = validate_username(e);
if(!is_err) {
ajax_data(e);
}
};
function validate_unique_email(e) {
var is_err = validate_email(e);
if(!is_err) {
ajax_data(e);
}
};

function ajax_data(e) {
var value = $(e).val();
if(value!='') {
var title = $('#'+e.id).attr("title");
$("#s"+e.id).remove();
$("#"+e.id).after("<span id='s"+e.id+"'style='padding-left:5px;' ><img src='"+img_spin+"'/></span>");
$.post(" ", { ajaxdata: value, ajaxtype : e.id },
function(data){
$('.'+AJAX_TARGET_ELEMENT).html(data);
$("#s"+e.id).remove();
if(exist==1) {
$('.ajax_error_'+ e.id).fadeIn();
makeErr(e,'e');
} else {
$('.ajax_error_'+e.id).fadeOut();
makeErr(e,'c');
}
$('#'+e.id).attr("title",'chk');
});
}

};
function validate_password(e) {
var min = MINIMUM_PASSWORD;
var len = e.value.length;
if(len < min || e.value.length==0)
{ return add(e);}
else
{ return del(e);}
};
function validate_password_confirm(e) {
var p = $('.validate_password').val();
if(p != e.value || e.value.length==0)
{ return add(e);}
else
{ return del(e);}
};
function validate_visa(e){
var val = e.value;
if(val.length==16 && !isNaN(val)){
return del(e);
}
if(val.length==0){return add(e);}
else if(val.length<16 || isNaN(val)){
return add(e);
}
else if(val.length>16 || isNaN(val)){
return add(e);
}
};
function validate_agree(e) {
if(!e.checked)
{return add(e);}
else
{ return del(e);}
};


})(jQuery);


[/JS]
register.css
HTML:
* {margin:0; padding:0;}
html {background:#FFFFFF; font-family:Arial, Helvetica, sans-serif; font-size:12px;}
body {color:#666666}
ul,form,h2 {margin:0; padding:0; list-style:none; clear:both}
#container { width:440px; height:550px; margin:10px auto; background:#FFFFFF; border: 1px solid  #CCCCCC}
#container {  padding:10px 10px 0 20px}
#container div.title { background:url(../img/ititle_bg.gif) no-repeat; width:417px; height:35px; text-align:center}
#container div.title  { margin:0 0 22px 0; padding:3px 0 0 5px; color:#FFFFFF; font-size:16px; font-weight:normal }
#container form .label,.field { margin-bottom:1px;height:33px;}
#container form .label { width:200px; float:left; color:#666666; font-size:13px; font-weight:normal}
#container form select.combo {font-size:13px; width:140px; padding:1px;}
#container form .desc { font-size:11px; display:block; color:#999999; font-weight:normal}
#container form .field { width:190px; float:left }

#container form li.height45px { height:45px;}
#container form input {padding:0.15em;width:10em;color:#666666}
#container form input { font-family:Arial, Helvetica, sans-serif}
#container form input.validate_agree { margin:0; padding:0; width:10px}

div#register-success { width:300px; margin:20px auto; text-align:center}
li.marginb35px { margin-bottom:35px;}

.ajax_spinner { color:#003399; font-size:12px;}
.ajax_spinner img { vertical-align:middle}
.ajax_notify { border:1px solid #990000; font-size:18px; padding:5px; margin-bottom:10px; width:500px; display:none}
.ajax_notify  { font-weight:normal; color:#333333}
.ajax_notify img { vertical-align:middle}
.ajax_error_user_gebrnaam, .ajax_error_user_email { height:45px; font-weight:bold; color:#990000;}
.ajax_error_user_gebrnaam, .ajax_error_user_email{  display:none}


.ajax_notify { font-size:12px; width:330px;}
config.php
PHP:
<?php

  error_reporting(0);
  define('MYSQL_HOSTNAME',  'localhost');           /* hostname */
  define('MYSQL_USERNAME',  '*******');                /* username */
  define('MYSQL_PASSWORD',  '******');            /* password */
  define('MYSQL_DATABASE',  '*******');          /* database */
  
  /* if the defined table in USERS_TABLE_NAME doesn't exist in the Database,
   * this module  will attempt to create.
   */
  define('USERS_TABLE_NAME','va_user');
  
  /* If registration successful then it will redirected  to */
  define('SUCCESS_REGISTRATION_GOTO'   ,'registration_successful.php');
  
  /* If AUTOMATIC_CREATE_FIELDS_FROM_FORM enable or true, 
   * this will automatically creates new field names from the html form
   */
  define('AUTOMATIC_CREATE_FIELDS_FROM_FORM'   ,false);
  
  /* minimum character length for username and password */
  define('VALIDATION_MINIMUM_USERNAME_LENGTH'   ,6);
  define('VALIDATION_MINIMUM_PASSWORD_LENGTH'   ,6);
 
  
  
  
  
  
  
  
  
  
  
  
  /* Advance Configuration - doesn't need to edit this section */
  define('AJAX_TIMEOUT',        '10000000');
  define('AJAX_TARGET_ELEMENT', 'ajax_target');
  define('AJAX_WAIT_TEXT',      'Please wait...');
  define('AJAX_FORM_ELEMENT',   'ajax_form');
  define('AJAX_WAIT_ELEMENT',   'ajax_wait');
  define('AJAX_NOTIFY_ELEMENT', 'ajax_notify');
      

?>
 
Laatst bewerkt:
Ik ga er vanuit dat je dit:
HTML:
 <form action="index.php" method="post" class="ajax_form">

Ook aangepast hebt om te verwijzen naar de nieuwe naam?
 
Ik ga er vanuit dat je dit:
HTML:
 <form action="index.php" method="post" class="ajax_form">

Ook aangepast hebt om te verwijzen naar de nieuwe naam?

Uiteraard... Ben er al een poosje mee bezig om het voor elkaar te krijgen.
Maar de vraag is waar moet ik het zoeken, is het in het javascript verhaal in stylesheet of toch ergens in een php code. Kom er maar niet uit helaas.

Gr Jeroen
 
Heb je deze ook aangepast?
[js]$.post("index.php", { 'fields[]': [values] });[/js]
 
Hoi,

Direkt even geprobeert maar helaas geen verandering.....
Voor de gene die ff wil proberen:

bestaand email adres: admin(at)admin(punt)nl (forum zet automatisch tags om het email adres)
bestaand gebruikersnaam: administrator

Gr Jeroen
 
Laatst bewerkt:
Nog vlug even een update....

Het werkt nu perfect in chrome en firefox. Alleen nog niet in Internet Explorer.
In Internet explorer geeft ie nu de volgende fout:

Code:
Message: 'exist' is undefined
Line: 165
Char: 6
Code: 0
URI: http://www.trancenetfm.com/test/files/js/validate.js

Natuurlijk al ff gekeken naar de regel:

[JS]
function(data){
$('.'+AJAX_TARGET_ELEMENT).html(data);
$("#s"+e.id).remove();
-------->>> if(exist==1) {
$('.ajax_error_'+ e.id).fadeIn();
makeErr(e,'e');
} else {
$('.ajax_error_'+e.id).fadeOut();
makeErr(e,'c');
}
$('#'+e.id).attr("title",'chk');
});
}
[/JS]

Heb ook even gezocht waar de 'exist' wordt meegegeven en dat is in dit stukje:

PHP:
function check_unique($type = 1) {
		if(isset($_POST['ajaxdata'])) {
			$field = $_POST['ajaxtype'];
			$value = $_POST['ajaxdata'];
			$strSQL = " SELECT * FROM " . USERS_TABLE_NAME . " WHERE $field='" . trim($value) . "'";
			$result = mysql_query($strSQL); 
			$fetch  = mysql_fetch_array($result); 
			if($fetch) {
		 		 $exist = 1; 
			} else {
			   	 $exist = 0; 
			}
			if($type == 1) { 
				echo "<script> var exist = $exist; </script>";   		  
			}
			exit;

Hoe kan het dat dit dan wel in bv chrome en firefox werkt maar uiteraard weer eens niet in Internet Explorer?
En dan wordt deze wel meegegeven als ik de bestandsnaam niet verander en verander ik de bestandsnaam dan wordt deze niet meer meegegeven? Vreemd

Wie o wie heeft er nog een idee of oplossing??

Alvast bedankt,

Gr Jeroen
 
Status
Niet open voor verdere reacties.
Steun Ons

Nieuwste berichten

Terug
Bovenaan Onderaan