Jump to content

climbjm

Members
  • Posts

    32
  • Joined

  • Last visited

    Never

About climbjm

  • Birthday 06/28/1982

Contact Methods

  • Website URL
    http://www.youtah.com

Profile Information

  • Gender
    Not Telling
  • Location
    Salt Lake City, UTAH

climbjm's Achievements

Member

Member (2/5)

0

Reputation

  1. thorpe, wow! I didnt see this when I was looking. Totally looking in the wrong spot! Thanks!
  2. What I am trying to do is use the PHP SSH2 functions to tunnel into a linux box and login. However SSH2 fails because the system I am logging into asks for two usernames and two passwords so I need to catch both using a regex. Currently I have a PHP script executing a perl script trying to use expect to do this, but I'd prefer to do this all in PHP. :'( Any thoughts or ideas? Thanks!
  3. Is there a way to make this even smaller or run even faster? I have another page that send a text fields input to this page. The name/id of that text field is "Question". <?php if(eregi("bb",$_POST["Question"])) echo("2B"); else echo("!2B"); ?> I'd like to make it as small as possible. I will be turning it into a bumper sticker eventually. Aiming for <4 lines. (feel free to make your own bumper stickers too)
  4. Ok, looking over the code example... that is just to kill a process right? I want it to completely shut down the server.
  5. I'll try that Dark Freaks and will let you know if it works! Thanks!
  6. Another Info: Functions I have tried: shell_exec() exec() system() Commands I have tried: halt shutdown reboot sudo halt sudo shutdown sudo reboot
  7. The Story/Setup: I have an Ubuntu FF Server up and running. However it is very noisy and it sits in my bedroom with the printer and all my other networking stuff. However, if I am not at home... I would like a way for my wife to be able to shut the box off without having to SSH into the box, but instead click a simple link to turn it off. However, nothing has worked so far. Anyone have any ideas? What I have so far: $v = ""; if($_GET['command']=='shutdown') { echo("<h1>SHUTTING DOWN SERVER</h1>"); $loadpage=false; // for something else, ignore this $v .= shell_exec('sync'); $v .= shell_exec('sync'); $v .= shell_exec('shutdown'); echo("".$v.""); } // much later down the road <li><a href="index.php?command=shutdown">Shutdown the Server</a> When I run this... it displays the "<h1>SHUTTING DOWN SERVER</h1>" but does not shut down the server.
  8. Check out this and compare. He also explains a lot of things in his tutorial as well as keeping it simple. http://www.tizag.com/phpT/fileupload.php Also make sure that your file "upload.php" and the folder you are uploading too have the correct permissions or you will start to get all sorts of warnings or fatal errors. for more info on that google "php chmod" and google "linux chmod".
  9. Agreed with thorpe... However if you wanted like a little 'splash' page that says something like, you will be redirected in five seconds... I would recommend using JavaScript. However, if they have JavaScript disabled or a JavaScript non-supported browser... they wont be redirected. this is why you usually provide a link stating "if you have not been re-directed in 5 seconds, please click here". It is usually easier to use a client side script to re-direct with a 5 second splash page opposed to having a server side redirect you. If you want this to be instantaneous... use the method above. For a JavaScript redirect tutorial, check here: http://www.tizag.com/javascriptT/javascriptredirect.php
  10. When I lower the permissions on the folder that I am writing too, I get errors just like you are showing. Do you have access to your servers shell? I really think you have a permissions not set correctly on your pending folder. If you have access to a shell, type... sudo chmod 0777 /FULLPATH/pending/ example... my upload folder for my website is located here: /var/www/upload/ so I would chmod my folder like this... sudo chmod 0777 /var/www/upload Once you get your permissions fixed and ruled out, then you can tighten your permissions to increase security. * sudo means you are basically running as a super user. * the chmod part tells the computer you want to change the permissions of the file in regards to read, write and execute. * the 0777 basically makes it so that everyone can read/write/execute (full permissions). * Last but not least you give the file or the folder you want to apply the permissions to. IF YOU DO NOT HAVE SHELL ACCESS TO YOUR SERVER... You can actually write a PHP script to do this for you. It goes something like this... Example from http://us3.php.net/chmod LAST BUT NOT LEAST... I promise I am almost done... Here is another great tutorial about creating scripts to upload files. http://www.tizag.com/phpT/fileupload.php As said in the tutorial, when a file is uploaded to your server... it is there only temporarily until the script finishes executing. Once the script finishes (which can be just milliseconds to execute) it destroys those temporary files. This is why when you looked in the folder, you did not see the file. This is actually why you are 'copying' the temp file, into a different folder. That way when the script finishes and deletes the temp file, you still have a copy else where .
  11. Thanks thorpe... great information! Man, I am falling in love with the linux/php/apache combination everyday. I found this article (site is down but I found a cached version of the site) http://72.14.253.104/search?q=cache:VLCvyCQMfXYJ:www.freeos.com/articles/2879/+/proc&hl=en&ct=clnk&cd=1&gl=us
  12. Check to make sure that your File that is executing the script has the proper permissions and the folder that you are writing the file to has the correct permissions. When I don't have the permissions set correctly or assigned to the wrong group, I often get that error message (or something almost identical to it).
  13. Here is an example of what I did to show just some of my machines information using PHP. status.php <html> <head> <title>System Status</title> </head> <body> <h1>Machine Information & System Status</h1> <? include("memory.php"); include("machine.php"); ?> </body> </html> memory.php <h2>Memory - KB</h2> <pre> <? echo shell_exec('free -o'); ?> </pre> machine.php <h2>Machine Details</h2> <pre> Hardware Type: <? echo shell_exec('uname -m'); ?> Node Name: <? echo shell_exec('uname -n'); ?> Processor: <? echo shell_exec('uname -p'); ?> Release: <? echo shell_exec('uname -r'); ?> OS System Name: <? echo shell_exec('uname -s'); ?> OS Version: <? echo shell_exec('uname -v'); ?> </pre> Works Great on my Ubuntu PHP/Apache Server. Note: This is for linux and doubt it will work on Windows.
×
×
  • 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.