Files
Testing/include/analytics/member_services_admin.php

72 lines
4.5 KiB
PHP
Raw Permalink Normal View History

2026-11-17 16:15:01 -05:00
<?php header('Content-type: application/json');
if ( !defined('PATHTOINCLUDES') ) define('PATHTOINCLUDES', $_SERVER["DOCUMENT_ROOT"] . '/include/analytics/');
include(PATHTOINCLUDES."base.php");
date_default_timezone_set('UTC');
$em="";
if(!isset($_GET["admin_tab"])){$admin_tab="pending";} else {$admin_tab=$_GET["admin_tab"];}
$sql="SELECT
`community_user_ads`.`adid`,
`community_user_ads`.`userid`,
`community_user_ads`.`username`,
`community_user_ads`.`useremail`,
`community_user_ads`.`image_url`,
`community_user_ads`.`image_width`,
`community_user_ads`.`image_height`,
`community_user_ads`.`approved`,
`community_user_ads`.`thelink`,
DATE_FORMAT(`community_user_ads`.`thedate`,'%m/%d/%Y') as fdate,
`community_user_ads`.`thesort`,
`community_user_ads`.`image_name`,
`community_user_ads`.`thetags`,
`community_user_ads`.`adclicks`,
`community_user_ads`.`adviews`,
`community_user_ads`.`ctr`
FROM
`community_user_ads`
WHERE `community_user_ads`.`approved` = '".$admin_tab."' AND `community_user_ads`.`trash` = 0
ORDER BY `community_user_ads`.`ctr` DESC, `community_user_ads`.`thesort` ASC";
$theform="";
$rownum=0;
$theads="";
$query=$database->database_query($sql) or $em.=$database->database_error();
while ($row = $database->database_fetch_assoc($query)) {
$rownum=$rownum+1;
$status=$row["approved"];
$theads.='<div id="ad_admin_cont_'.$row["adid"].'" style="positon:relative;">';
$theads.='<div class="ad_admin_form_heading">
<span class="left">'.$row["username"].'</span>
<span class="right">Delete <input type="checkbox" name="del_ad" id="del_ad_'.$row["adid"].'" onclick="ad_admin_del_ad(\''.$row["adid"].'\',\''.$row["image_name"].'\',\''.$row["userid"].'\');"/></span>
<div class="pdp-clearfix">&nbsp;</div>
</div>';
$theads.='<div><img src="'.$row["image_url"].'" width="'.$row["image_width"].'" height="'.$row["image_height"].'" alt="" class="" style="width:100%;height:auto;"></div>';
$theads.='<div class="ad_admin_form_container">';
$theads.='<select name="approved_'.$row["adid"].'" id="approved_'.$row["adid"].'" onchange="ad_admin_update_field(\'approved\',\''.$row["adid"].'\',\'select\',\'text\');" class="select">';
if($status=="pending"){$theads.='<option value="pending" selected="selected">Pending</option>';} else {$theads.='<option value="pending">Pending</option>';}
if($status=="yes"){$theads.='<option value="yes" selected="selected">Approved</option>';} else {$theads.='<option value="yes">Approved</option>';}
if($status=="no"){$theads.='<option value="no" selected="selected">Reject</option>';} else {$theads.='<option value="no">Rejected</option>';}
$theads.='</select>';
$theads.=' Sort: <input type="text" pattern="^-{0,1}\d*\.{0,1}\d+$" name="thesort_'.$row["adid"].'" id="thesort_'.$row["adid"].'" value="'.$row["thesort"].'" class="text" onblur="ad_admin_update_field(\'thesort\',\''.$row["adid"].'\',\'text\',\'int\');" style="width:30px;text-align:right;" maxlength="5" /> URL: <input type="text" name="thelink" id="thelink_'.$row["adid"].'" value="'.$row["thelink"].'" required pattern="/(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!-\/]))?/" style="width:140px;" onblur="ad_admin_update_field(\'thelink\',\''.$row["adid"].'\',\'text\',\'text\');"/><button style="float:right;">Go</button><div class="pdp-clearfix">&nbsp;</div><div class="ad_admin_stats">
<span>'.$row["fdate"].'</span>
<span>Impressions: '.$row["adviews"].'</span>
<span>Clicks: '.$row["adclicks"].'</span>
<span class="last">CTR: '.$row["ctr"].' %</span>
<span></span>
</div></div>';
$theads.='</div>';
}
$theform.='<div id="formmenu"><a href="javascript:ad_admin(\'/include/analytics/member_services_admin.php\',\'df_form\',\'Member Services\',\'pending\');">Pending</a> | <a href="javascript:ad_admin(\'/include/analytics/member_services_admin.php\',\'df_form\',\'Member Services\',\'yes\');">Approved</a> | <a href="javascript:ad_admin(\'/include/analytics/member_services_admin.php\',\'df_form\',\'Member Services\',\'no\');">Rejected</a></div>';
$theform.='<div class="xmlform" id="youtube_links" style="background-color:#e1e1e1;"><div class="xmlform_container" style="height:500px;"><div class="xmlform_pad" style="position:relative;padding:0px 0px 10px 0px;">';
$theform.=$theads;
$theform.='</div>';
$theform.='<div id="theprompt">
<div style="padding:2px 6px 2px 6px;color:#000;">Are you sure you want to delete this ad?</div>
<div style="text-align:right;padding-right:1px;"><button onclick="admin_del_ad();">Yes</button><button onclick="kill_del_ad_prompt();">Cancel</button>
</div>';
$theform.='</div></div>';
$arr = array ('status' => $em, 'theform' => $theform);
echo json_encode($arr);
?>