Monkuar Posted June 30, 2009 Share Posted June 30, 2009 I just want to get rid of all the functions it uses.. and make it echo a output and i can put variables in the output that's all.. somone help clean this baby up? require_once "sources/shop/core_lib.php"; //-------------------------------------------------------------- // Pull up the logs //-------------------------------------------------------------- $templateform = loadtemplate("logs"); $id = $ibforums->member["id"]; $name = $ibforums->member["name"]; $month = ( isset($_POST[month]) ? $_POST[month] : date(F) ); $year = ( isset($_POST[year]) ? "20" . $_POST[year] : date(Y) ); $DB->query("SELECT * FROM ibf_logs WHERE receiver_id = {$ibforums->member["id"]} && month = '$month' && year = '$year' or sender_id = {$ibforums->member["id"]} && month = '$month' && year = '$year' order by id desc"); if ($DB->get_num_rows()==0) { eval(empty_table); } else { eval(start_table); while ($item = $DB->fetch_row()) { if ($item['sender_id'] == $ibforums->member["id"]){ $grabTwo = ($item[receiver_id] == Store ? "" : mysql_query("SELECT * FROM ibf_members WHERE id = {$item[receiver_id]}")); $getReceiver = ($item[receiver_id] == Store ? "" : mysql_fetch_array($grabTwo)); $nameFrom = "<a href='?showuser={$ibforums->member["id"]}'>" . $ibforums->member["name"] . (isset($ibforums->member["desktop"]) ? "<img src='{$ibforums->member["desktop"]}' </a>" : "</a>"); $nameTo = ($item[receiver_id] == Store ? "Store" : "<a href='?showuser={$getReceiver["id"]}'>" . $getReceiver[name] . (isset($getReceiver[desktop]) ? "<img src='{$getReceiver["desktop"]}'</a>" : "</a>")); } else { $grabThree = mysql_query("SELECT * FROM ibf_members WHERE id = {$item[sender_id]}"); $getSender = mysql_fetch_array($grabThree); $nameFrom = "<a href='?showuser={$getSender["id"]}'>" . $getSender[name] . (isset($getSender[desktop]) ? "<img src='{$getSender["desktop"]}'</a>" : "</a>"); $nameTo = "<a href='?showuser={$ibforums->member["id"]}'>" . $ibforums->member["name"] . (isset($ibforums->member["desktop"]) ? "<img src='{$ibforums->member["desktop"]}'</a>" : "</a>"); } $to = $nameTo; $from = $nameFrom; $amount = $item["amount"]; $time_date = $item["date_time"]; $message = $item["message"]; eval(do_row); } eval(end_table); } $output = $templateform; print_and_exit(); thanks.. like the print_and_exit(); like i dont even want that i just want to beable to echo my stuff out w/o all these weird functions.. Quote Link to comment https://forums.phpfreaks.com/topic/164312-code-is-so-dirty/ Share on other sites More sharing options...
.josh Posted June 30, 2009 Share Posted June 30, 2009 Sure, I'll get right on that. Quote Link to comment https://forums.phpfreaks.com/topic/164312-code-is-so-dirty/#findComment-866767 Share on other sites More sharing options...
Monkuar Posted June 30, 2009 Author Share Posted June 30, 2009 Sure, I'll get right on that. thank u sir Quote Link to comment https://forums.phpfreaks.com/topic/164312-code-is-so-dirty/#findComment-866768 Share on other sites More sharing options...
gizmola Posted June 30, 2009 Share Posted June 30, 2009 Sure, I'll get right on that. thank u sir monkuar my friend, I realize that sarcasm does not always translate, especially when it is being practiced by a master of the art like CV. Let me state this another way: "Don't hold your breath." You have been participating here for 100+ posts, so I would think you would have picked up on what constitutes a good question vs a bad one, and yours is not very good. In essence you dropped a block of code in here and asked people to "Make it better." Anything is possible, but I won't be taking my time, nor apparently is CV. One piece of advise I can provide you, is to find a way to do whatever that code is doing, without resorting to the use of eval(). It's quite simply one of the most dangerous functions, from a security standpoint, that php offers. Not unlike the use of recursion, there is almost always a way to do without it. Quote Link to comment https://forums.phpfreaks.com/topic/164312-code-is-so-dirty/#findComment-866779 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.