>
include "logon.inc"; ?>
[ News ]
The latest News:
include "../messages/NewsFeed.htm" ; ?>
|
|
 |
//echo "\n";
if (isset($cmdRegister) )
{
echo "\n";
$Valid =0;
if (strLen($Name) < 6){
$NameErr = "Please enter your Full Name";
$Valid++;
}
if (strLen($Address3) < 4){
$CityErr = "Please enter the city / state in which you live";
$Valid++;
}
//if (strLen($RegPhone) < 4){
// $PhoneErr = "Please enter a contact Phone or mobile";
// $Valid =0;
//}
if (strLen($Email) < 10){
$EmailErr = "Please enter a valid Email address ";
$Valid++;
}
$sSQLE = "SELECT * FROM cust WHERE Email='$Email'";
$qSQLE = mysql($dbName,$sSQLE);
$nSQLE = @mysql_numRows($qSQLE);
if($nSQLE > 0){
$EmailErr = "That Email address is already in use by another account
Please use another email address ";
$Valid++;
}
// Validate UserId
if (strLen($UserId) < 8 || strLen($UserId) > 10){
$UserIdErr .= "User Id must be between 8 and 10 characters in length ";
$Valid++;
}
$sSQLE = "SELECT * FROM cust WHERE UserId='$UserId'";
$qSQLE = mysql($dbName,$sSQLE);
$nSQLE = @mysql_numRows($qSQLE);
if($nSQLE > 0){
$UserIdErr .= "That UserId is already in use by another account
Please use another UserId ";
$Valid++;
}
// Generate Password
$Pass1= substr(MD5($UserId . time()),0,8);
// Validate Answer
if (strLen($Answer) < 8){
$AnswerErr = "Answer must be between at least 8 characters in length";
$Valid++;
}
if($Valid==0)
{
echo "\n";
// Get next Valid ID
$SQL1 = "SELECT MAX(CustId) FROM cust";
$qSQL1= mysql($dbName,$SQL1);
echo mysql_error();
$NextCustId = mysql_result($qSQL1,0,0);
if($NextCustId < 40000000){
$NextCustId += 40000000;
$NextCustId = $NextCustId * 10;
}
$NextCustId = strval($NextCustId);
$NextCustId = substr($NextCustId,0,strlen($NextCustId) -1);
$NextCustId++;
// Calculate checksum
$Mod10 = mod10($NextCustId);
$AccountNo = strval($NextCustId) . $Mod10;
//$chkPass = "CK" . $UserPass;
//$MD5Pass = substr(MD5($chkPass),0,30);
// Calculate Passwrd
$Pass1 = substr(MD5("CK" . $UserPass ),0,30);
$Pass2 = substr(MD5("CK" . $Answer ),0,30);
// Determine Account Type
if($chkBusiness==1){
$AccType = "B";
}else{
$AccType = "A";
}
// $AccountNo = $CustId;
$dOpenDate= date("d/m/Y",time());
$SQL2 = "INSERT INTO cust
(CustId,Code,Name,Address1,Address2,Address3,
Country,PostCode,Contact,Phone,Fax,Mobile,Email,
Sponsor,UserId,Pass1,Pass2,AccType,Status,OpenDate)
VALUES('$AccountNo','$Code','$Name','$Address1','$Address2','$Address3',
'$Country','$PostCode','$Contact','$Phone','$Fax','$Mobile','$Email',
'$Sponsor','$UserId','$Pass1','$Pass2','$AccType','A','$dOpenDate')";
$qSQL2= mysql($dbName,$SQL2);
echo "\n";
$ApplicationNo = $AccountNo * 7112;
// Display Terms and conditions for acceptance
echo "";
}else{
include "RegisterConfirm.inc";
}
}
elseif (isset($cmdRegisterOK) )
{
//echo "\n";
$lCustId = intval($ApplicationNo / 7112);
// Get Saved Details
$sSQL2 = "SELECT * FROM cust WHERE CustId = '$lCustId'";
$qSQL2 = mysql($dbName,$sSQL2);
$nSQL2 = @mysql_numRows($qSQL2);
//echo "\n";
$AccountNo = $lCustId;
$Name=mysql_result($qSQL2,0,"Name");
$Address1=mysql_result($qSQL2,0,"Address1");
$Address2=mysql_result($qSQL2,0,"Address2");
$Address3=mysql_result($qSQL2,0,"Address3");
$Country=mysql_result($qSQL2,0,"Country");
$PostCode=mysql_result($qSQL2,0,"PostCode");
$Contact=mysql_result($qSQL2,0,"Contact");
$Phone=mysql_result($qSQL2,0,"Phone");
$Fax=mysql_result($qSQL2,0,"Fax");
$Email=mysql_result($qSQL2,0,"Email");
$UserId=mysql_result($qSQL2,0,"UserId");
$Pass1= substr(mysql_result($qSQL2,0,"Pass1"),0,8) ;
$chkPass = "CK" . $Pass1;
$MD5Pass = substr(MD5($chkPass),0,30);
// Update the customer details
$sSQL3 = "UPDATE cust SET Pass1 = '$MD5Pass'
WHERE CustId = $lCustId";
$qSQL3 = mysql($dbName,$sSQL3);
// Send another message
$filename = $DOCUMENT_ROOT . "/messages/RegOK.txt" ;
// Read in the file
// get contents of a file into a string
//$filename = "/usr/local/something.txt";
$fd = fopen ($filename, "r");
$contents = fread ($fd, filesize ($filename));
fclose ($fd);
eval ("\$lMessage = \"$contents\";");
$headers="From: registrations@tradedollars.com\n";
$headers.="X-Priority: 1\n";
if ($SERVER_NAME != "localhost"){
mail($Email,"Welcome to TradeDollars", $lMessage ,$headers);
$message = "The following registration has now been completed:
Account: $AccountNo
Name: $Name
Address : $Address1
$Address2
$Address3
Country: $Country
Postcode: $PostCode
Contact: $Contact
Phone: $Phone
Fax: $Fax
Mobile: $Mobile
Email $Email
UserId: $UserId";
$sMessage = $message . "\n $SQL2 \n" .mysql_error();
mail ("tonyhall@vcash.com", "Registration Confirmation", $sMessage , $headers);
mail ("trading@tradedollars.com", "Registration Confirmation", $message, $headers);
}
$filename = $DOCUMENT_ROOT ."/messages/RegistrationFinal.htm" ;
// Read in the file
// get contents of a file into a string
$fd = fopen ($filename, "r");
$contents = fread ($fd, filesize ($filename));
fclose ($fd);
echo " Confirmation complete
Your registration has now been been completed
Your account details have been emailed to you at $Email.
Thank you for registering";
}else{
//echo "\n";
include "RegisterConfirm.inc";
}
echo "\n | |