Location: PHPKode > projects > Wiki-Map > htdocs/register.php
#   Copyright notice                                                                
#   This file is part of Wiki-Map project [http://wiki-map.sourceforge.net/] 
#   Wiki-Map 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.                                    
#   The GNU General Public License can be found at                        
#   http://www.gnu.org/copyleft/gpl.html.                                 
#   A copy is found in the textfile GPL and important notices to the      
#   license from the team is found in the textfile LICENSE distributed    
#   with these scripts.                                                    
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   This copyright notice MUST APPEAR in all copies and derivatives of the script!
# $Source: /cvsroot/wiki-map/htdocs/register.php,v $
# $Header: /cvsroot/wiki-map/htdocs/register.php,v 1.1 2005/11/19 09:43:25 soumya42 Exp $
# $Author: soumya42 $

# All PHP scripts requires

dss.php          # DSS has global variables setup, and some common scripts
codepage.php     # Includes all user prompts declared as variable string for internatiolization
authorize.php    # Check authorization for running the program

All these scripts are referenced from /htdocs/ directory

# Global database variables (Defined in dss.php)
# 	$host      	- Database host
# 	$db_base    	- Database name
# 	$db_owner  	- Database user
# 	$db_passwd	- Database password
# ------------------- Your program should come below this --------------------------- -->

                     ******** Register New User  *************


  define("CAPTCHA_INVERSE", 0);
  include "captcha.php";

