Jump to content
MakeWebGames

Ben Nash

Members
  • Posts

    238
  • Joined

  • Last visited

Everything posted by Ben Nash

  1. I do believe he has actually posted in the correct section...
  2. Only $600?!?!?
  3. Ben Nash

    Hosting Template

    Looking good Dave!
  4. Zettieee has just finished a design for me and I must say I'm impressed! Looks clean, professional and the price is unbeatable. +1 for him!
  5. Add me on PS4 @ PHPFish, I play Watchdogs, BF4 and COD Ghosts.
  6. Just posting this to say how impressed I am with Dave's patience and professionalism. When I had a bug in my script he replied to all my questions and helped me via TeamViewer to fix it! +1 for Dave!
  7. Anyone? --------
  8. I have 2 php files and 2 smarty template files. The problem is in the stats.php file I believe. What happens is when I add a new link and then get "clicks" on it the stats do show but when I delete the link the stats mess up. Look at the screenshot below... [ATTACH=CONFIG]1455[/ATTACH] As you can see it displays a "[" but it should say "No statistics" instead. Here are the files: stats.tpl.php   {include file="header.tpl.php"} <!--Contents--> <div id="contents"> <!--Left Contents--> <div id="memberRightPanel"> <br /> <div class="heading1">Statistics</div> <br /> <div style=" background:#f6f6f6; padding:20px; overflow:hidden; -moz-border-radius: 4px; -webkit-border-radius: 4px; -khtml-border-radius: 4px; border-radius: 4px; border:1px solid #cccccc; color:#252525"> <!--Date Pickers--> <form action="stats.php" method="post"> <table cellspacing="0" style="font-size:13px; width:700px;" class="datearea"> <tr> <td class="label" style="width:80px;">From</td> <td><input type="text" name="date1" id="date1" class="input_small" /></td> <td class="label" style="text-align:center; width:85px">To</td> <td><input type="text" id="date2" name="date2" class="input_small" /></td><td > <input type="submit" name="submit" style="vertical-align:middle" value="View" /></td> </tr> </table> </div> </form></div> <!--End Date Picker--> <script type="text/javascript"> var today = '{$serverDate}'; {literal} $(document).ready(function(){ $('#date1').datepicker({ dateFormat: "yy-mm-dd"}); $('#date1').datepicker( "option", "defaultDate", today ); $('#date2').datepicker({ dateFormat: "yy-mm-dd"}); $('#date2').datepicker( "option", "defaultDate", today ); }); {/literal} </script> <div class="clear"> <p style="color:#56565f; font-size:16px; font-family:MyriadPro; margin:10px auto;">{if $date_start ne ""}Showing Statistics From | {$date_start} {/if}{if $date_end ne ""}- {$date_end}{/if} </p> </div> <div class="clear"> <br /> <div class="heading2">Link Locker Statistics</div> <br /> <table cellspacing="0" class="earnings_table"> <tr> <th> Link Locker Name</th> <th>Earnings</th> <th>Unlocks</th> <th>Clicks</th> <th>CR</th> <th>EPC</th> </tr> {if $history ne "" && $history|@count gt 0} {foreach item=data from=$history} <tr> <td>{$data.file}</td> <td>${$data.profit}</td> <td >{$data.downloads}</td> <td>{$data.clicks}</td> <td>{$data.conv}%</td> <td>${$data.epc}</td> </tr> {/foreach} <tr> <td> Total/Average</td> <td>${$total_profit}</td> <td >{$total_downloads}</td> <td>{$total_clicks}</td> <td>{$total_conv}%</td> <td>${$total_epc}</td> </tr> {else} <tr><td colspan="7">No Statistics.</td></tr> {/if} </table> <div class="clear"> <br /> <div class="heading2">Content Locker Statistics</div> <br /> <table cellspacing="0" class="earnings_table"> <tr> <th> Content Locker Name</th> <th>Earnings</th> <th>Unlocks</th> <th>Clicks</th> <th>CR</th> <th>EPC</th> </tr> {if $gw_data ne "" && $gw_data|@count gt 0} {foreach item=data from=$gw_data} <tr> <td><span title="{$data.gw_name}" class="ec-tip-twitter"> {$data.gw_name}</span></td> <td>${$data.profit}</td> <td >{$data.downloads}</td> <td>{$data.clicks}</td> <td>{$data.conv}%</td> <td>${$data.epc}</td> </tr> {/foreach} <tr> <td> Total/Average</td> <td>${$gtotal_profit}</td> <td >{$gtotal_downloads}</td> <td>{$gtotal_clicks}</td> <td>{$gtotal_conv}%</td> <td>${$gtotal_epc}</td> </tr> {else} <tr><td colspan="7">No Statistics.</td></tr> {/if} </table> </div> </div> </div> <!--End Right Contents--> </div> <!--End Contents--> {include file="footer.tpl.php"}   stats.php   <?php require_once('header.php'); if(!$Auth->checkAuth()) // if user isn't logged in { header("location: index.php"); exit; } $uid = $Auth->getLoggedId(); $template->assign('script', 'stats'); //Dates $date_start = makesafe($_POST['date1']); $date_end = makesafe($_POST['date2']); $serverDate = date("Y-m-d"); $template->assign('serverDate', $serverDate); if(!empty($date_start)) $template->assign('date_start', date('d-m-Y', strtotime($date_start))); if(!empty($date_end)) $template->assign('date_end', date('d-m-Y', strtotime($date_end))); if(!empty($date_start)) { $q = "AND DATE(`date`) >= '$date_start'"; if(!empty($date_end)) { $q .= " AND DATE(`date`) <= '$date_end'"; } $q2 = "AND DATE(d.date) >= '$date_start'"; if(!empty($date_end)) { $q2 .= " AND DATE(d.date) <= '$date_end'"; } $hourly = false; } if(empty($q)) { $q = "AND DATE(`date`) > DATE_SUB(CURDATE(), INTERVAL 7 DAY)"; $q2 = "AND DATE(d.date) > DATE_SUB(CURDATE(), INTERVAL 7 DAY)"; $hourly = false; $template->assign('date_start', date('d-m-Y', strtotime("-6 days"))); } //Country BreakDown $csql1 = "SELECT COUNT(id) as total, campaign_id, country FROM offer_process WHERE uid = '$uid' AND status = 1 $q GROUP BY country "; $result = mysql_query($csql1); if(mysql_num_rows($result)) { while($cr = mysql_fetch_object($result)) { $country = $cr->country; $countries[$country] = $cr->total; } } if(!empty($countries)) { $country_analytics = "['Country', 'Downloads'],"; foreach($countries as $c => $v) { $c = getCountryName($c); $country_analytics .= "['$c', $v],"; } $country_analytics = substr($country_analytics, 0, -1); $template->assign('country_analytics', $country_analytics); } //Get Clicks/Downloads in given days require_once("leads_chart.php"); //End Clicks/Downloads //Get data associated with countries $crsql = mysql_query("SELECT id, filename FROM files WHERE uid = '$uid' AND hits > 0"); if(mysql_num_rows($crsql)) { $data = array(); $total_clicks = 0 ; $total_downloads = 0; $total_profit = 0; $total_conv = 0; $total_avg = 0; $tota_epc = 0; while($crrow = mysql_fetch_object($crsql)) { $fid = $crrow->id; $filename = stripslashes($crrow->filename); if(strlen($filename) > 23) $filename = substr($filename,0,20)."..."; //report data $profit = 0; $clicks = 0; $downloads = 0; $conv = 0; $epc = 0; $avgCPA = 0; //First get data from offer process $rsql = mysql_query("SELECT * FROM offer_process WHERE file_id = '$fid' AND uid = '$uid' $q"); if(mysql_num_rows($rsql)) { while($rrs = mysql_fetch_object($rsql)) { //update clicks $clicks++; //update downloads $status = $rrs->status; if($status == 1){ $downloads++; //update profit $credits = $rrs->credits; $profit += $credits; } } } //conv $conv = sprintf("%.2f", ($downloads / $clicks) * 100); //avg cpa $avgCPA = sprintf("%.2f", $profit / $downloads); //ToDo Epc Calculation $epc = sprintf("%.2f", $profit / $clicks); //total CLICKS $total_clicks += $clicks ; $total_downloads += $downloads; $total_profit += $profit; if(!empty($clicks)){ $data[] = array('id' => $fid, 'file' => $filename, 'downloads' => $downloads, 'clicks' => $clicks, 'profit' => $profit, 'conv' => $conv, 'avgcpa' => $avgCPA, 'epc' => $epc); } } } $total_conv = sprintf("%.2f", ($total_downloads / $total_clicks) * 100); $total_avg = sprintf("%.2f", $total_profit / $total_downloads); $total_epc = sprintf("%.2f", $total_profit / $total_clicks); $template->assign('total_clicks', $total_clicks); $template->assign('total_downloads', $total_downloads); $template->assign('total_profit', $total_profit); $template->assign('total_conv', $total_conv); $template->assign('total_avg', $total_avg); $template->assign('total_epc', $total_epc); $template->assign('history', $data); //Premium Chart $mm2 = mysql_query("SELECT SUM(credits) as income, date FROM earnings_log WHERE uid = '$uid' AND notes LIKE '%Premium Signup%' $q GROUP BY DATE(date) "); if(mysql_num_rows($mm2)) { while($mr2 = mysql_fetch_object($mm2)) { $pdate = date("Y-m-d", strtotime($mr2->date)); $pincome = $mr2->income; $pdata .= "['$pdate', $pincome],"; } $pdata = "['Date', 'Premium Earnings'],".$pdata; $pdata = substr($pdata, 0, -1); $template->assign('pdata', $pdata); } $dsql = mysql_query("SELECT COUNT(d.id) as `count`, d.referrer as referrer, f.id FROM downloads_log as d INNER JOIN files as f ON d.file_uniqid = f.code WHERE f.uid = '$uid' AND d.referrer != 'NULL' AND d.referrer != '' $q2 GROUP BY d.referrer ORDER BY `count` DESC LIMIT 20"); if(mysql_num_rows($dsql)) { while($dr = mysql_fetch_object($dsql)) { $ref_name = stripslashes($dr->referrer); $ref_name = str_replace("http://", "", $ref_name); if(strpos($ref_name, "/") > 0){ //$ref_name = substr($ref_name, 0, strpos($ref_name, "/")); } $refs[] = array('referrer' => $ref_name, 'count' => $dr->count); } $template->assign('referrers', $refs); } function getGatewayNameByGid($gid) { $gid = makesafe($gid); $sql = mysql_query("SELECT name FROM gateways WHERE gid = $gid"); if(mysql_num_rows($sql)) { $m = mysql_fetch_object($sql); return $m->name; }else { return 0; } } //Content Gateways Stats----------------------------------// $rsql = mysql_query("SELECT SUM(IF(status = 'complete', 1, 0)) as downloads, SUM(IF(status = 'complete', credits, 0)) as credits, COUNT(DISTINCT session_id) as `hits`, gid, COUNT(id) as clicks FROM gw_session_offers WHERE uid = '$uid' $q GROUP BY gid"); if(mysql_num_rows($rsql)) { while($rrs = mysql_fetch_assoc($rsql)) { $gid = $rrs['gid']; $gwname = getGatewayNameByGid($gid); //null variables $profit = 0; $clicks = 0; $downloads = 0; $conv = 0; $epc = 0; $avgCPA = 0; $hits = 0; $hits = $rrs['hits']; $clicks = 0; $downloads = 0; $clicks = $rrs['clicks']; $profit = 0; $credits = 0; $downloads = $rrs['downloads']; //update profit $credits = $rrs['credits']; $profit = $credits; if(empty($hits)) $hits = 0; if(empty($downloads)) $downloads = 0; if(empty($downloads)) { $credits = 0; $profit = $credits; } if(!empty($clicks)){ //conv $conv = sprintf("%.2f", ($downloads / $clicks) * 100); //$conv = abs(($downloads / $clicks) * 100); //avg cpa $avgCPA = sprintf("%.2f", $profit / $downloads); //ToDo Epc Calculation $epc = sprintf("%.2f", $profit / $clicks); if($conv == '100.00') $conv = 100; if($conv == '0.00') $conv = 0; if($epc == '0.00') $epc = 0; if($avgCPA == '0.00') $avgCPA = 0; //total CLICKS $gtotal_clicks += $clicks ; $gtotal_downloads += $downloads; $gtotal_profit += $profit; $gw_data[] = array('id' => $gid, 'downloads' => $downloads, 'clicks' => $clicks, 'profit' => $profit, 'conv' => $conv, 'avgcpa' => $avgCPA, 'epc' => $epc, 'gw_name' => $gwname); }else { $conv = '0'; $avgCPA = '0'; $epc = '0'; } } }else { } $gtotal_conv = sprintf("%.2f", ($gtotal_downloads / $gtotal_clicks) * 100); $gtotal_avg = sprintf("%.2f", $gtotal_profit / $gtotal_downloads); $gtotal_epc = sprintf("%.2f", $gtotal_profit / $gtotal_clicks); @mysql_free_result($rsql); $template->assign('gtotal_clicks', $gtotal_clicks); $template->assign('gtotal_downloads', $gtotal_downloads); $template->assign('gtotal_profit', $gtotal_profit); $template->assign('gtotal_conv', $gtotal_conv); $template->assign('gtotal_avg', $gtotal_avg); $template->assign('gtotal_epc', $gtotal_epc); //End Content gateways stats -----------------------------// $template->assign('gw_data', $gw_data); $template->display('stats.tpl.php'); ?>   Thank you.
  9. I smoked weed a few times with "buckets" - It didn't seem to harm me in anyway...
  10. For? -------
  11. I'm working with the Google Feed Api and made a search form to search for rss feeds.   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>Google AJAX Search API Sample</title> <script src="//www.google.com/jsapi?key=AIzaSyAWetejqPLSq_LiLzg2jeJ98QWGiF8ocgQ" type="text/javascript"></script> <script type="text/javascript"> /* * How to find a feed based on a query. */ google.load("feeds", "1"); function OnLoad() { // Query for president feeds on cnn.com var query = "<?= $searchfor ?>"; google.feeds.findFeeds(query, findDone); } function findDone(result) { // Make sure we didn't get an error. if (!result.error) { // Get content div var content = document.getElementById('content'); var html = ''; // Loop through the results and print out the title of the feed and link to // the url. for (var i = 0; i < result.entries.length; i++) { var entry = result.entries[i]; html += '<p><a href="' + entry.url + '">' + entry.title + '</a></p>'; } content.innerHTML = html; } } google.setOnLoadCallback(OnLoad); </script> </head> <body style="font-family: Arial;border: 0 none;"> <form action="play.php" method="POST" /> Query: <input type="text" name="searchfor" /> <input type="submit" name="search" /> </form> <?php if (isset($_POST['search'])) { $searchfor = $_POST['searchfor']; if (empty($searchfor)) { echo"No text entered."; } else { echo'<div id="content">Loading...</div>'; } } ?> </body> </html>   This is the code I have but when I search for something e.g. bbc news the text "Loading..." appears and it doesn't show any rss feeds. What is wrong???
  12. Ben Nash

    curl help

    I know mysql_real_escape_string is not needed there... It was for another part of the script I took out as it was unnecessary, just forgot to remove it.
  13. Ben Nash

    curl help

    What I mean is how do I make it link back to reed? Also how to display the listings on my site in a tidy fashion? atm it's all jumbled... up
  14. Ben Nash

    curl help

    Thanks Dj but it's just grabbing all the text. How do I output the html as well?
  15. Ben Nash

    curl help

    That fixed the link but It's not displaying the full listing on my site. I have a strong belief this is the issue: $regex = '/<p class="description">(.*?)<\/p>/s';
  16. Ben Nash

    curl help

    I'm trying to grab job listings from job sites like reed.com.   <?php include("config.php"); echo" <form action='index.php' method='POST' /> What: <input type='text' name='what' /> Where: <input type='text' name='where' /> <input type='submit' name='search' value='Search'/> </form>"; if (isset($_POST['search'])) { $what = mysql_real_escape_string($_POST['what']); $where = mysql_real_escape_string($_POST['where']); if (empty($what) && (empty($where))) { echo"You need to enter info"; }else{ $curl = curl_init("http://www.reed.co.uk/jobs/$what-in-$where"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); $page = curl_exec($curl); curl_close($curl); $regex = '/<p class="description">(.*?)<\/p>/s'; if ( preg_match($regex, $page, $list) ) echo $list[0]; } echo"<a href='http://www.reed.co.uk/jobs/$what-in-$where'>Continue</a>"; } ?>   This is my current code. If you enter info into the fields a link will appear for testing purposes, click on it and it will take you to reed. You will see the data entered at my site is all stuffed into the location field on reed. This is causing my site to display incorrect data... What am I doing wrong?
  17. I sent you a private message.
  18. Why can't you pay?
  19. Anyone interested in some 48hour xbox codes? £0.80/each. *They only work on silver accounts
  20. What suggestions do people have to improve it?
  21. Got bored and decided to have a go at making a clean and simple theme. I'm not very good in Photoshop but I gave it a go! [ATTACH=CONFIG]1179[/ATTACH]
  22. <?php session_start(); include("inc/main.php"); if (!isset($_SESSION['user'])) { header('location:index.php'); }else{ include("inc/user_info.php"); $id = abs ((int) $_GET['id']); echo" <h3>Send Points</h3> <form action='send_points.php?id={$_GET['id']}' method='POST' /> Amount: <input type='text' name='points' /> <input type='submit' name='send' value='Send Points!' /> </form> "; if (isset($_POST['send'])) { $amount = abs ((int) $_POST['points']); $query = mysql_query("SELECT * FROM users WHERE username = '{$_SESSION['user']}' "); $d = mysql_fetch_array($query); $exists = mysql_query("SELECT id FROM users WHERE id = '$id' "); if (!mysql_num_rows($exists)) { echo"Invalid User."; } elseif (empty($amount)) { echo"You need to enter something."; } elseif ($amount > $d['points']) { echo"Not enough points."; } elseif ($id == $d['id']) { echo"You can't send points to yourself."; }else{ echo"Points Sent!"; mysql_query("UPDATE users SET points=points+$amount WHERE id = '$id' "); mysql_query("UPDATE users SET points=points-$amount WHERE username = '{$_SESSION['user']}' "); } } } ?>   Working apart from if I change the url to just send_points.php, it stilling saying them errors...
  23. How would I do that Guest?
  24.   <?php session_start(); include("inc/config.php"); if (!isset($_SESSION['user'])) { header('location:index.php'); }else{ include("inc/user_info.php"); $id = $_GET['id']; $query = mysql_query("SELECT * FROM users WHERE username = '{$_SESSION['user']}' "); $d = mysql_fetch_array($query); if(isset($_GET['id'])) { echo" <h3>Send Points</h3> <form action='send_points.php?id={$_GET['id']}' method='POST' /> Amount <input type='text' name='amount' /> <input type='submit' name='send' value='Send Points' /> </form> "; }else{ echo"Invalid User"; } if (isset($_POST['send'])) { $amount = $_POST['amount']; if ($_GET['id'] == $d['id']) { echo"You can't send points to yourself."; } elseif (empty($_POST['amount'])) { echo"You must enter how many points you want to send."; } elseif($_POST['amount'] > $d['cash']) { echo"You dont have that much points."; }else{ mysql_query("UPDATE users SET points=points+$amount WHERE id = '$id' "); mysql_query("UPDATE users SET points=points-$amount WHERE username = '{$_SESSION['user']}' "); echo"SENT"; } } } ?>   New code and it still goes ahead and sends points to users that don't exist
  25. <?php session_start(); include("inc/config.php"); if (!isset($_SESSION['user'])) { header('location:index.php'); }else{ include("inc/user_info.php"); $id = $_GET['id']; $query = mysql_query("SELECT * FROM users WHERE username = '{$_SESSION['user']}' "); $d = mysql_fetch_array($query); echo" <h3>Send Points</h3> <form action='send_points.php?id={$_GET['id']}' method='POST' /> Amount <input type='text' name='amount' /> <input type='submit' name='send' value='Send Points' /> </form> "; if (isset($_POST['send'])) { if (!isset($_GET['id'])) { echo"Invalid User"; }else{ $amount = $_POST['amount']; if ($_GET['id'] == $d['id']) { echo"You can't send points to yourself."; } elseif (empty($_POST['amount'])) { echo"You must enter how many points you want to send."; } elseif($_POST['amount'] > $d['cash']) { echo"You dont have that much points."; }else{ mysql_query("UPDATE users SET points=points+$amount WHERE id = '$id' "); mysql_query("UPDATE users SET points=points-$amount WHERE username = '{$_SESSION['user']}' "); echo"SENT"; } } } } ?>   Everything works apart from the part where I'm checking if the id is valid. It should say a error message if the id doesn't exist if the user changes the id value in the url like this: send_points.php?id=xxx ERRORS I'm getting:   ( ! ) Notice: Undefined index: id in C:\wamp\www\GameWork\send_points.php on line 10 Call Stack # Time Memory Function Location 1 0.0005 254032 {main}( ) ..\send_points.php:0 ( ! ) Notice: Undefined index: id in C:\wamp\www\GameWork\send_points.php on line 16 Call Stack # Time Memory Function Location 1 0.0005 254032 {main}( ) ..\send_points.php:0
×
×
  • Create New...