Jump to content

Code is so dirty...


Monkuar

Recommended Posts

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..

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.