Jump to content

If IP is in the databse do this


Bman900

Recommended Posts

Would this be correct?

 

<?php
$ipchecker = $_SERVER['REMOTE_ADDR'];
mysql_query("select iptable from ipcheck where iptable = '$ipchecker'");
if (mysql_num_rows > 0) {
?>

<form id="form1" method="post" action="redirect.php">
<textarea name="question" cols="52" rows="8"></textarea><br />
<input name="firstname" type="text" /><br />
<input name="email" type="text" /><br />
<input name="submit" type="submit" />
</form>
<?php  
}
else {
?>
       <script type="text/javascript" src="http://forms.aweber.com/form/40/1675361340.js"></script>
       
       <?php } ?>

 

I added my IP manualy to test it out and it goes to the else statement no matter what.

no...i told you, that was pseudo code.  You need to assign the mysql_query to a variable and use that variable as argument in mysql_num_rows.

 

 

mysql_query

mysql_num_rows

 

You mean like this:

<?php

 

$ipchecker = $_SERVER['REMOTE_ADDR'];
$ipsql = mysql_query("select iptable from ipcheck where iptable = '$ipchecker'");
$row_number = mysql_num_rows($ipsql);

if ($row_number > 0) {
?>

<form id="form1" method="post" action="redirect.php">
<textarea name="question" cols="52" rows="8"></textarea><br />
<input name="firstname" type="text" /><br />
<input name="email" type="text" /><br />
<input name="submit" type="submit" />
</form>
<?php  
}
else {
?>
       <script type="text/javascript" src="http://forms.aweber.com/form/40/1675361340.js"></script>
       
       <?php } ?>

 

That doesn't work either...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.