desperate php script help needed
Posted: Thu Jun 29, 2006 2:33 am
I have a script that checks the persons ip address, if its "banned" they see a banned message but if its not they see an email form, they enter there email address and click submit and then they are sent to a webpage and a cookie is created. I would then get an email containing the persons email adddress and ip address. This worked fine on a shared hosting plan i had. I had to switch to a VPS plan and now all of a sudden the script stopped working. The person puts there email address in and goes to that page and i get an email but the email it sends to me is missing all of the persons info.
I have tried desperatly to find a solution but cant. Would there be some php setting or something else that is preventing this from working on the VPS.
The script is below:
here is the ip ban file(this file is where i put the banned ip addresses):
any help is greatly appreciated.
Thanks so much
ppc

I have tried desperatly to find a solution but cant. Would there be some php setting or something else that is preventing this from working on the VPS.
The script is below:
Code: Select all
<?php include ("ipban.php"); ?>
<?php
session_start();
$ip = $REMOTE_ADDR;
$recipient="myemail@myemail.com";
$subject="A email form for a survey has been submited";
$msg="E-Mail Address: $email IP: $ip OptIn: $opt";
$email = $_POST["email"];
if(array_key_exists($ip,$iplook)){
print 'IP BANNED';
}
if((!ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.
'@'.
'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.
'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $email))
&& (! array_key_exists($ip,$iplook))
&& (! isset($_SESSION['email'])))
{
print "<center>
Please enter a valid e-mail address to continue: <p>
<form action=\"$SERVER[self_php]\" method=\"post\">
Email: <input name=\"email\" type=\"test\" size=\"20\" maxlength=\"100\"><p>
checkbox<input type=\"checkbox\" name=\"opt\" CHECKED>
<p> </p>
<b></b><p></p><input name=\"Submit\" type=\"submit\" value=\"Submit\"><p> </p></center>";
}
if((ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.
'@'.
'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.
'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $email))
&& (! array_key_exists($ip,$iplook))
&& (! isset($_SESSION['email']))){
if(mail($recipient, $subject, $msg)){
$_SESSION['email'][] = array('email' => $email);
$email=null;}}
if(isset($_SESSION['email'])){
$site = file_get_contents('http://www.google.com');
print "$site";
}
?>Code: Select all
<?php
$iplook['68.239.139.166'] = '68.239.139.166';
?>Thanks so much
ppc