KDM Posted June 29, 2011 Share Posted June 29, 2011 Can you guys help me modify this code? I have a row in my database that is called avatar. This is at the top of my page <?php if (isset($_GET['logout']) && ($_GET['logout'] == '1')) { session_destroy(); $msg = '<span style="color:#ffffff;">you are now logged out.</span>'; } require_once('admin_common.php'); session_start(); /** * This is function _get_top_uploader * * @return mixed Associative array where ['user_id'] and ['freq']. * */ function _get_top_uploader() { global $ezdb; $_start = (int)(time() / 86400) * 86400 - 25200; $_info = $ezdb->get_results( "SELECT user_id, count(*) AS freq " . "FROM image_map " . "WHERE obj_type = 'image' " . "AND date_added >= $_start " . "GROUP BY user_id " . "ORDER BY freq DESC", 'ARRAY_A'); if ($_info != null) { $_info[0]['user'] = $_info[0]['user_id']; $_info2 = $ezdb->get_results( "SELECT username " . "FROM users " . "WHERE user_id = {$_info[0]['user_id']} ", 'ARRAY_A'); if ($_info2 != null) { $_info[0]['user'] = $_info2[0]['username']; } else { $_info[0]['user'] = $_info[0]['user_id']; } return $_info[0]; } else { return null; } } This is where the user with the most uploads is printed out. <div id="mostuploads">'; $_info = _get_top_uploader(); if ($_info != null) { $foot .= "<div style='padding-top:30px;'>Most valuable user today is {$_info['user']} with {$_info['freq']} photo uploads!</div>"; } $foot .= '</div> </div> </div>'.$clear; Quote Link to comment https://forums.phpfreaks.com/topic/240730-i-need-the-avatar-to-show-along-with-the-username/ Share on other sites More sharing options...
KDM Posted June 30, 2011 Author Share Posted June 30, 2011 uhh help. Quote Link to comment https://forums.phpfreaks.com/topic/240730-i-need-the-avatar-to-show-along-with-the-username/#findComment-1236922 Share on other sites More sharing options...
xyph Posted June 30, 2011 Share Posted June 30, 2011 It's not your code. I don't like coding for you. If you have a basic understanding of PHP/HTML, you should be able to follow what this script is doing. Displaying another field from an existing query is trivial, assuming you understand what's going on. I suggest paying someone $20-$40 to do this for you. It's cheap, and ideally it'll be done by a professional who won't open up holes. Quote Link to comment https://forums.phpfreaks.com/topic/240730-i-need-the-avatar-to-show-along-with-the-username/#findComment-1236944 Share on other sites More sharing options...
MadTechie Posted June 30, 2011 Share Posted June 30, 2011 Which means putting it in the freelance section, 12. All request for code to be written for you should be posted under the freelance section. No exceptions. however.. if your willing to learn then maybe this will point you in the right direction change SELECT user_id, count(*) AS freq to SELECT user_id, count(*) AS freq, avatar $_info[0]['user'] = $_info2[0]['username']; $_info[0]['avatar'] = $_info2[0]['avatar']; //Add update with {$_info['freq']} to something like with {$_info['freq']} <img src="{$_info['avatar']}" /> Hope that helps! Quote Link to comment https://forums.phpfreaks.com/topic/240730-i-need-the-avatar-to-show-along-with-the-username/#findComment-1237002 Share on other sites More sharing options...
KDM Posted June 30, 2011 Author Share Posted June 30, 2011 It's not your code. I don't like coding for you. If you have a basic understanding of PHP/HTML, you should be able to follow what this script is doing. Displaying another field from an existing query is trivial, assuming you understand what's going on. I suggest paying someone $20-$40 to do this for you. It's cheap, and ideally it'll be done by a professional who won't open up holes. I already paid someone to do work on this script. I'm trying to learn, not continue to pay people duh. Quote Link to comment https://forums.phpfreaks.com/topic/240730-i-need-the-avatar-to-show-along-with-the-username/#findComment-1237019 Share on other sites More sharing options...
KDM Posted June 30, 2011 Author Share Posted June 30, 2011 Which means putting it in the freelance section, 12. All request for code to be written for you should be posted under the freelance section. No exceptions. however.. if your willing to learn then maybe this will point you in the right direction change SELECT user_id, count(*) AS freq to SELECT user_id, count(*) AS freq, avatar $_info[0]['user'] = $_info2[0]['username']; $_info[0]['avatar'] = $_info2[0]['avatar']; //Add update with {$_info['freq']} to something like with {$_info['freq']} <img src="{$_info['avatar']}" /> Hope that helps! Thanks I'll give that a try. I just need a push in the right direction. Quote Link to comment https://forums.phpfreaks.com/topic/240730-i-need-the-avatar-to-show-along-with-the-username/#findComment-1237021 Share on other sites More sharing options...
xyph Posted June 30, 2011 Share Posted June 30, 2011 I already paid someone to do work on this script. I'm trying to learn, not continue to pay people duh. This is a terrible way to learn, IMO. Start small, work your way up. I'd be more willing to help you if you showed some effort in trying to do it yourself, rather than 'TEACH ME PHP PLEASE' Quote Link to comment https://forums.phpfreaks.com/topic/240730-i-need-the-avatar-to-show-along-with-the-username/#findComment-1237029 Share on other sites More sharing options...
MadTechie Posted June 30, 2011 Share Posted June 30, 2011 While i have to agree, it is fun to look back on the code you did write when it was over your head and think Gezzzzzzz i hope no one ever see this! Quote Link to comment https://forums.phpfreaks.com/topic/240730-i-need-the-avatar-to-show-along-with-the-username/#findComment-1237034 Share on other sites More sharing options...
xyph Posted June 30, 2011 Share Posted June 30, 2011 Or even code you thought you understood - register_globals turns off in 4.2 and I was like WHAT THE HELL ARE YOU GUYS DOING?! 5 minutes of reading and I had much less of an issue rewriting my scripts. Quote Link to comment https://forums.phpfreaks.com/topic/240730-i-need-the-avatar-to-show-along-with-the-username/#findComment-1237036 Share on other sites More sharing options...
KDM Posted June 30, 2011 Author Share Posted June 30, 2011 I'll just go to scriptlance...so much for learning over here. Quote Link to comment https://forums.phpfreaks.com/topic/240730-i-need-the-avatar-to-show-along-with-the-username/#findComment-1237040 Share on other sites More sharing options...
xyph Posted June 30, 2011 Share Posted June 30, 2011 You can almost copy and paste MadTechie's solution directly in to your script - and you're unhappy?! This is why I didn't 'help' you in the first place. I won't miss you. Quote Link to comment https://forums.phpfreaks.com/topic/240730-i-need-the-avatar-to-show-along-with-the-username/#findComment-1237044 Share on other sites More sharing options...
KDM Posted July 1, 2011 Author Share Posted July 1, 2011 You can almost copy and paste MadTechie's solution directly in to your script - and you're unhappy?! This is why I didn't 'help' you in the first place. I won't miss you. it didn't work...obviously. Quote Link to comment https://forums.phpfreaks.com/topic/240730-i-need-the-avatar-to-show-along-with-the-username/#findComment-1237206 Share on other sites More sharing options...
xyph Posted July 3, 2011 Share Posted July 3, 2011 The code he provided is the correct way to implement it in to whoever's script. You being unable to just shows you shouldn't be touching the code. Who knows if a solution someone gives you won't open up security holes? Quote Link to comment https://forums.phpfreaks.com/topic/240730-i-need-the-avatar-to-show-along-with-the-username/#findComment-1237903 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.