Location: PHPKode > projects > ZompLog > join.php
<?php

/* Written by Gerben Schmidt, http://scripts.zomp.nl */


ob_start();
include_once("admin/functions.php");
include_once("admin/config.php");
include("admin/session.php");
include('admin/loadsettings.php');

?>
<!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=ISO-8859-1" />
<title>Zomplog &rsaquo; Join</title>

<script type="text/javascript">
	function focusit() {
		document.getElementById('log').focus();
	}
	window.onload = focusit;
	</script>
	

<link href="admin/images/docsstyle.css" rel="stylesheet" type="text/css" />

</head>
<body>
<a name="top"></a>

<div id="header">
<div class="headercontent">
</div>
</div>
<div id="mainbox">
<div class="maincontent">

<?php


checkLoggedIn("no");

if(!$settings[use_join]){
header("Location: index.php");
}

if($_POST["submit"]){
	
	field_validator("login name", $_POST["login"], "alphanumeric", 4, 15);
	field_validator("password", $_POST["password"], "string", 4, 15);
	field_validator("confirmation password", $_POST["password2"], "string", 4, 15);
	
	
	if(strcmp($_POST["password"], $_POST["password2"])) {
		
		$messages[]="$lang_mismatch";
	}
	
	if(!$_POST['email']){
	$messages[]="$lang_message031";
	}
	
	if(!$_POST['name']){
	$messages[]="$lang_message030";
	}
	
		if(!$_POST['adress']){
	$messages[]="$lang_message034";
	}
	
			if(!$_POST['zip']){
	$messages[]="$lang_message035";
	}
	
				if(!$_POST['country']){
	$messages[]="$lang_message036";
	}
	
					if(!$_POST['gender']){
	$messages[]="$lang_message037";
	}
	


	
	$query="SELECT login FROM $table_users WHERE login='".$_POST["login"]."'";
	
	
	$result=mysql_query($query, $link) or die("MySQL query $query failed.  Error if any: ".mysql_error());
	

	if( ($row=mysql_fetch_array($result)) ){
		$messages[]="$lang_username \"".$_POST["login"]."\" $lang_login_id";
	}

	
	if(empty($messages)) {
		
			$birthday = $_POST['bMonth']." ".$_POST['bDay']." ".$_POST['bYear'];
		
		newUser($birthday);

		
		cleanMemberSession($_POST["login"], $_POST["password"]);

		
		header("Location: admin/members.php?".session_name()."=".session_id());

	}
}


if(!empty($messages)){
	displayErrors($messages);
}
?>
<br />
<form action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST">
  <table width="470" align="left" border="0">
    <tr>
      <td width="464">
  <table width="270" class="text">
    
    <tr>
      <td colspan="2"><div class="title">Register</div></td>
    </tr>
    <tr>
      <td colspan="2">All fields are required. </td>
    </tr>
    <tr>
      <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2">Login:</td>
    </tr>
    <tr> 
      <td colspan="2"><input type="text" name="login" value="<?php print $_POST["login"] ?>" maxlength="15" id="log"></td>
    </tr>
    <tr>
      <td colspan="2">Password:</td>
    </tr>
    <tr> 
      <td colspan="2"><input type="password" name="password" value="" maxlength="15" id="pwd"></td>
    </tr>
    <tr>
      <td colspan="2">Confirm password:</td>
    </tr>
    <tr> 
      <td colspan="2"><input type="password" name="password2" value="" maxlength="15" id="pwd2"></td>
    </tr>
    <tr>
      <td colspan="2">Email:</td>
    </tr>
    <tr>
      <td colspan="2"><input type="text" name="email" value="<?php print $_POST["email"] ?>" maxlength="80" id="email" /></td>
    </tr>
    <tr>
      <td colspan="2">Full name:</td>
    </tr>
    <tr>
      <td colspan="2"><input type="text" name="name" value="<?php print $_POST["name"] ?>" id="name" /></td>
    </tr>
    <tr>
      <td colspan="2">Adress:</td>
    </tr>
    <tr>
      <td colspan="2"><input type="text" name="adress" value="<?php print $_POST["adress"] ?>" id="adress" /></td>
    </tr>
    <tr>
      <td colspan="2">Zip:</td>
    </tr>
    <tr>
      <td colspan="2"><input type="text" name="zip" value="<?php print $_POST["zip"] ?>" id="zip" /></td>
    </tr>
    <tr>
      <td colspan="2">Country:</td>
    </tr>
    <tr>
      <td colspan="2">  
  <?php selectCountry(); ?>
</td>
    </tr>
    <tr>
      <td colspan="2">Gender:</td>
    </tr>
    <tr>
      <td colspan="2"><input name="gender" type="radio" value="male" />
        male 
          <input name="gender" type="radio" value="female" />
          female</td>
    </tr>
    <tr>
      <td colspan="2">Date of birth: </td>
    </tr>
    <tr>
      <td colspan="2">
	  
	<select name="bMonth" id="bMonth"></select>
	<select name="bDay" id="bDay"></select>
	<select name="bYear" id="bYear"></select>
	
<script type="text/javascript">
function selMosb(pid,pval){
	var h=document.getElementById(pid);
	var m= new Array('January','February','March','April','May','June','July','August','September','October','November','December');
	for(var i=1; i <= 12;i++)
		h.options[h.options.length]=new Option(m[i-1],i);
	h.value=pval;
	}
function selRngb(pid,pval,pstart,pend){
	var h=document.getElementById(pid);
	for(var i=pstart;i<=pend; i++)
		h.options[h.options.length]=new Option(i,i);
	h.value=pval;
	}// addStuff

	function selAddBlnkb(pid,pidx){
		var l= new Array('Year','Month','Day');
		var h=document.getElementById(pid);
		h.options[h.options.length]=new Option(l[pidx],0);
		}
	selAddBlnkb( "bYear",0);
	selAddBlnkb( "bMonth",1 );
	selAddBlnkb( "bDay",2);

selMosb( "bMonth", 0 );
selRngb( "bDay", 0, 1, 31 );
selRngb( "bYear", 0, 1906, 2006 );
</script>	  </td>
    </tr>
    <tr>
      <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2"><div align="right">
        <input name="submit" type="submit" value="Submit &rsaquo;&rsaquo;" id="submit" />
      </div></td>
    </tr>
    <tr>
      <td colspan="2">&nbsp;</td>
    </tr>
    <tr> 
      <td width="263"><a href="index.php">&lsaquo;&lsaquo; back to site </a></td>
      <td width="78"><div align="right"><a href="http://www.zomp.nl/zomplog/" target="_blank"></a> </div></td>
    </tr>
  </table>
  </tr></td></table>
</form>
</div>
</div>
</body>
</html>
Return current item: ZompLog