Quote:
Originally Posted by Gsx-R
You can also do this.
PHP Code:
if(!isset($paid))
|
That is plain wrong. You're checking if the variable exists, not if the value is true or false.
--
The real solution:
PHP Code:
if(!isset($paid) || !$paid){
if(isset($users_credits)){
if($credits > $users_credits){
$errors[] = 'Not enough credits for this action. Visit credits page from your profile to charge up your account!';
}
} else {
$errors[] = 'You need to login before you can watch this video';
}
}
You should really considering lowering your error reporting level. This should be done at the top of the script, and the script can look like this. Less messy and actually faster.
PHP Code:
error_reporting(E_ALL ^ E_NOTICE); // put this on top of the script, preferably inside your top configuration include file
if(!$paid){
if(isset($users_credits)){
if($credits > $users_credits){
$errors[] = 'Not enough credits for this action. Visit credits page from your profile to charge up your account!';
}
} else {
$errors[] = 'You need to login before you can watch this video';
}
}