iSpeedDevil! Posted September 17, 2008 Share Posted September 17, 2008 I have managed to fetch the IP's, but it wont ip ban the person, from the script i have, here take a look: <? include "header2.php"; include "_menu.php"; include "_home.php"; include "_block_user.php"; if ($melding) { echo "<div class=\"window\">"; echo "<div class=\"mainTitle\">Ban user!</div>"; echo "<div class=\"mainText\">"; echo "$melding"; echo "</div></div>"; } else { ?> <div class="window"> <div class="mainTitle">Ban user <?php echo $b_user; ?></div> <div class="mainText"> <? if ($moderator > 1) { $lijstIp = "SELECT * FROM users WHERE username='$b_user'"; $resultLijstIp = mysql_query($lijstIp); $data = $data = mysql_fetch_array($resultLijstIp); ?> <? echo $b_user." - ".$data[ip]; ?><br/><br/> <form action=block_user.php method=post> <?php if (!$data[ip]) { //geen ip bekend echo "Ip:<br/>"; echo "<input type=text name=ip><br/><br/>"; } elseif ($data[ip]) { //ip bekend echo "<input type=hidden name=ip value=$data[ip]>"; } ?> Reason (In english): <br/> <textarea name=reason></textarea><br/> <input type=hidden name=user value=<?php echo $b_user; ?>><br/><br/> <input type=submit value=Ban! name=hehe> </form> <?php } else { echo "You are not allowed to see this area!"; } ?> </div> </div> <? } include "footer.php"; ?> And this is the _block_user that is included: <?php if ($ip and $reason and $user) { if ($moderator > 1) { $opdracht = "insert INTO ip_block values('0','$ip','$reason', '$user')"; $resultaat = mysql_query($opdracht); if ($resultaat) { $melding = "User succesfully blocked, $user can't acces the game anymore!"; } } } ?> In my database, i have and empty table called "ip_block" with rows; id, ip, reason and username! and i store the IP's in the table "users" what is wrong, i dont even get an error :S Thanks alot anyway! ~iSpeedDevil! Quote Link to comment https://forums.phpfreaks.com/topic/124713-i-wanna-ip-ban-people-on-my-game/ Share on other sites More sharing options...
HeaDmiLe Posted September 17, 2008 Share Posted September 17, 2008 I think you missed extract($_POST); above the if condition in _block_user.php... but i do not recomment you to use it... try if ($_POST['ip'] and $_POST['reason'] and $_POST['user']) { instead od extract... Tip: check some html rules like writing html attributes... Going to bed now, post if you success... Quote Link to comment https://forums.phpfreaks.com/topic/124713-i-wanna-ip-ban-people-on-my-game/#findComment-644170 Share on other sites More sharing options...
iSpeedDevil! Posted September 17, 2008 Author Share Posted September 17, 2008 still nothing here Quote Link to comment https://forums.phpfreaks.com/topic/124713-i-wanna-ip-ban-people-on-my-game/#findComment-644185 Share on other sites More sharing options...
PFMaBiSmAd Posted September 17, 2008 Share Posted September 17, 2008 It is so easy to get a new IP address, that most 13 year olds on this planet know how to get one (and I just checked with an 11 year old and even he knows that you cannot stop someone from playing a game by banning their IP address) that you would be wasting your time trying to make an IP ban system work. You need an email verified registration and login member system, where you can disable accounts/email addresses. This at least requires a banned member to obtain a new email address and create a new account to get back into your game. Quote Link to comment https://forums.phpfreaks.com/topic/124713-i-wanna-ip-ban-people-on-my-game/#findComment-644199 Share on other sites More sharing options...
xoligy Posted September 17, 2008 Share Posted September 17, 2008 As PFMaBiSmAd said its so easy to get a new ip these days but its also easy to ge a new email address! There isnt really much you can do to block a person from coming to your site, infact i got completely ip banned from a site because i called the admin a lier when they said "they" had coded a script and i knew it to be false 2 secods later i had a new account and i sent the admin an email this of cause was after: Sever ip ban Account ban Quote Link to comment https://forums.phpfreaks.com/topic/124713-i-wanna-ip-ban-people-on-my-game/#findComment-644292 Share on other sites More sharing options...
guyfromfl Posted September 17, 2008 Share Posted September 17, 2008 If you still want to do that here is something i came up with a couple years ago <?php public function checkBan() { $ip = $_SERVER['REMOTE_ADDR']; $sql = "SELECT * FROM banned WHERE ip='$ip'"; $check = $this->query($sql); if (mysql_num_rows($check) == 0) { return; } else { header ("Location: banned.php"); } } ?> stick that into a class and call it from where ever. also notice i had a seperate function for the mysql_query()... change it how you need to. Quote Link to comment https://forums.phpfreaks.com/topic/124713-i-wanna-ip-ban-people-on-my-game/#findComment-644302 Share on other sites More sharing options...
guyfromfl Posted September 18, 2008 Share Posted September 18, 2008 BTW I know thats not a very effective/good script... just offering an example of one way to deal with that Quote Link to comment https://forums.phpfreaks.com/topic/124713-i-wanna-ip-ban-people-on-my-game/#findComment-644310 Share on other sites More sharing options...
iSpeedDevil! Posted September 18, 2008 Author Share Posted September 18, 2008 didnt work tried putting it in the _check_user.php file tried to include it, nothing of it worked Quote Link to comment https://forums.phpfreaks.com/topic/124713-i-wanna-ip-ban-people-on-my-game/#findComment-644643 Share on other sites More sharing options...
iSpeedDevil! Posted September 19, 2008 Author Share Posted September 19, 2008 no one else? Quote Link to comment https://forums.phpfreaks.com/topic/124713-i-wanna-ip-ban-people-on-my-game/#findComment-645949 Share on other sites More sharing options...
iSpeedDevil! Posted September 20, 2008 Author Share Posted September 20, 2008 One last try, then ill close Quote Link to comment https://forums.phpfreaks.com/topic/124713-i-wanna-ip-ban-people-on-my-game/#findComment-646397 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.