Hi, I have a form that adds new users to our membership. The form posts all of the information fine, it even echos beatifully. for some reason, I don't think my function registeraff() is being called, mostly due to the fact that I try to put in an email that is already there, and I get the same error and the error, could not is in the else on the regaffiliate.php. I am not sure where it is going wrong.
regaffiliate.php
<?php
// include function files for this application
ini_set('error_reporting', E_ALL);
ini_set('display_errors', true);
session_start();
require_once('db_fns.php');
// user, password, change functions
require_once('user_auth_fns.php');
// results after functions run
require_once('output_fns.php');
//create short variable names
$_SESSION['bill_email'] = $billemail;
$_SESSION['institutioncontact'] = $institutioncontact;
$_SESSION['institutionname'] = $institutionname;
$_SESSION['fname'] = $fname;
$_SESSION['mname'] = $mname;
$_SESSION['lname'] = $lname;
$_SESSION['title'] = $title;
$_SESSION['departmentname'] = $departmentname;
$_SESSION['street'] = $street;
$_SESSION['street2'] = $street2;
$_SESSION['city'] = $city;
$_SESSION['state'] = $state;
$_SESSION['zip'] = $zip;
$_SESSION['Country'] = $country;
$_SESSION['phone'] = $phone;
$_SESSION['alternatephone'] = $alternatephone;
$_SESSION['faxphone'] = $faxphone;
$_SESSION['website'] = $website;
$_SESSION['secretquestion'] = $secretquestion;
$_SESSION['secretanswer'] = $secretanswer;
$HTTP_POST_VARS['paidflag'] = $paidflag;
$HTTP_POST_VARS['expired'] = $expired;
$passwd=$HTTP_POST_VARS['passwd'];
$rptpasswd=$HTTP_POST_VARS['rptpasswd'];
// attempt to register (function in user_auth_fns.php)
$reg_result = registeraff($billemail,$institutioncontact,$passwd,$dateadded,$dateupdated,$secretquestion,
$secretanswer,$fname,$mname,$lname,$title,$institutionname,$departmentname,
$street,$street2,$city,$state,$zip,$country,$phone,$faxphone,$alternatephone,
$institutioninfo,$institutionsize,$website,$timetocall,$paymentmethod,$paidflag,$expired);
if ($reg_result === true)
{
// mail code
$to = "me@mysite.com";
$subject = "New Member has registered";
/* additional headers which helps from being dropped as junk mail and allows
html mail*/
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: me@mysite.com";
$message = '<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
just a bunch of stuff that gets emailed to the user here
</table>
</body>
</html>';
mail($to,$subject,$message,$headers);
//end mail code
// register session variable
$HTTP_SESSION_VARS['valid_user'] = $billemail;
echo '<head><meta http-equiv="refresh"
content="0;url=https://mysite.com/bosha/continueaffnew.php"></head>';
}
else
{
// otherwise provide link back, tell them to try again
echo 'PROBLEM:';
echo $reg_result;
do_html_url('../memberapplication.php', 'Please try to register again or contact Us');
exit;
}
// end page
?>
myfuntion
function registeraff($billemail,$institutioncontact,$passwd,$dateadded,$dateupdated,$secretquestion,
$secretanswer,$fname,$mname,$lname,$title,$institutionname,$departmentname,
$street,$street2,$city,$state,$zip,$country,$phone,$faxphone,$alternatephone,
$institutioninfo,$institutionsize,$website,$timetocall,$paymentmethod,$paidflag,$expired)
{
ini_set('error_reporting', E_ALL);
ini_set('display_errors', true);
// connect to db
$conn = db_connect();
if (!$conn)
return 'Could not connect to database server - please try later.';
// check if email is unique
$emailresult = mysql_query("select * from regauth_tbl where billemail='$billemail'");
if (!$emailresult)
return 'Could not execute query';
if (mysql_num_rows($emailresult)>0)
return 'That username is taken - go back and choose another one.';
$resultdc = mysql_query("SELECT paidflag
FROM regauth_tbl
WHERE institutionname = '$institutionname'");
if(!$resultdc)
return 'Could not execute query this query';
$rowdc = mysql_fetch_assoc($resultdc);
$insertdc = mysql_query("
INSERT INTO regauth_tbl
VALUES ('$billemail', 'No', password('$passwd'), NOW(), '$dateupdated',
'$secretquestion', '$secretanswer', '$fname', '$mname', '$lname', '$title',
'$institutionname', '$departmentname', '$street', '$street2', '$city', '$state', '$zip',
'$country', '$phone', '$faxphone', '$alternatephone', '$institutioninfo',
'$institutionsize', '$website', '$timetocall', '$paymentmethod', ".
($rowdc['paidflag'] == 1 ? 1 : 0). ", ".
($rowdc['paidflag'] == 1 ? 4 : 2).")"
);
if (!$insertdc)
return 'Could not register you in database - please try again later.';
return true;
}