| | |
checking if a value exists
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Mar 2004
Posts: 765
Reputation:
Solved Threads: 38
I believe there's a php command to get a user's IP address. Store that in a variable and compare it to all the values in the database where you have blocked IP's stored.
Something like this in PHP I think would do it.
[php]
$isBlocked = false;
$result = mysql_db_query("$database", "SELECT blocked_ip FROM ip_table");
//loop through all rows returned by result
while ($row = mysql_fetch_array($result))
{
if ($user_IP = $row["blocked_ip"])
{
$isBlocked = true;
}
}
if ($isBlocked)
{
//redirect to YOU ARE BLOCKED page
}
[/php]
Also, as this seems related to your subject of ip blocking:
http://daniweb.com/techtalkforums/thread2176.html
Something like this in PHP I think would do it.
[php]
$isBlocked = false;
$result = mysql_db_query("$database", "SELECT blocked_ip FROM ip_table");
//loop through all rows returned by result
while ($row = mysql_fetch_array($result))
{
if ($user_IP = $row["blocked_ip"])
{
$isBlocked = true;
}
}
if ($isBlocked)
{
//redirect to YOU ARE BLOCKED page
}
[/php]
Also, as this seems related to your subject of ip blocking:
http://daniweb.com/techtalkforums/thread2176.html
![]() |
Similar Threads
- IE6/IE7 unexpectedly drops the PHP Session ID cookie (PHPSESSID) (PHP)
- fstream Tutorial (C++)
- how to open a jpg from mysql database (PHP)
- Comparing two STL maps.. (C++)
- Guestbook help. Post in two different spots. (Perl)
- How to Perform Disk Error Checking in Windows XP (Windows tips 'n' tweaks)
- OS 9.2 freez on new mem alloc ("new" opperator) (OS 7 / 8 / 9)
- dynamic memory alloc with "new" freezes OS9.2 (C++)
Other Threads in the MySQL Forum
- Previous Thread: query problem
- Next Thread: Query hell
| Thread Tools | Search this Thread |
agplv3 alfresco amazon api artisticlicense aws bizspark breathalyzer camparingtocolumns changingprices cmg communityjournalism contentmanagement contractors copyright count court crm database design developer development distinct drupal dui ec2 email enterprise eudora facebook form foss gartner gnu government gpl greenit groupware hiring hyperic images innerjoins insert ip joebrockmeier join keyword keywords kickfire laptop law legal license licensing linux maintenance managing mariadb matchingcolumns metron micromanage microsoft microsoftexchange mindtouch montywidenius mozilla multiple music mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opendatabasealliance opengovernment opensource oracle penelope priceupdating query referencedesign reorderingcolumns resultset saas select sharepoint simpledb sourcecode spotify sql sugarcrm syntax techsupport thunderbird transparency virtualization





