Welcome to Code Forum!

Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    GIF shows where to locate </> in the thread and or post editor toolbar.
    To learn more about how to use our BBCode feature, review our "How to post your code into threads" here.

    Thank you, Code Forum.

PHP Help with understanding where is this in the code?

chrisj

Bronze Coder
Can you let me know something about this code? This is from a web video script that I have (but didn't develop):

Code:
 if (!empty($_POST['set_p_v'])) {
       
if (($pt->config->sell_videos_system == 'on' && $pt->config->who_sell == 'pro_users' && $pt->user->is_pro) || ($pt->config->sell_videos_system == 'on' && $pt->config->who_sell == 'users') || ($pt->config->sell_videos_system == 'on' && $pt->user->admin) && !empty($_POST['set_p_v'])) {
           
if (!empty($_POST['set_p_v']) || (in_array('set_p_v', array_keys($_POST)) && $_POST['set_p_v'] < 0)) {
               
if (!is_numeric($_POST['set_p_v']) || $_POST['set_p_v'] < 0 || (($pt->config->com_type == 0 && $_POST['set_p_v'] <= $pt->config->admin_com_sell_videos)) ) {
                    $error = $lang->video_price_error." ".($pt->config->com_type == 0 ? $pt->config->admin_com_sell_videos : 0);
                }
}}}

I know that 'set p_v' is the buy price of the video. I know that if text (or a negative number) is entered into the ‘Price’ form field the
PHP:
$error = $lang->video_price_error
is activated and displays: “The video price should be numeric and greater than 0”.

I know that if the 'Price' form field is left empty and Submitted, the video is free. I'd like to know where that is in this code. That's what I'd like help with.

I believe this code overall says/does:
the config variables in $pt needs to be set and if the sell_videos_system config variable is set to 'on' and the type of video sale is a user, or set to 'pro_users' and the user is a pro_user or the user is an admin proceed with the check.
If set_p_v is not a number, or below 0 or the variable com_type=0 and the price of the video is less than or equal to the admin_com_sell_videos price, then display the language video_price_error with either com_type=0 and the admin_com_sell_videos price or 0.

What I'd like to know is, where in this code does it generate the ability to have the video be free when the 'Price' form field is left empty and Submitted?

Any help is appreciated.
 
Last edited:
Can you let me know something about this code? This is from a web video script that I have (but didn't develop):

Code:
 if (!empty($_POST['set_p_v'])) {
      
if (($pt->config->sell_videos_system == 'on' && $pt->config->who_sell == 'pro_users' && $pt->user->is_pro) || ($pt->config->sell_videos_system == 'on' && $pt->config->who_sell == 'users') || ($pt->config->sell_videos_system == 'on' && $pt->user->admin) && !empty($_POST['set_p_v'])) {
          
if (!empty($_POST['set_p_v']) || (in_array('set_p_v', array_keys($_POST)) && $_POST['set_p_v'] < 0)) {
              
if (!is_numeric($_POST['set_p_v']) || $_POST['set_p_v'] < 0 || (($pt->config->com_type == 0 && $_POST['set_p_v'] <= $pt->config->admin_com_sell_videos)) ) {
                    $error = $lang->video_price_error." ".($pt->config->com_type == 0 ? $pt->config->admin_com_sell_videos : 0);
                }
}}}

I know that 'set p_v' is the buy price of the video. I know that if text (or a negative number) is entered into the ‘Price’ form field the
PHP:
$error = $lang->video_price_error
is activated and displays: “The video price should be numeric and greater than 0”.

I know that if the 'Price' form field is left empty and Submitted, the video is free. I'd like to know where that is in this code. That's what I'd like help with.

I believe this code overall says/does:
the config variables in $pt needs to be set and if the sell_videos_system config variable is set to 'on' and the type of video sale is a user, or set to 'pro_users' and the user is a pro_user or the user is an admin proceed with the check.
If set_p_v is not a number, or below 0 or the variable com_type=0 and the price of the video is less than or equal to the admin_com_sell_videos price, then display the language video_price_error with either com_type=0 and the admin_com_sell_videos price or 0.

What I'd like to know is, where in this code does it generate the ability to have the video be free when the 'Price' form field is left empty and Submitted?

Any help is appreciated.
Hey there, I may be a little late to the party, but what is your overall goal with this script?
 

Buy us a coffee!

Buy me a coffee.
Back
Top Bottom