Jump to content

Chrisj

Members
  • Posts

    531
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Chrisj

  1. Thanks for your reply/assistance. I have attached the resulting screen shot, after running this: SELECT SUM(earned_amount) AS sum FROM u_paid_videos c WHERE `time` >= 1553040000 AND 'time' <= 1553126340 AND user_id_uploaded = 2 I look forward to any comments/suggestions
  2. Thanks for your reply. I could have googled that, but I'm looking for some assistance at phpfreaks.com. Getting help with determining what converts the variable called $today_earn into a parameter called {{TODAY_EARN}} in the code may help me resolve this. Any additional guidance is appreciated.
  3. Thanks for your reply. But I don’t know how to do it manually. Any additional guidance is apprecisted
  4. Thanks so much for your help. I've added that line, visited the html page and see this: SELECT SUM(earned_amount) AS sum FROM u_paid_videos c WHERE `time` >= 1553040000 AND 'time' <= 1553126340 AND user_id_uploaded = 2 I'm not sure what this tells me. It seems to be generating the time, and the correct user_id_uploaded (user number 2), but maybe it should show something numeric instead of earned_amount? Maybe something else needs to be modified in the following file code, but I have looked it over and can't figure out if it does need another change. I look forward to any feedback/guidance. Much thanks again. <?php if (!IS_LOGGED || ($pt->config->sell_videos_system == 'off' && $pt->config->usr_v_mon == 'off') ) { header('Location: ' . PT_Link('404')); exit; } $types = array('today','this_week','this_month','this_year'); $type = 'today'; if (!empty($_GET['type']) && in_array($_GET['type'], $types)) { $type = $_GET['type']; } if ($type == 'today') { $start = strtotime(date('M')." ".date('d').", ".date('Y')." 12:00am"); $end = strtotime(date('M')." ".date('d').", ".date('Y')." 11:59pm"); $array = array('00' => 0 ,'01' => 0 ,'02' => 0 ,'03' => 0 ,'04' => 0 ,'05' => 0 ,'06' => 0 ,'07' => 0 ,'08' => 0 ,'09' => 0 ,'10' => 0 ,'11' => 0 ,'12' => 0 ,'13' => 0 ,'14' => 0 ,'15' => 0 ,'16' => 0 ,'17' => 0 ,'18' => 0 ,'19' => 0 ,'20' => 0 ,'21' => 0 ,'22' => 0 ,'23' => 0); $ads_array = $array; $date_type = 'H'; $pt->cat_type = 'today'; $pt->chart_title = $lang->today; $pt->chart_text = date("l"); } elseif ($type == 'this_week') { $time = strtotime(date('l').", ".date('M')." ".date('d').", ".date('Y')); if (date('l') == 'Saturday') { $start = strtotime(date('M')." ".date('d').", ".date('Y')." 12:00am"); } else{ $start = strtotime('last saturday, 12:00am', $time); } if (date('l') == 'Friday') { $end = strtotime(date('M')." ".date('d').", ".date('Y')." 11:59pm"); } else{ $end = strtotime('next Friday, 11:59pm', $time); } $array = array('Saturday' => 0 , 'Sunday' => 0 , 'Monday' => 0 , 'Tuesday' => 0 , 'Wednesday' => 0 , 'Thursday' => 0 , 'Friday' => 0); $ads_array = $array; $date_type = 'l'; $pt->cat_type = 'this_week'; $pt->chart_title = $lang->this_week; $pt->chart_text = date('y/M/d',$start)." To ".date('y/M/d',$end); } elseif ($type == 'this_month') { $start = strtotime("1 ".date('M')." ".date('Y')." 12:00am"); $end = strtotime(cal_days_in_month(CAL_GREGORIAN, date('m'), date('Y'))." ".date('M')." ".date('Y')." 11:59pm"); if (cal_days_in_month(CAL_GREGORIAN, date('m'), date('Y')) == 31) { $array = array('01' => 0 ,'02' => 0 ,'03' => 0 ,'04' => 0 ,'05' => 0 ,'06' => 0 ,'07' => 0 ,'08' => 0 ,'09' => 0 ,'10' => 0 ,'11' => 0 ,'12' => 0 ,'13' => 0 ,'14' => 0 ,'15' => 0 ,'16' => 0 ,'17' => 0 ,'18' => 0 ,'19' => 0 ,'20' => 0 ,'21' => 0 ,'22' => 0 ,'23' => 0,'24' => 0 ,'25' => 0 ,'26' => 0 ,'27' => 0 ,'28' => 0 ,'29' => 0 ,'30' => 0 ,'31' => 0); }elseif (cal_days_in_month(CAL_GREGORIAN, date('m'), date('Y')) == 30) { $array = array('01' => 0 ,'02' => 0 ,'03' => 0 ,'04' => 0 ,'05' => 0 ,'06' => 0 ,'07' => 0 ,'08' => 0 ,'09' => 0 ,'10' => 0 ,'11' => 0 ,'12' => 0 ,'13' => 0 ,'14' => 0 ,'15' => 0 ,'16' => 0 ,'17' => 0 ,'18' => 0 ,'19' => 0 ,'20' => 0 ,'21' => 0 ,'22' => 0 ,'23' => 0,'24' => 0 ,'25' => 0 ,'26' => 0 ,'27' => 0 ,'28' => 0 ,'29' => 0 ,'30' => 0); }elseif (cal_days_in_month(CAL_GREGORIAN, date('m'), date('Y')) == 29) { $array = array('01' => 0 ,'02' => 0 ,'03' => 0 ,'04' => 0 ,'05' => 0 ,'06' => 0 ,'07' => 0 ,'08' => 0 ,'09' => 0 ,'10' => 0 ,'11' => 0 ,'12' => 0 ,'13' => 0 ,'14' => 0 ,'15' => 0 ,'16' => 0 ,'17' => 0 ,'18' => 0 ,'19' => 0 ,'20' => 0 ,'21' => 0 ,'22' => 0 ,'23' => 0,'24' => 0 ,'25' => 0 ,'26' => 0 ,'27' => 0 ,'28' => 0 ,'29' => 0); }elseif (cal_days_in_month(CAL_GREGORIAN, date('m'), date('Y')) == 28) { $array = array('01' => 0 ,'02' => 0 ,'03' => 0 ,'04' => 0 ,'05' => 0 ,'06' => 0 ,'07' => 0 ,'08' => 0 ,'09' => 0 ,'10' => 0 ,'11' => 0 ,'12' => 0 ,'13' => 0 ,'14' => 0 ,'15' => 0 ,'16' => 0 ,'17' => 0 ,'18' => 0 ,'19' => 0 ,'20' => 0 ,'21' => 0 ,'22' => 0 ,'23' => 0,'24' => 0 ,'25' => 0 ,'26' => 0 ,'27' => 0 ,'28' => 0); } $ads_array = $array; $pt->month_days = count($array); $date_type = 'd'; $pt->cat_type = 'this_month'; $pt->chart_title = $lang->this_month; $pt->chart_text = date("M"); } elseif ($type == 'this_year') { $start = strtotime("1 January ".date('Y')." 12:00am"); $end = strtotime("31 December ".date('Y')." 11:59pm"); $array = array('01' => 0 ,'02' => 0 ,'03' => 0 ,'04' => 0 ,'05' => 0 ,'06' => 0 ,'07' => 0 ,'08' => 0 ,'09' => 0 ,'10' => 0 ,'11' => 0 ,'12' => 0); $ads_array = $array; $date_type = 'm'; $pt->cat_type = 'this_year'; $pt->chart_title = $lang->this_year; $pt->chart_text = date("Y"); } $day_start = strtotime(date('M')." ".date('d').", ".date('Y')." 12:00am"); $day_end = strtotime(date('M')." ".date('d').", ".date('Y')." 11:59pm"); $this_day_ads_earn = $db->rawQuery("SELECT SUM(amount) AS sum FROM ".T_ADS_TRANS." c WHERE `time` >= ".$day_start." AND `time` <= ".$day_end." AND type = 'video' AND video_owner = ".$pt->user->id); $this_day_video_earn = $db->rawQuery("SELECT SUM(earned_amount) AS sum FROM ".T_U_PAID_VIDEOS." c WHERE `time` >= ".$day_start." AND `time` <= ".$day_end." AND user_id_uploaded = ".$pt->user->id); //$this_day_video_earn = $db->rawQuery("SELECT SUM(amount - admin_com) AS sum FROM ".T_VIDEOS_TRSNS." c WHERE `time` >= ".$day_start." AND `time` <= ".$day_end." AND user_id = ".$pt->user->id); $today_earn = $this_day_ads_earn[0]->sum + $this_day_video_earn[0]->sum ; $month_start = strtotime("1 ".date('M')." ".date('Y')." 12:00am"); $month_end = strtotime(cal_days_in_month(CAL_GREGORIAN, date('m'), date('Y'))." ".date('M')." ".date('Y')." 11:59pm"); $this_month_video_earn = $db->rawQuery("SELECT (earned_amount) FROM u_paid_videos c WHERE `time` >= ".$month_start." AND `time` <= ".$month_end." AND user_id_uploaded = ".$pt->user->id); //$this_month_video_earn = $db->rawQuery("SELECT SUM(amount - admin_com) AS sum FROM ".T_VIDEOS_TRSNS." c WHERE `time` >= ".$month_start." AND `time` <= ".$month_end." AND user_id = ".$pt->user->id); $month_earn = $this_month_ads_earn[0]->sum + $this_month_video_earn[0]->sum ; // print_r($this_month_video_earn); // exit(); echo "SELECT SUM(earned_amount) AS sum FROM ".T_U_PAID_VIDEOS." c WHERE `time` >= ".$day_start." AND `time` <= ".$day_end." AND user_id_uploaded = ".$pt->user->id; $trans = $db->where('user_id_uploaded',$user->id)->orderBy('id_user')->get(T_U_PAID_VIDEOS); //$trans = $db->where('user_id',$user->id)->orderBy('id','DESC')->get(T_VIDEOS_TRSNS); $ads_trans = $db->where('time',$start,'>=')->where('time',$end,'<=')->where('video_owner',$pt->user->id)->where('type','video')->get(T_ADS_TRANS); $total_ads = 0; if (!empty($ads_trans)) { foreach ($ads_trans as $key => $ad) { if ($ad->time >= $start && $ad->time <= $end) { $day = date($date_type,$ad->time); if (in_array($day, array_keys($ads_array))) { $ads_array[$day] += $ad->amount; $total_ads += $ad->amount; } } } } $ads_list = ""; $total_earn = 0; if (!empty($trans)) { foreach ($trans as $tr) { $video = PT_GetVideoByID($tr->video_id, 0, 0, 2); $user_data = PT_UserData($tr->paid_id); $currency = ""; $admin_currency = ""; $net = 0; if ($tr->currency == "USD") { $currency = "$"; $admin_currency = "$".$tr->admin_com; $net = $tr->amount - $tr->admin_com; } else if($tr->currency == "EUR"){ $currency = "€"; $admin_currency = "€".$tr->admin_com; $net = $tr->amount - $tr->admin_com; } elseif ($tr->currency == "EUR_PERCENT") { $currency = "€"; $admin_currency = $tr->admin_com."%"; $net = $tr->amount - ($tr->admin_com * $tr->amount)/100; } elseif ($tr->currency == "USD_PERCENT") { $currency = "$"; $admin_currency = $tr->admin_com."%"; $net = $tr->amount - ($tr->admin_com * $tr->amount)/100; } if ($tr->time >= $start && $tr->time <= $end) { $day = date($date_type,$tr->time); if (in_array($day, array_keys($array))) { $array[$day] += $net; } } $total_earn = $total_earn + (float)$net; if (!empty($video) && !empty($user_data)) { $ads_list .= PT_LoadPage('transactions/list',array( 'ID' => $tr->id, 'PAID_USER' => substr($user_data->name, 0,20), 'PAID_URL' => $user_data->url, 'USER_NAME' => $user_data->username, 'VIDEO_NAME' => substr($video->title, 0,20) , 'VIDEO_URL' => $video->url, 'VIDEO_ID_' => PT_Slug($video->title, $video->video_id), 'AMOUNT' => $tr->amount, "CURRENCY" => $currency, "A_CURRENCY" => $admin_currency, "NET" => $net, "TIME" => PT_Time_Elapsed_String($tr->time) )); } } } $total_earn = $total_earn + $total_ads; $pt->array = implode(', ', $array); $pt->ads_array = implode(', ', $ads_array); $pt->page_url_ = $pt->config->site_url.'/transactions'; $pt->title = $lang->earnings . ' | ' . $pt->config->title; $pt->page = "transactions"; $pt->description = $pt->config->description; $pt->keyword = @$pt->config->keyword; $pt->content = PT_LoadPage('transactions/content',array( 'CURRENCY' => $currency, 'ADS_LIST' => $ads_list, 'TOTAL_EARN' => $total_earn, 'TODAY_EARN' => $today_earn, 'MONTH_EARN' => $month_earn ));
  5. Thanks again for your reply, I have access to the scripts phpnyadmin, but I don’t know how to do what you’re suggesting. any guidance is appreciated
  6. Thanks for your reply. Can you please clarify your message? which variables/values? how would I do it manually? I look forward to any additional direction.
  7. This code no longer blocks the html page from displaying ( I apparently have it correct now ? $this_day_video_earn = $db->rawQuery("SELECT SUM(earned_amount) AS sum FROM ".T_U_PAID_VIDEOS." c WHERE `time` >= ".$day_start." AND `time` <= ".$day_end." AND user_id_uploaded = ".$pt->user->id); $today_earn = $this_day_ads_earn[0]->sum + $this_day_video_earn[0]->sum ; However, after a transaction (the 'earned_amount' successfully appears in the 'u_paid_videos' table > in the 'earned_amount' column) the html still shows $0 in this code: <p>{{TODAY_EARN}}</p> instead of the earned_amount. Any additional guidance be appreciated.
  8. Thanks for your reply. I have now attempted this line, without success: $this_day_video_earn = $db->rawQuery("SELECT SUM(earned_amount) AS sum FROM ".T_U_PAID_VIDEOS." c WHERE `time` >= ".$day_start." AND `time` <= ".$day_end." AND user_id_uploaded = ".$pt->user->id); With success means when I select the web button that would normally direct me to the transaction html page, it just hangs, no redirect. When I put this file as it was originally, I can redirect to the transaction page. And yes, the u_paid_videos table has a 'time' column (identical to the videos_transactions table). Here is the file, where I've modified line 86 and 100: <?php if (!IS_LOGGED || ($pt->config->sell_videos_system == 'off' && $pt->config->usr_v_mon == 'off') ) { header('Location: ' . PT_Link('404')); exit; } $types = array('today','this_week','this_month','this_year'); $type = 'today'; if (!empty($_GET['type']) && in_array($_GET['type'], $types)) { $type = $_GET['type']; } if ($type == 'today') { $start = strtotime(date('M')." ".date('d').", ".date('Y')." 12:00am"); $end = strtotime(date('M')." ".date('d').", ".date('Y')." 11:59pm"); $array = array('00' => 0 ,'01' => 0 ,'02' => 0 ,'03' => 0 ,'04' => 0 ,'05' => 0 ,'06' => 0 ,'07' => 0 ,'08' => 0 ,'09' => 0 ,'10' => 0 ,'11' => 0 ,'12' => 0 ,'13' => 0 ,'14' => 0 ,'15' => 0 ,'16' => 0 ,'17' => 0 ,'18' => 0 ,'19' => 0 ,'20' => 0 ,'21' => 0 ,'22' => 0 ,'23' => 0); $ads_array = $array; $date_type = 'H'; $pt->cat_type = 'today'; $pt->chart_title = $lang->today; $pt->chart_text = date("l"); } elseif ($type == 'this_week') { $time = strtotime(date('l').", ".date('M')." ".date('d').", ".date('Y')); if (date('l') == 'Saturday') { $start = strtotime(date('M')." ".date('d').", ".date('Y')." 12:00am"); } else{ $start = strtotime('last saturday, 12:00am', $time); } if (date('l') == 'Friday') { $end = strtotime(date('M')." ".date('d').", ".date('Y')." 11:59pm"); } else{ $end = strtotime('next Friday, 11:59pm', $time); } $array = array('Saturday' => 0 , 'Sunday' => 0 , 'Monday' => 0 , 'Tuesday' => 0 , 'Wednesday' => 0 , 'Thursday' => 0 , 'Friday' => 0); $ads_array = $array; $date_type = 'l'; $pt->cat_type = 'this_week'; $pt->chart_title = $lang->this_week; $pt->chart_text = date('y/M/d',$start)." To ".date('y/M/d',$end); } elseif ($type == 'this_month') { $start = strtotime("1 ".date('M')." ".date('Y')." 12:00am"); $end = strtotime(cal_days_in_month(CAL_GREGORIAN, date('m'), date('Y'))." ".date('M')." ".date('Y')." 11:59pm"); if (cal_days_in_month(CAL_GREGORIAN, date('m'), date('Y')) == 31) { $array = array('01' => 0 ,'02' => 0 ,'03' => 0 ,'04' => 0 ,'05' => 0 ,'06' => 0 ,'07' => 0 ,'08' => 0 ,'09' => 0 ,'10' => 0 ,'11' => 0 ,'12' => 0 ,'13' => 0 ,'14' => 0 ,'15' => 0 ,'16' => 0 ,'17' => 0 ,'18' => 0 ,'19' => 0 ,'20' => 0 ,'21' => 0 ,'22' => 0 ,'23' => 0,'24' => 0 ,'25' => 0 ,'26' => 0 ,'27' => 0 ,'28' => 0 ,'29' => 0 ,'30' => 0 ,'31' => 0); }elseif (cal_days_in_month(CAL_GREGORIAN, date('m'), date('Y')) == 30) { $array = array('01' => 0 ,'02' => 0 ,'03' => 0 ,'04' => 0 ,'05' => 0 ,'06' => 0 ,'07' => 0 ,'08' => 0 ,'09' => 0 ,'10' => 0 ,'11' => 0 ,'12' => 0 ,'13' => 0 ,'14' => 0 ,'15' => 0 ,'16' => 0 ,'17' => 0 ,'18' => 0 ,'19' => 0 ,'20' => 0 ,'21' => 0 ,'22' => 0 ,'23' => 0,'24' => 0 ,'25' => 0 ,'26' => 0 ,'27' => 0 ,'28' => 0 ,'29' => 0 ,'30' => 0); }elseif (cal_days_in_month(CAL_GREGORIAN, date('m'), date('Y')) == 29) { $array = array('01' => 0 ,'02' => 0 ,'03' => 0 ,'04' => 0 ,'05' => 0 ,'06' => 0 ,'07' => 0 ,'08' => 0 ,'09' => 0 ,'10' => 0 ,'11' => 0 ,'12' => 0 ,'13' => 0 ,'14' => 0 ,'15' => 0 ,'16' => 0 ,'17' => 0 ,'18' => 0 ,'19' => 0 ,'20' => 0 ,'21' => 0 ,'22' => 0 ,'23' => 0,'24' => 0 ,'25' => 0 ,'26' => 0 ,'27' => 0 ,'28' => 0 ,'29' => 0); }elseif (cal_days_in_month(CAL_GREGORIAN, date('m'), date('Y')) == 28) { $array = array('01' => 0 ,'02' => 0 ,'03' => 0 ,'04' => 0 ,'05' => 0 ,'06' => 0 ,'07' => 0 ,'08' => 0 ,'09' => 0 ,'10' => 0 ,'11' => 0 ,'12' => 0 ,'13' => 0 ,'14' => 0 ,'15' => 0 ,'16' => 0 ,'17' => 0 ,'18' => 0 ,'19' => 0 ,'20' => 0 ,'21' => 0 ,'22' => 0 ,'23' => 0,'24' => 0 ,'25' => 0 ,'26' => 0 ,'27' => 0 ,'28' => 0); } $ads_array = $array; $pt->month_days = count($array); $date_type = 'd'; $pt->cat_type = 'this_month'; $pt->chart_title = $lang->this_month; $pt->chart_text = date("M"); } elseif ($type == 'this_year') { $start = strtotime("1 January ".date('Y')." 12:00am"); $end = strtotime("31 December ".date('Y')." 11:59pm"); $array = array('01' => 0 ,'02' => 0 ,'03' => 0 ,'04' => 0 ,'05' => 0 ,'06' => 0 ,'07' => 0 ,'08' => 0 ,'09' => 0 ,'10' => 0 ,'11' => 0 ,'12' => 0); $ads_array = $array; $date_type = 'm'; $pt->cat_type = 'this_year'; $pt->chart_title = $lang->this_year; $pt->chart_text = date("Y"); } $day_start = strtotime(date('M')." ".date('d').", ".date('Y')." 12:00am"); $day_end = strtotime(date('M')." ".date('d').", ".date('Y')." 11:59pm"); $this_day_ads_earn = $db->rawQuery("SELECT SUM(amount) AS sum FROM ".T_ADS_TRANS." c WHERE `time` >= ".$day_start." AND `time` <= ".$day_end." AND type = 'video' AND video_owner = ".$pt->user->id); $this_day_video_earn = $db->rawQuery("SELECT SUM(earned_amount) AS sum FROM ".T_U_PAID_VIDEOS." c WHERE `time` >= ".$day_start." AND `time` <= ".$day_end." AND user_id_uploaded = ".$pt->user->id); //$this_day_video_earn = $db->rawQuery("SELECT earned_amount FROM ".T_U_PAID_VIDEOS." c WHERE `time` >= ".$day_start." AND `time` <= ".$day_end." AND user_id_uploaded = ".$pt->user->id); //$this_day_video_earn = $db->rawQuery("SELECT SUM(amount - admin_com) AS sum FROM ".T_VIDEOS_TRSNS." c WHERE `time` >= ".$day_start." AND `time` <= ".$day_end." AND user_id = ".$pt->user->id); $today_earn = $this_day_ads_earn[0]->sum + $this_day_video_earn[0]->sum ; $month_start = strtotime("1 ".date('M')." ".date('Y')." 12:00am"); $month_end = strtotime(cal_days_in_month(CAL_GREGORIAN, date('m'), date('Y'))." ".date('M')." ".date('Y')." 11:59pm"); $this_month_ads_earn = $db->rawQuery("SELECT SUM(amount) AS sum FROM ".T_ADS_TRANS." c WHERE `time` >= ".$month_start." AND `time` <= ".$month_end." AND type = 'video' AND video_owner = ".$pt->user->id); $this_month_video_earn = $db->rawQuery("SELECT SUM(amount - admin_com) AS sum FROM ".T_VIDEOS_TRSNS." c WHERE `time` >= ".$month_start." AND `time` <= ".$month_end." AND user_id = ".$pt->user->id); $month_earn = $this_month_ads_earn[0]->sum + $this_month_video_earn[0]->sum ; // print_r($this_month_video_earn); // exit(); $trans = $db->where('user_id_uploaded',$user->id)->orderBy('id','DESC')->get(T_U_PAID_VIDEOS); //$trans = $db->where('user_id',$user->id)->orderBy('id','DESC')->get(T_VIDEOS_TRSNS); $ads_trans = $db->where('time',$start,'>=')->where('time',$end,'<=')->where('video_owner',$pt->user->id)->where('type','video')->get(T_ADS_TRANS); $total_ads = 0; if (!empty($ads_trans)) { foreach ($ads_trans as $key => $ad) { if ($ad->time >= $start && $ad->time <= $end) { $day = date($date_type,$ad->time); if (in_array($day, array_keys($ads_array))) { $ads_array[$day] += $ad->amount; $total_ads += $ad->amount; } } } } $ads_list = ""; $total_earn = 0; if (!empty($trans)) { foreach ($trans as $tr) { $video = PT_GetVideoByID($tr->video_id, 0, 0, 2); $user_data = PT_UserData($tr->paid_id); $currency = ""; $admin_currency = ""; $net = 0; if ($tr->currency == "USD") { $currency = "$"; $admin_currency = "$".$tr->admin_com; $net = $tr->amount - $tr->admin_com; } else if($tr->currency == "EUR"){ $currency = "€"; $admin_currency = "€".$tr->admin_com; $net = $tr->amount - $tr->admin_com; } elseif ($tr->currency == "EUR_PERCENT") { $currency = "€"; $admin_currency = $tr->admin_com."%"; $net = $tr->amount - ($tr->admin_com * $tr->amount)/100; } elseif ($tr->currency == "USD_PERCENT") { $currency = "$"; $admin_currency = $tr->admin_com."%"; $net = $tr->amount - ($tr->admin_com * $tr->amount)/100; } if ($tr->time >= $start && $tr->time <= $end) { $day = date($date_type,$tr->time); if (in_array($day, array_keys($array))) { $array[$day] += $net; } } $total_earn = $total_earn + (float)$net; if (!empty($video) && !empty($user_data)) { $ads_list .= PT_LoadPage('transactions/list',array( 'ID' => $tr->id, 'PAID_USER' => substr($user_data->name, 0,20), 'PAID_URL' => $user_data->url, 'USER_NAME' => $user_data->username, 'VIDEO_NAME' => substr($video->title, 0,20) , 'VIDEO_URL' => $video->url, 'VIDEO_ID_' => PT_Slug($video->title, $video->video_id), 'AMOUNT' => $tr->amount, "CURRENCY" => $currency, "A_CURRENCY" => $admin_currency, "NET" => $net, "TIME" => PT_Time_Elapsed_String($tr->time) )); } } } $total_earn = $total_earn + $total_ads; $pt->array = implode(', ', $array); $pt->ads_array = implode(', ', $ads_array); $pt->page_url_ = $pt->config->site_url.'/transactions'; $pt->title = $lang->earnings . ' | ' . $pt->config->title; $pt->page = "transactions"; $pt->description = $pt->config->description; $pt->keyword = @$pt->config->keyword; $pt->content = PT_LoadPage('transactions/content',array( 'CURRENCY' => $currency, 'ADS_LIST' => $ads_list, 'TOTAL_EARN' => $total_earn, 'TODAY_EARN' => $today_earn, 'MONTH_EARN' => $month_earn )); Any additional enlightenment/guidance will be appreciated.
  9. Thanks for your reply. From the code I initially posted here it shows "T_VIDEOS" and this line of code I posted: $this_day_video_earn = $db->rawQuery("SELECT SUM(amount - admin_com) AS sum FROM ".T_VIDEOS_TRSNS." c WHERE `time` >= ".$day_start." AND `time` <= ".$day_end." AND user_id = ".$pt->user->id); it shows "T_VIDEOS_TRSNS". So, I know there is a db table named "videos" and a db table named "videos_transactions". Therefore, I am assuming that "T_U_PAID_VIDEOS" would identify the u_paid_videos db table. So, I'm trying to modify this: $this_day_video_earn = $db->rawQuery("SELECT SUM(amount - admin_com) AS sum FROM ".T_VIDEOS_TRSNS." c WHERE `time` >= ".$day_start." AND `time` <= ".$day_end." AND user_id = ".$pt->user->id); I've tried this, without success: $this_day_video_earn = $db->rawQuery("SELECT earned_amount FROM ".T_U_PAID_VIDEOS." c WHERE `time` >= ".$day_start." AND `time` <= ".$day_end." AND user_id = ".$pt->user->id); can you please tell me if the syntax is correct in that line of code?
  10. Thanks for your reply. I'm initially looking for some coding help with how to put the amount that is in the 'upload_amount' column of the db table 'u_paid_videos' to properly replace (amount - admin_com) in this line: $this_day_video_earn = $db->rawQuery("SELECT SUM(amount - admin_com) AS sum FROM ".T_VIDEOS_TRSNS." c WHERE `time` >= ".$day_start." AND `time` <= ".$day_end." AND user_id = ".$pt->user->id); to help calculate the amount earned for the day
  11. I'm using a php video web script which includes this buy_video.php file, which calculates the video uploader's earned amount, and insert's that amount in the 'u_paid_videos' table column named 'earned_amount', which appears in this file on line 73: <?php ob_start(); if (IS_LOGGED == false) { $data = array('status' => 400, 'error' => 'Not logged in'); echo json_encode($data); exit(); } if (!empty($_POST['id'])) { if (!is_array($_POST['id'])) { $id_array[] = $_POST['id']; } else { $id_array = $_POST['id']; } // get cost video // get the default video price, to use if there is no per video play price $db->where('name', 'video_play_price'); $db_cost = $db->getOne('config'); $video_cost = (float)$db_cost->value; // the number of submitted videos - used to determine if all records were inserted $count_video = count($id_array); $user_id = $user->id; $wallet = (float)str_replace(',', '', $user->wallet); $balance = (float)str_replace(',', '', $user->balance); // add up the video prices $amount = 0; foreach ($id_array as $id) { $video_id = (int)PT_Secure($id); // get video data $video = $db->where('id', $id)->getOne(T_VIDEOS); // add the video play price if any, or the default price $amount += $video->video_play_price?$video->video_play_price:$video_cost; } // determine if the user has enough credits if( ($wallet >= $amount) OR ($balance + $wallet >= $amount) ) { //if( ($wallet >= $amount) OR ($balance >= $amount) ) { $db->startTransaction(); $inserted_records = 0; foreach ($id_array as $id){ $video_id = (int)PT_Secure($id); // get video data $video = $db->where('id', $id)->getOne(T_VIDEOS); // use the video play price if any, or the default price $video_cost_new = $video->video_play_price?$video->video_play_price:$video_cost; // credit the user 50% of the video cost $uploader_amount = $video_cost_new *0.50; // add data to paid table $insert_buy = $db->insert('u_paid_videos', [ 'id_user' => $user_id, 'id_video' => $video_id, 'session_key' => $_SESSION['session_key'], 'video_play_price' => (string)$video_cost, // the cost at the time of purchase // this is the default video cost not the $video_cost_new 'video_title' => $video->title, // storing the title 'user_id_uploaded' => $video->user_id, // the user who uploaded the video 'earned_amount' => $uploader_amount, ]); // count successful inserted records if ($insert_buy) { $inserted_records++; } //update the 'balance' of the user who uploaded the video // get the user's record $userwallet = $db->where('id', $video->user_id)->getOne(T_USERS); // add to the balance $videouserwallet = $userwallet->balance+$uploader_amount; // update the record $db->where('id', $video->user_id); $update_balance = $db->update(T_USERS, [ 'balance' => number_format($videouserwallet, 1, '.', ''), ]); } $update_wallet = null; $update_user_balance = null; ETC ..................................................... Ultimately, I’m trying to integrate the buy_video.php file’s ‘$earned_amount’ into a web script’s existing transaction file. Here are a couple of lines from that transaction file: $this_day_video_earn = $db->rawQuery("SELECT SUM(amount - admin_com) AS sum FROM ".T_VIDEOS_TRSNS." c WHERE `time` >= ".$day_start." AND `time` <= ".$day_end." AND user_id = ".$pt->user->id); $today_earn = $this_day_ads_earn[0]->sum + $this_day_video_earn[0]->sum ; and $trans = $db->where('user_id',$user->id)->orderBy('id','DESC')->get(T_VIDEOS_TRSNS); That may not be enough info, but I’d like assistance changing those lines to: $this_day_video_earn = $db->rawQuery("SELECT SUM(earned_amount) AS sum FROM “.T_VIDEOS.” c WHERE time >= “.$day_start.” AND time <= “.$day_end.” AND user_id = ".$pt->user->id); $trans = $db->where('user_id',$user->id)->orderBy('id','DESC')->get(T_VIDEOS); I tried those changes without success. Any guidance/suggestions will be appreciated.
  12. Thanks for the replies. In tried this: use assets\import\PHPMailer; and I see this error: Fatal error: Uncaught Error: Class 'assets\import\PHPMailer' not found in /home/public_html/submit/submit.php:18 Stack trace: #0 {main} thrown in ... and I tried this: use assets/import/PHPMailer; and I see this error: Parse error: syntax error, unexpected '/', expecting ',' or ';' in any additional help will be welcomed.
  13. Yes, thanks, got it. Now I see this: Fatal error: Uncaught Error: Class 'PHPMailer\PHPMailer\PHPMailer' not found in /home/public_html/submit/submit.php:13 Stack trace: #0 {main} thrown in /home/public_html/submit/submit.php on line 13 any additional help is appreciated
  14. Thanks for your reply. I'm now trying the code below, but am getting this error: Warning: require(../assets/import/PHPMailer/PHPMailerAutoLoad.php): failed to open stream: No such file or directory in /home/public_html/submit/submit.php on line 11Warning: require(../assets/import/PHPMailer/PHPMailerAutoLoad.php): failed to open stream: No such file or directory in /home/public_html/submit/submit.php on line 11Fatal error: require(): Failed opening required '../assets/import/PHPMailer/PHPMailerAutoLoad.php' (include_path='.:/opt/cpanel/ea-php70/root/usr/share/pear') in /home/public_html/submit/submit.php on line 11 <?php /** * This example shows how to handle a simple contact form. */ //Import PHPMailer classes into the global namespace use PHPMailer\PHPMailer\PHPMailer; $msg = ''; //Don't run this unless we're handling a form submission if (array_key_exists('email', $_POST)) { date_default_timezone_set('Etc/UTC'); require '../assets/import/PHPMailer/PHPMailerAutoLoad.php'; //Create a new PHPMailer instance $mail = new PHPMailer; //Tell PHPMailer to use SMTP - requires a local mail server //Faster and safer than using mail() $mail->isSMTP(); $mail->Host = 'localhost'; $mail->Port = 25; //Use a fixed address in your own domain as the from address //**DO NOT** use the submitter's address here as it will be forgery //and will cause your messages to fail SPF checks $mail->setFrom('chrisj@hmail.com', 'First Last'); //Send the message to yourself, or whoever should receive contact for submissions $mail->addAddress('chrisj@hmail.com', 'John Doe'); //Put the submitter's address in a reply-to header //This will fail if the address provided is invalid, //in which case we should ignore the whole request if ($mail->addReplyTo($_POST['email'], $_POST['name'])) { $mail->Subject = 'PHPMailer contact form'; //Keep it simple - don't use HTML $mail->isHTML(false); //Build a simple message body $mail->Body = <<<EOT Email: {$_POST['email']} Name: {$_POST['name']} Message: {$_POST['message']} EOT; //Send the message, check for errors if (!$mail->send()) { //The reason for failing to send will be in $mail->ErrorInfo //but you shouldn't display errors to users - process the error, log it on your server. $msg = 'Sorry, something went wrong. Please try again later.'; } else { $msg = 'Message sent! Thanks for contacting us.'; } } else { $msg = 'Invalid email address, message ignored.'; } } ?> Any additional guidance is appreciated.
  15. Thanks for your reply. It's not so straight forward to me. Here's what I tried, without success: <?php use PHPMailer\PHPMailer\PHPMailer; $msg = ''; if (array_key_exists('userfile', $_FILES)) { $uploadfile = tempnam(sys_get_temp_dir(), hash('sha256', $_FILES['userfile']['name'])); if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { // Upload handled successfully // Now create a message require '../vendor/autoload.php'; $mail = new PHPMailer; $mail->setFrom('from@example.com', 'First Last'); $mail->addAddress('s@hmail.com', 'John Doe'); $mail->Subject = 'PHPMailer file sender'; $mail->message = 'My message body'; // Attach the uploaded file $mail->addAttachment($uploadfile, 'My uploaded file'); if (!$mail->send()) { $msg .= "Mailer Error: " . $mail->ErrorInfo; } else { $msg .= "Message sent!"; } } else { $msg .= 'Failed to move file to ' . $uploadfile; } header('Location: https://........com'); exit; } ?> any additional guidance will be appreciated
  16. Thanks for your reply. I have PHPMailer installed. Maybe you can help direct me to tie-in this example code to my Form and to the PHPMailer: <?php /** * PHPMailer simple file upload and send example. */ //Import the PHPMailer class into the global namespace use PHPMailer\PHPMailer\PHPMailer; $msg = ''; if (array_key_exists('userfile', $_FILES)) { // First handle the upload // Don't trust provided filename - same goes for MIME types // See http://php.net/manual/en/features.file-upload.php#114004 for more thorough upload validation $uploadfile = tempnam(sys_get_temp_dir(), hash('sha256', $_FILES['userfile']['name'])); if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { // Upload handled successfully // Now create a message require '../vendor/autoload.php'; $mail = new PHPMailer; $mail->setFrom('from@example.com', 'First Last'); $mail->addAddress('whoto@example.com', 'John Doe'); $mail->Subject = 'PHPMailer file sender'; $mail->Body = 'My message body'; // Attach the uploaded file $mail->addAttachment($uploadfile, 'My uploaded file'); if (!$mail->send()) { $msg .= "Mailer Error: " . $mail->ErrorInfo; } else { $msg .= "Message sent!"; } } else { $msg .= 'Failed to move file to ' . $uploadfile; } } ?> And my Form looks like this: <form action='/submit/submit.php' method='post' name='myform'> <input type="hidden" id="some-place" name="some_place" value="classified"> <div class="row"> <div class="col-sm-14"> <textarea name='message' placeholder="Message..." class="form-control" rows="9" ></textarea> </div> </div> <div class="row"> <input class="form-control" type="text" name="name" placeholder="Name "> <input class="form-control" type="email" name="email" placeholder="Email" required> </div> <div class="row"> <input class="btnbtn-action" type='submit' value="Send" onclick="return UpdateTheHiddenField()" > <br/><br/> </div> </div> </div> </form> Any additional guidance is appreciated
  17. Thanks for your reply and suggestion. Would you be interested in providing a simple basic example of a php mailer code similar to what I have shown in my posting?
  18. The html Form I'm using works successfully with this php code: <?php //check if form was sent if($_POST){ $to = 's@hmail.com'; $subject = 'Form1'; $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $headers = $name; $message .= "\r\n\r\n" . $name; if( empty($_POST["some_place"]) or $_POST['some_place'] != "glory" ) { header("HTTP/1.0 403 Forbidden"); }else{ mail( $to, $subject, $message, $email, $headers ); } header('Location: https://.......com'); exit; } ?> The problem is that when the email is received it shows the (from) email address to be my domain account user name @ the server name, like this: domain1@host3servername.com, where I’d prefer something more like noReply@actualdomain.com Any help or suggested remedy will be appreciated
  19. Thanks for your reply. After adding your suggestion and visiting each page, I see 'category' in the top right corner of a blank white page quickly (see attached) and then the page with this HELLOcategory text here print("<pre>".var_export($page, true)."</pre>"); $text = 'default'; $cateogry_id = ''; $videos = array(); if ($page == 'trending') { $title = $lang->trending; $db->where('privacy', 0); $videos = $db->where('time', time() - 172800, '>')->orderBy('views', 'DESC')->get(T_VIDEOS, $limit); $text = 'trending text here'; } else if ($page == 'latest') { $title = $lang->latest_videos; $db->where('privacy', 0); $videos = $db->orderBy('id', 'DESC')->get(T_VIDEOS, $limit); $text = 'latest text here'; } else if ($page == 'top') { $title = $lang->top_videos; $db->where('privacy', 0); $videos = $db->orderBy('views', 'DESC')->get(T_VIDEOS, $limit); $text = 'top text here'; } else if ($page == 'category') { if (!empty($_GET['id'])) { if (in_array($_GET['id'], array_keys($categories))) { $pt->page_url_ = $pt->config->site_url.'/videos/'.$page.'/'.$_GET['id']; $category = PT_Secure($_GET['id']); $title = $categories[$category]; $category_id = "data-category='$category'"; if (!empty($_GET['sub_id'])) { $is_found = $db->where('type',PT_Secure($_GET['id']))->where('lang_key',PT_Secure($_GET['sub_id']))->getValue(T_LANGS,'COUNT(*)'); if ($is_found > 0) { $pt->page_url_ = $pt->config->site_url.'/videos/'.$page.'/'.$_GET['id'].'/'.$_GET['sub_id']; $db->where('sub_category', PT_Secure($_GET['sub_id'])); } } $db->where('privacy', 0); $category_old = str_replace('category__', '', $category); $videos = $db->where('category_id = "' . $category . '" OR category_id = "' . $category_old . '"')->orderBy('id', 'DESC')->get(T_VIDEOS, $limit); $text = 'category text here'; } else { header("Location: " . PT_Link('404')); exit(); } } } Any additional help is appreciated.
  20. Thanks for your reply. However, I'm not clear on your message. My initial intention was to display separate unique text, on each page, of the three pages. When you say you're "printing custom text on each of the three specified pages", I see that I'm printing the same text on all three pages. Is that what you mean? Also, I'm not clear on this "you're just not testing from one of those three pages". Can you please explain what you mean? You say "If you need custom text per page", - yes, that's what I'd like. "and don't want to limit it to the three listed pages" - I do want it to display on each of just those three pages " you'll have to account for those pages in your conditional logic" so, having if ($page == 'latest') and $text = 'Latest text here'; is accounting for those pages? Any additional guidance is appreciated.
  21. Thanks again for your reply. Ultimately, I am looking for guidance to display unique text, when each of three pages appears. I don't see how that has goal has been reached Any additional help is appreciated
  22. Thanks for your reply. I've added: $text = 'category text here'; else if ($page == 'category') { if (!empty($_GET['id'])) { if (in_array($_GET['id'], array_keys($categories))) { $category = PT_Secure($_GET['id']); $title = $categories[$category]; $category_id = "data-category='$category'"; $db->where('privacy', 0); $videos = $db->where('category_id', $category)->orderBy('id', 'DESC')->get(T_VIDEOS, $limit); $text = 'category text here'; } else { header("Location: " . PT_Link('404')); exit(); } } } when I remove die("<pre>".var_export($page, true)."</pre>"); I see this displayed on the html page: HELLOcategory text here when I add it back in I see blank page except for: 'category' And additional guidance is welcomed
  23. Thanks for your reply. You really don't have to be so condescending. I'm just trying to learn. Here's the code as requested. <?php declare( strict_types=1); // these should be set in PHP.ini error_reporting(-1); // set maximum errors ini_set('display_errors' , 'true'); if (empty($_GET['page'])) { header("Location: " . PT_Link('404')); exit(); } $page = PT_Secure($_GET['page']); $limit = 20; $pt->rss_feed = false; $pt->exp_feed = true; $pages = array( 'trending', 'category', 'latest', 'top' ); if (!in_array($page, $pages)) { header("Location: " . PT_Link('404')); exit(); } if (!empty($_GET['feed']) && $_GET['feed'] == 'rss') { $limit = 50; $pt->rss_feed = true; } die("<pre>".var_export($page, true)."</pre>"); $text = ''; $category_id = ''; $videos = array(); if ($page == 'trending') { $title = $lang->trending; $db->where('privacy', 0); $videos = $db->where('time', time() - 172800, '>')->orderBy('views', 'DESC')->get(T_VIDEOS, $limit); $text = 'trending text here'; } else if ($page == 'latest') { $title = $lang->latest_videos; $db->where('privacy', 0); $videos = $db->orderBy('id', 'DESC')->get(T_VIDEOS, $limit); $text = 'Latest text here'; } else if ($page == 'top') { $title = $lang->top_videos; $db->where('privacy', 0); $videos = $db->orderBy('views', 'DESC')->get(T_VIDEOS, $limit); $text = 'Top text here'; } else if ($page == 'category') { if (!empty($_GET['id'])) { if (in_array($_GET['id'], array_keys($categories))) { $category = PT_Secure($_GET['id']); $title = $categories[$category]; $category_id = "data-category='$category'"; $db->where('privacy', 0); $videos = $db->where('category_id', $category)->orderBy('id', 'DESC')->get(T_VIDEOS, $limit); } else { header("Location: " . PT_Link('404')); exit(); } } } use Bhaktaraz\RSSGenerator\Item; use Bhaktaraz\RSSGenerator\Feed; use Bhaktaraz\RSSGenerator\Channel; //Export rss feed if ($pt->rss_feed) { $rss_feed_xml = ""; $fl_rss_feed = new Feed(); $fl_rss_channel = new Channel(); $fl_rss_channel ->title($pt->config->title) ->description($pt->config->description) ->url($pt->config->site_url) ->appendTo($fl_rss_feed); if (is_array($videos)) { foreach ($videos as $feed_item_data) { $feed_item_data = PT_GetVideoByID($feed_item_data, 0, 0, 0); $fl_rss_item = new Item(); $fl_rss_item ->title($feed_item_data->title) ->description($feed_item_data->markup_description) ->url($feed_item_data->url) ->pubDate($feed_item_data->time) ->guid($feed_item_data->url,true) ->media(array( 'attr' => 'url', 'ns' => 'thumbnail', 'link' => PT_GetMedia($feed_item_data->org_thumbnail))) ->appendTo($fl_rss_channel); } } header('Content-type: text/rss+xml'); echo($fl_rss_feed); exit(); } $html_videos = ''; if (!empty($videos)) { foreach ($videos as $key => $video) { $video = PT_GetVideoByID($video, 0, 0, 0); $html_videos .= PT_LoadPage('videos/list', array( 'ID' => $video->id, 'VID_ID' => $video->id, 'TITLE' => $video->title, 'VIEWS' => $video->views, 'VIEWS_NUM' => number_format($video->views), 'USER_DATA' => $video->owner, 'THUMBNAIL' => $video->thumbnail, 'URL' => $video->url, 'TIME' => $video->time_ago, 'DURATION' => $video->duration, //'PRICE' => number_format($video->video_play_price<$config['video_play_price'] ? $config['video_play_price'] : $video->video_play_price) )); } } if (empty($videos)) { $html_videos = '<div class="text-center no-content-found empty_state"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-video-off"><path d="M16 16v1a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h2m5.66 0H14a2 2 0 0 1 2 2v3.34l1 1L23 7v10"></path><line x1="1" y1="1" x2="23" y2="23"></line></svg>' . $lang->no_videos_found_for_now . '</div>'; } $pt->videos_count= count($videos); $pt->page = $page; $pt->title = $title . ' | ' . $pt->config->title; $pt->description = $pt->config->description; $pt->keyword = @$pt->config->keyword; $pt->content = PT_LoadPage('videos/content', array( 'TITLE' => $title, 'VIDEOS' => $html_videos, 'TYPE' => $page, 'CATEGORY_ID' => $category_id, 'TEXT' => $text ));
  24. Thanks for your reply. I added this as per your instructions: die("<pre>".var_export($page, true)."</pre>"); $text = ''; $category_id = ''; $videos = array(); And all I see displayed on the whole html page is simply this: 'category' I look forward to any other guidance. Much thanks again
  25. Thanks for your reply. I didn't write this code, I'm just trying to modify it. So, it seems that the load page part should be at the end, which it is, assuming the everything should run first and then you load the page, I would guess. And saying that the conditional blocks aren't working doesn't seem correct. They serve a purpose for the script. Any other ideas will be welcomed
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.