if (isset($_POST[login])) {
// Validate data
	$res = captcha::check();
if (isset($res)) {
     if ($res) { 	
	$validate = ($_POST[pass1] == $_POST[pass2]);
	if (!$validate) {echo "<P> Passwords do not match</P>";}
	if (!isset($_POST[pass1])){
		echo "<P>Password is required</P>";
		$validate = false;
	if (!isset($_POST[agree])){
			echo "<p>You have not agreed with the terms</p>";
			$validate = false;
	if (!preg_match('/\d+/',$_POST[ph_o])) {
		echo "<P> Office ph. no $_POST[ph_o] is not a valid number</P>";
		$validate = false;
	if (!preg_match('/\d+/',$_POST[ph_h])) {
		echo "<P> House ph. no $_POST[ph_h] is not a valid number</P>";
		$validate = false;
	if (!preg_match('/\d+/',$_POST[ph_m])) {
		echo "<P> Mobile ph. no $_POST[ph_m] is not a valid number</P>";
		$validate = false;
	if (!isset($_POST[email])){
		$validate = false;
		echo "<p>E-Mail address is required for reistration</p>";
	} else {
		if (!preg_match('/\w+@\w+/',$_POST[email])){
				$validate = false;
				echo "<p>A valid Email address is required for registration</p>";
		echo "<P>** Data Error **</P>"; exit;
	$dt = date('Y-m-d h:m');
	$pass = md5($_POST[pass1]);

	$sql = "INSERT INTO user (logname,password,f_name,l_name,ph_o,ph_h,ph_m,e_mail,";
	$sql .= "o_addr1,o_addr2,o_city,o_cntry,o_zip,h_addr1,h_addr2,h_city,h_cntry,h_zip,";
	$sql .= "status,groups,created_on) values (";
	$sql .= "'$_POST[login]',	'$pass','$_POST[fname]','$_POST[lname]',";
	$sql .= "'$_POST[ph_o]',	'$_POST[ph_h]',		'$_POST[ph_m]',";
	$sql .= "'$_POST[email]',	'$_POST[o_addr1]',	'$_POST[o_addr2]',";
	$sql .= "'$_POST[o_city]',	'$_POST[o_cntry]',	'$_POST[o_zip]',";
	$sql .= "'$_POST[h_addr1]',	'$_POST[h_addr2]',	'$_POST[h_city]',";
	$sql .= "'$_POST[h_cntry]',	'$_POST[h_zip]',	'new', 'uc','$dt');";

	$result = mysql_query($sql);
	if (!$result){
		echo '<P>** Creation falied ** '.mysql_error().'</P>';

	echo "<P> Processing completed </P><A HREF='index.php'>Home</A>";
} else {
<title>WikiMap: User registration</title>
<style type="text/css">
     @import url(./wikimap.css);
<H2>WikiMap: New User Registration </H2><HR>
<FORM method='POST'>
	<INPUT type=text name=login>
    <INPUT type=password name=pass1>
    Confirm Password<br>
    <INPUT type=password name=pass2>
    First Name <br>
    <INPUT type=text name=fname>
	Last Name <br>
    <INPUT type=text name=lname><br>
	Phone No(Office)<br>
    <INPUT type=text name=ph_o size=15><br>
	Phone No(Home)<br>
    <INPUT type=text name=ph_h size=15><br>
	Phone No(Mobile)<br>
    <INPUT type=text name=ph_m size=15><br>
<INPUT type=text name=email size=20>
Home Address:<br>
    <INPUT type=text name=h_addr1 value='House No'><br>
    <INPUT type=text name=h_addr2 value='Postal Area'><br>
    <INPUT type=text name=h_city value='City'><br>
    <INPUT type=text name=h_zip value='PIN code'><br>
    <INPUT type=text name=h_cntry value='India'><br>
Office Address:<br>
    <INPUT type=text name=o_addr1 value='House No'><br>
    <INPUT type=text name=o_addr2 value='Postal Area'><br>
    <INPUT type=text name=o_city value='City'><br>
    <INPUT type=text name=o_zip value='PIN code'><br>
    <INPUT type=text name=o_cntry value='India'><br>

<TR><TD colspan=3>
<h4 align=center>Terms and condition</h4>
<div id=terms>
<p>This site is made 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.</p>
<p> WikiMap is an online collaborative open-content Geographical Knowledge repository. It is a voluntary association of individual and groups working to develop a common resource of human knowledge on places on Earth. The facility allows anyone with access to Internet alter its content. Please be advised that nothing found here has necessarily been reviewed by people with expertise to provide accurate or reliable information.</p>
<p>This is to say, there is no formal peer review and moderation in place. You are adviced to cross check the information of this site from independent cross reference. While the readers of wikimap would normally correct errors, they have no legal duty to do so and thus all information read here is without any implied warranty of fitness for any purpose or use.</p>
<p>None of the contributors, sponsors, administrators, or anyone else connected with WikiMap in any way whatsoever can be held responsible for the appearance of any inaccurate or libelous information or for your use of the information contained in or linked from these web pages.</p>
<p>Please make sure that you understand that the information provided here is being provided freely, and that no kind of agreement or contract is created between you and the owners or users of this site, the owners of the servers upon which it is housed, the individual WikiMap contributors, any project administrators, sysops or anyone else who is in any way connected with this project or sister projects subject to your claims against them directly. You are being granted a limited license to copy anything from this site; it does not create or imply any contractual or extracontractual liability on the part of WikiMap or any of its agents, members, organizers or other users.</p>
<p>There is no agreement or understanding between you and WikiMap regarding your use or modification of this information beyond the GNU Free Documentation License (GFDL); neither is anyone at WikiMap responsible should someone change, edit, modify or remove any information that you may post on WikiMap or any of its associated projects.</p>
<p>Any of the trademarks, service marks, collective marks, design rights, personality rights or similar rights that are mentioned, used or cited in the articles of the WikiMap encyclopedia are the property of their respective owners. Their use here does not imply that you may use them for any other purpose other than for the same or a similar informational use as contemplated by the original authors of these WikiMap articles under the GFDL licensing scheme. Unless otherwise stated WikiMap and Wikimedia sites are neither endorsed nor affiliated with any of the holders of any such rights and as such WikiMap cannot grant any rights to use any otherwise protected materials. Your use of any such or similar incorporeal property is at your own risk.</p>
<p>Publication of information found in WikiMap may be in violation of the laws of the country or jurisdiction from where you are viewing this information. The WikiMap database is maintained in reference to the protections afforded under Indian Laws. Laws in your country or jurisdiction may not protect or allow the same kinds of speech or distribution. WikiMap does not encourage the violation of any laws; and cannot be responsible for any violations of such laws, should you link to this domain or use, reproduce, or republish the information contained herein.</p>
<p>If you need specific advice (for example, medical, legal, financial, or risk management) please seek a professional who is licensed or knowledgeable in that area.</p>

<INPUT type=checkbox name=agree> I agree with the terms and condition
<TR><TD colspan=2>
 echo captcha::form();
<INPUT type=submit name=b_submit value='UPDATE'>
<INPUT type=reset name=b_reset value='RESET'>


#---------------------------- End of program --------------------------------------------
# $Log: register.php,v $
# Revision 1.1  2005/11/19 09:43:25  soumya42
# New addition
Return current item: Wiki-Map