Jump to content

Michdd

Members
  • Posts

    510
  • Joined

  • Last visited

    Never

Everything posted by Michdd

  1. I've never done something like this specifically, but I have done a lot of other PHP math.. and I can't seem to figure this logic out. I'll have a certain number of items and I'll need to place this in a circle spaced evenly apart, I'll be using PHP GD, and I just need help getting a good concept of how to generate the coords for each item.
  2. /\{AUTHOR\}(.+?)\{/ Should work.
  3. Yea I thought of that as well. Still the same problem.
  4. You mean just running the file before it's compiled? And yea, the input I put is different every time.
  5. I made a mistake, I meant after submitting information, not just pressing any key.
  6. I have a compiled program in PHP and it works something like this: while(true) { $cmd = fread(STDIN, 80); // To stuff with the results, then loop back and wait for another entry } However when nothing is entered for a few minutes then a key is pressed the program just shuts. Does anyone know why?
  7. Okay, I've done some research.. I found something will work like this: #!/usr/bin/php -q <?php /* Define STDIN in case if it is not already defined by PHP for some reason */ if(!defined("STDIN")) { define("STDIN", fopen('php://stdin','r')); } echo "Hello! What is your name (enter below):\n"; $strName = fread(STDIN, 80); // Read up to 80 characters or a newline echo 'Hello ' , $strName , "\n"; ?> However, this is PHP CLI, so it would be running it from the command line. Which isn't exactly what I'm doing. I'm using PriadoBlender to compile it is a .exe. Is it possible to allow user input from the compiled .exe? Edit: Nevermind it was a stupid problem, I solved it. Thanks for all your help. I got one last question, how can I make the program 'pause' when it's done instead of closing right away? I know I can run the program through the command line to get this effect, but it's kinda inconvenient. Edit Edit: Never mind, it's the same as in C++, system("PAUSE"); thanks for all your help.
  8. I'm not sure I understand what you mean :|
  9. Do you know of any websites that explains how to accept user input in a PHP compiled console application? I couldn't seem to find anything myself.
  10. Oh, one other question.. Is it possible to have user input with one of this console applications? I'm pretty sure it's not, just making sure.
  11. You are limited to what extensions and / or libraries exist for the language. But in principle they are much the same. I write quite a few command line PHP programs for work. What about performance and speed differences?
  12. Is it possible to call a function through proc_open as the $cmd parameter? Like.. as the $cmd to execute enter something so that it runs a certain function for me?
  13. No, I don't misunderstand how PHP works I've been using PHP for a very long time, I just read that it's also possible to compile PHP into stand-alone applications. So I was talking about what you said later in your post. I actually found something called PriadoBlender myself which works well, and it does supporting compiling for PHP5 and PHP4.
  14. I've never done anything like this, as I didn't even know it was possible. Is it much more complicated than just compiling it and then running it on a computer with a internet connection?
  15. Safe mode may be enabled then. You can try set_time_limit(0);
  16. Wow, I never knew that was possible. Thanks a lot! It worked perfectly.
  17. I'm using eval() in an image handling class that I'm writing and I seem to be having a problem with it.. When I do this it doesn't create a valid image resource: $this->image = eval("imagecreatefrom" . $this->ext . "('" . $this->file . "');"); Where $this->ext is the mime type (png, gif, jpeg etc..) and $this->file is the filename of the image. However when testing this works: $this->image = imagecreatefromgif($this->file); This doesn't seem to work either: eval("image" . $this->ext . "('" . $this->image . "');"); But in testing this does: imagegif($this->image); I'm not sure why, am I doing something in eval incorrectly?
  18. I've been considering getting a VPS, and I probably will soon. But now it's not necessary. My solution was really simple, actually. Instead of using file_get_contents I changed to a cURL method, which allows to to set the time out of the connection time to 25 seconds, just under when my host would terminate the script. So it all works out fine. Thanks.
  19. Thanks. For anyone else that may also have this question from my tests it shows that it does in fact continue.
  20. Using CURLOPT_TIMEOUT if the limit set is passed will it stop execution and throw and error? Or will it just skip it and continue?
  21. I kind of figured out the problem. My script relies on getting resources from an outside source via file_get_contents(external link), and my host seems to terminate a script when a connection takes more than 30 seconds. Is there any way that I can make it so that if a file_get_contents request takes about that long it'll just skip it? Or retry? So my script isn't completely stopped.
  22. I have a script that can potentially run for many hours, this isn't a problem because it's collecting information and depending on how much I want to collect I can stop it whenever I want. So I used set_time_limit(0) so it isn't stopped. This works fine on my local server, however when uploaded to my hosting it stops at a certain point, without displaying an error. It just stops. Are there any other setting or anything on the web server that could potentially stop this script from executing after X amount of minutes? Because the time that it runs seems pretty random. Sometimes it'll only run for a minute or 2, sometimes over 30 minutes. Any ideas on what could be causing this?
  23. This might be what I'm looking for, but I'm not completely sure. Here's an example: http://www.apple.com/ipodtouch/gallery/ You'll notice the links to change gallery display are like #image2, #image3, etc.. But if you also directly visit http://www.apple.com/ipodtouch/gallery/#image2 it loads that page with the second item.
  24. You see it on many websites where content will switch. I know how to do this easily, accept if I want to load a page with a certain starting content it's pretty complicated and I have to use $_GET variables and such. But on many websites I see it's done through like pagename.php#section, is there a standard way for creating dynamic content? If so can you point me in the direction of an example?
×
×
  • 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.