Cuchara2 0 Newbie Poster

I'm trying to make a postback script which works with a CPALead widget, however it does not seem to work. I do not think my code is wrong (which I have attached at the bottom) so I was beginning to think this was not possible due to the fact that the CPALead widget is performing the action, thus rendering the $_SESSION variables useless. Am I right or is the code wrong?

<?php
include("dbc.php");
$YOURPASSWORD   = "secretpassword123";
$password = $_REQUEST['password'];
if ($password != $YOURPASSWORD) {
    echo "Access Denied";
    exit;
}

$id = $_SESSION['user_id'];

$earn    = $_REQUEST['earn']; //getting amount earned from cpalead.
if ($earn < 1){
	$earn = ceil($earn);
}
else{
$earn = round($earn);
}

$add = $earn;

mysql_connect($mysql_where, $mysql_username, $mysql_password);
mysql_select_db($mysql_database);

mysql_query("UPDATE users SET points = points + $add WHERE id='$id'") or die(mysql_error());
mysql_query("UPDATE users SET surveys = surveys + 1 WHERE id='$id'") or die(mysql_error());

?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.