ob_start();include "/home/intsch/public_html/include/shared.inc.php";head("EN",'','','',1); $answers=array(3,2,2,3,2,3,3,2,1,2,1,1,2,4,3,2,4,1,2,3,3,2,4,4,3,2,2,4,4,1); function option($q,$s,$value){global $HTTP_POST_VARS;$q='q'.$q; echo ''; } function head_($page=''){ if(!$page){?> }?>
| Test your English |
| } function form_block($errors=''){global $HTTP_POST_VARS;if($errors){echo ' '.$errors.' ';}?>} if(!$HTTP_POST_VARS[submit]){ head_(); table_open(); form_block(); }elseif($REQUEST_METHOD=="POST"&&$HTTP_POST_VARS[submit]){ if(!trim($HTTP_POST_VARS[name])||!trim($HTTP_POST_VARS[email])){head_();table_open(); form_block("Please enter your name and e-mail address!");} elseif(!check_email(trim($HTTP_POST_VARS[email]))){ head_();table_open(); form_block("Please enter a valid e-mail address!"); }elseif(!$HTTP_POST_VARS[q1]||!$HTTP_POST_VARS[q2]||!$HTTP_POST_VARS[q3]||!$HTTP_POST_VARS[q4]||!$HTTP_POST_VARS[q5]||!$HTTP_POST_VARS[q6]||!$HTTP_POST_VARS[q7]||!$HTTP_POST_VARS[q8]||!$HTTP_POST_VARS[q9]||!$HTTP_POST_VARS[q10]||!$HTTP_POST_VARS[q11]||!$HTTP_POST_VARS[q12]||!$HTTP_POST_VARS[q13]||!$HTTP_POST_VARS[q14]||!$HTTP_POST_VARS[q15]||!$HTTP_POST_VARS[q16]||!$HTTP_POST_VARS[q17]||!$HTTP_POST_VARS[q18]||!$HTTP_POST_VARS[q19]||!$HTTP_POST_VARS[q20]||!$HTTP_POST_VARS[q21]||!$HTTP_POST_VARS[q22]||!$HTTP_POST_VARS[q23]||!$HTTP_POST_VARS[q24]||!$HTTP_POST_VARS[q25]||!$HTTP_POST_VARS[q26]||!$HTTP_POST_VARS[q27]||!$HTTP_POST_VARS[q28]||!$HTTP_POST_VARS[q29]||!$HTTP_POST_VARS[q30]){ head_();table_open(); form_block("Please complete the whole test."); }else{ $result=mysql_query("SELECT * FROM test WHERE email='$HTTP_POST_VARS[email]'"); $row=mysql_fetch_array($result); for ($i=1 ;$i <= 30; $i++){$q='q'.$i; if($HTTP_POST_VARS[$q]==$answers[$i-1]){$correct++;}} $percentage = round(100/(30/$correct)); head_(1); table_open(); if($HTTP_POST_VARS[news]){subscribe($HTTP_POST_VARS[email]);} if(mysql_num_rows($result)==0){ mysql_query("INSERT INTO test (name,email,score) values ('$HTTP_POST_VARS[name]', '$HTTP_POST_VARS[email]', '$correct')"); echo ' Thank you for taking our placement test, your score is: '; echo ''.$correct.' out of 30 correct. ('.$percentage.'%) '; echo 'If you are booking a course online, please remember this figure ('.$correct.') and enter it into the booking form. This will help us to place you in the correct group (although of course we will interview and test you again when you arrive at the School.) '; setcookie("score", $correct, $timestamp+604800, "/");}else{ echo 'Your score this time is: '; echo ''.$correct.' out of 30 correct. ('.$percentage.'%) '; echo 'As you have taken this test before please use your first score ('.$row["score"].') if you are booking a course as this will help us to place you in the correct group (although of course we will interview and test you again when you arrive at the School.)'; setcookie("score", $row["score"], $timestamp+604800, "/");} }}?> |