function generateRandomString($length, $api_key) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $randomString = ''; for ($i = 0; $i < $length; $i++) { $randomString .= $characters[rand(0, strlen($characters) - 1)]; } $client_sql = re_db_query("SELECT * FROM cs_sites WHERE api_key='" . $randomString . "' OR api_secret='" . $randomString . "'"); if (re_db_num_rows($client_sql) > 0) { generateRandomString('10'); } else { if ($api_key == $randomString) { generateRandomString('10'); } else { return $randomString; } } }
color: "<?php echo $color_arr[$i]; ?> ", subs: [ <?php $j = 0; $sub_fb_main = "select count(*) as total, 'Facebook' as Provider, relationship_status from cs_fb_share_users where reg_on is not null and reg_on!='0000-00-00 00:00:00' and relationship_status='" . $main_rec['relation'] . "' and client_id='" . $_SESSION['admin_id'] . "' " . $select_main . " group by relationship_status"; $sub_gp_main = "select count(*) as total, 'Google+' as Provider, relationship_status from cs_gp_users where reg_on is not null and reg_on!='0000-00-00 00:00:00' and relationship_status='" . $main_rec['relation'] . "' and client_id='" . $_SESSION['admin_id'] . "' " . $select_main . " group by relationship_status"; $sub_li_main = "select count(*) as total, 'LinkedIn' as Provider, '' as relationship_status from cs_li_data where reg_on is not null and reg_on!='0000-00-00 00:00:00' and client_id='" . $_SESSION['admin_id'] . "' " . $select_main . " group by relationship_status HAVING relationship_status='" . $main_rec['relation'] . "'"; $sub_yh_main = "select count(*) as total, 'Yahoo' as Provider, '' as relationship_status from cs_yahoo_data where reg_on is not null and reg_on!='0000-00-00 00:00:00' and client_id='" . $_SESSION['admin_id'] . "' " . $select_main . " group by relationship_status HAVING relationship_status='" . $main_rec['relation'] . "'"; $sub_ig_main = "select count(*) as total, 'Instagram' as Provider, '' as relationship_status from cs_ig_data where reg_on is not null and reg_on!='0000-00-00 00:00:00' and client_id='" . $_SESSION['admin_id'] . "' " . $select_main . " group by relationship_status HAVING relationship_status='" . $main_rec['relation'] . "'"; $sub_main_qry = $sub_fb_main . " union all " . $sub_gp_main . " union all " . $sub_li_main . " union all " . $sub_yh_main . " union all " . $sub_ig_main; //$sub_main_qry=$sub_fb_main." union all ".$sub_gp_main; $sub_main_sql = re_db_query($sub_main_qry); $sub_total = re_db_num_rows($sub_main_sql); while ($sub_main_rec = re_db_fetch_array($sub_main_sql)) { $j++; ?> { type: "<?php echo $sub_main_rec['Provider']; ?> ", percent: <?php echo $sub_main_rec['total']; ?> }<?php if ($j < $tot_rec) { ?> ,<?php } }
<?php $dateRange = ""; $ageRange = ""; $select_rev_main = "select sum(if(ot.is_from=1,ot.order_amt,0)) as fb_total, sum(if(ot.is_from=2,ot.order_amt,0)) as li_total, sum(if(ot.is_from=3,ot.order_amt,0)) as gp_total, sum(if(ot.is_from=5,ot.order_amt,0)) as yh_total, sum(if(ot.is_from=6,ot.order_amt,0)) as ig_total, date_format(ot.date_time,'%m-%d-%Y') as order_date from cs_track_orders as ot, `cs_users` as csu where csu.id=ot.ref_by and ot.client_id=csu.client_id and ot.date_time is not null and ot.client_id='" . $_SESSION['admin_id'] . "' "; if (isset($_POST['day_range']) && ($_POST['day_range'] == '0' || $_POST['day_range'] == '1')) { $select_rev_main .= " and datediff(current_date,ot.date_time) ='" . $_POST['day_range'] . "'"; } else { if (isset($_POST['day_range']) && $_POST['day_range'] > 1) { $select_rev_main .= " and datediff(current_date,ot.date_time) <='" . $_POST['day_range'] . "'"; } else { $select_rev_main .= " and datediff(current_date,ot.date_time) <='30'"; } } $select_rev_main .= " group by date_format(ot.date_time,'%m-%d-%Y')"; $rev_main_sql = re_db_query($select_rev_main); $total = re_db_num_rows($rev_main_sql); ?> <script type="text/javascript"> var chart = AmCharts.makeChart("rbpBarChartDiv", { "type": "serial", "theme": "none", "startDuration": 2, "depth3D":20, "angle":30, "legend": { "menuTop": '0px', "horizontalGap": 1, "maxColumns": 1, "position": "right", "useGraphSettings": true, "markerSize": 10,
if (($btn_style == "1" || $btn_style == "2") && $social_rec['short_name'] == "li") { $img_div .= '<img style="float: left; margin-right: 5px; " src="' . SITE_URL . 'img/social_icon/' . $social_rec['short_name'] . '_share_icon_' . $counter_type . '.jpg" alt="" title="" />'; } else { $img_div .= '<img style="float: left; margin-right: 5px; " src="' . SITE_URL . 'img/social_icon/' . $social_rec['short_name'] . '_share_btn_' . $counter_type . '.jpg" alt="" title="" />'; } $social_div .= '<div style="margin-bottom: 5px;"> <input type="checkbox" name="share_button[' . $i . ']" id="share_button_' . $i . '" value="' . $val . '" checked="checked" onclick="call_manage_display()" /> ' . $social_rec['social_name'] . ' <span style="float: right;"> <a href="javascript:void(0);" onclick="call_ordering(\'' . $i . '\',\'up\')">up</a> <a href="javascript:void(0);" onclick="call_ordering(\'' . $i . '\',\'down\')">down</a> </span> <input type="hidden" name="short_order[' . $i . ']" id="short_order_' . $i . '" value="' . $i . '" /> </div>'; } } $social_sql = re_db_query("select * from cs_social_network_master where social_id not in ('" . implode("','", $new_social_arr) . "') and is_display='1'"); if (re_db_num_rows($social_sql) > 0) { while ($social_rec = re_db_fetch_array($social_sql)) { $i++; $social_div .= '<div style="margin-bottom: 5px;"> <input type="checkbox" name="share_button[' . $i . ']" id="share_button_' . $i . '" value="' . $social_rec['social_id'] . '" onclick="call_manage_display()" /> ' . $social_rec['social_name'] . ' <span style="float: right;"> <a href="javascript:void(0);" onclick="call_ordering(\'' . $i . '\',\'up\')">up</a> <a href="javascript:void(0);" onclick="call_ordering(\'' . $i . '\',\'down\')">down</a> </span> <input type="hidden" name="short_order[' . $i . ']" id="short_order_' . $i . '" value="' . $i . '" /> </div>'; } } $social_div .= '<input type="hidden" name="odr_id" id="odr_id" value="" /> <input type="hidden" name="odr_type" id="odr_type" value="" /> <input type="hidden" name="total_social" id="total_social" value="4" />'; echo $img_div . '~!##!~' . $social_div;
<thead> <tr> <th> <div class="checkbox"> <input id="checkbox1" type="checkbox" data-check-all> <label for="checkbox1"></label> </div> </th> <th>URL</th> <th>Shared By</th> <th>Date & Time</th> </tr> </thead> <tbody> <?php if (re_db_num_rows($res_banner) > 0) { $i = 0; while ($row_banner = re_db_fetch_array($res_banner)) { $i++; ?> <tr> <td> <div class="checkbox"> <input id="checkbox2" type="checkbox" /> <label for="checkbox2"></label> </div> </td> <td><?php echo re_db_output($row_banner['url']); ?> </td>
} } $disabled = ""; } if (count($error) <= 0) { $u_update = "update cs_sites set \n icon_size='" . $icon_size . "', \n req_custom='" . $req_custom . "', \n custom_icon_size='" . $custom_icon_size . "' \n where id='" . $_SESSION['admin_id'] . "'"; re_db_query($u_update); $_SESSION['msg'] = "update"; header("location:social_icon_setting.php"); exit; } } if (!isset($_POST['update'])) { $site_data_qry = "select * from cs_sites where id='" . $_SESSION['admin_id'] . "'"; $site_data_sql = re_db_query($site_data_qry); if (re_db_num_rows($site_data_sql) > 0) { $site_data_rec = re_db_fetch_array($site_data_sql); $icon_size = $site_data_rec['icon_size']; $req_custom = $site_data_rec['req_custom']; $custom_icon_size = $site_data_rec['custom_icon_size']; $is_size_approved = $site_data_rec['is_size_approved']; if ($req_custom == "1") { $custom_icon_size_arr = explode('x', $custom_icon_size); $icon_w = $custom_icon_size_arr[0]; $icon_h = $custom_icon_size_arr[1]; $disabled = ""; } } } if (isset($_SESSION['msg']) && $_SESSION['msg'] == "update") { $msg = "Change Saved Successfully.";
if ($_GET['is_like'] == '4') { $like_unlike = "is_gp='1',"; } } } } $insert_into = "insert into cs_like_unlike set " . $like_unlike . " url='" . mysql_real_escape_string($_GET['like_url']) . "',client_id='" . mysql_real_escape_string($_GET['site_id']) . "'"; re_db_query($insert_into); } echo "Event Tracked success fully"; exit; } if (isset($_GET['order_id']) && $_GET['order_id'] != '') { $select_order = "select id from cs_track_orders where order_id='" . mysql_real_escape_string($_GET['order_id']) . "' and client_id='" . mysql_real_escape_string($_GET['site_id']) . "'"; $res_ord = re_db_query($select_order); if (re_db_num_rows($res_ord) <= 0) { $ins_order = "insert into cs_track_orders (client_id,order_id,order_amt,ref_by,is_from,date_time,ip) \n values ('" . mysql_real_escape_string($_GET['site_id']) . "','" . mysql_real_escape_string($_GET['order_id']) . "','" . mysql_real_escape_string($_GET['order_amt']) . "','" . mysql_real_escape_string($_GET['csid']) . "','" . mysql_real_escape_string($_GET['is_from']) . "','" . date('Y-m-d H:i:s', mktime(gmdate('H'), gmdate('i'), gmdate('s'), gmdate('m'), gmdate('d'), gmdate('Y'))) . "','" . $_SERVER['REMOTE_ADDR'] . "')"; re_db_query($ins_order); echo "Order Tracked Successfully."; exit; } else { echo "This order has been already tracked"; exit; } } $udata = json_decode($_GET['other']); if (isset($_GET['is_fb']) && $_GET['is_fb'] == '1') { $u_email = $udata->email; } else { if (isset($_GET['is_li']) && $_GET['is_li'] == '1') { $u_email = $udata->emailAddress;
function manage_fb_page($fb_page_title, $fb_page_id, $member_id, $client_id, $total_likes) { $select_all = "select * from `cs_like_pages` where page_title='" . mysql_real_escape_string($fb_page_title) . "'"; $res_like = re_db_query($select_all); if (re_db_num_rows($res_like) > 0) { $row_page = re_db_fetch_array($res_like); re_db_query("update cs_like_pages set fb_page_id='" . $fb_page_id . "',total_likes='" . $total_likes . "' where id='" . $row_page['id'] . "'"); $user_entry = re_db_query("select id from `cs_member_pages_like` where page_id='" . $row_page['id'] . "' and client_id='" . $client_id . "' and member_id='" . $member_id . "'"); if (re_db_num_rows($user_entry) <= 0) { $insert_user = "******" . $row_page['id'] . "',member_id='" . $member_id . "',client_id='" . $client_id . "'"; re_db_query($insert_user); } } else { $insert_cs = re_db_query("insert into cs_like_pages set page_title='" . mysql_real_escape_string($fb_page_title) . "',fb_page_id='" . $fb_page_id . "',total_likes='" . $total_likes . "'"); $last_page_id = mysql_insert_id(); $insert_user = "******" . $last_page_id . "',member_id='" . $member_id . "',client_id='" . $client_id . "'"; re_db_query($insert_user); } }
$fb_sub_age_sql = re_db_query($fb_sub_age_qry); if (re_db_num_rows($fb_sub_age_sql) > 0) { while ($fb_sub_age_rec = re_db_fetch_array($fb_sub_age_sql)) { $fb_age_arr[$fb_sub_age_rec['ageband']] = $fb_sub_age_rec['total']; } } $gp_sub_age_qry = "SELECT COUNT(*) as total, CASE WHEN age = 0 THEN 'NP' WHEN age > 0 AND age < 13 THEN '13' WHEN age >=13 AND age <=17 THEN '13-17' WHEN age >=18 AND age <=34 THEN '18-34' WHEN age >=35 AND age <= 49 THEN '35-49' WHEN age >=50 THEN '50+' END AS ageband FROM ( " . $select_gp_main . " ) as tbl GROUP BY ageband"; $gp_sub_age_sql = re_db_query($gp_sub_age_qry); if (re_db_num_rows($gp_sub_age_sql) > 0) { while ($gp_sub_age_rec = re_db_fetch_array($gp_sub_age_sql)) { $gp_age_arr[$gp_sub_age_rec['ageband']] = $gp_sub_age_rec['total']; } } $li_sub_age_qry = "SELECT COUNT(*) as total, CASE WHEN age = 0 THEN 'NP' WHEN age > 0 AND age < 13 THEN '13' WHEN age >=13 AND age <=17 THEN '13-17' WHEN age >=18 AND age <=34 THEN '18-34' WHEN age >=35 AND age <= 49 THEN '35-49' WHEN age >=50 THEN '50+' END AS ageband FROM ( " . $select_li_main . " ) as tbl GROUP BY ageband"; $li_sub_age_sql = re_db_query($li_sub_age_qry); if (re_db_num_rows($li_sub_age_sql) > 0) { while ($li_sub_age_rec = re_db_fetch_array($li_sub_age_sql)) { $li_age_arr[$li_sub_age_rec['ageband']] = $li_sub_age_rec['total']; } } ?> <script type="text/javascript"> var chartAge; var typesAge = [ <?php $i = 0; $total = count($main_age_arr); foreach ($main_age_arr as $key => $val) { $i++; if ($key == "NP") { $title = 'Age Not Provided';
<thead> <tr> <!--th> <div class="checkbox"> <input id="checkbox1" type="checkbox" data-check-all> <label for="checkbox1"></label> </div> </th--> <th>Page</th> <th>No. of Likes</th> <th>View</th> </tr> </thead> <tbody> <?php if (re_db_num_rows($res_tlp) > 0) { while ($row_tlp = re_db_fetch_array($res_tlp)) { ?> <tr> <td><?php echo re_db_output($row_tlp['page_title']); ?> </td> <td><?php echo re_db_output($row_tlp['total']); ?> </td> <td><a href="<?php echo $row_tlp['fb_page_id'] ? "https://www.facebook.com/" . $row_tlp['fb_page_id'] . "" : "#";
$error[] = "Please enter username and password."; } if (count($error) <= 0) { if ($_POST['user'] == "csadmin" && md5($_POST['pass']) == "29ad0e3fd3db681fb9f8091c756313f7") { $_SESSION['admin_type'] = "master"; $_SESSION['admin_id'] = "1"; $_SESSION['firstname'] = "Master"; $_SESSION['lastname'] = "Admin"; $_SESSION['admin_email'] = "*****@*****.**"; $_SESSION['admin_img'] = "admin_1.jpg"; header("location:index.php"); exit; } else { $sel_cs = "select * from `cs_sites` where admin_email='" . $_POST['user'] . "' and admin_password='******'pass']) . "' and is_approved='1'"; $rec_cs = re_db_query($sel_cs); if (re_db_num_rows($rec_cs) > 0) { $row_cs = re_db_fetch_array($rec_cs); $_SESSION['admin_type'] = "client"; $_SESSION['admin_id'] = $row_cs['id']; $_SESSION['site_admin'] = $row_cs['site_admin']; $_SESSION['firstname'] = $row_cs['firstname']; $_SESSION['lastname'] = $row_cs['lastname']; $_SESSION['admin_email'] = $row_cs['admin_email']; $_SESSION['admin_img'] = $row_cs['admin_img']; $_SESSION['fb_app_id'] = $row_cs['fb_app_id']; $_SESSION['twitter_app_id'] = $row_cs['twitter_app_id']; $_SESSION['linkedin_app_id'] = $row_cs['linkedin_app_id']; header("location:index.php"); exit; } else { $error[] = "Invalid username or password";
?> </div> </section> <section class="widget"> <header> <h4>User's Google+ <small>Profile</small></h4> <div class="widget-controls"> <a data-widgster="expand" title="Expand" href="#"><i class="glyphicon glyphicon-chevron-up"></i></a> <a data-widgster="collapse" title="Collapse" href="#"><i class="glyphicon glyphicon-chevron-down"></i></a> <a data-widgster="close" title="Close" href="#"><i class="glyphicon glyphicon-remove"></i></a> </div> </header> <div class="widget-body"> <?php if (re_db_num_rows($gp_data_sql) > 0) { $gp_data_rec = re_db_fetch_array($gp_data_sql); ?> <table class="table" style="border: medium none;"> <tr> <td colspan="4"> <div> <?php if ($gp_data_rec['profile_pic'] != "") { ?> <img style="float: left;" src="<?php echo $gp_data_rec['profile_pic']; ?> " alt="Profile Image" title="Profile Image" /> <?php } else {
<?php if (isset($_SESSION['admin_type']) && $_SESSION['admin_type'] == "master") { $chl_app_sql = re_db_query("select * from cs_sites where is_approved='0'"); $tot_app = re_db_num_rows($chl_app_sql); } ?> <!DOCTYPE html> <html> <head> <title>Coupay Social - Dashboard</title> <link href="css/application.min.css" rel="stylesheet"> <!-- as of IE9 cannot parse css files with more that 4K classes separating in two files --> <!--[if IE 9]> <link href="css/application-ie9-part2.css" rel="stylesheet"> <![endif]--> <link rel="shortcut icon" href="img/favicon.png"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <meta name="description" content=""> <meta name="author" content=""> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <script> /* yeah we need this empty stylesheet here. It's cool chrome & chromium fix chrome fix https://code.google.com/p/chromium/issues/detail?id=167083 https://code.google.com/p/chromium/issues/detail?id=332189 */ </script> <script type="text/javascript" language="javascript"> var sitepath='http://www.coupay.com.sg/';
} $select_cu = "select email from cs_users where id='" . mysql_real_escape_string($_GET['mid']) . "'"; $res_cu = re_db_query($select_cu); $row_cu = re_db_fetch_array($res_cu); $fb_data_qry = "select * from cs_fb_share_users where member_id='" . mysql_real_escape_string($_GET['mid']) . "' and client_id='" . $_SESSION['admin_id'] . "' "; $fb_data_sql = re_db_query($fb_data_qry); $li_data_qry = "select lid.*, csu.email from cs_li_data as lid, cs_users as csu where csu.id=lid.member_id and csu.client_id='" . $_SESSION['admin_id'] . "' and member_id='" . mysql_real_escape_string($_GET['mid']) . "' "; $li_data_sql = re_db_query($li_data_qry); $gp_data_qry = "select * from cs_gp_users where member_id='" . mysql_real_escape_string($_GET['mid']) . "' and client_id='" . $_SESSION['admin_id'] . "' "; $gp_data_sql = re_db_query($gp_data_qry); $yh_data_qry = "select * from cs_yahoo_data where member_id='" . mysql_real_escape_string($_GET['mid']) . "' and client_id='" . $_SESSION['admin_id'] . "' "; $yh_data_sql = re_db_query($yh_data_qry); $ig_data_qry = "select * from cs_ig_data where member_id='" . mysql_real_escape_string($_GET['mid']) . "' and client_id='" . $_SESSION['admin_id'] . "' "; $ig_data_sql = re_db_query($ig_data_qry); $is_profile = 0; if (re_db_num_rows($fb_data_sql) > 0 || re_db_num_rows($gp_data_sql) > 0 || re_db_num_rows($li_data_sql) > 0 || re_db_num_rows($yh_data_sql) > 0 || re_db_num_rows($ig_data_sql) > 0) { $is_profile = 1; $fb_data_rec = re_db_fetch_array($fb_data_sql); $li_data_rec = re_db_fetch_array($li_data_sql); $gp_data_rec = re_db_fetch_array($gp_data_sql); $yh_data_rec = re_db_fetch_array($yh_data_sql); $ig_data_rec = re_db_fetch_array($ig_data_sql); if ($fb_data_rec['profile_pic']) { $profle_pic = $fb_data_rec['profile_pic']; } else { if ($li_data_rec['pictureUrl']) { $profle_pic = $li_data_rec['pictureUrl']; } else { if ($gp_data_rec['profile_pic']) { $profle_pic = $gp_data_rec['profile_pic']; } else {
fclose($myfile); $_SESSION['msg'] = "update"; } //$_SESSION['msg']="update"; header("location:follow_bar_setting.php"); exit; } } if (!isset($_POST['save'])) { $site_data_qry = "select * from cs_sites where id='" . $_SESSION['admin_id'] . "'"; $site_data_sql = re_db_query($site_data_qry); if (re_db_num_rows($site_data_sql) > 0) { $site_data_rec = re_db_fetch_array($site_data_sql); $follow_btn_size = $site_data_rec['follow_btn_size']; $detail_sql = re_db_query("select * from cs_follow_bar_setting where client_id='" . $_SESSION['admin_id'] . "'"); if (re_db_num_rows($detail_sql) > 0) { $i = 0; while ($detail_rec = re_db_fetch_array($detail_sql)) { $i++; $provider[$i] = $detail_rec['provider']; $provider_url[$i] = $detail_rec['provider_url']; $provider_title[$i] = $detail_rec['provider_title']; $provider_id[$i] = $detail_rec['provider_id']; } } } } if ($provider[1] == "") { $file_url = ""; } if (isset($_SESSION['msg']) && $_SESSION['msg'] == "update") {
function re_db_select($tb, $fields, $where = "") { global $lastQuery; if (is_array($fields) && count($fields) > 0) { $query .= "SELECT " . implode(",", $fields) . " FROM " . $tb . " "; if (isset($where) && $where != "") { $query .= "WHERE " . $where; } $lastQuery['query'] = $query; $lastQuery['time'] = date('Y-m-d H:i:s.u'); $rec = mysql_query($query); // echo $query."<br/>"; if (re_db_num_rows($rec) > 0) { while ($res = re_db_fetch_array($rec)) { $result[] = $res; } return $result; } else { return false; } } }