'$$var'"; } // end function // Format MySQL dates to US standard function format_date( $date ) { // Fetch date from database to array using regular expression to format $search = '/0*([^-]*)-0*([^-]*)-([^-]*)/'; $replace = '$2/$3/$1'; $date = preg_replace( $search, $replace, $date ); return $date; } // end function // Convert quiz names for feedback display function format_quiz( $quiz ) { $quiz = ucfirst( $quiz ); if( $quiz == 'Simrtk' ) $quiz = 'Simulated RTK'; return $quiz; } // end function // Convert quiz names for feedback display function encode_email( $email, $text = 'Email' ) { $search = array( '/@/', '/\./' ); $replace = array( '@', '.' ); $email = preg_replace( $search, $replace, $email ); $email = ""; return $email; } // end function // Swaps affiliation abbreviations with full strings for display function swap_affiliations( $affiliation ) { // See if affiliation is pre-defined switch( $affiliation ) { case '_kma': $affiliation = 'Kongming’s Archives'; break; case '_sosz': $affiliation = 'Scholars of Shen Zhou'; break; case '_simrtk': $affiliation = 'Simulated RTK'; break; case '_tkf': $affiliation = '3 Kingdoms Frontier'; break; case '_soc': $affiliation = 'Sanguo Online'; break; case '_tkc': $affiliation = 'Three Kingdoms.com'; break; case '_gf': $affiliation = 'GameFAQs TKSB'; break; } // end switch return $affiliation; } // end function // Strips results of swap_affiliations for plain text processing function strip_affiliations( $var ) { $search = array( '{([^<]*)}', '/’/' ); $replace = array( '$1', "'" ); $var = preg_replace( $search, $replace, $var ); return $var; } // end function // Check whether or not a quiz variable is valid function validate_quiz( $quiz ) { $quiz = preg_match( '/(^game$|^easy$|^moderate$|^hard$|^simrtk$)/', $quiz ); return $quiz; } // end function // DATABASES and FILES /* // Return information related to a database failure function database_error( $job ) { $_SESSION['query'] = '

' . "There was an error while $job:
\n" . '' . mysql_error() . "”
\n" . 'Please try again at a later time, or nofify the Webmaster.

' . "\n"; // Redirect them to the quiz home page for error display header( 'Location: /quiz/' ); exit(); } // end function */ // COMMUNICATION and MAIL // Return information related to a database failure function redirect_error( $query, $location = '/quiz/', $level = 'red' ) { $_SESSION['query'] = '

$query.

\n"; // Redirect them to the quiz home page for feedback display header( "Location: $location" ); exit(); } // end function /* // Send an email using PHP function sendmail( $recipients, $headers, $body ) { // Include the PEAR Mail Library include( 'Mail.php'); // Specify method of delivery $mail_object =& Mail::factory( "mail" ); // Send the prepared email message $mail_object->send( $recipients, $headers, $body ); } // end function */ ?> Romance of the Three Kingdoms Quizzes - Kongming's Archives

Romance of the Three Kingdoms Quizzes

Home | Forum | SimRTK | History | Games | Graphics | Writing | Products | Links | Site Map

Kongming’s Archives: Three Kingdoms Quizzes

You are here: [ Home –> Quizzes ]

Sign up for a new account, or…