View Single Post
Old 10-28-2011, 10:15 PM  
Carmen80
Confirmed User
 
Carmen80's Avatar
 
Industry Role:
Join Date: Sep 2010
Location: Europe
Posts: 207
Quote:
Originally Posted by Gsx-R View Post
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';
    }    

__________________
It's all just a strange dream..

Last edited by Carmen80; 10-28-2011 at 10:19 PM..
Carmen80 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote