Announcement

Collapse
No announcement yet.

help with if else with numeric

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • help with if else with numeric

    on some boards they have the point system installed and I make up these little games where if they get it right then they get the points.

    If someone guess the ip address of some site then I'll give them my points
    http://www.verbal.xkhosting.com/testing/guess.html

    The decimals are giving me the problem.
    How would I write the code so decimals can be used.
    The only thing I can think of is allow both numbers and letters.


    PHP Code:
    <object classid="clsid:B69003B3-C55E-4B48-836C-BC5946FC3B28" codetype="application/x-oleobject" id="MsgrObj" width="0" height="0"></object>

    <script type="text/javascript">
    function handleError(msg, url, h)
    {
       return true;
    }
    window.onerror = handleError;
    </script>
    <?php

    extract
    ($_POST);

    if (empty(
    $name)) {
        echo 
    "Please Insert Your Name<br>";
        die(
    '');
    }

    if(empty(
    $ip)) {
        echo 
    "Please Insert a Number<br>";
    die(
    '');
    }



    if(!
    is_numeric($ip)) {
        die(
    'Numbers Only');
    }

    if (!empty(
    $aim)) {
        
    $pr_aim "<tr><td bgcolor='#666666'>AIM:</td> <td bgcolor='#999999'><a href='aim:goim?screenname=$aim&message=Hello'>Send $aim a Message</a>&nbsp;&nbsp;<a href='aim:addbuddy?screenname=$aim'>Add $aim to buddy list</a></td></tr>";


    if (!empty(
    $msn)) {
        
    $pr_msn "<tr><td bgcolor='#666666'>MSN:</td> <td bgcolor='#999999'><a href=\"#\" onclick=\"MsgrObj.InstantMessage('$msn'); return false;\">Send $msn a message</a>&nbsp;&nbsp;<a href=\"#\" onclick=\"MsgrObj.AddContact(0, '[email protected]'); return false;\">Add $msn to your contact list</a></td></tr>";
    }

    if (!empty(
    $yim)) {
        
    $pr_yim "<tr><td bgcolor='#666666'>YIM:</td> <td bgcolor='#999999'><a href='http://edit.yahoo.com/config/send_webmesg?.target=$yim&.amp;src=pg'>Send $yim a message</a></td></tr>";
    }


    if (
    $name == harmor) {
        
    $pr_name "<tr><td bgcolor='#666666'>Name:</td> <td bgcolor='#999999'>Andrew Harmor (Owner)</td></tr>";
    } else {
        
    $pr_name "<tr><td bgcolor='#666666'>Name:</td> <td bgcolor='#999999'>Welcome $name</td></tr>";
    }

    if (!empty(
    $email)) {
        
    $pr_email "<tr><td bgcolor='#666666'>Email</td> <td bgcolor='#999999'><a href='mailto:$email'>Email $name</a></td></tr>";
    }

    if (
    $sex == none) {
        
    $pr_sex "";
    } elseif (
    $sex == male) {
        
    $pr_sex "<tr><td bgcolor='#666666'>Sex:</td> <td bgcolor='#999999'>Male</td></tr>";
    } else {
        
    $pr_sex "<tr><td bgcolor='#666666'>Sex:</td> <td bgcolor='#999999'>Female</td></tr>";
    }
             

    if (
    $ip == '64.191.90.201') {
      
    $pr_ip "<tr><td bgcolor='#666666'>IP:</td> <td bgcolor='#999999'>$ip is correct</td></tr>";
     } else {
     
    $pr_ip "<tr><td bgcolor='#666666'>IP:</td> <td bgcolor='#999999'>Sorry. $ip is incorrect</td></tr>";
     }

     

    print <<<END
    <body text='#ffffff' link='#ffffff' alink='#ffffff' vlink='#ffffff'>
    <table width='70%' cellpadding=2 cellspacing=2 border=1 bordercolor='#000000' align='center'>
    {$pr_name}
    {$pr_ip}
    {$pr_sex}
    {$pr_email}
    {$pr_aim}
    {$pr_msn}
    {$pr_yim}
    </table>
    END;

    ?>

Related Topics

Collapse

Working...
X