Jump to content

Using exec()


dangercrow

Recommended Posts

<?php$program = 'D:\growlnotify.exe /pass:password /a:app /t:'.$_GET['title'].' /n:Message '.$_GET['message']$run = exec($program);if ($run)	echo 'Success!';else 	echo 'Fail.';?>

This is my code, and it is used to run the program "growlnotify", passing the required arguments. However, it keeps on throwing an error to my browser... can anyone explain why? I've tried to keep the code as concise as possible, to prevent too many complications :)ThanksDangercrow

Link to comment
Share on other sites

if ($run) {    echo 'Success!';else    echo 'Fail.';}

Should work.

if you're going to re-write it with braces I think the proper way to write it would be
if ($run) {	echo 'Success!';}else{	echo 'Fail.';}

but a slightly niftier way to write it could be like this:

($run) ? echo 'Success!' : echo 'Fail.';

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...