<?php
function sortTraits(&$score, &$desc) {
    $x = 0;
    while ($x < 10) {
        $y = $x + 1;
        while ($y < 16) {
            if ($score[$x] < $score[$y]) {
                $t1 = $score[$x];
                $t2 = $desc[$x];
                $score[$x] = $score[$y];
                $desc[$x] = $desc[$y];
                $score[$y] = $t1;
                $desc[$y] = $t2;
            }
            $y++;
        }
        $x++;
    }
}

function getMDesc($name, $osex) {
    $name = substr(strtolower($name), 0, 3);
    $ret  = '';
    switch ($name) {
    case 'wea':
        $ret = 'You know what your goals are and you pursue them vigourously.  Achieving success is important to you.';
        break;
    case 'rel':
        $ret = 'Faith matters to you.  It is the foundation that you build your life upon.  You trust that God has a plan for you.';
        break;
    case 'ath':
        $ret = 'Physical fitness is one of your priorities.  You find the time to work athletic pursuits into your schedule.  You enjoy being active.';
        break;
    case 'big':
        $ret = 'You are a kind and caring person.  Your warmth is inviting, and your heart is a wellspring of love.';
        break;
    case 'int':
        $ret = 'You consider your mind amongst your assets.  Learning is not a chore but a constant search after wisdom and knowledge.  You value education and rationality.';
        break;
    case 'fun':
        $ret = 'You laugh often.  People never accuse you of lacking a sense of humor.  You don\'t take yourself too seriously.';
        break;
    case 'out':
        $ret = 'You can liven up any party.  You\'ve got a way with people and have little difficulty charming your dates.';
        break;
    case 'adv':
        $ret = 'Just sitting around the house is not something that appeals to you.  You love to be out trying new things and really experiencing life.';
        break;
    case 'sty':
        $ret = 'You do not lack for fashion sense.  Style matters.  You wouldn\'t want to be seen with someone who doesn\'t care about ' . ($osex == 'm' ? 'his' : 'her') . ' appearance.';
        break;
    case 'shy':
        $ret = 'You are often timid around others, though you will open up when the right person comes along.';
        break;
    case 'tra':
        $ret = 'Modern culture does not move you. You hold traditional values dear to your heart.';
        break;
    case 'sen':
        $ret = 'You are not particularly shy when it comes to your sexuality.  You know what you like and do not feel inhibited.';
        break;
    case 'pra':
        $ret = 'You are a down-to-earth individual who is not impressed with material excess.  You care about the stuff of like that really matters.';
        break;
    case 'lib':
        $ret = 'Politics matters to you, and you aren\'t afraid to share your left-leaning views.  You would never be caught voting for a conservative candidate.';
        break;
    case 'con':
        $ret = 'You take a conservative stance on most issues and aren\'t shy about saying so.  Your political views are an important component of who you are.';
        break;
    case 'rom':
        $ret = 'You know exactly how to melt your date\'s heart.  Romance comes naturally to you and is an important component of any relationship you have.';
        break;
    }
    return $ret;
}

function getODesc($name, $osex) {
    $name = substr(strtolower($name), 0, 3);
    $ret  = '';
    switch ($name) {
    case 'wea':
        $ret = 'You seek someone with goals, someone to whom success is important.  You would like for this person to open up new experiences and opportunities for you.';
        break;
    case 'rel':
        $ret = 'You seek someone who is grounded in faith and who possesses religious values.  You believe that a religious person can enhance your life.';
        break;
    case 'ath':
        $ret = 'You aren\'t looking for a couch potato.  You seek someone who is active and who keeps ' . ($osex == 'm' ? 'his' : 'her') . ' body in top shape.';
        break;
    case 'big':
        $ret = 'You want someone compassionate, someone gentle and kind.  A loving, nurturing person will fill that hole in your life.';
        break;
    case 'int':
        $ret = 'You seek out intelligence.  Idle chit-chat is not what you are after.  You prefer your date who can stimulate your mind.';
        break;
    case 'fun':
        $ret = 'You consider a good sense of humor a major necessity in a date.  If ' . ($osex == 'm' ? 'his' : 'her') . ' jokes make you laugh, ' . ($osex == 'm' ? 'he' : 'she') . ' has won your heart.';
        break;
    case 'out':
        $ret = 'Shy and timid people are not who you are after.  You need someone with a vibrant personality to breathe life into a relationship.';
        break;
    case 'adv':
        $ret = 'You are looking for someone who is willing to try new things and experience life to its fullest.  You need a companion who encourages you to take risks and do exciting things.';
        break;
    case 'sty':
        $ret = 'You cannot put up with someone who is lacking in style.  You want an original, someone with flare, someone with good taste.';
        break;
    case 'shy':
        $ret = 'You are put off by people who are open books.  You are drawn to someone who is a bit more mysterious.  You want to draw ' . ($osex == 'm' ? 'him' : 'her') . ' out of ' . ($osex == 'm' ? 'his' : 'her') . ' shell and get to know what ' . ($osex == 'm' ? 'he' : 'she') . ' is all about.';
        break;
    case 'tra':
        $ret = 'You need someone who is a bit old-fashioned.  A person with traditional values and beliefs will perfectly compliment your lifestyle.';
        break;
    case 'sen':
        $ret = 'You aren\'t looking for someone who is sexually repressed.  You want someone who is adventurous under the covers.';
        break;
    case 'pra':
        $ret = 'You are drawn to people who are sensible and smart.  Flashy, materialistic people turn you off.  You appreciate the simpler side of living.';
        break;
    case 'lib':
        $ret = 'You need a person who has liberal opinions and beliefs.  You are engaged by political discussions and would find a liberal viewpoint refreshing in a date.';
        break;
    case 'con':
        $ret = 'Forget liberals, you need a conservative match.  Political discussions interest you, and a conservative will offer the viewpoint you need.';
        break;
    case 'rom':
        $ret = 'You need someone with a traditional understanding of romance.  A true romantic is a must-have in any potential date.';
        break;
    }
    return $ret;
}

require('../setClassPath.php');
require_once('db/TransManager.php');
require_once('util/InputHelper.php');

$input = InputHelper::getInstance();

$msex = $input->fullySanitize($_POST['msex']);
$osex = $input->fullySanitize($_POST['osex']);
$mage = intval($_POST['mage']);

if ((strlen($msex) == 0) || (strlen($osex) == 0) || ($mage == 0)) {
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Take the Famous Dating Quiz at Dating Diversions</title>
<link rel="stylesheet" type="text/css" href="dd.css">
<link rel="stylesheet" type="text/css" href="quiz.css">
<script type="text/javascript">
var _gaq=_gaq||[];_gaq.push(['_setAccount','UA-628020-4']);_gaq.push(['_trackPageview']);(function(){var ga=document.createElement('script');ga.type='text/javascript';ga.async=true;ga.src=('https:'==document.location.protocol?'https://ssl':'http://www')+'.google-analytics.com/ga.js';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(ga,s);})();
</script>
</head>
<body>
<h1>Cannot Continue the Quiz</h1>
<br>
The DatingDiversions.com dating quiz did not receive the data from your browser that it needs to generate your results. 
<a href="/">Go to the main page</a> and begin taking the test from the beginning.
</body></html>
<?php
}
else {
    $trans = TransManager::getInstance();
    $trans->beginTrans();
    $pdo = $trans->getPDO();

    $year = date('Y');
    $month = date('M');
    $monthnum = date('m');
    $day = date('d');
    $stmt = $pdo->prepare('SELECT prof_stats_id FROM prof_stats WHERE year = ? AND month = ? AND day = ?');
    $stmt->bindParam(1, $year);
    $stmt->bindParam(2, $month);
    $stmt->bindParam(3, $day);
    $stmt->execute();
    $profstatsid = 0;
    if ($myrow = $stmt->fetch(PDO::FETCH_NUM))
        $profstatsid = $myrow[0];

    if ($profstatsid == 0) {
        $stmt = $pdo->prepare('INSERT INTO prof_stats (year, month, day, month_num) VALUES (?, ?, ?, ?)');
        $stmt->bindParam(1, $year);
        $stmt->bindParam(2, $month);
        $stmt->bindParam(3, $day);
        $stmt->bindParam(4, $monthnum);
        $stmt->execute();
        $profstatsid = $pdo->lastInsertId();
    }

    $sqlsex = '';
    if (($msex == 'm') && ($osex == 'f'))
        $sqlsex = 'm_seeking_f = m_seeking_f + 1';
    else if (($msex == 'f') && ($osex == 'm'))
        $sqlsex = 'f_seeking_m = f_seeking_m + 1';
    else if (($msex == 'f') && ($osex == 'f'))
        $sqlsex = 'f_seeking_f = f_seeking_f + 1';
    else if (($msex == 'm') && ($osex == 'm'))
        $sqlsex = 'm_seeking_m = m_seeking_m + 1';

    $sqlage = '';
    if ($mage < 18)
        $sqlage = 'age_group_one = age_group_one + 1';
    else if ($mage < 22)
        $sqlage = 'age_group_two = age_group_two + 1';
    else if ($mage < 26)
        $sqlage = 'age_group_three = age_group_three + 1';
    else if ($mage < 30)
        $sqlage = 'age_group_four = age_group_four + 1';
    else if ($mage < 40)
        $sqlage = 'age_group_five = age_group_five + 1';
    else
        $sqlage = 'age_group_six = age_group_six + 1';

    $stmt = $pdo->prepare("UPDATE prof_stats SET total = total + 1, $sqlsex, $sqlage WHERE prof_stats_id = $profstatsid");
    $stmt->execute();

    if (strlen($_POST['locbody']) > 120) {
        $stmt = $pdo->prepare('SELECT location_cat_id FROM location_cat WHERE cat_path = ? AND loc_path = ?');
        $stmt->bindParam(1, $input->fullySanitize($_POST['cat_path']));
        $stmt->bindParam(2, $input->fullySanitize($_POST['loc']));
        $stmt->execute();
         if ($myrow = $stmt->fetch(PDO::FETCH_NUM)) {
             $loccatid = $myrow[0];

             $locname  = "'Anonymous'";
             if (strlen($_POST['locname']) != 0)
                 $locname = $input->fullySanitize($_POST['locname']);
             $locemail = FALSE;
             if (strlen($_POST['locemail']) != 0)
                 $locemail = $input->killLinks($input->stripTags($input->fixInput($_POST['locemail'])));
                 //$locemail = $input->fullySanitize($_POST['locemail']);
             $loclocation = FALSE;
             if (strlen($_POST['loclocation']) != 0)
                 $loclocation = $input->fullySanitize($_POST['loclocation']);
             $locbody = FALSE;
             if (strlen($_POST['locbody']) != 0)
                 $locbody = $input->fullySanitize($_POST['locbody']);

             $stmt = $pdo->prepare('INSERT INTO tip (name, email, location, body, location_cat_id) VALUES (?, ?, ?, ?, ?)');
             $stmt->bindParam(1, $locname);
             if ($locemail)
                 $stmt->bindParam(2, $locemail);
             else
                 $stmt->bindValue(2, null);
             if ($loclocation)
                 $stmt->bindParam(3, $loclocation);
             else
                 $stmt->bindValue(3, null);
             if ($locbody)
                 $stmt->bindParam(4, $locbody);
             else
                 $stmt->bindValue(4, null);
             $stmt->bindParam(5, $loccatid);
             $stmt->execute();
         }
    }
    $trans->commit(TRUE);

    $mreligious     = 0;
    $mathletic      = 0;
    $mheart         = 0;
    $mmoney         = 0;
    $mintellect     = 0;
    $mfunny         = 0;
    $moutgoing      = 0;
    $madventure     = 0;
    $mstylish       = 0;
    $mshy           = 0;
    $mtradition     = 0;
    $msensual       = 0;
    $mpractical     = 0;
    $mliberal       = 0;
    $mconserve      = 0;
    $mromantic      = 0;
    $mpolitics      = 0;
    $oreligious     = 0;
    $oathletic      = 0;
    $oheart         = 0;
    $omoney         = 0;
    $ointellect     = 0;
    $ofunny         = 0;
    $ooutgoing      = 0;
    $oadventure     = 0;
    $ostylish       = 0;
    $oshy           = 0;
    $otradition     = 0;
    $osensual       = 0;
    $opractical     = 0;
    $oliberal       = 0;
    $oconserve      = 0;
    $oromantic      = 0;

    if ($msex == 'f') {
        $oheart++;
        $oromantic++;
    }
    else
        $osensual++;

    if ($mage > 29) {
        $ointellect++;
        if ($osex == 'm')
            $omoney++;
    }

    switch ($_POST['q1']) {
    case 'comedy':
        $mfunny++;
        $ofunny++;
        break;
    case 'drama':
        $mheart++;
        $oheart++;
        break;
    case 'action':
        $madventure++;
        break;
    case 'documentary':
        $mintellect++;
        $ointellect++;
    }

    switch ($_POST['q2']) {
    case 'yes':
        $mathletic = $mathletic + 2;
        $oathletic++;
        break;
    case 'nobut':
        $oathletic = $oathletic + 2;
        break;
    case 'no':
        $mathletic--;
        $oathletic = $oathletic - 2;
    }

    switch ($_POST['q3']) {
    case 'party':
        $moutgoing = $moutgoing + 2;
        $ooutgoing = $ooutgoing + 2;
        $oshy--;
        break;
    case 'work':
        $mmoney++;
        $omoney++;
        break;
    case 'book':
        $mintellect = $mintellect + 2;
        $ointellect++;
        break;
    case 'sweep':
        $mromantic = $mromantic + 2;
        $mtradition++;
        $mshy++;
        $omoney++;
        $oromantic++;
    }

    switch ($_POST['q4']) {
    case 'wantto':
        $omoney++;
        break;
    case 'spouse':
        $omoney = $omoney + 3;
        $opractical = $opractical - 2;
        break;
    case 'yes':
        $mmoney = $mmoney + 2;
        break;
    case 'dontneed':
        $mpractical = $mpractical + 2;
        $omoney--;
    }

    switch ($_POST['q5']) {
    case 'call':
        $mheart++;
        $oheart++;
        break;
    case 'nurse':
        $mheart = $mheart + 2;
        $oheart = $oheart + 2;
        break;
    case 'inside':
        $mheart = $mheart - 2;
        $oheart--;
    }

    switch ($_POST['q6']) {
    case 'yes':
        $mtradition = $mtradition + 2;
        $mconserve++;
        $oconserve++;
        $otradition = $otradition + 2;
        break;
    case 'no':
        $mtradition--;
        $otradition--;
    }

    switch ($_POST['q7']) {
    case 'yes':
        $mstylish = $mstylish + 2;
        $mpractical = $mpractical - 2;
        $ostylish++;
        $omoney++;
        break;
    case 'no':
        $mstylish = $mstylish - 2;
        $mpractical++;
        $ostylish = $ostylish - 2;
    }

    switch ($_POST['q8']) {
    case 'depends':
        $osensual++;
        break;
    case 'yes':
        $madventure++;
        $msensual = $msensual + 2;
        $osensual = $osensual + 2;
        break;
    case 'dependsshy':
        $msensual++;
        $osensual = $osensual + 2;
        break;
    case 'no':
        $mtradition++;
        $otradition = $otradition + 2;
        $madventure--;
        $msensual = $msensual - 2;
        $osensual--;
    }

    switch ($_POST['q9']) {
    case 'yes':
        $mreligious = $mreligious + 2;
        $oreligious++;
        break;
    case 'notas':
        $mreligious++;
        $oreligious = $oreligious + 2;
        break;
    case 'no':
        $mreligious = $mreligious - 2;
        $oreligious = $oreligious - 2;
    }

    switch ($_POST['q11']) {
    case 'show':
        $madventure++;
        $mpractical--;
        $mmoney--;
        $mromantic++;
        $oadventure = $oadventure + 2;
        $omoney++;
        $opractical = $opractical - 2;
        $ooutgoing++;
        break;
    case 'share':
        $madventure = $madventure + 2;
        $mpractical--;
        $mromantic++;
        $mmoney++;
        $oadventure = $oadventure + 2;
        $opractical--;
        break;
    case 'away':
        $madventure++;
        $omoney++;
        $oadventure++;
        break;
    case 'stay':
        $madventure = $madventure - 2;
        $mshy++;
        $oshy++;
        $oadventure--;
    }

    switch ($_POST['q12']) {
    case 'just':
        $mpractical++;
        $mmoney--;
        $opractical++;
        break;
    case 'latest':
        $mpractical--;
        $mmoney++;
        $opractical--;
        break;
    case 'afford':
        $mmoney = $mmoney - 2;
        $omoney = $omoney + 2;
    }

    switch ($_POST['q13']) {
    case 'relax':
        $mathletic = $mathletic - 2;
        $oathletic = $oathletic - 2;
        break;
    case 'both':
        $mathletic++;
        break;
    case 'active':
        $mathletic = $mathletic + 2;
        $madventure++;
        $oathletic = $oathletic + 2;
    }

    switch ($_POST['q14']) {
    case 'over':
        $mshy--;
        break;
    case 'terror':
        $mshy = $mshy + 2;
        break;
    case 'peers':
        $mmoney++;
        $mshy = $mshy - 2;
    }

    switch ($_POST['q15']) {
    case 'boring':
        $mintellect--;
        $ointellect--;
        break;
    case 'learn':
        $mintellect++;
        $ointellect = $ointellect + 2;
        break;
    case 'know':
        $mintellect = $mintellect + 2;
        $ointellect++;
    }

    switch ($_POST['q16']) {
    case 'attend':
        $mreligious = $mreligious + 2;
        $mtradition++;
        $oreligious = $oreligious + 2;
        $otradition++;
        break;
    case 'nonreligious':
        $mreligious = $mreligious - 2;
        $oreligious--;
        break;
    case 'nothing':
        $mtradition--;
        $mreligious--;
        $moutgoing--;
    }

    switch ($_POST['q17']) {
    case 'alone':
        $moutgoing--;
        $mshy++;
        $oheart++;
        break;
    case 'cost':
        $mromantic--;
        $mmoney--;
        $oromantic--;
        $omoney++;
        break;
    case 'love':
        $mromantic = $mromantic + 2;
        $oromantic = $oromantic + 2;
        $omoney++;
        break;
    case 'care':
        $mromantic = $mromantic - 2;
        $oromantic--;
        $opractical++;
        $ointellect++;
    }
    
    switch ($_POST['q18']) {
    case 'fire':
        $mromantic = $mromantic + 2;
        $mheart++;
        $oromantic = $oromantic + 2;
        break;
    case 'fly':
        $madventure++;
        $omoney++;
        $oadventure++;
        break;
    case 'ski':
        $mathletic = $mathletic + 2;
        $mmoney++;
        $mromantic--;
        $oathletic = $oathletic + 2;
    }

    switch ($_POST['q19']) {
    case 'not':
        $mtradition++;
        $mliberal--;
        $oliberal--;
        break;
    case 'beautiful':
        $mheart++;
        $mliberal++;
        break;
    case 'kids':
        $mpractical++;
    }

    switch ($_POST['q20']) {
    case 'unreal':
        $mconserve++;
        $mliberal--;
        $mheart--;
        $oconserve++;
        $oliberal--;
        break;
    case 'achievable':
        $mconserve--;
        $mliberal++;
        $oconserve--;
        $oliberal++;
        break;
    case 'history':
        $mpractical++;
        $mintellect++;
        $oliberal--;
    }

    switch ($_POST['q21']) {
    case 'man':
        $mconserve++;
        $mtradition = $mtradition + 2;
        if ($osex == 'm')
            $otradition = $otradition + 2;
        else
            $otradition++;
        $oromantic++;
        break;
    case 'split':
        $mtradition--;
        break;
    case 'woman':
        $mtradition = $mtradition - 2;
        $mliberal++;
        $otradition--;
    }

    switch ($_POST['q22']) {
    case 'love':
        $mromantic = $mromantic + 2;
        $mtradition++;
        $moutgoing--;
        $oromantic++;
        break;
    case 'settle':
        $mtradition--;
        $moutgoing++;
        $mconserve--;
        $otradition--;
        break;
    case 'comfort':
        $mpractical = $mpractical + 2;
        $mromantic--;
    }

    switch ($_POST['q23']) {
    case 'me':
        $moutgoing = $moutgoing + 2;
        if ($msex == 'm')
            $mshy--;
        else {
            $mshy = $mshy - 2;
            $mtradition--;
            $msensual++;
        }
        break;
    case 'you':
        $ooutgoing++;
        if ($msex == 'm') {
            $moutgoing--;
            $mshy = $mshy + 2;
        }
        else {
            $mshy++;
            $mtradition++;
        }
    }

    switch ($_POST['q24']) {
    case 'bores':
        $mpolitics = $mpolitics - 2;
        $mintellect--;
        $ointellect--;
        break;
    case 'passion':
        $mpolitics = $mpolitics + 2;
        $mintellect++;
        $ointellect++;
        break;
    case 'few':
        $mpolitics++;
    }

    switch ($_POST['q25']) {
    case 'dontfeel':
        $oreligious--;
        break;
    case 'oughtto':
        $oreligious++;
        break;
    case 'central':
        $mreligious = $mreligious + 2;
        $mconserve++;
        $oreligious = $oreligious + 2;
        break;
    case 'waste':
        $mreligious = $mreligious - 3;
        $mliberal++;
        $oreligious = $oreligious - 2;
    }

    switch ($_POST['q26']) {
    case 'comfort':
        $mpractical++;
        $mromantic--;
        $opractical++;
        break;
    case 'nothing':
        $mromantic++;
        $mstylish--;
        $omoney--;
        break;
    case 'pamper':
        $mpractical = $mpractical - 2;
        $mstylish++;
        $mmoney--;
        $omoney = $omoney + 2;
        $ostylish++;
        $opractical = $opractical - 2;
    }

    switch ($_POST['q27']) {
    case 'reward':
        $mpractical++;
        $mtradition = $mtradition + 2;
        $mheart++;
        $madventure--;
        $oadventure = $oadventure - 2;
        $otradition = $otradition + 2;
        break;
    case 'drag':
        $madventure++;
        $mreligious--;
        $oadventure++;
        $otradition--;
        $oconserve--;
        break;
    case 'challenge':
        $mtradition++;
    }

    switch ($_POST['q28']) {
    case 'laugh':
        $mfunny++;
        $mstylish--;
        $ostylish--;
        $ofunny = $ofunny + 2;
        break;
    case 'interests':
        $mstylish--;
        $ostylish--;
        break;
    case 'important':
        $mstylish++;
        $ointellect--;
        $oathletic++;
        $ostylish++;
        break;
    case 'dress':
        $mstylish = $mstylish + 2;
        $ostylish = $ostylish + 2;
    }

    switch ($_POST['q29']) {
    case 'interested':
        $madventure++;
        $oadventure = $oadventure + 2;
        $omoney++;
        break;
    case 'try':
        $madventure = $madventure + 2;
        $moutgoing++;
        $mtradition--;
        $oadventure++;
        break;
    case 'stick':
        $mtradition++;
        $madventure--;
        $oadventure--;
    }

    switch ($_POST['q30']) {
    case 'afford':
        $mmoney = $mmoney - 2;
        $madventure++;
        $omoney++;
        $oadventure++;
        break;
    case 'romantic':
        $mromantic = $mromantic + 2;
        $msensual++;
        $oromantic = $oromantic + 2;
        break;
    case 'fun':
        $madventure++;
        $oadventure++;
        $opractical--;
        break;
    case 'notravel':
        $mpractical++;
        $madventure = $madventure - 2;
        $oadventure--;
        break;
    case 'museums':
        $mintellect = $mintellect + 2;
        $ointellect++;
    }

    switch ($_POST['q31']) {
    case 'oppose':
        $mpolitics++;
        $mliberal++;
        break;
    case 'support':
        $mpolitics++;
        $mliberal--;
        break;
    case 'no':
        $mpolitics--;
        $mintellect--;
        $ointellect--;
    }

    switch ($_POST['q32']) {
    case 'help':
        $oheart++;
        break;
    case 'given':
        $mpolitics++;
        $mheart++;
        $oheart++;
        break;
    case 'own':
        $mheart--;
        $omoney++;
    }

    switch ($_POST['q33']) {
    case 'hate':
        $mconserve++;
        $mliberal--;
        $oliberal--;
        break;
    case 'vile':
        $mconserve--;
        $mliberal++;
        $oliberal++;
        break;
    case 'forces':
        $mintellect++;
        break;
    case 'god':
        $mreligious++;
    }

    switch ($_POST['q34']) {
    case 'funny':
        $mfunny++;
        $ofunny++;
        $mconserve--;
        break;
    case 'kids':
        $mconserve++;
        $mtradition++;
        $otradition++;
        break;
    case 'never':
        $mfunny--;
        $mintellect++;
        $ointellect++;
    }

    switch ($_POST['q35']) {
    case 'guidance':
        $mpractical++;
        $mtradition--;
        $mconserve--;
        break;
    case 'abstinence':
        $mtradition++;
        $mreligious++;
        $mconserve++;
        $msensual--;
        $otradition++;
        break;
    case 'explore':
        $mconserve--;
        $mtradition--;
        $msensual++;
        $otradition--;
        $oconserve--;
        break;
    case 'resist':
        $mtradition = $mtradition + 2;
        $mliberal--;
        $otradition++;
        $osensual++;
    }

    switch ($_POST['q36']) {
    case 'love':
        $mheart = $mheart + 2;
        $mromantic++;
        $mliberal++;
        break;
    case 'conform':
        $mliberal++;
        $madventure++;
        $mstylish++;
        $mtradition--;
        break;
    case 'values':
        $mreligious++;
        $mtradition++;
        $mconserve++;
        $msensual--;
        break;
    case 'means':
        $mpractical = $mpractical + 2;
        $mconserve++;
        break;
    case 'lazy':
        $mmoney++;
        $mconserve++;
        $mheart--;
    }

    switch ($_POST['q37']) {
    case 'success':
        $mmoney++;
        $omoney++;
        break;
    case 'love':
        $mromantic++;
        $mheart++;
        break;
    case 'vices':
        $mtradition++;
        $mreligious++;
        $otradition++;
        $osensual--;
    case 'change':
        $mpractical--;
        $mheart++;
        $mliberal++;
        $oliberal++;
        $oheart++;
        $omoney--;
    }

    switch ($_POST['q38']) {
    case 'manwoman':
        $mpolitics++;
        $mtradition = $mtradition + 2;
        $mconserve++;
        $oliberal--;
        break;
    case 'immoral':
        $mpolitics++;
        $mreligious = $mreligious + 2;
        $mconserve++;
        $oliberal--;
        $oreligious++;
        break;
    case 'love':
        $mliberal++;
        $mheart++;
        $mromantic++;
        $otradition--;
        break;
    case 'rights':
        $mpolitics++;
        $mliberal++;
        $oliberal++;
        $oconserve--;
    }

    switch ($_POST['q39']) {
    case 'laugh':
        $mfunny++;
        $otradition--;
        $ofunny = $ofunny + 2;
        break;
    case 'feelings':
        $mheart++;
        $oheart++;
        break;
    case 'finances':
        $omoney++;
        break;
    case 'roles':
        $mtradition = $mtradition + 2;
        $otradition = $otradition + 2;
        $oliberal--;
    }

    switch ($_POST['q40']) {
    case 'laughter':
        $mfunny++;
        $ofunny = $ofunny + 2;
        $ointellect--;
        break;
    case 'honesty':
        $mshy++;
        $oreligious++;
        $oheart++;
        break;
    case 'cuddle':
        $mromantic++;
        $oromantic = $oromantic + 2;
        $oheart++;
        break;
    case 'intellect':
        $mintellect++;
        $ointellect = $ointellect + 2;
        $oromantic--;
        $oheart--;
        break;
    case 'foreplay':
        $msensual++;
        $osensual = $osensual + 2;
        $otradition--;
        $oadventure++;
        break;
    case 'fashion':
        $mstylish++;
        $ostylish = $ostylish + 2;
        $omoney++;
        $opractical--;
    }

    switch ($_POST['q41']) {
    case 'assert':
        $omoney++;
        $ooutgoing = $ooutgoing + 2;
        $oshy = $oshy - 2;
        $oadventure++;
        $osensual++;
        break;
    case 'fit':
        $mathletic++;
        $oathletic = $oathletic + 2;
        break;
    case 'wealthy':
        $mstylish++;
        $omoney = $omoney + 2;
        $ostylish = $ostylish + 2;
        $opractical--;
        break;
    case 'modest':
        $opractical++;
        $omoney--;
        $ostylish--;
        break;
    case 'quiet':
        $oshy = $oshy + 2;
        $ooutgoing--;
    }

    switch ($_POST['q42']) {
    case 'appear':
        $ostylish++;
        break;
    case 'ambition':
        $omoney++;
        break;
    case 'meek':
        $oshy = $oshy - 2;
        $ooutgoing = $ooutgoing + 2;
        break;
    case 'intellect':
        $mintellect++;
        $ointellect = $ointellect + 2;
        break;
    case 'energy':
        $mathletic++;
        $madventure++;
        $oathletic++;
        $oadventure++;
    }

    switch ($_POST['q43']) {
    case 'humor':
        $oshy = $oshy + 2;
        $ofunny++;
        $ooutgoing--;
        break;
    case 'engaging':
        $oshy = $oshy - 2;
        $ointellect++;
        $ooutgoing = $ooutgoing + 2;
        break;
    case 'outgoing':
        $oshy--;
        $ofunny++;
        $ooutgoing++;
        break;
    case 'quiet':
        $oshy = $oshy + 2;
        $ointellect++;
        $ooutgoing--;
    }

    switch ($_POST['q44']) {
    case 'grounded':
        $opractical = $opractical + 2;
        $omoney--;
        $ostylish--;
        break;
    case 'wants':
        $omoney = $omoney + 2;
        break;
    case 'god':
        $oreligious = $oreligious + 2;
        $oconserve = $oconserve + 1;
        break;
    case 'experience':
        $ointellect = $ointellect + 2;
        break;
    case 'generous':
        $oheart = $oheart + 2;
        $opractical++;
    }

    switch ($_POST['q45']) {
    case 'bedroom':
        $oshy--;
        $osensual = $osensual + 2;
        $ooutgoing++;
        break;
    case 'causes':
        $mpolitics++;
        $ointellect++;
        break;
    case 'culture':
        $otradition++;
        $osensual--;
        break;
    case 'career':
        $omoney = $omoney + 2;
    }


    // <## Correction factors ##>
    
    if ($mtradition > 14)
        $oshy++;
    if ($mathletic > 2)
        $oathletic++;
    if ($mromantic > 8)
        $oromantic++;
    
    
    // <## GO BACK AND DO Q10 AT THE END! ALSO CHECK Q28, answer 2! ##>
    
    
    if ($_POST['q28'] == 'interests') {
        if ($mreligious > 7) $oreligious++;
        if ($mathletic > 3) $oathletic++;
        if ($mmoney > 6) $omoney++;
        if ($mintellect > 7) $ointellect = $ointellect + 2;
        if ($mfunny > 3) $ofunny++;
        if ($madventure > 7) $oadventure++;
        if ($mstylish > 4) $ostylish++;
        if ($mliberal > 3) $oliberal++;
        if ($mconserve > 3) $mconserve++;
    }
    
    if ($_POST['q10'] == 'yes') {
        if ($mmoney > 5) $omoney = $omoney - 2;
        if ($mreligious < 0) $oreligious = $oreligious + 2;
        if ($mathletic < 0) $oathletic++;
        if ($mintellect > 6) $ointellect = $ointellect - 2;
        if ($mintellect < 1) $ointellect = $ointellect + 2;
        if ($moutgoing > 4) {
            $oshy++;
            $ooutgoing--;
        }
        if ($mstylish > 4) $ostylish--;
        if ($mshy > 3) {
            $oshy--;
            $ooutgoing++;
        }
        if ($mtradition > 10) $otradition--;
        if ($mpractical > 6) $opractical = $opractical - 2;
        if ($mpractical < 0) $opractical = $opractical + 2;
        if ($mliberal > 3) {
            $oconserve = $oconserve + 2;
            $oliberal = $oliberal - 2;
        }
        if ($mconserve > 3) {
            $oconserve = $oconserve - 2;
            $oliberal = $oliberal + 2;
        }
    }
    else if ($_POST['q10'] == 'sometimes') {
        if ($mmoney > 5) $omoney--;
        if ($mreligious < 0) $oreligious++;
        if ($mathletic < 0) $oathletic++;
        if ($mintellect > 6) $ointellect--;
        if ($mintellect < 1) $ointellect++;
        if ($moutgoing > 4) $oshy++;
        if ($mstylish > 5) $ostylish--;
        if ($mshy > 3) $ooutgoing++;
        if ($mpractical > 6) $opractical--;
        if ($mpractical < 0) $opractical++;
        if ($mliberal > 3) {
            $oconserve++;
            $oliberal--;
        }
        if ($mconserve > 3) {
            $oconserve--;
            $oliberal++;
        }
    }

    if (($mpolitics > 2) && (($_POST['q10'] == 'no') || (($_POST['q10'] == 'sometimes') && ($_POST['q28'] == 'interests')))) {
        if ($mliberal > 2) {
            $oconserve = $oconserve - 3;
            $oliberal++;
        }
        if ($mconserve > 2) {
            $oconserve++;
            $oliberal = $oliberal - 3;
        }
    }
    else if ($mpolitics < 0) {
        $oliberal--;
        $oconserve--;
    }
    

    $mpolitics = ($mpolitics + 3) * 100 / 9;
    $mreligious = ($mreligious + 8) * 100 / 20;
    $mathletic = ($mathletic + 3) * 100 / 11;
    $mheart = ($mheart + 5) * 100 / 17;
    $mmoney = ($mmoney + 9) * 100 / 19; // <## / +1 correction ##>
    $mintellect = ($mintellect + 4) * 100 / 16; // <## +1 correction ##>
    $mfunny = ($mfunny + 1) * 100 / 6;
    $moutgoing = ($moutgoing + 4) * 100 / 10;
    $madventure = ($madventure + 7) * 100 / 19;
    $mstylish = ($mstylish + 4) * 100 / 11;
    $mshy = ($mshy + 4) * 100 / 13;
    $mtradition = ($mtradition + 10) * 100 / 31; // <## +1 correction ##>
    $msensual = ($msensual + 4) * 100 / 10;
    $mpractical = ($mpractical + 7) * 100 / 21;
    $mliberal = ($mliberal + 5) * 100 / 13;
    $mconserve = ($mconserve + 5) * 100 / 14;
    $mromantic = ($mromantic + 6) * 100 / 21;

    $oreligious = ($oreligious + 5) * 100 / 15;
    $oathletic = ($oathletic + 4) * 100 / 14;
    $oheart = ($oheart + 2) * 100 / 13;
    $omoney = ($omoney + 7) * 100 / 29; // <## +2 correction ##>
    $ointellect = ($ointellect + 6) * 100 / 21; // <## +1 correction ##>
    $ofunny = ($ofunny + 1) * 100 / 9; // <## +1 correction ##>
    $ooutgoing = ($ooutgoing + 2) * 100 / 13;
    $oadventure = ($oadventure + 5) * 100 / 15;
    $ostylish = ($ostylish + 5) * 100 / 14;
    $oshy = ($oshy + 6) * 100 / 12; // <## / +1 correction ##>
    $otradition = ($otradition + 9) * 100 / 23;
    $osensual = ($osensual + 2) * 100 / 13; // <## / +1 correction ##>
    $opractical = ($opractical + 8) * 100 / 16; // <## -2 correction ##>
    $oliberal = ($oliberal + 5) * 100 / 9;
    $oconserve = ($oconserve + 4) * 100 / 8; // <## / +1 correction ##>
    $oromantic = ($oromantic + 2) * 100 / 14;

// <## ensure conservative and liberal don't end up in the same results ##>
    if ($mconserve > $mliberal)
        $mliberal = $mliberal - 150;
    else
        $mconserve = $mconserve - 150;
    if ($oconserve > oliberal)
        $oliberal = $oliberal - 150;
    else
        $oconserve = $oconserve - 150;

// <## ensure outgoing and shy don't end up in the same results ##>
    if ($moutgoing > $mshy)
        $mshy = $mshy - 150;
    else
        $moutgoing = $moutgoing - 150;
    if ($ooutgoing > $oshy)
        $oshy = $oshy - 150;
    else
        $ooutgoing = $ooutgoing - 150;

// <## do them all ##>

$md[] = 'Religious';
$m[] = $mreligious;
//echo 'Religious ' . $mreligious . '<br>';
$md[] = 'Athletic';
$m[] = $mathletic;
//echo 'Athletic ' . $mathletic . '<br>';
$md[] = 'Big-Hearted';
$m[] = $mheart;
//echo 'Big-Hearted ' . $mheart . '<br>';
$md[] = 'Wealthy/Ambitious';
$m[] = $mmoney;
//echo 'Wealthy/Ambitious ' . $mmoney . '<br>';
$md[] = 'Intellectual';
$m[] = $mintellect;
//echo 'Iintellectual ' . $mintellect . '<br>';
$md[] = 'Funny';
$m[] = $mfunny;
//echo 'Funny ' . $mfunny . '<br>';
$md[] = 'Outgoing';
$m[] = $moutgoing;
//echo 'Outoging ' . $moutgoing . '<br>';
$md[] = 'Adventurous';
$m[] = $madventure;
//echo 'Aventurous ' . $madventure . '<br>';
$md[] = 'Stylish';
$m[] = $mstylish;
//echo 'Sylihs ' . $mstylish . '<br>';
$md[] = 'Shy';
$m[] = $mshy;
//echo 'Shy ' . $mshy . '<br>';
$md[] = 'Traditional';
$m[] = $mtradition;
//echo 'Traditional ' . $mtradition . '<br>';
$md[] = 'Sensual';
$m[] = $msensual;
//echo 'Sensual ' . $msensual . '<br>';
$md[] = 'Practical';
$m[] = $mpractical;
//echo 'practical ' . $mpractical . '<br>';
$md[] = 'Liberal';
$m[] = $mliberal;
//echo 'Liberal ' . $mliberal . '<br>';
$md[] = 'Conservative';
$m[] = $mconserve;
//echo 'Conservtative ' . $mconserve . '<br>';
$md[] = 'Romantic';
$m[] = $mromantic;
//echo 'Romantic ' . $mromantic . '<br><br>';
$od[] = 'Religious';
$o[] = $oreligious;
//echo 'Religious ' . $oreligious . '<br>';
$od[] = 'Athletic';
$o[] = $oathletic;
//echo 'Athletic ' . $oathletic . '<br>';
$od[] = 'Big-Hearted';
$o[] = $oheart;
//echo 'Big-Hearted ' . $oheart . '<br>';
$od[] = 'Wealthy/Ambitious';
$o[] = $omoney;
//echo 'Wealthy/Ambitious ' . $omoney . '<br>';
$od[] = 'Intellectual';
$o[] = $ointellect;
//echo 'Intellecutal ' . $ointellect . '<br>';
$od[] = 'Funny';
$o[] = $ofunny;
//echo 'Funny ' . $ofunny . '<br>';
$od[] = 'Outgoing';
$o[] = $ooutgoing;
//echo 'Outoging ' . $ooutgoing . '<br>';
$od[] = 'Adventurous';
$o[] = $oadventure;
//echo 'Adventurous ' . $oadventure . '<br>';
$od[] = 'Stylish';
$o[] = $ostylish;
//echo 'Stylish ' . $ostylish . '<br>';
$od[] = 'Shy';
$o[] = $oshy;
//echo 'Shy ' . $oshy . '<br>';
$od[] = 'Traditional';
$o[] = $otradition;
//echo 'Traditional ' . $otradition . '<br>';
$od[] = 'Sensual';
$o[] = $osensual;
//echo 'Sensual ' . $osensual . '<br>';
$od[] = 'Practical';
$o[] = $opractical;
//echo 'Practical ' . $opractical . '<br>';
$od[] = 'Liberal';
$o[] = $oliberal;
//echo 'Liberal ' . $oliberal . '<br>';
$od[] = 'Conservative';
$o[] = $oconserve;
//echo 'Conservtaive ' . $oconserve . '<br>';
$od[] = 'Romantic';
$o[] = $oromantic;
//echo 'Romantic ' . $oromantic . '<br>';

// check to see if we need to update the cookie!
if (($msex != $osex) && ($mreligious > 65)) {
    $cookieval = $_COOKIE['mystic'];
    if (strlen($cookieval) == 6)
        setcookie("mystic", $cookieval . '-r', time() + 94608000);
    else if (strlen($cookieval) == 8)
        setcookie("mystic", substr($cookieval, 0, 6) . '-r', time() + 94608000);
}

/*
<MvCOMMENT>
mreligious:  &[mreligious];<br>
mathletic: &[mathletic];<br>  
mheart: &[mheart];<br>     
mmoney: &[mmoney];<br>     
mintellect: &[mintellect];<br> 
mfunny: &[mfunny];<br>
moutgoing: &[moutgoing];<br>  
madventure: &[madventure];<br> 
mstylish: &[mstylish];<br>   
mshy: &[mshy];<br>       
mtradition: &[mtradition];<br> 
msensual: &[msensual];<br>   
mpractical: &[mpractical];<br> 
mliberal: &[mliberal];<br>   
mconserve: &[mconserve];<br>  
mromantic: &[mromantic];<br>  
mpolitics: &[mpolitics];<br>  
oreligious: &[oreligious];<br> 
oathletic: &[oathletic];<br>  
oheart: &[oheart];<br>     
omoney: &[omoney];<br>
ointellect: &[ointellect];<br> 
ofunny: &[ofunny];<br>     
ooutgoing: &[ooutgoing];<br>  
oadventure: &[oadventure];<br> 
ostylish: &[ostylish];<br>   
oshy: &[oshy];<br>       
otradition: &[otradition];<br> 
osensual: &[osensual];<br>   
opractical: &[opractical];<br> 
oliberal: &[oliberal];<br>   
oconserve: &[oconserve];<br>  
oromantic: &[oromantic];<br>  
</MvCOMMENT>
*/
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Your Results for the Famous Dating Quiz at Dating Diversions</title>
<link rel="stylesheet" type="text/css" href="dd.css">
<script type="text/javascript">
var _gaq=_gaq||[];_gaq.push(['_setAccount','UA-628020-4']);_gaq.push(['_trackPageview']);(function(){var ga=document.createElement('script');ga.type='text/javascript';ga.async=true;ga.src=('https:'==document.location.protocol?'https://ssl':'http://www')+'.google-analytics.com/ga.js';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(ga,s);})();
</script>
</head>
<body>
<h1>Dating Diversions Famous Dating Quiz Results</h1>

<div class="sm bspace" style="width: 672px;">
<a href="/">Dating Diversions Home</a> | 
<a href="/dating_jokes.html">Dating Jokes</a> | 
<a href="/advice/men/advice.html">Dating Advice for Men</a> | 
<a href="/advice/women/advice.html">Dating Advice for Women</a> | 
<a href="stories.mv">Dating Stories</a> | 
<a href="gift_ideas.html">Great Gift Ideas</a>
</div>

<div style="width: 700px;"><b>Below are your results for this quiz.</b>  On the left are <i>your</i> top dating personality traits. 
On the right are the top dating personality traits for a potential date to match best with you.</div><br>

<div class="ctr" style="width: 700px;">

<?php
    if ($mage < 18) {
        echo '<a href="http://www.tkqlhce.com/72103lnwtnvACHHKKGHACBEIHECI" target="_top" onmouseover="window.status=\'http://www.jamster.com\';return true;" onmouseout="window.status=\' \';return true;">';
        echo '<img src="http://www.awltovhc.com/4g108o26v0zKMRRUUQRKMLOSROMS" alt="The best games for your phone! " border="0"></a>';
    }
     else if (($msex == 'f') && ($osex == 'f')) {
         echo '<a href="http://www.jdoqocy.com/jb108xdmjdl0277AA670934666A" target="_top" onmouseover="window.status=\'http://www.glimpse.com/default.asp?prm=11514\';return true;" onmouseout="window.status=\' \';return true;">';
         echo '<img src="http://www.lduhtrp.net/dr65r6Az42OQVVYYUVOXRSUUUY" alt="Love, Romance and Dating at Glimpse.com" border="0"></a>';
     }
     else if (($msex == 'm') && ($osex == 'm') && ($mage > 28)) {
         echo '<a href="http://www.anrdoezrs.net/99101lnwtnvACHHKKGHAJDEGGHB" target="_top" onmouseover="window.status=\'http://www.glimpse.com/default.asp?prm=11514\';return true;" onmouseout="window.status=\' \';return true;">';
         echo '<img src="http://www.afcyhf.com/oc115ax0pvtEGLLOOKLENHIKKLF" alt="Love, Romance and Dating at Glimpse.com" border="0"></a>';
     }
     else if (($msex == 'm') && ($osex == 'm')) {
         echo '<a href="http://www.kqzyfj.com/94116biroiq57CCFFBC5769E669C" target="_top" onmouseover="window.status=\'http://friendfinder.com\';return true;" onmouseout="window.status=\' \';return true;">';
         echo '<img src="http://www.tqlkg.com/ss67elpdjh2499CC892436B3369" alt="Join GayFriendFinder...Over 1 million active" border="0"></a>';
     }
     else if ($mreligious > 65) {
         echo '<a href="http://www.dpbolvw.net/1d111zw41w3JLQQTTPQJLKNTLPKN" target="_top" onmouseover="window.status=\'http://www.christiancafe.com\';return true;" onmouseout="window.status=\' \';return true;">';
         echo '<img src="http://www.lduhtrp.net/qh105z15u-yJLQQTTPQJLKNTLPKN" alt="Christian Singles" border="0"></a>';
     }
     else if (($osex == 'f') && ($osensual > 65)) {
         echo '<a href="http://www.anrdoezrs.net/ok79qgpmgo35AADD9A354795CDB" target="_top" onmouseover="window.status=\'http://www.cupidjunction.com\';return true;" onmouseout="window.status=\' \';return true;">';
         echo '<img src="http://www.awltovhc.com/aj103r6Az42OQVVYYUVOQPSUQXYW" alt="" border="0"></a>';
     }
     else if (($osex == 'f') && ($_POST['q4'] == 'yes') && ($mage > 28)) {
         echo '<a href="http://www.tkqlhce.com/da74shqnhp46BBEEAB4658C96C5" target="_top" onmouseover="window.status=\'http://www.ge-dating.com?pid=0\';return true;" onmouseout="window.status=\' \';return true;">';
         echo '<img src="http://www.awltovhc.com/th75jy1qwuFHMMPPLMFHGJNKHNG" alt="Serious about dating?" border="0"></a>';
     }
     else if (($osex == 'm') && (($mtradition > 60) || ($mreligious > 60))) {
         echo '<a href="http://www.dpbolvw.net/bi103lnwtnvACHHKKGHACBEHGGCK" target="_top" onmouseover="window.status=\'http://www.soulmatch.com\';return true;" onmouseout="window.status=\' \';return true;">';
         echo '<img src="http://www.ftjcfx.com/7p121p59y31NPUUXXTUNPORUTTPX" alt="Soulmatch - Sign Up Today!" border="0"></a>';
     }
     else if ($osex == 'm') {
         echo '<a href="http://www.tkqlhce.com/j1108ar-xrzEGLLOOKLEGFHOJMMO" onmouseover="window.status=\'http://www.eharmony.com\';return true;" onmouseout="window.status=\' \';return true;">';
         echo '<img src="http://www.tqlkg.com/df66snrflj46BBEEAB4657E9CCE" alt="" border="0"></a>';
     }
     else {
         echo '<a href="http://www.tkqlhce.com/2h103ox52x4KMRRUUQRKMLNUQSOO" target="_top" onmouseover="window.status=\'http://personals.yahoo.com\';return true;" onmouseout="window.status=\' \';return true;">';
         echo '<img src="http://www.ftjcfx.com/rn68g04tzxIKPPSSOPIKJLSOQMM" alt="Yahoo! Personals - Give Fate a Nudge" border="0"></a>';
     }
?>
</div>
<br>
<div class="fll" style="width: 350px; padding-left: 20px;">
<h2 style="margin-left: -20px;">Your dating personality profile:</h2>
<?php
     sortTraits($m, $md);
     sortTraits($o, $od);
     $mtraits = '<b>' . $md[0] . '</b> - ' . getMDesc($md[0], $osex) . '<br><b>' . $md[1] . '</b> - ' . getMDesc($md[1], $osex) . '<br><b>' . $md[2] . '</b> - ' . getMDesc($md[2], $osex);
     $otraits = '<b>' . $od[0] . '</b> - ' . getODesc($od[0], $osex) . '<br><b>' . $od[1] . '</b> - ' . getODesc($od[1], $osex) . '<br><b>' . $od[2] . '</b> - ' . getODesc($od[2], $osex);

     $mten = '';
     $c = 1;
     while ($c < 11) {
         if ($c < 4)
             $mten .= '<b>' . $c . '. ' . $md[$c-1] . '</b><br>';
         else
             $mten .= $c . '. ' . $md[$c-1] . '<br>';
         $c++;
     }

     $oten = '';
     $c = 1;
     while ($c < 11) {
         if ($c < 4)
             $oten .= '<b>' . $c . '. ' . $od[$c-1] . '</b><br>';
         else
             $oten .= $c . '. ' . $od[$c-1] . '<br>';
         $c++;
     }

     $match = '';
     if ($mage > 29) {
         if ($osex == 'f')
             $match = 'Woman';
         else
             $match = 'Man';
     }
     else {
         if ($osex == 'f')
             $match = 'Girl';
         else
             $match = 'Guy';
     }
?>

You matched the following traits:<br><br>
<?= $mtraits ?>
</div>

<div class="fll" style="width: 350px; padding-left: 20px;">
<h2 style="margin-left: -20px;">Your date match profile:</h2>

You match with <?= ($osex == 'm' ? 'men' : 'women') ?> who have following traits:<br><br>
<?= $otraits ?>
</div><br style="clear: both;"><br>

<div class="fll" style="width: 350px; padding-left: 20px;">
<div class="box1" style="width: 260px;">
<h2>Your Top Ten Traits, Ranked</h2>
<div class="bpad">
<?= $mten ?>
</div></div>
</div>

<div class="fll" style="width: 350px; padding-left: 20px;">
<div class="box2" style="width: 260px;">
<h2>Your Top Ten Match Traits, Ranked</h2>
<div class="bpad">
<?= $oten ?>
</div></div>
</div><br><br>

<br style="clear: both;"><br>
<?php
    if ($mage > 17) {
?>
<h2>Find That Special <?= $match ?>...</h2>

<div class="box3" style="width: 600px;">
  <h2>Would I Date You is a unique dating site</h2>
  <div class="bpad">
    <a href="http://www.wouldidateyou.com/account/join1.html">Create your personal dating quiz</a> at WouldIDateYou.com.<br><br>
    Let your friends take your quiz or find matches in your area.  This site makes it easy and fun.  It's completely free, now and always.  No charge, ever.
  </div>
</div><br>

<?php
    }
/* commented on 3/29/08
<div class="box3" style="width: 600px;">
<h2>Finding your perfect match is easier than you think</h2>
<div class="bpad">
In 2003 alone <b>23 million Americans visited online dating/singles sites</b>.<br><br>

You are <b>literally</b> just a few clicks away from finding that <?= strtolower($od[0]) . ', ' . strtolower($od[1]) . ', ' . strtolower($od[2]) . ' ' . strtolower($match) ?> on one of the popular online matching services.  
It's 2005, start dating like it!<br><br>

<?php
        if ($osex != $msex) {
            if ($mage > 59) {
                echo '<a href="http://www.tkqlhce.com/e9116ar-xrzEGLLOOKLEGFIMIIFJ" target="_top" onmouseover="window.status=\'http://friendfinder.com\';return true;" onmouseout="window.status=\' \';return true;">Meet Active, Single Seniors for Friendship and More</a><img src="http://www.lduhtrp.net/ng122wquiom79EEHHDE798BFBB8C" width="1" height="4" border="0">';
                echo '- SeniorFriendFinder.com is tops in experience for serving the senior community.<br><br>';
            }
            if ($_POST['loc'] != '') {
                echo '<a href="http://www.dpbolvw.net/oi121shqnhp46BBEEAB4658BC7DA" target="_top" onmouseover="window.status=\'http://www.americansingles.com/default.asp?p=7090&prm=44816\';return true;" onmouseout="window.status=\' \';return true;">Free Online Singles</a><img src="http://www.awltovhc.com/k6115h48x20MOTTWWSTMONQTUPVS" width="4" height="9" border="0">';
                echo '- AmericanSingles is a leading online matchmaker and offers free features that other services charge for.<br><br>';
            }
?>
<a href="http://www.anrdoezrs.net/n0116ft1zt0GINNQQMNGIHKHKOIO" target="_top" onmouseover="window.status='http://www.eharmony.com';return true;" onmouseout="window.status=' ';return true;">eHarmony - Free Personality Profile</a><img src="http://www.awltovhc.com/8f116qmqeki35AADD9A354747B5B" width="3" height="7" border="0"> 
- eHarmony will create a free personality profile for you based on 29 dimensions of compatibility. They have over 5 million members and an emphasis on those seeking serious relationships.<br><br>

<a href="http://www.tkqlhce.com/dt121ar-xrzEGLLOOKLEGFHMNHFN" onmouseover="window.status='http://personals.yahoo.com';return true;" onmouseout="window.status=' ';return true;">Find love at Yahoo! Personals</a><img src="http://www.ftjcfx.com/nc117o26v0zKMRRUUQRKMLNSTNLT" width="1" height="1" border="0"> 
- Backed by the reputation of Yahoo! and one of the most popular match-making services.  Search for singles (with pictures) in your area for free.<br><br>

<?php
            if ($_POST['loc'] == '') {
                echo '<a href="http://www.dpbolvw.net/ba107hz74z6MOTTWWSTMQWWWNVN" onmouseover="window.status=\'http://www.date.com\';return true;" onmouseout="window.status=\' \';return true;">Find A Date Now! - Date.com</a><img src="http://www.ftjcfx.com/5p65tkocig1388BB7815BBB2A2" width="3" height="5" border="0">';
                echo '- Launched in 1997, Date.com adds approximately 250,000 new members each month.  Join up today and get your love life back on track!<br><br>';
            }
        }
        else {
?>
<a href="http://www.anrdoezrs.net/to114cy63y5LNSSVVRSLNMOVQNPV" target="_top" onmouseover="window.status='http://www.glimpse.com/default.asp?prm=11514';return true;" onmouseout="window.status=' ';return true;">Glimpse.com, Free Registration</a><img src="http://www.awltovhc.com/en98xjnbhf0277AA670213A524A" width="1" height="1" border="0"> 
- Glimpse is a major gay and lesbian relationship network. Fill out your profile at Glimpse for free.<br><br>

<a href="http://www.kqzyfj.com/nn75js0ys-FHMMPPLMFPKMGKNL" target="_top" onmouseover="window.status='http://www.gay.com';return true;" onmouseout="window.status=' ';return true;">Gay.com Personals</a><img src="http://www.afcyhf.com/r470kpthnl68DDGGCD6GBD7BEC" width="1" height="1" border="0">
- With over 3 million members, this service has years of experience serving the gay community.<br><br>

<a href="http://www.tkqlhce.com/dt121ar-xrzEGLLOOKLEGFHMNHFN" onmouseover="window.status='http://personals.yahoo.com';return true;" onmouseout="window.status=' ';return true;">Find love at Yahoo! Personals</a><img src="http://www.ftjcfx.com/nc117o26v0zKMRRUUQRKMLNSTNLT" width="1" height="1" border="0"> 
Backed by the reputation of Yahoo! and one of the most popular match-making services.  Search for singles (with pictures) in your area for free.<br><br>
<?php
        }
?>
DatingDiversions.com's dating personality profile is, we must admit, not as sophisticated as the ones you will find at the sites above. :)

</div></div><br><br>
<?php
    }
    else {
?>
<h2>Some offers you might be interested in...</h2>
<div class="box3" style="width: 600px;">
<h2>Consider These Advertisers</h2>
<div class="bpad">

<a href="http://www.kqzyfj.com/c4106p-85-7NPUUXXTUNPORVTSVT" target="_top" onmouseover="window.status='http://www.jamster.com';return true;" onmouseout="window.status=' ';return true;">Free Ringtone at Jamster!</a><img src="http://www.lduhtrp.net/1i103z15u-yJLQQTTPQJLKNRPORP" width="4" height="4" border="0"><br><br>

<a href="http://www.tkqlhce.com/5l115gv30v2IKPPSSOPIKJNJKMPS" target="_top" onmouseover="window.status='http://www.myYearbook.com';return true;" onmouseout="window.status=' ';return true;">myYearbook.com</a> -- "Created by 2 high school students as the greatest procrastination tool in history." And it's free.<img src="http://www.afcyhf.com/3l104tkocig1388BB7813262358B" width="2" height="5" border="0"><br><br>

<a href="http://www.jdoqocy.com/o0104js0ys-FHMMPPLMFHGJNOOPI" target="_top" onmouseover="window.status='http://www.spreadshirt.com/shop.php?sid=1000';return true;" onmouseout="window.status=' ';return true;">Make it personal: design and buy your shirt!</a><img src="http://www.ftjcfx.com/h7104r6Az42OQVVYYUVOQPSWXXYR" width="6" height="6" border="0"><br><br>

Find great deals on <a href="http://www.kqzyfj.com/me115p-85-7NPUUXXTUNPPOOVXR" target="_top" onmouseover="window.status='http://www.half.com';return true;" onmouseout="window.status=' ';return true;">videos & DVDs</a> at Half.com<img src="http://www.afcyhf.com/rh79p59y31NPUUXXTUNPPOOVXR" width="7" height="7" border="0"><br><br>

<a href="http://www.kqzyfj.com/4l117ox52x4KMRRUUQRKNNLNTNL" target="_top" onmouseover="window.status='http://www.gogamer.com';return true;" onmouseout="window.status=' ';return true;">Save 10% to 70% off retail prices on computer games everyday at gogamer.com</a><img src="http://www.lduhtrp.net/qo68elpdjh2499CC8925535B53" width="3" height="3" border="0"><br><br>

<a href="http://www.tkqlhce.com/1l77ar-xrzEGLLOOKLENHILOLN" target="_top" onmouseover="window.status='http://www.iseeme.com';return true;" onmouseout="window.status=' ';return true;">Personalized Children's Books</a>, adorable gifts for young children <img src="http://www.awltovhc.com/3g103qmqeki35AADD9A3C67ADAC" width="2" height="3" border="0">

</div></div><br>
<?php
    }
?>
*/
?>

<h2>If You Already Have a <?= $match ?>, <a href="/gift_ideas.html">Here Are Some Perfect Gift Ideas</a></h2><br>

<h2>Copy and Paste the HTML Code Below to your Blog, Online Journal, or Message Board:</h2>
<h3>The HTML code below will display your dating quiz results</h3>

<textarea cols="60" rows="10">
<table width="600"><tr valign="top"><td width="300"><b>Your dating personality profile:</b><br><br><?= $mtraits ?></td><td><b>Your date match profile:</b><br><br><?= $otraits ?></td></tr><tr><td><div style="color: black; border: 1px solid black; background-color: white; width: 220px; padding: 5px;"><b><u>Your Top Ten Traits</u></b><br><br><?= $mten ?></div></td><td width="300"><div style="color: black; border: 1px solid black; background-color: white; width: 220px; padding: 5px;"><b><u>Your Top Ten Match Traits</u></b><br><br><?= $oten ?></div></td></tr></table><br>Take the Online <a href="http://www.datingdiversions.com/">Dating Profile</a> Quiz at <a href="http://www.datingdiversions.com/">Dating Diversions</a>
</textarea><br><br>

<div style="border: 1px solid #000000; background-color: #ffffee; color: #000000; padding: 5px; width: 500px;">
  <b>Hey Take a Brand New Quiz--</b><br>
  <a href="/dating_sw_quiz.html">Dating Strengths and Weaknesses Quiz</a><br>
  The sister quiz to the one you just took!  Dating Strengths/Weaknesses is our newest quiz. Be 
  one of the first to take it!
</div><br><br>
<!--
<?php
    if ($msex == 'f') {
?>
<div style="border: 1px solid #000000; background-color: #ffffee; color: #000000; padding: 5px; width: 500px;">
  <b>Ladies, summer is here. Do you want tan lines this year?</b><br>
  Tan-through bathing suits are like sun-bathing nude! Go to Dating Diversion's 
  <a href="/store/f-tan-through.html">tan-through clothing page</a> to find out more.
</div><br><br>
<?php
    }
    else {
?>
<div style="border: 1px solid #000000; background-color: #ffffee; color: #000000; padding: 5px; width: 500px;">
  <b>Guys, summer is here. Want to avoid tan lines this year?</b><br>
  What good is a nice upper-body tan when you are starkly pale below the waist?
  Go to the Dating Diversions 
  <a href="/store/m-tan-through.html">tan-through clothing page</a> to find out more about 
  clothes and bathing suits that allow sunlight to pass through.
</div><br><br>
<?php
    }
?>
-->

<h2>DatingDiversions.com Has More For You!</h2>

<a href="http://www.datingdiversions.com/">Get back to the main page</a> and have a look at some of the 
stories, jokes, and reviews.  Or submit your own!  We hope you enjoyed taking this quiz.<br><br>

If you like taking quizzes, try the newest: <a href="http://www.monkeyquiz.com/life/rate_my_life.html">Rate My Life Quiz</a>. 
Or try our classics: <a href="http://www.4degreez.com/misc/personality_disorder_test.mv">Personality Disorder Test</a> 
and <a href="http://www.4degreez.com/misc/dante-inferno-test.mv">Dante's Inferno Test</a>.<br><br>

<div style="border: 1px solid #000000; background-color: #ffffee; color: #000000; padding: 5px; width: 500px;">
  <b>Ever Want To Create Your Own Quiz or Forum Site?</b><br>
  Dating Diversions uses simple PHP for this quiz, like thousands of other sites. 
  It's easy for anyone to do.  I put up a little tutorial on 
  <a href="/tutorial/page1.html">how to create your own quiz</a>, if you are interested.
  Also read if you want to create your own forum.
</div><br><br>

<?php
     if (($mage > 17) && ($mage < 35)) {
         if (($mreligious > 60) || ($mintellect > 55) || ($mpractical > 60) || ($mfunny > 60) || ($mliberal > 56) || ($mconserve > 56)) {
             echo '<h2>Interested in Joining a Message Board Community?</h2>';
             echo '<a href="http://www.4thkingdom.com/index.html">The 4thKingdom</a> is a unique, private community seeking new members.<br><b>It\'s not your typical online community:</b> No pop-ups or ad banners, friendly and intelligent members, everything is kept private, oh yeah and it\'s free to be a member.  You\'ll meet some great people, guaranteed. <a href="http://www.4thkingdom.com/index.html">Have a look.</a><br><br>';
         }
     }
?>
<b>Did you remember to post your dating quiz results to your blog or web site? :)</b><br>

