Fix the version loading/detection in common inc, and properly put debug info in the footer in 'debug' versions (odd numbered versions)

Check for a valid email address before sending an email
Check for a valid email address when trying to create a new participant account
This commit is contained in:
james 2006-02-14 21:50:41 +00:00
parent eae0ebde0c
commit 54769f999a
2 changed files with 39 additions and 22 deletions

View File

@ -38,7 +38,7 @@ else
$prependdir="";
$sfiabversion=@file($prependdir."version.txt");
$config['version']=$sfiabversion[0];
$config['version']=trim($sfiabversion[0]);
//make sure the data subdirectory is writable, if its not, then we're screwed, so make sure it is!
@ -478,10 +478,12 @@ global $config;
<div id="footer">
<?
//we only show the debug session variables if we have an ODD numbered version.
$lastdigit=$config['version'][strlen($config['version']-1)];
$lastdigit=$config['version'][strlen($config['version'])-1];
if($lastdigit%2!=0)
{
echo "DEBUG:";
print_r($_SESSION);
}
echo "SFIAB Version ".$config['version'];
?>
</div>
@ -707,6 +709,10 @@ function outputStatus($status)
function email_send($val,$to,$sub_subject=array(),$sub_body=array())
{
//if our "to" doesnt look like a valid email, then forget about sending it.
if(!eregi('[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.([a-zA-Z]{2,4})', $to))
return;
$q=mysql_query("SELECT * FROM emails WHERE val='$val'");
if($r=mysql_fetch_object($q))
{

View File

@ -306,6 +306,10 @@
}
else
{
//they can only create a new registraiton if they have a valid email address, so lets do a quick ereg check on their email
if(eregi('[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.([a-zA-Z]{2,4})', $_SESSION['email']))
{
$regnum=0;
//now create the new registration record, and assign a random/unique registration number to then.
do
@ -330,6 +334,13 @@
echo i18n("You have been identified as a new registrant. An email has been sent to <b>%1</b> which contains your new <b>registration number</b>. Please check your email to obtain your <b>registration number</b> and then enter it below:",array($_SESSION['email']),array("email address"));
echo "<input type=\"hidden\" name=\"action\" value=\"new\">";
}
else
{
echo error(i18n("The email address you entered (%1) appears to be invalid. You must use a proper email address in order to create an account",array($_SESSION['email'])));
echo "<a href=\"register_participants.php\">".i18n("Return to participant registration")."</a>";
$showform=false;
}
}
}
if($showform)