Jump to content

ZachMEdwards

Members
  • Posts

    95
  • Joined

  • Last visited

    Never

Everything posted by ZachMEdwards

  1. The shell_exec line is not executing "flare". I believe there is something wrong with the path
  2. I am using shared hosting at HostGator. I am trying to execute flare (a command line actionscript decompiler) via PHP. According to phpinfo() my System is Linux gator1854.hostgator.com 3.2.13 #4 SMP Thu Mar 29 19:22:42 CDT 2012 x86_64 In my public_html, I have a folder named "zachafer" and inside that folder, I have a folder named "flare". Inside the flare folder, I have the flare command line version, named "flare" and a file named movie.swf. The flare website says that I need to run "./flare somepath/somename.swf" Here is my code: <?PHP error_reporting(-1); $swf = 'movie'; chdir("/home/infamous/public_html/zachafer/flare"); $cmd = "./flare $swf.swf"; shell_exec($cmd); echo "Cmd: $cmd\n"; echo "File: ".file_get_contents("$swf.flr"); ?> Thank you.
  3. Hey guys, I've been running PHP on my computer and running scripts through FireFox via localhost. I want to try PHP CGI. I don't know how to run scripts that I've made (even a simple hello world) and I would like to see a sample script that prompts the user for their "Username" and their "Password" and then checks if both are != "" Thanks, Zach
  4. Here's your Javascript pattern in PHP: '#^https?\:\/\/(www\d?\d?\d?\d?\.)?([A-Za-z0-9-_]+\.)?[A-Za-z0-9-_]+((\.[A-Za-z]{2,6})(\.[A-Za-z]{2})?([0-9-_%&\?\/\.=]*))$#'
  5. file_get_contents echo file_get_contents($_POST['id'].'.txt');
  6. What format do you want your serial number to be in? rand()
  7. Have your checkboxes named to an array, like so: <input type=checkbox name=box[] value='1'> And your PHP code should look like: $box=$_POST['box']; while (list ($key,$val) = @each ($box)) echo "www.link.com/".$val.".php";
  8. My (nerd) friend presented me this puzzle today: There are 4 people on 2 sides of a room, with 1 empty spot in the middle (looks like AAAA_BBBB). Your ending goal is to reverse the starting order. So the solution is BBBB_AAAA. Here are the valid moves: Advance: Person moves into blank tile. (AAAA_BBBB -> AAA_ABBBB) Pass: Person hops around another person of opposite type into blank tile. (AAA_ABBBB -> AAABA_BBB) I've been at this for a good time and I still can't figure it out. I mean I guess I could hard write a solution but that'd be for a fixed amount (4 A's and 4 B's). I was think recursion but I'm not sure... Needing help ASAP in order to get my free lunch tomorrow!
  9. I don't really understand the question, but is this what you are looking for? $pattern = '%/^(.*)$/%m';
  10. Hey guys! I am writing a class file that does this: sends a GET/POST request with headers to a page and returns the HTML stores cookies Uses GZIp decompression I was wondering: what is the difference between fsockopen and curl? Which is faster for completing those tasks? Thanks
  11. Hey guys! I found a flush function and it seems to be working well, but sometimes it will cut off characters. It's very strange. Here's my flush function: function out($str) { echo $str."<br />\n"; vbflush(); } function vbflush() { if (ob_get_length()){ @ob_flush(); @flush(); @ob_end_flush(); } @ob_start(); } And I'm calling it like this: out('Waiting 30 seconds until execution'); And this is my output: Waiting 30 seconds until executio Anyone know why?
  12. Nevermind, it was an entry error in my list.
  13. Perfect! I had all that changed but the second one. Thanks a ton, you guys are genius.
  14. Ok your code is perfect but one little thing. All the entries in the list occur at :53. For example, if the list is like: Saturday 12:20 PM Saturday 12:29 PM , it is really occurring at Saturday 12:20:53 PM and 12:29:53 PM. So using the list in this post: If the current time is Saturday 12:20:50 PM, it should say 12:20:53. If the time is Saturday 12:20:54 PM, it should say 12:29:53. Does that make sense?
  15. Alternatively: $Search = array ( '~^\d{5}$~', '~^[a-zA-Z\d\s]{48}$~' ); or if(preg_match('/(?:\d{5}|[a-zA-Z\d\s]{48})/', $text)) {
  16. Well to match an email address according to RFC 2822 standard, you have to use this pattern: '/(?:[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(??:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(??:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/i' Which is suggested not to use. Here's a simplified version, and probably the best to use: '/[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/i' To answer your questions: To show a dot, use \. It will escape the . (dot) character, so it matches "." The forward slash "/" is used to show the start or end of the regular expression. The parentheses are used as capturing groups. They capture what's inside them, for example: $str = "My name is Susan. My name is Robert."; preg_match_all('/My name is ([^.]+)\./', $str, $matches); print_r($matches); Run that script!
  17. if (preg_match('/_START_OF_WEBPAGE_(.+)_END_OF_WEBPAGE/', $string, $matches)) { $string = $matches[1]; } else { $string = ""; } Yeah?
  18. I'll try it in a few minutes and I'll edit this post.
  19. Yeah so if the list is like this: Saturday 11:50 PM Saturday 11:58 PM Sunday 12:03 AM Sunday 12:15 AM And the current time is Saturday 11:59 PM, it should return Sunday 12:03 AM. That's where the code gets hard for me
  20. Would that still work if the current time is 11:58 PM on Monday and the next time is on 12:02 AM Tues?
  21. Hey guys! I have a list of times in this format: Saturday 12:01 AM Saturday 12:09 AM And so on. I have about 200 times for each day of the week, in that same format. The list is stored in variable $times as an array. How can I have my PHP script find the next time in the list? For example, I have "Monday 1:53 PM". Right now, the time is 1:49 PM ("Monday 1:49 PM"). It needs to output 1:53 PM. I've tried so many things now
  22. or: <?php $str="123-456-789"; echo preg_match_all('/\d/', $str, $out); ?>
  23. The 's' modifier will make the . (dot) match newlines.
×
×
  • 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.