Jump to content


Photo

sys_tem()


  • Please log in to reply
4 replies to this topic

#1 Beerbar

Beerbar
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 19 June 2006 - 03:58 PM

I am trying use php to search my mail info log for email addresses to try and stay away from having to create user accounts on the system.

My problem is that I want to have the results show up on new lines, without <PRE> I can not seem to figure out how to do that, everything just splatters on the screen. The problem with <PRE> is that the output is all on one line but its a mile long. How can I get it to wrap nicely?

       

if (validate_email($_POST['email']))
        {
         echo "Checking <b>/var/log/mail/info!</b><br><br/>";
        echo "<PRE>";
        $outcome = sys_tem("sudo /usr/bin/tac /var/log/mail/info |grep -i ".$_POST['email']."", $results);
        foreach ($results as $result) echo $result;
        echo "</PRE>";
        }


#2 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 19 June 2006 - 04:14 PM

By what I have been told, and what I learnt you should never have a need for the system() function and if you ever use it for user input as well it's a security risk.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#3 Beerbar

Beerbar
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 19 June 2006 - 05:31 PM

I understand.

If anyone has any suggestions on the best way to search syslog from a web interface, I'm all ears. The file I need to search grows very large.

#4 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 19 June 2006 - 05:52 PM

Yes you can use this.
[a href=\"http://www.debianhelp.co.uk/syslog-ng.htm\" target=\"_blank\"]http://www.debianhelp.co.uk/syslog-ng.htm[/a]

If not go to
www.google.com
and type in the same thing you said

"search syslog from a web interface"

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#5 Beerbar

Beerbar
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 19 June 2006 - 06:07 PM

Sweet, thanks for the idea.

I will look at syslog-ng and the frontend php-syslog-ng.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users