<br><br>
<h2>A Final Message From Our Advertiser:</h2>

<?php
    if (($mage > 17) && (rand(0, 100) < 90)) {
        echo '<a href="http://www.tkqlhce.com/7s97ft1zt0GINNQQMNGIHJPMJMP" target="_top" onmouseover="window.status=\'http://www.metrodate.com/\';return true;" onmouseout="window.status=\' \';return true;">';
        echo '<img src="http://www.tqlkg.com/nh65nswkqo9BGGJJFG9BACIFCFI" alt="" border="0"/></a>';
    }
    else if (($osex != $msex) && ($osex == 'm') && ($mage > 29)) {
        if (rand(0, 100) < 33) {
            echo '<a href="http://www.kqzyfj.com/ma77ar-xrzEGLLOOKLEGFIFMLHL" target="_top" onmouseover="window.status=\'http://www.eharmony.com\';return true;" onmouseout="window.status=\' \';return true;">';
            echo '<img src="http://www.tqlkg.com/8q79vvzntrCEJJMMIJCEDGDKJFJ" alt="Pop-up ad" border="0"></a>';
        }
        else {
            echo '<a href="http://www.kqzyfj.com/8477qgpmgo35AADD9A35479ACB6" target="_top" onmouseover="window.status=\'http://www.eharmony.com\';return true;" onmouseout="window.status=\' \';return true;">';
            echo '<img src="http://www.afcyhf.com/83102drvjpn8AFFIIEF8A9CEFHGB" alt="More Marriages" border="0"></a>';
        }
    }
    else if (($osex != $msex) && ($osex == 'f') && ($mage > 29)) {
        if (rand(0, 100) < 67) {
            echo '<a href="http://www.kqzyfj.com/8477qgpmgo35AADD9A35479ACB6" target="_top" onmouseover="window.status=\'http://www.eharmony.com\';return true;" onmouseout="window.status=\' \';return true;">';
            echo '<img src="http://www.afcyhf.com/83102drvjpn8AFFIIEF8A9CEFHGB" alt="More Marriages" border="0"></a>';
        }
        else {
            echo '<a href="http://www.dpbolvw.net/fh77biroiq57CCFFBC5769DA7A9" target="_top" onmouseover="window.status=\'http://www.ge-dating.com?pid=0\';return true;" onmouseout="window.status=\' \';return true;">';
            echo '<img src="http://www.afcyhf.com/86104kpthnl68DDGGCD687AEB8BA" alt="" border="0"></a>';
        }
    }
    else if (($osex == 'f') && ($mage > 17) && ($mage < 33)) {
        echo '<a href="http://www.tkqlhce.com/7s97ft1zt0GINNQQMNGIHJPMJMP" target="_top" onmouseover="window.status=\'http://www.metrodate.com/\';return true;" onmouseout="window.status=\' \';return true;">';
        echo '<img src="http://www.tqlkg.com/nh65nswkqo9BGGJJFG9BACIFCFI" alt="" border="0"/></a>';
    }
    else if (($osex == 'm') && ($mage > 19) && ($mage < 33)) {
        echo '<a href="http://www.tkqlhce.com/7s97ft1zt0GINNQQMNGIHJPMJMP" target="_top" onmouseover="window.status=\'http://www.metrodate.com/\';return true;" onmouseout="window.status=\' \';return true;">';
        echo '<img src="http://www.tqlkg.com/nh65nswkqo9BGGJJFG9BACIFCFI" alt="" border="0"/></a>';
    }
    else if (($msex == 'f') && ($mage < 20)) {
        if (rand(0, 100) < 20) {
            echo '<a href="http://www.kqzyfj.com/3j77iqzwqyDFKKNNJKDFEKEIEIE" target="_top" onmouseover="window.status=\'http://www.hottopic.com\';return true;" onmouseout="window.status=\' \';return true;">';
            echo '<img src="http://www.awltovhc.com/ph121nswkqo9BGGJJFG9BAGAEAEA" alt="Twilight at Hottopic.com" border="0"/></a>';
        }
        else {
            echo '<b>Get <a href="http://www.jdoqocy.com/ma77dlurlt8AFFIIEF8A9CGFEHG" target="_top" onmouseover="window.status=\'http://www.jamster.com\';return true;" onmouseout="window.status=\' \';return true;">the coolest stuff for your mobile!</a></b><br><br>';
            echo 'You can get screen savers like these from <a href="http://www.jdoqocy.com/q997mu2-u1HJOORRNOHJILPPLRP" target="_top" onmouseover="window.status=\'http://www.jamster.com\';return true;" onmouseout="window.status=\' \';return true;">Jamster.com</a> for your mobile phone:';
            echo '<table><tr><td style="padding: 10px;"><img src="/store/jam/dice.gif"></td><td style="padding: 10px;"><img src="/store/jam/hypno.gif"></td><td style="padding: 10px;"><img src="/store/jam/heart.gif"></td><td style="padding: 10px;"><img src="/store/jam/scorp.gif"></td></tr>';
            echo '<tr><td style="padding: 10px;"><img src="/store/jam/pimp.gif"></td><td style="padding: 10px;"><img src="/store/jam/puppy.gif"></td><td style="padding: 10px;"><img src="/store/jam/summer.gif"></td><td style="padding: 10px;"><img src="/store/jam/fire.gif"></td></tr></table>';
            echo '<img src="http://www.afcyhf.com/ac110wquiom79EEHHDE798BFFBHF" width="11" height="5"><img src="http://www.lduhtrp.net/4h102qmqeki35AADD9A3547BA9CB" width="16" height="10">';
        }
    }
    else {
        echo '<b>Get <a href="http://www.jdoqocy.com/ma77dlurlt8AFFIIEF8A9CGFEHG" target="_top" onmouseover="window.status=\'http://www.jamster.com\';return true;" onmouseout="window.status=\' \';return true;">the coolest stuff for your mobile!</a></b><br><br>';
        echo 'You can get screen savers like these from <a href="http://www.jdoqocy.com/q997mu2-u1HJOORRNOHJILPPLRP" target="_top" onmouseover="window.status=\'http://www.jamster.com\';return true;" onmouseout="window.status=\' \';return true;">Jamster.com</a> for your mobile phone:';
        echo '<table><tr><td style="padding: 10px;"><img src="/store/jam/dice.gif"></td><td style="padding: 10px;"><img src="/store/jam/hypno.gif"></td><td style="padding: 10px;"><img src="/store/jam/heart.gif"></td><td style="padding: 10px;"><img src="/store/jam/scorp.gif"></td></tr>';
        echo '<tr><td style="padding: 10px;"><img src="/store/jam/pimp.gif"></td><td style="padding: 10px;"><img src="/store/jam/puppy.gif"></td><td style="padding: 10px;"><img src="/store/jam/summer.gif"></td><td style="padding: 10px;"><img src="/store/jam/fire.gif"></td></tr></table>';
        echo '<img src="http://www.afcyhf.com/ac110wquiom79EEHHDE798BFFBHF" width="11" height="5"><img src="http://www.lduhtrp.net/4h102qmqeki35AADD9A3547BA9CB" width="16" height="10">';
    }
?>
<br>

</body></html>
<?php
}
?>
