weeder Posted July 4, 2006 Share Posted July 4, 2006 I'm new into php and have a script that uses a blacklist and would like to convert it to a whitelist but i can't seem to get it workThe code is two files the config file[quote]function blacklist($url) { $fil = @file("blacklist.txt"); $go = false; for ($i=0; $i<count($fil); $i++) { if (eregi(substr($fil[$i], 0, strlen($fil[$i])-3), $url)) { $go = true; break; } } if ($go) return true; else return false; }}[/quote]And then in the file that inserts the info into the dasbase[quote]if ($HTTP_POST_VARS && (!$HTTP_POST_VARS[sname] || !$HTTP_POST_VARS[surl] || !$HTTP_POST_VARS[title][0] || !$HTTP_POST_VARS[url][0] || !$HTTP_POST_VARS[type][0])) { include "wrong.html"; die();} elseif ($HTTP_POST_VARS) { $c->open(); if ($c->blacklist($surl)) $dont = true; else $dont = false; if (!$dont) { for ($i=0; $i<count($HTTP_POST_VARS[title]); $i++) { if (!$title[$i] || !$url[$i] || !$type[$i] || $c->blacklist($url[$i])) break; else { $dato = $c->dato(); @mysql_query("INSERT INTO $c->mysql_tb_que (type, title, url, sname, surl, date, email) " ."VALUES ('$type[$i]','$title[$i]','$url[$i]','$sname','$surl','$dato','$email')"); } }include "thanks.html"; die(); $inc = true;} else $inc = false;[/quote]Can anybody give me some help on how to convert this to use a whitelistMany thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/13639-converting-from-blacklist-to-whitlist/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.