Home      Products & Services      Contact Us      Links

WebHatchers will design & develop your site for you.

Website Menu Heaven: menus, buttons, etc.

Send us your questions.

site search by freefind

SEO, Google, Privacy
   and Anonymity
Browser Insanity
Popups and Tooltips
Free Website Search
HTML Form Creator
Buttons and Menus
Image Uploading
Website Poll
IM and Texting
   or Not MySQL
Personal Status Boards
Content Management
Article Content
   Management Systems
Website Directory
   CMS Systems
Photo Gallery CMS
Forum CMS
Blog CMS
Customer Records
   Management CMS
Address Book CMS
Private Messaging CMS
Chat Room CMS
JavaScript Charts
   and Graphs

Free Personal Status Boards (PSB™)

Free Standard Free PSB

Free PSB Pro Version

Free Social PSB

Free Social PSB Plus (with Email)

Free Business PSB

Free Business PSB Plus (with Email)

PSB demo

Social PSB demo

Business PSB demo

So what's all this PSB stuff about?

Chart comparing business status boards

PSB hosting diagram

PSB Licence Agreement

Copyright © 2002 -
MCS Investments, Inc. sitemap

PSBs, social networking, social evolution, microcommunities, personal status boards
PSBs, social networking, business personal status boards
website design, ecommerce solutions
website menus, buttons, image rotators
Ez-Architect, home design software
the magic carpet and the cement wall, children's adventure book
the squirrel valley railroad, model railroad videos, model train dvds
the deep rock railroad, model railroad videos, model train dvds

Microcommunity (MC) Registration Script — Enter Questionnaire Data in Database

This script is called register-for-an-mc.php

The first PHP section is at the start of the script. First, we use the checkid.php script to ensure that the session id variable is set, and send the user to register-with-captcha.php if it is not. Then we define a named constant '_NODIRECTACCESS'. We include the config.php file (in the includes folder) which uses the PHP defined() function to check on this constant. If it is not set, we are thrown out of the config.php file like yesterday's trash. Then we put the POSTed value of 'username' into $U—we will be checking that it is set in a second. And we put the POSTed value of 'flag' into $flag.

Next we check if the session variables 'flag', 'username', and 'sessionid' are set and we make sure $U is set. If not, we are sent to the login-to-mc.php script.

We get the POSTed value of 'u' into $o and the POSTed value of 'g' into $q. $o now contains the 13 option arrays separated by | characters. Option arrays contain number values like 4 or 33 separated by commas. First we use the PHP explode() function to explode this stringified array of stringified arrays into 13 arrays and put them in the $opt[] array. Next we use a regular expression search and replace on each array element value (still stringified arrays) using the preg_replace() function. This limits data to numbers and commas even though that was done by JavaScript already—one can never have too much security.

Next we explode the 13 arrays into their separate numeric values in a loop, putting the results in the $opt2[] array. To be extra safe, we now use intval() to get the integer value of each number. They were only allowed to enter numbers from 0 to 99, so if the number is greater, we set it to 0. Now we dump duplicate values in each array and close the gaps where empty array element values are, using the array_keys() and array_flip() functions.

Now we stringify the resulting cleaned arrays using implode() and stick them each into $comma_separated_string and add commas to each end so searches work in the MySQL table searches using MC (Microcommunity) Search and Match. These stringified arrays we stick back into the $opt[] array elements, in a loop. This takes care of the select/option values.

Now we deal with the text input box values. They are in the stringified comma separated array of numbers (any of which may be from 0 to 99) sitting in the $q string. We explode() this into separate numbers and put these into the $howmany[] array. To be extra safe, we now use intval() to get the integer value of each number. We use the substr() function to get any number beginning with 0 and make the number into only the last number in the substring, which is usually 0 since starting with 0 should only be done by a user if he intends only a 0, but if he is weird enough to type 09 or 04, we fix it. If numbers are negative or more than 99 or not integers or not even set, we zero them.

Our data is ready to go into the MySQL table, as soon as we use the mysql_real_escape_string() function on them to make them safe to put in the db, even though they already are safe because we know they are simply numbers! One can never have too much security. We use MySQL's UPDATE . . . SET . . . WHERE combo to get the user's questionnaire data into the database. If all is well, we tell them and send them to Login to MC Search and Match Profile and Account Management. If it did not work because of connection problems or whatever, we tell them and send them to Login to MC Search and Match Profile and Account Management.

