Quote Originally Posted by Chris2009 View Post
ok so now im adding an IP check, here's what ive come up with:

PHP Code: 
    $IP gethostbyname($_SERVER['REMOTE_ADDR']);
    
$id = (isset($_GET['id'])) ? mysql_real_escape_string(trim($_GET['id'])): ''
    
     
$check "SELECT ip FROM wcddl_downloads WHERE id = '$id'";
    
$result mysql_query($check) or die(mysql_error());
    
    if (
$IP == $result) {
        
$thumbsHTML .= 'You have already voted';
    } else {
        
$thumbsHTML .= '
        <center>
        <form action="" method="post">
        
            <input name="good" type="submit" value="." id="upBtn" /><br />
            <input name="bad" type="submit" value="." id="downBtn" />
        
        </form>
        </center>'
;
    } 
doesnt seem to work, why? any help.
I see no point why you should use gethostbyname after getting user ip
And you are checking the ip with the mysql query results
$IP == $result

Use mysql_num_rows to count results! Try this:

PHP Code: 
    $IP $_SERVER['REMOTE_ADDR'];
    
$id = (isset($_GET['id'])) ? mysql_real_escape_string(trim($_GET['id'])): ''
    
    
$check "SELECT ip FROM wcddl_downloads WHERE id = '$id'";
    
$result mysql_query($check) or die(mysql_error());
    
    if (
mysql_num_rows($result)==0) {
        
$thumbsHTML .= '
        <center>
        <form action="" method="post">
        
            <input name="good" type="submit" value="." id="upBtn" /><br />
            <input name="bad" type="submit" value="." id="downBtn" />
        
        </form>
        </center>'
;
    } else {
       
$thumbsHTML .= 'You have already voted';
    }