function str_makerand ($minlength, $maxlength, $useupper, $usespecial, $usenumbers)
{
/*
Author: Peter Mugane Kionga-Kamau
http://www.pmkmedia.com
Description: string str_makerand(int $minlength, int $maxlength, bool $useupper, bool $usespecial, bool $usenumbers)
returns a randomly generated string of length between $minlength and $maxlength inclusively.
Notes:
- If $useupper is true uppercase characters will be used; if false they will be excluded.
- If $usespecial is true special characters will be used; if false they will be excluded.
- If $usenumbers is true numerical characters will be used; if false they will be excluded.
- If $minlength is equal to $maxlength a string of length $maxlength will be returned.
- Not all special characters are included since they could cause parse errors with queries.
Modify at will.
*/
$charset = "abcdefghijklmnopqrstuvwxyz";
if ($useupper) $charset .= "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if ($usenumbers) $charset .= "0123456789";
if ($usespecial) $charset .= "~@#$%^*()_+-={}|]["; // Note: using all special characters this reads: "~!@#$%^&*()_+`-={}|\\]?[\":;'><,./";
if ($minlength > $maxlength) $length = mt_rand ($maxlength, $minlength);
else $length = mt_rand ($minlength, $maxlength);
for ($i=0; $i<$length; $i++) $key .= $charset[(mt_rand(0,(strlen($charset)-1)))];
return $key;
}
?>
McMembers Membership Administration
switch ($IID)
{
case 1:
include "IndexFeatures.php"; // This line will not be executed
break;
case 2:
include "IndexValue.php"; // This line will not be executed
break;
case 3:
include "IndexGuarantee.php"; // This line will not be executed
break;
case 4:
include "IndexFAQs.php"; // This line will not be executed
break;
case 5:
include "IndexContactUs.php"; // This line will not be executed
break;
case 6:
include "IndexDemos.php"; // This line will not be executed
break;
case 7:
include "Login.php"; // This line will not be executed
break;
case 8:
switch($PID){
case 1 :
// process the create org details - forward to page 2
include "CreateOrganization.php";
break;
case 2 :
// process the create org details - forward to page 3
if ($OrgParent == "OTHER"){
$OrgParentFinal = $OrgParentOther;
}
else{
$OrgParentFinal = $OrgParent;
}
If (!is_null($OrgName) && !is_null($OrgType)){
$result = $connector->query("SELECT * FROM org WHERE OrgName = '$OrgName' AND OrgNumber = '$OrgNum'");
// Get the result
$row = $connector->fetchArray($result);
if (!empty($row)){
// EXISTING MATCH ORGANIZATION
$_SESSION['McMember_OrgId'] =$row['OrgId'];
$_SESSION['McMember_FailureReason'] = "ExistingOrg";
$SuccessInsert=0;
}
else{
// NO MATCH FOUND
// $FieldNames = "OrgName,OrgParent,OrgType,OrgNumber,OrgMeetDate,OrgMeetTime,OrgIsParent,OrgWebPage,OrgEmail,OrgAddress1,OrgAddress2,OrgCity,OrgState,OrgZip,OrgCountry,OrgAllowGuests,OrgGuestRestrictions,OrgDressCode,OrgDressCodeDetails,PublishMeetingDetails,PublishOrganizationDetails,DateCreated";
// $FieldValues = "'$OrgName','$OrgParentFinal','$OrgType','$OrgNum','$OrgMeetDate','$OrgMeetTime',$OrgIsParent,'$OrgWebPage','$OrgEmail','$OrgAddress1','$OrgAddress2','$OrgCity','$OrgState','$OrgZip','$OrgCountry',$OrgAllowGuests,'$OrgGuestRestrictions',$OrgDressCode,'$OrgDressCodeDetails',$OrgPublishMeetingDetails,$OrgPublishOrganizationDetails,CURDATE()";
$FieldNames = "OrgName,OrgParent,OrgType,OrgNumber,DateCreated";
$FieldValues = "'$OrgName','$OrgParentFinal','$OrgType','$OrgNum',CURDATE()";
$qVals = "INSERT INTO org ($FieldNames) VALUES ($FieldValues)";
// echo "$qVals";
$result = $connector->query("$qVals");
// POP THE NEW RECORD ID INTO A SESSION VARIABLE
// Register session key with the value
$_SESSION['McMember_OrgId'] = mysql_insert_id();
$_SESSION['McMember_qVals'] = $qVals;
// header("location: CreateOrg2.php");
$SuccessInsert=1;
}
}
Else{
If (isset($OrgName) && isset($OrgType)){
echo "Missing Org Name and Org Type Details";
}
}
if($SuccessInsert==1){
include "CreateAdministrator.php";
}
else{
echo "That organization already exists. Would you like to send a mail to the Administrator asking to join? ";
echo "You have the option of creating a new organization having a similar name - ie. 'Vintage Corvette Cliub 2' ";
echo "SELECTION TO JOIN OR CREATE NEW GOES HERE";
}
break;
case 3 :
if($_SESSION['McMember_OrgId']){
// CHECK TO SEE IF THE CLUB NAME EXISTS
$qVals11 = "SELECT * FROM org WHERE OrgId =".$_SESSION['McMember_OrgId'];
$result = $connector->query($qVals11);
// Get the result
$row = $connector->fetchArray($result);
} else {
// No OrgId Found
If ($thehiddenSubmitter == "pookachoo"){
$_SESSION['McMember_FailureReason'] = "NoOrgIdFoundInSession";
// header("location: CreateMemFailure.php");
}
}
If (!is_null($MemFName) && !is_null($MemLName) && !is_null($MemEmail)){
$PotentialDup = 0;
$FieldNames = "FirstName,LastName,Phone_Type,Title,MemStatus,MemType, Email,Address1,Address2,City,State,Zip,Country,Phone_Area,Phone_Prefix, Phone_Suffix, Phone_Display,CreateDate,MemberSince,Birthdate";
$FieldValues = "'$MemFName','$MemLName','$MemPT1','$MemTitle','$MemStatus','$MemType','$MemEmail','$MemAddress1','$MemAddress2','$MemCity','$MemState','$MemZip','$MemCountry','$MemArea','$MemPre','$MemSuf','$MemDisplay',CURDATE(),CURDATE(),'0000-00-00 00:00:00'";
$qVals = "INSERT INTO mem ($FieldNames) VALUES ($FieldValues)";
$result = $connector->query("$qVals");
$theNewMemId = mysql_insert_id();
// IF THERE IS A MEMBER ID WITH THIS SESSION, ASSIGN IT AS THE CREATORID
if($_SESSION['McMember_MemId']){
$qVals11 = "UPDATE mem SET CreatedByMemId=".$_SESSION['McMember_MemId']." WHERE MemId=".$theNewMemId;
$result11 = $connector->query("$qVals11");
// echo $qVals11;
}
else{ // ASSIGN THE NEW MEMBER ID TO THE SESSION
$_SESSION['McMember_MemId'] = $theNewMemId;
$qVals12 = "UPDATE mem SET CreatedByMemId=".$_SESSION['McMember_MemId']." WHERE MemId=".$theNewMemId;
$result12 = $connector->query("$qVals12");
// echo $qVals12;
}
$FieldNames2 = "OrgId,MemId";
$FieldValues2 =$_SESSION['McMember_OrgId'].",".$theNewMemId;
$qVals2 = "INSERT INTO oda ($FieldNames2) VALUES ($FieldValues2)";
$result3 = $connector->query("$qVals2");
$theNewOdaId = mysql_insert_id();
$qVals3 = "UPDATE oda SET oda.Admin = 1, oda.MemAdd = 1, oda.MemDel = 1, oda.MemEdit = 1, oda.GrpAdd = 1, oda.GrpDel = 1, oda.GrpEdit = 1, oda.SendEmail = 1, oda.CalAdd = 1, oda.CalDel = 1, oda.CalEdit = 1 WHERE OdaId=$theNewOdaId";
$result4 = $connector->query("$qVals3");
// UPDATE THE USER ID AND PASSWORD FOR THE NEW MEMBER
// CREATE THE UID
// -----------------------------------------------------------------
$FN = $MemFName{0};
$LN = $MemLName{0}.$MemLName{1}.$MemLName{2}.$MemLName{3}.$MemLName{4};
$UserID = $FN.$LN.$theNewMemId;
// GENERATE THE PASSWORD
$UserString = str_makerand(6,8,0,0,0);
$UserPass = Encrypt($UserString);
// ASSIGN THE DATA TO SESSION DETAILS
$_SESSION['McMember_UserID'] = $UserID;
$_SESSION['McMember_UserPass'] = $UserString;
$_SESSION['McMember_UserHash'] = $UserPass;
echo " ".$_SESSION['McMember_UserID']." - ".$_SESSION['McMember_UserPass']." ";
// UPDATE THE MEMBER RECORD IN THE DATABASE
$qVals15 = "UPDATE mem SET UID='".$UserID."',UPASS='".$UserPass."' WHERE MemId=".$theNewMemId;
$result15 = $connector->query($qVals15);
// echo $qVals15;
echo " You will be receiving an e-mail shortly with activation information to activate your organization. ";
echo "Please copy the userid and password that you have been sent to a safe place.";
echo "Once you receive the email, please click here.";
// TODO -----------------------------------------------------------------
// SEND THE NEW MEMBER A MAIL NOTIFICATION ASKING
// THEM TO ACTIVATE THEIR ACCOUNT
// SEND THE UID AND PASS TO THEM
} // END IF NOT IS NULL REQUIRED FIELDS
else {
If ($thehiddenSubmitter == "pookachoo"){
echo "Missing First Name, Last Name or Email Address! These fields are required! ";
}
}
break;
default:
include "CreateOrganization.php";
break;
}
break;
default:
include "IndexRightPane.php"; // This line will be executed
break;
}
?>