smcgilvray
06-21-2009, 12:00 AM
I have the following script and I am getting the dreaded 500 error. Any help would be grateful.
#!/usr/bin/perl
require DBI;
use DBI;
$DBHOST = "localhost";
$DBNAME = "autoresponder";
$TABLENAME = "user";
$DBUSER = "teamrenew";
$DBPASS = "*********";
print "Content-type: text/html \n\n";
read(STDIN, $data, $ENV{'CONTENT_LENGTH'});
($cNum, $provider, $subs)=split(/&/,$data);
$cNum=~s/.*=//;
$cNum=~s/\-//g;
$cNum=~s/\.//g;
$cNum=~s/%28//g;
$cNum=~s/%29//g;
$provider=~s/.*=//;
$provider=~s/%40/@/;
$subs=~s/.*=//;
$name=~s/.*=//;
$fk_account=~s/.*=//;
$cellemail="$cNum$provider,";
$dbcall = DBI->connect("DBI:mysql:$DBNAME;$BDHOST",$DBUSER,$DBPASS) ||
die "We are not connected to database $DATABASE \n\n Error: $DBI::err : $DBI::errstr ";
if ($subs eq 'sub')
{
subscribe();
}
else
{
unsubscribe();
}
print "<br>Executed ...<br>$data<br>";
$dbcall->disconnect();
$statementhandle->finish();
sub subscribe
{
$sqlstatement="INSERT INTO $TABLENAME (email, name)
VALUES ('$cellemail','$name';
$statementhandle = $dbcall->prepare($sqlstatement);
$statementhandle->execute
|| die print
"<br><br><h2>Number already exists....redirecting to home page\!</h2><br>
<META HTTP-EQUIV='REFRESH' CONTENT='3;url=http://www.greatcareerplan.com/tr/'>";
print << "EOD";
<META HTTP-EQUIV="REFRESH" CONTENT="0;url=http://www.greatcareerplan.com/tr/index.php?option=com_content&view=article&id=74">
EOD
}
sub unsubscribe
{
$sqlstatement="DELETE FROM $TABLENAME WHERE email='$cellemail'";
$statementhandle = $dbcall->prepare($sqlstatement);
$statementhandle->execute || die print
"<br><br><h2>Your Number Is Not There To Remove....redirecting to home page\!</h2><br>
<META HTTP-EQUIV='REFRESH' CONTENT='3;url=http://www.greatcareerplan.com/tr/'>";
print << "EOD";
<META HTTP-EQUIV="REFRESH" CONTENT="0;url=http://www.greatcareerplan.com/tr/index.php?option=com_content&view=article&id=75">
EOD
}
Thank you,
Sean McGilvray
#!/usr/bin/perl
require DBI;
use DBI;
$DBHOST = "localhost";
$DBNAME = "autoresponder";
$TABLENAME = "user";
$DBUSER = "teamrenew";
$DBPASS = "*********";
print "Content-type: text/html \n\n";
read(STDIN, $data, $ENV{'CONTENT_LENGTH'});
($cNum, $provider, $subs)=split(/&/,$data);
$cNum=~s/.*=//;
$cNum=~s/\-//g;
$cNum=~s/\.//g;
$cNum=~s/%28//g;
$cNum=~s/%29//g;
$provider=~s/.*=//;
$provider=~s/%40/@/;
$subs=~s/.*=//;
$name=~s/.*=//;
$fk_account=~s/.*=//;
$cellemail="$cNum$provider,";
$dbcall = DBI->connect("DBI:mysql:$DBNAME;$BDHOST",$DBUSER,$DBPASS) ||
die "We are not connected to database $DATABASE \n\n Error: $DBI::err : $DBI::errstr ";
if ($subs eq 'sub')
{
subscribe();
}
else
{
unsubscribe();
}
print "<br>Executed ...<br>$data<br>";
$dbcall->disconnect();
$statementhandle->finish();
sub subscribe
{
$sqlstatement="INSERT INTO $TABLENAME (email, name)
VALUES ('$cellemail','$name';
$statementhandle = $dbcall->prepare($sqlstatement);
$statementhandle->execute
|| die print
"<br><br><h2>Number already exists....redirecting to home page\!</h2><br>
<META HTTP-EQUIV='REFRESH' CONTENT='3;url=http://www.greatcareerplan.com/tr/'>";
print << "EOD";
<META HTTP-EQUIV="REFRESH" CONTENT="0;url=http://www.greatcareerplan.com/tr/index.php?option=com_content&view=article&id=74">
EOD
}
sub unsubscribe
{
$sqlstatement="DELETE FROM $TABLENAME WHERE email='$cellemail'";
$statementhandle = $dbcall->prepare($sqlstatement);
$statementhandle->execute || die print
"<br><br><h2>Your Number Is Not There To Remove....redirecting to home page\!</h2><br>
<META HTTP-EQUIV='REFRESH' CONTENT='3;url=http://www.greatcareerplan.com/tr/'>";
print << "EOD";
<META HTTP-EQUIV="REFRESH" CONTENT="0;url=http://www.greatcareerplan.com/tr/index.php?option=com_content&view=article&id=75">
EOD
}
Thank you,
Sean McGilvray