0

I have all the php coding Insert, view, delete. The problem now is user only can use once email address to register at my website. I would want them to register with same email at my website.

is it possible?

Thanks!

1
Contributor
1
Reply
2
Views
6 Years
Discussion Span
Last Post by alanlee9898
0
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST')
{	
	$file = array();
	$file = explode(',', $_POST['uploads']);
	
	$name = $_POST['name'];
	$email = $_POST['email'];
	$icno = $_POST['icno'];
	$phone = $_POST['phone'];
	
	$subcat = $_POST['subcat'];	
	$mode = 0;
	//sell
	if($_POST['sell'] == 'on' && $_POST['rent'] == '')
	{ $mode = 1; }
	//rent
	if($_POST['sell'] == '' && $_POST['rent'] == 'on')
	{ $mode = 2; }	
	//both
	if($_POST['sell'] == 'on' && $_POST['rent'] == 'on')
	{ $mode = 3; }	
	
	$header = $_POST['header'];
	$text = $_POST['text'];
	$addr = $_POST['addr'];
	$loc_id = $_POST['location'];
	$sub_id = $_POST['subcat'];
	$price = $_POST['price'];
	$reg_year = $_POST['reg_year'];
	$room = $_POST['broom']; 
	$space = $_POST['space'];
	$htitle = $_POST['htitle'];
	$pwd = sha1($_POST['pwd']);
	
	if(isset($_SESSION['user_id'])){
		$user_id = $_SESSION['user_id'];
		
		//validate this user..
		$q = "select count(*) from post_user where user_pwd = '$pwd' and user_id = $user_id";
		$r = $c->Execute($q);
		
		if($r->fields[0] == 0){
			?>
			<script language="javascript" type="text/javascript">
            alert('You have entered the wrong password for your account.');
            history.go(-1);
            </script>
            <?php
            exit;
        }
		
		if(isset($_POST['update_info'])){
			$q = "update post_user set user_name = '$name', user_email = '$email', user_phone = '$phone', loc_id = '$loc_id' where user_id = $user_id";
			$r = $c->Execute($q);
		}
	}else{
		$q = "insert into post_user 
		(user_id, user_name, user_email, user_phone, user_region, user_pwd, user_reg, user_active, utype_id) 
		values (null, '$name', '$email', '$phone', '$loc_id', '$pwd', convert_tz(now(), '-07:00', '+08:00'), 1, 2)";
		$r = $c->Execute($q);
		
		$user_id = $c->Insert_ID();
	}
	
	//publish status...
	//0 - unpublished
	//1 - published
	//2 - prohibited
	
	$q = "insert into post_item (item_id, item_stamp, item_title, item_desc, item_price, item_addr, 
		item_mode, item_yr, item_room, item_space, item_htitle, item_publish, loc_id, sub_id, user_id) 
		values (null, convert_tz(now(), '-07:00', '+08:00'), '$header', '$text', '$price', '$addr',
		$mode, '$reg_year', '$room', '$space', '$htitle', 0, $loc_id, $sub_id, $user_id)";
	$r = $c->Execute($q);
	
	$item_id = $c->Insert_ID();
	
	for($i=0; $i<count($file); $i++){
		$path = $file[$i];
		if($path != ''){
			$q = "update images set item_id = $item_id where img_path = '$path'";
			$r = $c->Execute($q);
		}
	}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.