The script below is called: register-for-an-mc.php


<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<TITLE>PHP Microcommunity (MC) Registration Script</TITLE>
<meta name="description" content="PHP MC Registration Script">
<meta name="keywords" content="PHP MC Registration Script,MC Registration Script,MC Registration,PHP Microcommunity Registration Script,Microcommunity Registration Script,Microcommunity Registration,add member,php,mysql,dhtml, DHTML">



$flag=$_POST['flag'];if(!isset($flag) || !isset($_SESSION['username']) || !isset($_SESSION['sessionid']) || !isset($U)){
echo '<script language="javascript">alert("Please login."); window.location="login-to-mc.php";</script>';


for ($i=0; $i<count($opt); $i++){
$opt[$i]=preg_replace('/[^0-9\\,]/', '', $opt[$i]);
for ($j=0; $j<count($opt2); $j++){
$comma_separated_string = implode(",", $opt2);

for ($i=0; $i<count($howmany); $i++){
if (substr($howmany[$i],0,1)=="0"){$howmany[$i]=substr($howmany[$i],-1,1);}
if ($howmany[$i]<0 || $howmany[$i]>99 || !is_int($howmany[$i]) || !isset($howmany[$i])){$howmany[$i]=0;}


$sql = "UPDATE mc_members SET
signup_date = '$signup_date',
males03 = '$males03',
males47 = '$males47',
males811 = '$males811',
males1214 = '$males1214',
males1517 = '$males1517',
males1823 = '$males1823',
males2434 = '$males2434',
males3549 = '$males3549',
males5065 = '$males5065',
males6679 = '$males6679',
males80 = '$males80',
females03 = '$females03',
females47 = '$females47',
females811 = '$females811',
females1214 = '$females1214',
females1517 = '$females1517',
females1823 = '$females1823',
females2434 = '$females2434',
females3549 = '$females3549',
females5065 = '$females5065',
females6679 = '$females6679',
females80 = '$females80',
childless = '$childless',
emptynesters = '$emptynesters',
widows = '$widows',
widowers = '$widowers',
married = '$married',
livingtogether = '$livingtogether',
separated = '$separated',
divorced = '$divorced',
engaged = '$engaged',
single = '$single',
gaymales = '$gaymales',
lesbian = '$lesbian',
white = '$white',
black = '$black',
asian = '$asian',
hispanic = '$hispanic',
hawaiian = '$hawaiian',
mixed = '$mixed',
criminal = '$criminal',
homeschooled = '$homeschooled',
publicschools = '$publicschools',
privateschools = '$privateschools',
religiousschools = '$religiousschools',
specialschools = '$specialschools',
allergies = '$allergies',
chronic = '$chronic',
mental = '$mental',
disabilities = '$disabilities',
ramps = '$ramps',
willingeldercare = '$willingeldercare',
availableeldercare = '$availableeldercare',
needeldercare = '$needeldercare',
willingchildcare = '$willingchildcare',
availablechildcare = '$availablechildcare',
needchildcare = '$needchildcare',
Smoking_Drinking = '$Smoking_Drinking',
Preferred_Housing_Type = '$Preferred_Housing_Type',
Willing_to_relocate = '$Willing_to_relocate',
MC_type_sought = '$MC_type_sought',
Open_to_be_in_mixed_race_MC = '$Open_to_be_in_mixed_race_MC',
Sexuality = '$Sexuality',
Religious_Openness = '$Religious_Openness',
Religion = '$Religion',
Childrearing_Style_and_Preferences = '$Childrearing_Style_and_Preferences',
Pets = '$Pets',
Personal_Entertainment = '$Personal_Entertainment',
Housing_Interested_in_Common_Shared_Space_for = '$Housing_Interested_in_Common_Shared_Space_for',
Employment = '$Employment' WHERE username = '$U'";
// Execute query


echo '<script language="javascript">alert("Entries were made OK."); window.location="login-to-mc.php";</script>';
echo '<script language="javascript">alert("Entries were NOT made—something went wrong."); window.location="login-to-mc.php";</script>';