dangercrow Posted October 1, 2010 Share Posted October 1, 2010 <?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 More sharing options...
niche Posted October 1, 2010 Share Posted October 1, 2010 What error are you getting? Link to comment Share on other sites More sharing options...
dangercrow Posted October 1, 2010 Author Share Posted October 1, 2010 a parse error... i think its on the "if" line Link to comment Share on other sites More sharing options...
niche Posted October 1, 2010 Share Posted October 1, 2010 if ($run) { echo 'Success!';else echo 'Fail.';} Should work. Link to comment Share on other sites More sharing options...
justsomeguy Posted October 1, 2010 Share Posted October 1, 2010 You're missing a semicolon on the first line. Link to comment Share on other sites More sharing options...
thescientist Posted October 2, 2010 Share Posted October 2, 2010 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 beif ($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 More sharing options...
niche Posted October 2, 2010 Share Posted October 2, 2010 I missed the semi colon and the brackets for the else. Please excuse me. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.