Proxy Checker
Posted: Mon Dec 11, 2006 1:38 pm
Hello,
I was wondering if there was any way to check if a IP is a proxy server?
Thanks.!!!
I was wondering if there was any way to check if a IP is a proxy server?
Thanks.!!!
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
<?php
// use this script to detect whether a user is using a
//proxy server to connect to your website.
echo "Proxy Detector
";
if(isset($HTTP_X_FORWARDED_FOR))
{
if ($HTTP_X_FORWARDED_FOR)
{
// proxy detected...
?>
Proxy Detected...
Your Actual IP Address:
<?= $HTTP_X_FORWARDED_FOR ?>
Your Proxy Server:
<?= $HTTP_VIA ?>
You Proxy I.P address: <?= $REMOTE_ADDR ?>
<?
}
}
else
{
// no proxy detected
?>
No Proxy Detected
Your Actual IP Address:
<?= $REMOTE_ADDR ?>
<?
}
?>Code: Select all
<?
$ip = $_SERVER[REMOTE_ADDR];
include "/home/muot/public_html/ipban/check.php";
//this is just a checker for a ip banner i have.
?>
<body bgcolor=black>
<script LANGUAGE="JavaScript">
<!--
// Nannette Thacker http://www.shiningstar.net
function confirmSubmit()
{
var agree=confirm("Are you sure you want to vote for this person? You cannot vote again, or change your vote if you do.");
if (agree)
return true ;
else
return false ;
}
// -->
</script>
<style type=text/css>
body {
color:white;
}
#formfont {
color:white;
}
input,textarea {
background-color:black;
color:white;
}
</style>
<?php
$host = "localhost";//Hostname
$usr = "muot_report";//DB Usr
$psw = "passwordd";//DB Password
$dbname = "muot_report";//DB Name
$tbl_name = "moty_ip";//Table Name
$ip_field = "IP";//Field For IP
$visitor_ip = $_SERVER[REMOTE_ADDR];//Visitor's IP Address
$conn = mysql_connect($host, $usr, $psw) or die(mysql_error());
mysql_select_db($dbname, $conn) or die(mysql_error());
$sql = "SELECT $ip_field FROM $tbl_name WHERE $ip_field = '$visitor_ip'";
$res = mysql_query($sql, $conn) or die(mysql_error());
$num_rows = mysql_num_rows($res);
if($num_rows > 0)
{
?>
<font size=6 color=red><b><center>Thanks for voting.</font><br></center>
<br><font size=4 color=white>The next voting round for the Muot Of The Year, will be on December 23rd.<br>Until then check out <a href=http://www.sickrat.com target=_blank><b><font size=5 color=white>SICKRAT.COM</font></a> for the new CJ vs. Joe fight.<br></font>
</center>
<?
}
else
{
?>
<html>
<body bgcolor=black>
<?php
$ip = @$REMOTE_ADDR;
$usr = "muot_report";
$pwd = "passsword";
$db = "muot_report";
$host = "localhost";
# connect to database
$cid = mysql_connect($host,$usr,$pwd);
if (!$cid) { echo("ERROR: " . mysql_error() . "\n"); }
$output = '<HTML>';
# setup SQL statement
$SQL = " SELECT * FROM `report` WHERE previous = 1 AND moty = 1";
$SQL = $SQL .
# execute SQL statement
$retid = mysql_db_query($db, $SQL, $cid) or die(mysql_error());
# display results
$output .= "<table align=center bgcolor=black border=1 bordercolor=white cellpadding=20 width=450>\n\n";
$howmany = mysql_num_rows($retid);
$rowmax = 4;
for($x = 0; $row = mysql_fetch_array($retid); $x++)
{
if($x % $rowmax == 0)
$output .= "<tr>\n";
$prevpic = $row["Number"];
$prevname = $row["prevname"];
$output .= "<td align=center><a href=/prev.php?id=$prevpic target=_blank><img src =\"/prevpics/$prevpic.jpg\" width=100 height=100><br><font color=white>$prevname</font></a><br>
<form action=/moty_vote.php method=post>
<input type=hidden name=choice value=$prevpic>
<input type=submit value=Vote! onClick=\"return confirmSubmit()\"></form>
</td>";
if($x % $rowmax == $rowmax - 1)
$output .= "\r</tr>\n\n";
}
$output .= "</table>\n\n";
$output .= "</DT></P>";
$output .= '</BODY>
</HTML>';
echo $output;
?><?
}
?>Code: Select all
<?
$ip = @$REMOTE_ADDR;
$choice = $_POST['choice'];
$username2= "muot_report";
$password2= "passwordd";
$database2= "muot_report";
$connection2 = mysql_connect('localhost',$username2,$password2);
mysql_select_db($database2);
$sql4 = "SELECT * FROM `report` WHERE `Number` =".$choice;
$result4 = mysql_query($sql4) or die(mysql_error());
while($row4 = mysql_fetch_array($result4)) {
$choice2 = $row4['votes']+1;
}
mysql_query('UPDATE report set `votes` = '.$choice2.' WHERE `Number` ='.$choice);
$query = "INSERT INTO moty_ip VALUES ('','$ip','$choice')";
$result = mysql_query($query) or die(mysql_error());
?>
<META HTTP-EQUIV="Refresh" CONTENT="0; URL=/moty_thankyou.php">As you can tell there is no foolproof way to handle single votes only, unless your user based is forced to make an account first.nickman013 wrote:Yeah I was thinking of that, like if they are at a school or somthing like that.
Would cookies be better?
The only reason why I didnt use cookies was because people can just delete them and re-vote.