Executing PHP Tasks While Letting A User Continue To Browse?
I was wondering if someone could help me out with the following two
situations.
In a lot of my web apps, it seems that if i launch a PHP script that takes
a long time to complete, the user is unable to browse/use the rest of the
website until the tasks completes. Is there a way to avoid this?
Specifically, app #1 let's a user choose which files to include in a zip
file, then PHP makes the .zip file on the server and streams it to the user
via fopen/fread. So, as the user is downloading a file on the side (it
presents them with the open/save dialog) they are unable to browse the rest
of the PHP-based site until the download completes; clicking on any links
to pages does nothing, the browser just sits there until the file has been
downloaded, THEN the screen advances.
I am experiencing a similar thing with a PHP mail delivery system. I tried
to create a work-around: a pop-up window that sends an 'exec' command to
the a php-script that sends the email to a few hundred recipients. Again,
even though this action is being done in a pop-up window (and via the
command line, no less), the user is paralyzed in the main window until the
action completes.
View Complete Forum Thread with Replies
Related Forum Messages:
Safetly Letting Users Use Tags
I have a field on my profile system that allows a users to put in a paragraph about themselves. I want to allow some very basic styling here (like returns, bold, color etc) is there a way I can add BB tags to this easily or some other method (I"ve never used BB tags before so if someone could point me in the right direction that be great).
View Replies !
Letting People Upload Files To Web Accessible Area
I'm currently making a CMS for my company, and in the CMS, the user has the possibility to upload any file to a documents folder - both for having a document archive and uploading pdf / doc / ppt etc files that people who visits the site the CMS generates can download. Code:
View Replies !
PHP Tasks
some times i get this error on my script: Internal Server Error i researched very much on why this error happens and i get to: i forgot to close some php tasks in my script. now i know only mysql_close() for closing one of php tasks. what are others php tasks that need to closing?
View Replies !
How Can I Automate PHP Tasks?
I am currently running the same task multiple times a day and I'm sure there is a way to automate it. It is a simple one, but with limited PHP knowledge I'm not sure of the best way to do this. Here's what I need to do 1) log-in to a 3rd party site 2) Download the CSV 3) Upload to my db
View Replies !
Cron Tasks
I'm building an auction site which needs scripts automatically launched to scan the closing auctions. I'll use Linux's crontab. I'd prefer to avoid installing Php as a cgi and prefer to keep my apache module config. I'd also prefer to avoid the use of a browser as lynx to do this job because I fear the time-out How I can launch my scripts?
View Replies !
Background Tasks
I'm using some weather rss feeds in a web site. The feeds are updated once every hour and cached in a local file. My problem is that every time the weather report is updating I get a long wait (not that long.. 2 or 3 secs) before the page is displayed. This happens becauses the teplate engine that parses the page is waiting for the weather section to be parsed and cached. Is there a ay I can start the weather parsing as a background thread and return immediatly to the template engine to continue to parse the page? And if so How?
View Replies !
Automated Tasks
I have an auction site running. Now I want the auction to be able to automatically send a mail msg to the seller after it expires. How do I do it? Obviously there is some sort of way that I can employ so that this task does not require an operator (such as me) to run manually. This task will involve accessing the database and sending an email. Can somebody enlighten me on this?
View Replies !
Directory Tasks
Im looking to do some work with directories. Basically, there are some directories which I want my website users to access fully, and see all the files in there. My server allows index of directories automatically, where users can see all the files in the directory (unless there is an index page). Code:
View Replies !
Continue Not Working
I *MUST* be overlooking something obvious. Consider the following code: foreach($_POST as $key=>$value) { print "$key=>$value<br />"; if(! empty($value)) { switch($key) { case "Submit": case "keyList": case "curKey": print "Matched exception<br />"; continue; } print "Didn't bypass.<br />"; ....... Among the form display is: keyList=>$keyList Matched exception Didn't bypass. Obviously, the "switch" statement was properly matched as it shows it matched the test expression. The next statement is a "continue", which should have gone to the next statement in the loop, but it DIDN'T. It's as if the "continue" statement was ignored. What am I missing?
View Replies !
Continue Statement
I read this code: if ($value < $max) { continue; It didnt really make sense to me, can anyone plz help me to understand more about the "Continue" statement?
View Replies !
Continue Prompt
I would like to implement a "press any key to continue" prompt, similar to many command-line programs, so that a script running under Windows (in particular) will stay open until the user dismisses it, allowing for time to read any messages. I have the following code, but it only works if the ENTER key is the key pressed: PHP Code: function anykey($s='Press any key to continue...') { echo "".$s.""; fgetc(STDIN); } Is there a way to get just a single keystroke (in this case, it doesn't even matter what key is pressed), instead of waiting for the enter key?
View Replies !
Using PHP For Nightly Backend Tasks?
I have to develop a script to be run nightly to go through a database and send emails based on conditions. It's a large database, and there are several thousands of emails to be sent during the week everyday. The script will be run with a cron job at midnight or so. I was wondering if PHP is suitable for this, or may it be problematic, for instance would its execution abort after a certain amount of time? Or is it perfectly fine for this task?
View Replies !
How To Schedule Tasks On Website.
I am trying to figure out how to schedule tasks on my website. For example, PAGE1 should perform a different task in the morning than in the afternoon. And at the end of the day, I have to extract some data from the database and put them into a file. This should be done automatically.
View Replies !
Script In Windows Tasks
I would like to know how do i work with php in windows tasks. i developed a php web application and i would like to recieve to my email every day a certain report which will be produced by a php script.
View Replies !
Cron/scheduled Tasks
Im running my site on a web server, and want to add something so that every hour the variable $gold = $gold*($workers*3.1) +($banks*30); and the way to do this is cron jobs from what ive gathered from searching google. BUT not only haven't i found a good tutorial, but I haven't found a single example taht isn't with CGI or a download.
View Replies !
Continue On Mysql Error
I've an insert statement that takes datas from XML files. Sometimes, for some reasons, the XML file get corrupted. If it's the case, the script crashes and it doesn't continue, even if the following items are ok. How to let the script continue, even if there is an "insert" error (or any error). I won't my script to stop. I will be able to log where the problem is then continue the script. I can then come back later to analyse the corrupted file.
View Replies !
Daemonising To Continue Asynchronously
I've got a script which calls (via exec) "php myscript.php --params=here". Within myscript.php I try to become a daemon (to continue asynchronously from the calling script) using pcntl_fork, posix_setsid and pcntl_fork again. It works if I call the myscript.php from the command line (it correctly damonises and returns immediately, carrying on processing in the background), but when I do it through Apache (request the calling script) it waits for the child to complete first. Anything obvious I'm doing wrong? I'll happily post snippets of the script here, but I'd imagine it's something fundamental I'm missing.
View Replies !
Continue Loading Page
I have a form to allow a user to change their password. Pretty standard form with 3 text boxes, old password, new password and retype new password. I have some pretty standard checking, like comparing the old password typed with the actual old password, comparing both the new passwords, etc. Anyhow, if a condition isnt met, i want the script to exit and then to notify the user what happened. If I use the exit() function any HTML that comes afterwards wont load. How can i just exit out of the php script but continue to load everything below it.
View Replies !
Print, Pause, Continue
So, we all know that calling loadVariablesNum in flash pauses action script until the data from the external file is loaded. With PHP, the webpage is not printed until the page PHP script is finished processing. My question is, how can I tell my script to run a little, print a line of text, and finally complete its routine? This would allow my Flash program to get needed data and then use that data while PHP finishes.
View Replies !
PHP/mySQL Running Tasks Automatically?
I have a MySQL DB with all my client details (name, email address etc). I want to use PHP to retrieve records from the DB and email each of these clients (easy enough) BUT I want the system to automatically do this at pre-defined times. I have thought about using the UNIX/Linux CRON utility to perhaps call a PHP script that would retrieve specific records (based on a timestamp perhaps?) and then have it email based upon those records. Does this sound feasible? Are there better ways to do this?
View Replies !
Cron Jobs / Tabs / Tasks And More
I'm building a site with a mySQL db behind it. There are going to be a lot of records in it with products. Now i have recently discovered cron jobs, and i thought it would be a good idea to use those to backup the database. i have a few questions: - If i back up the database, does it put the backup in an actual different db, or just in the same db but other tables? (Silly question maybe, but i'm new to this) - Can the DB still be queried bij site-visitors though it's being backed up? - Is it possible to just backup new/updated records instead of the entire db? - Imagine i backup once a month. can the cron job notice if the DB is dameged/ has errors, so it'll stop backing up so it doesn't overwrite the previous backup... or doesn't backup delete the previous backup?
View Replies !
Code Wont Continue After While Loop
Im using the following code to describe a database table. It works perfectly fine when echo() is used to display field titles, but no code after the loop is running: $result = mysql_query ( "DESCRIBE `test`" ); while ( $r = mysql_fetch_array ( $result ) ) { extract ( $r ); echo "$Field<br>";} echo "bla bla"; <---- this code doesn't run! Ideas?
View Replies !
Continue Calculation After Header(location)
My web server runs on apache/Linux. It collects data from users (using a form), process it, does some calculations using external scripts and programs. The output is displayed using links given from an HTML which is created during the php's run. The Output HTML is created at the very beginning, and includes a "refresh" tag. During the processing and calculation, messages are written to that HTML, so the user is updated with the server's progress. Code:
View Replies !
Make Posts Continue On Another Page?
I'm was wondering how I could make it so that after the first 15 posts it continues on another page for 15 and then another and another? Kind of like the system here. When a certain amount of posts are on a page it creates a page two to continue with the posts..
View Replies !
Close Http Connection But Continue Execution?
I'm trying to work out how to close the connection to the browser at a defined point within my code, but go on to do some time-consuming processing with PHP. Although it *should* be possible to do this by moving the slow stuff into a function registered with register_shutdown_function, it appears that in many cases, the connection is not closed before calling the shutdown function - there are also issues with calling other functions from the registered function. I can't close stdout since I don't have a handle for it. While I can get the desired result by creating a sort of 'proxy' which posts on to the real script without waiting for the latter to finish this will be rather difficult to implement in the operational context.
View Replies !
Sending Mails Without Using Scheduled Tasks (crone Jobs)
Can we set up a mail program that the mail can sent frequently..ie may be daily or weekly or monthly... with out using scheduled tasks or crone jobs. for eg .. can we create a page that works like the scheduled tasks page( there we can set up the time at which time the program will execute )..that means we have options in our webpage to set up the time at which the mail will sent. for eg..every monday.. can we set up this in the program without using scheduled tasks or crone jobs. can we run our page frequently without using crone jobs .
View Replies !
Browse A Web-site
I want to use a PHP script to browse a web-site on which i do exactly the smae things time after time. The website uses cookies to log users on, here is my first problem. I have been informed that if i simply get a script to logon the web-site will send the cookie to the PHP script and not my browser. Then the PHP script will ignore the cokie and the site will not regard em as being logged on. How can i go about saving this cookie? Upon entering the web-site how can i serach the content of the site for a time? The time is always in the same place and i would like to be able to update the page every minute or so to check the time, as some actions have to be done at a certain time.
View Replies !
Disabled Browse
I have created a database with phpMyAdmin, without problem. I can save and retrieve from the database without problem But, when I want to browse the database with phpMYAdmin, the browse button is grayed out and when I move the cursor over it I get a red X displayed. I have use phpMyAdmin on (1) prior database I was designing, and did not have that problem. Anyone know what it is trying to tell me (beyond the obvious) and why ?
View Replies !
Browse Through A Directory
I need to browse through several .tif files in a directory, and open one each time. They are to be handled depending on how it looks (linked to a company and then placed in another directory) After it is done another file shall be opened, and presented on the site.
View Replies !
Event List Browse
We would like to add a new feature which lists all events. That in itself i sno problem. But I want people to specify a few parameter so that they can filter the events. That filtering thing is what I am having trouble with. I am looking to be able to do something like this. http://www.site.net/events.php?show=all
View Replies !
How To Browse A Directory For A File?
I need to add a download function in a VB program, but since a file can be located anywhere in our /download section on the web, I was thinking of putting a PHP script there that would take the filename as parameter, and browse through the /download directory to look for this file, including sub-directories, and return the URL, ie.
View Replies !
Browse For File Path?
Is it possible for a user to click a button (i.e. Browse), point to a local document, or a document on a networked fileshare, and then the application would save the path to that document, but not actually upload the file? I.E.: 1. User clicks "Browse". (i.e. browses the filesystem just as he/she would if say opening a document from Word) 2. User selects the //fileserver/docs/document1.doc 3. When the user clicks ok, the application saves the path to the document. 4. The path is saved to a database with records and subsequent users can view that record and click the link to open the document from the fileserver.
View Replies !
Browse Specific Directory
i am facing problems on the : <input name="file" bgcolor="#FFFF99" type="file" /> to import the xml files, the directory is : ....ftprootPSPKSMStatusUpdateInboundsample.xml and i use if ( $_FILES['file']['tmp_name'] ) { $TransactionMessage = simplexml_load_file($_FILES['file']['tmp_name']); foreach ($TransactionMessage->TransactionHeader as $TransactionHeader) {} } for $_FILES['file']['tmp_name'] : When we click browse, could we specific the dir, means when we browse it is directly go to the dir we want?
View Replies !
Browse->open New Window
I'm trying to figure out a way to make a browse button on a form that when clicked, it would open up a new window to display a list of selection. Once one of the item from the list would be clicked, the selection window would close and the selected item would be pasted to a text box on the page. I have been looking around to find if there is any javascript or php script available that I could use and modify but I can't find any them.
View Replies !
Alphabetically Browse Selection
I have on my site an area where it allows you to search the database alphabetically for the product you want. $query_Recordset1 = sprintf("SELECT * FROM products WHERE description LIKE '%s' ORDER BY description ASC", $colname_Recordset1); I can't get it to return result even though I have 350 products to browse... Code:
View Replies !
Phpinfo() - Cannot Browse .php Files In My Browser
Tried installation with apache 2.0.47. But nothing is working. Copied all the dll's and .ini file to the right locations. Changed the httpd.conf file as well. Here is what I added in httpd.conf LoadModule php4_module "c:/php/sapi/php4apache2.dll" ScriptAlias /php4/ "C:/php" AddType application/x-httpd-php4 .php" Action application/x-httpd-php4 "php4/php.exe" Start up apache is ok. But when I try to to this <?php phpinfo(); ?> in my index.html nothing is showed up. I also cannot browse .php files in my browser
View Replies !
File-Field/Browse-Window Doesn't Appear
I've encountered big problems with one of my file-fields, which was implemented for uploading files. Some of my users don't have any problems at all - the "browse"-window appears. But with some PCs, it doesn't work at all. A js-error appears and the "browse"-window doesn't appear. Has anybody a clue on how to fix that bug?
View Replies !
File Upload :: Get Rid Of Browse Button
Q1. i wonder can we get rid of "browse" button instead of the one textfield and one button beside? <form name="form1" method="post" action="addevent.php3" enctype="multipart/form-data"> <input type="file" name="userfile" size="40" maxlength="100"> <input type="submit" name="submit" value="Add"> </form>
View Replies !
|