Subject PLZ HELP - I am lost
Author jason_panzera
Hay there,

I have a problem, this form works perfectly well on two local
machines, but on the server it only allows 1 person to signup and
then I have to restart IIS so another user can register. I can't see
the prob here or on the server. PLZ HELP

Jason

<?php
session_start();
require_once 'dbcon.php';
$registered=0;
if ($_POST['submit']=='Register'){
$query = "SELECT * from MEMBERS where EMAIL='".$_POST
['EMAIL']."'";
$result = ibase_query($dbh, $query);
$row = ibase_fetch_assoc($result);
$email_exist = 0;
if ($row[EMAIL] == $_POST['EMAIL']) $email_exist =
1;
if ($email_exist == 0){

if(($_POST['WEBPASSWORD'] != ($_POST['WEBPASSWORD_again']))
|| $_POST['WEBPASSWORD'] == ''){
$msg = '<span class="sub_heading"><font
color=red>Incorrect passord</font></span><br><br>';
} else {
/*
//strip tags before enter data in db
$_POST[VENUE] = addslashes(htmlspecialchars($_POST
[VENUE]));
$_POST[SURNAME] = addslashes(htmlspecialchars($_POST
[SURNAME]));
$_POST[NAME] = addslashes(htmlspecialchars($_POST
[NAME]));
$_POST[TELH] = addslashes(htmlspecialchars($_POST
[TELH]));
$_POST[CEL] = addslashes(htmlspecialchars($_POST
[CEL]));
$_POST[FAX] = addslashes(htmlspecialchars($_POST
[FAX]));
$_POST[EMAIL] = addslashes(htmlspecialchars($_POST
[EMAIL]));
$_POST[ADDRESS1] = addslashes(htmlspecialchars($_POST
[ADDRESS1]));
$_POST[ADDRESS2] = addslashes(htmlspecialchars($_POST
[ADDRESS2]));
$_POST[ADDRESS3] = addslashes(htmlspecialchars($_POST
[ADDRESS3]));
$_POST[ADDRESS4] = addslashes(htmlspecialchars($_POST
[ADDRESS4]));
$_POST[POSTAL1] = addslashes(htmlspecialchars($_POST
[POSTAL1]));
$_POST[POSTAL2] = addslashes(htmlspecialchars($_POST
[POSTAL2]));
$_POST[POSTAL3] = addslashes(htmlspecialchars($_POST
[POSTAL3]));
$_POST[POSTAL4] = addslashes(htmlspecialchars($_POST
[POSTAL4]));


$_POST[ID] = addslashes(htmlspecialchars($_POST[ID]));
$_POST[OCCUPATION] = addslashes(htmlspecialchars
($_POST[OCCUPATION]));
$_POST[TELW] = addslashes(htmlspecialchars($_POST
[TELW]));
$_POST[BANKNAME] = addslashes(htmlspecialchars($_POST
[BANKNAME]));
$_POST[BRANCHNAME] = addslashes(htmlspecialchars
($_POST[BRANCHNAME]));
$_POST[BRANCHCODE] = addslashes(htmlspecialchars
($_POST[BRANCHCODE]));
$_POST[BANKACCOUNT] = addslashes(htmlspecialchars
($_POST[BANKACCOUNT]));
$_POST[ACCOUNTHOLDER] = addslashes(htmlspecialchars
($_POST[ACCOUNTHOLDER]));
$_POST[ACCOUNTTYPE] = addslashes(htmlspecialchars
($_POST[ACCOUNTTYPE]));


$_POST[DIRECTIONS] = addslashes(htmlspecialchars
($_POST[DIRECTIONS]));
*/
$query = 'SELECT * from MEMBERS order by LINK desc';
$result = ibase_query($dbh, $query);
$row = ibase_fetch_assoc($result);
$link_no = $row[LINK];
$link_no++;

$query = "INSERT INTO MEMBERS
(LINK,SURNAME,NAME,TELH,CEL,FAX,EMAIL,ADDRESS1, ADDRESS2,
ADDRESS3,ADDRESS4,ADDRESS5,";

$query .= "POSTAL1,POSTAL2,POSTAL3,POSTAL4,MEMBERSHIPID,WEBPAS
SWORD,VENUENAME) VALUES (".$link_no.",'".ucwords(substr($_POST
['SURNAME'], 0, 30));
$query .= "', '".ucwords(substr($_POST['NAME'], 0,
30))."', '".substr($_POST['TELH'], 0, 30)."', '".substr($_POST
['CEL'], 0, 30);
$query .= "', '".substr($_POST['FAX'], 0,
30)."', '".strtolower(substr($_POST['EMAIL'], 0, 36))."','".substr
($_POST['ADDRESS1'], 0, 30);
$query .= "', '".substr($_POST['ADDRESS2'], 0,
30)."', '".substr($_POST['ADDRESS3'], 0, 30)."','".substr($_POST
['ADDRESS4'], 0, 30);
$query .= "', '".substr($_POST['ADDRESS5'], 0,
30)."', '".substr($_POST['POSTAL1'], 0, 20)."', '".substr($_POST
['POSTAL2'], 0, 20);
$query .= "', '".substr($_POST['POSTAL3'], 0,
20)."', '".substr($_POST['POSTAL4'], 0, 20)."', '".substr($_POST
['MEMBERSHIPID'], 0, 30)."', '".strtolower(substr($_POST
['WEBPASSWORD'], 0, 20))."','".substr($_POST['VENUE'], 0, 30)."')";

//echo $query;
$result=ibase_query($dbh, $query) or
die('Database error. Please contact
Administrator');
//if (!mail("nedeljko@...", "My
Subject", "this is just test email\n")) echo error;

$message = '
<html>
<head>
<title>Wildfly - Confirm of
membership</title>
</head>
<body>
<br><strong>Welcome to
Wildfly</strong>
<br>
<br>You are now a registered member
of the Wildfly community, which depending on
<br>what membership you have
selected, will give you access to a wide range of different benefits.
<br>
<br>
<br><strong>Your Registrations
Detials:</strong>
<br> Email Address: '.$_POST
['EMAIL'].'
<br> Password: '.$_POST
['WEBPASSWORD'].'
<br>
<br>
<br>We hope you enjoy everything that
WildFly has to offer and should you have
<br>any questions or need anything in
the world of fly fishing, please do not
<br>hesitate to contact us.
<br>
<br>Please Do not reply to this email!
<br>
<br>
<br>Regards,
<br>Wildfly
<br>
<br>www.wildfly.co.za
<br>Tel (033) 2666981
<br>Fax (033) 2666981
<br>Email: reservations@...
</body>
</html>';

$emailfrom
= 'admin@...';
$emailto = $_POST
['EMAIL'].',gareth@...,jason@...';
$subject = 'Wildfly -
Confirmation of membership';

$headers = "MIME-Version: 1.0
\r\n";
$headers .= "Content-type:
text/html; charset=iso-8859-1\r\n";

// additional headers
$headers .= "To:
$emailto\r\n";
$headers .= "From:
$emailfrom\r\n";
$headers .= "Cc:\r\n";
$headers .= "Bcc:\r\n";
// and now mail it

$query = "select * from
members where ((EMAIL='" . $_POST['EMAIL'] . "') or (EMAIL='" .
strtoupper($_POST['EMAIL']) . "')) and WEBPASSWORD='" . $_POST
['WEBPASSWORD'] . "'";
$result = ibase_query
($dbh, "select * from members where ((EMAIL='" . $_POST
['EMAIL'] . "') or (EMAIL='" . strtoupper($_POST['EMAIL']) . "')) and
WEBPASSWORD='" . $_POST['WEBPASSWORD'] . "'");
if ($row = ibase_fetch_assoc
($result)) {
session_register('login');
session_register
('member_id');
$_SESSION['login'] = $row
['MEMBERSHIPID'];
$_SESSION['member_id'] = $row
['LINK'];

mail($emailto, $subject,
$message, $headers);
session_write_close();
ibase_close($dbh);
if ($row['MEMBERSHIPID']
=="Fly Fisher") header("Location: club_rulesb.php");
else header("Location:
myadminvenue.php");
}else {
// not send email and
password
header('Location: join.php');
}
}
}
$registered = 1;
}
include('header.php');
?>
<script src="js/check.js" type="text/javascript"></script>
<script Language="JavaScript">
function validateForm(theForm)
{
if (!validRequired(theForm.NAME,"Name")){return false;}
if (!validRequired(theForm.SURNAME,"Surname")){return false;}
if (!validRequired(theForm.CEL,"Cel")){return false;}
if (!validRequired(theForm.WEBPASSWORD,"Password")){return false;}
if (!isequal
(theForm.WEBPASSWORD_again,theForm.WEBPASSWORD,"Passwords")){return
false;}
if (!validEmail(theForm.EMAIL,"Email Address",true)) return false;
return true;
}
</script>
<style type="text/css">
<!--
.style1 {font-weight: bold}
-->
</style>
<link href="main.css" rel="stylesheet" type="text/css">

<table width="770" border="0" align="center" cellpadding="6"
cellspacing="0" class="lastest_catch_boarder">
<tr>
<td colspan="2" ><p align="right"><span class="heading">Join
WildFly</span><br>
<br>
<span class="sub_heading"><span style="font-weight: bold"><a
href="join.php" style="color: #000000">Membership Types</a> - <br>
<a href="club_rules.php" style="color: #000000">Club
Rules</a> - <br>
<a href="mem_terms.php" style="color: #333333">Membership
Terms & Conditions</a> - <br>
<a href="reg.php" style="color: #000000">Signup Now</a> -
</span></span> <strong><br>
</strong> </p>
<p>

<?
if ($email_exist == 1){
//edit this part
//you can close php, put html code and open again php
echo 'Email exist in database';
}
if ($registered == 1) include('sponsors_h.php');
$registered == 0;
if (($_POST[submit]!='Continue')&&($_POST['submit']!='Register')){
?>
<form name="newuser" action="<? 'PHP_SELF' ?>" method="post">

<span class="sub_heading"> Registration Form </span><br>
<br>
<? print $msg ?>
<table width="98%" border="0" align="center" cellpadding="4"
cellspacing="0" bgcolor="eeeeee" class="main_boarder">
<tr>
<td nowrap>Registration Type </td>
<td nowrap>
<select name="MEMBERSHIPID" class="body" id="MEMBERSHIPID">
<option value='Fly Fisher'>Fly Fisher</option>
<option value="Venue">Venue</option>
</select>
</td>
<td nowrap> </td>
<td nowrap> </td>
</tr>
<tr>
<td nowrap> </td>
<td nowrap> </td>
<td nowrap> </td>
<td nowrap>
<input name="submit" type="submit" class="body"
value="Continue" id="sumbit">
</td>
</tr>
<?
include('sponsors_h.php');
?>
</table>
</form>
<?
};
if ($_POST[submit]=='Continue'){
?>
<form name="newuser" action="<? 'PHP_SELF' ?>" method="post"
onsubmit="return validateForm(this)">
<input type="hidden" name="MEMBERSHIPID" value='<?echo $_POST
[MEMBERSHIPID];?>'>

<span class="sub_heading"> Registration Form </span><br>
<br>
<? print $msg ?>



<table width="98%" border="0" align="center" cellpadding="4"
cellspacing="0" bgcolor="eeeeee" class="main_boarder">

<tr>
<td colspan="4" nowrap><strong>New Registraton</strong></td>
</tr>
<tr>
<td nowrap>Email Address*<br>
</td>
<td nowrap><input name="EMAIL" type="text" class="body"
id="EMAIL"></td>
<td nowrap>First Name*</td>
<td nowrap><input name="NAME" type="text" class="body"
id="NAME"></td>
</tr>
<tr>
<td nowrap>Password*</td>
<td nowrap><input name="WEBPASSWORD" type="password" class="body"
id="WEBPASSWORD"></td>
<td nowrap>Last Name* </td>
<td nowrap><input name="SURNAME" type="text" class="body"
id="SURNAME"></td>
</tr>
<tr>
<td nowrap>Confirm Password*</td>
<td nowrap><input name="WEBPASSWORD_again" type="password"
class="body" id="WEBPASSWORD_again"></td>
<td nowrap>Tel</td>
<td nowrap><input name="TELH" type="text" class="body"
id="TELH"></td>
</tr>
<td nowrap>Fax</td>
<td nowrap><input name="FAX" type="text" class="body"
id="FAX"></td>
</tr>
<tr>
<td nowrap>Comanpy Name (if aplicable) </td>
<td nowrap><input name="VENUE" type="text" class="body"
id="VENUE"></td>
<td nowrap>Cell*</td>
<td nowrap><input name="CEL" type="text" class="body"
id="CEL"></td>
</tr>
<tr valign="top">
<td nowrap>Physical Address<br></td>
<td nowrap><input name="ADDRESS1" type="text"
class="body" value="<? echo $row['ADDRESS1']; ?>"></td>
<td nowrap>Postal Address*</td>
<td nowrap><input name="POSTAL1" type="text" class="body"
value="<? echo $row['POSTAL1']; ?>"></td>
</tr>
<tr valign="top">
<td nowrap> </td>
<td nowrap><?
print get_combo('SELECT * FROM TOWNS ORDER BY
TOWN', 'TOWN','', '','ADDRESS2');
?></td>
<td nowrap> </td>
<td nowrap><?
print get_combo('SELECT * FROM TOWNS ORDER BY
TOWN', 'TOWN', '', '','POSTAL2');
?></td>
</tr>
<tr valign="top">
<td nowrap> </td>
<td nowrap><?
print get_combo('SELECT * FROM V_PROVINCES
ORDER BY PROVINCES', 'PROVINCES', '', '','ADDRESS3');
?></td>
<td nowrap> </td>
<td nowrap><?
print get_combo('SELECT * FROM V_PROVINCES
ORDER BY PROVINCES', 'PROVINCES', '', '','POSTAL3');
?></td>
</tr>
<tr valign="top">
<td nowrap> </td>
<td nowrap> <input name="ADDRESS4"
type="text" class="body" size="8" value="<? echo $row['ADDRESS4']; ?
>"></td>
<td nowrap> </td>
<td nowrap> <input name="POSTAL4"
type="text" class="body" size="8" value="<? echo $row['POSTAL4']; ?
>"></td>
</tr>
<tr valign="top">
<td><div align="left">Country</div></td>
<td colspan="3" nowrap>
<?
print get_combo('SELECT * FROM V_COUNTRY ORDER BY
COUNTRY', 'COUNTRY', '', '','COUNTRY');
?>
</td>
</tr>
<tr>
<td nowrap>
<input name="submit" type="submit" class="body"
value="Register" id="sumbit">
</td>
<td nowrap> </td>
<td nowrap> </td>
<td nowrap> </td>
</tr>
<?
include('sponsors_h.php');
?>
</table>
</form>
<?
}
?>
</td>
</tr>

</table>
<?php
include('footer.php')
?>