Keeping Users Informed In Lengthy PHP Processes
Often PHP processes take a long time, such as wildcard searching a PostgreSQL database, or generating thumbnails.
The PHP host page does not display until the script is complete, so you can not effectively use code such as
echo "Converting file ".$Infile;
exec(convert $Infile $O8utfile);
for realtime feedback to the user.
How have others implemented a "progress meter" in PHP processes , one thought I had was to use Javascript redirection to call a PHP page with differing parameters each time .
View Complete Forum Thread with Replies
Related Forum Messages:
Keeping Your Site Secure From Users
I've got textareas for my users to input descriptions etc into. The problem is that when they enter HTML or PHP code, it comes out like that, which means they could potentially access the database and mess around with the page. How can I keep my pages secure when displaying this text. IE: How can I make it actually say on screen: "Hello, I'm <strong>Grego</strong>" rather than "Hello, I'm Grego"?
View Replies !
Keeping Track Of Logged In Users
The first step, before viewing or posting in the forum is to log in. Now, the trouble i am having is how do i keep track of who the user is logged in as. Like on this forum, you log in and it knows who you are but then next time you come to the site, you have to log in again. I need something like this.
View Replies !
How To Properly Handle Lengthy Operations?
I'm developing a photo album web application for use on a web site, and I'm running into a problem with lengthy operations. My application allows the user to import a number of images at once into a photo album. For each image that gets imported, I create two thumbnail images (small and medium) and insert some data into a database. The thumbnail generation process takes some time and, for relatively large amount of photos, the application apparently times out. For example, if I import 40 pictures at once, 15 or so get imported successfully, but the app then seems to time out. So I then have to import the images that are left (that didn't get imported). Code:
View Replies !
Submitting Lengthy Text Into A Form
like the subject states, Im having trouble submitting lengthy text into a form. Im on a VPS and my post_max_size = 8m and my upload_max_filesize = 2m, which should be able to handle the lengthy text. The text I'm trying to submit is about 5 paragraphs. I have another site on a shared server with the same settings and I have no problems. It's only the VPS giving me a headache.
View Replies !
PHP Processes
I have a cronjob triggering a php script that takes several minutes to accomplish. I need to prevent multiple triggering by the cronjob mulfunctioning. So I would like a clean way to know how many instances of a certain php are currently working on the server. is there a server variable for that? if not, how do I know (via php) how many concurrent accesses are there to a certain php page? for example in mysql (the "SHOW PROCESSLIST" command), but I need a similar function for the php page iself.
View Replies !
Background Processes
I'd like to know how to send an external process to the background, so that I can run multiple instances of the same process at one time. Any tips, links.. etc?
View Replies !
Listing Processes In PHP
Using PHP, is it possible to return and display a list of currently running processes on the client's machine? In fact, is it possible to run a system command on a client's machine?
View Replies !
Automated Processes
Customers post 'projects' to my site. These 'projects' are closed after 10 days. I could run a script on the default.php page that detects this, but it seems a waste of resources to run it everytime someone visits the site. Is there a way around this, for example the first visitor to the site in any, say, 3 hour period, runs the script & switches the most recently outdated projects from open to closed?
View Replies !
Max Number Of Processes
how can i determine what the maximum number of processes i should open with popen (or proc_open) is? i assume it'd depend on the hardware of the computer in question, but if that were teh case, then is there a way to get info. about it, and some general method to determine a good number of processes to open from that info?
View Replies !
Stranded PHP Processes And ProcessExplorer
Does anyone know what it means if I see PHP processes in the process tree at the base level, instead of under the IIS worker process? I do nothing but web serving off of the box. These processes that are not under the IIS worker process seem to be stranded/hung. They are never cleaned up by any garbage collection and I have to kill them manually. They also always have a fairly low memory usage, potentially indicating that they fail before loading completely. Could it be that the execution of the process fails early enough that ProcessExplorer doesn't see them as being executed by IIS?
View Replies !
Handling Long Processes
I am building web app, that will run a long processs (image processing) that can porbably take 15-30 minutes to complete) in respond to a user request (the user clicks a "process" button on a php web form). The ideal situation that I see is once the user's request was recevied, a reply that says "you request is being processed. we will send you email once finished", will be sent to the user, while the other process will take place. When it's finished, a callback function will be called that sends email to the user notifying him the process outcome. What are the options to implement that? multithreading?
View Replies !
Shared Memory Between 2 Processes?
I have two running php processes (they have infinite loops) and I need them to pass some data to eachother. Writing and reading shared memory in one process works just fine but when I try to save var in process1 and read in process2 I get error: "Variable key 555 doesn't exist". What I'm doing wrong? //PROCESS 1 (saving var) $key = 'My Key' $value = 'My Value' $app = 'lovelyapp' $key = $key . 'a' $segment_key = abs(crc32($app . $key)); $segment_size = 1024; $segment_perms = 0600; $shm_id = shm_attach($segment_key, $segment_size, $segment_perms); shm_put_var($shm_id, 555, $value); shm_detach($shm_id); // PROCESS 2 (reading var) $key = 'My Key' $app = 'lovelyapp' $key = $key . 'a' $segment_key = abs(crc32($app . $key)); $segment_size = 1024; $segment_perms = 0600; $shm_id = shm_attach($segment_key, $segment_size, $segment_perms); $value = shm_get_var($shm_id, 555); shm_detach($shm_id);
View Replies !
Insert Processes Before Form Is Submitted
I am trying to stop using Macromedia as my crutch and you guys have been a big help. I need some assistance with submitting a form. I have a form on my page and need to do an insert. I have the action posting it back to the same page I am on versus sending it to an insert page. The problem I am having is it trys to do the insert as soon as I pull up the page instead of waiting till the form is submitted. I believe I need to do something with isset, but can't really find a tutorial that goes over it really well. Code:
View Replies !
Forking Multiple Processes At A Time
i have a php script that needs to execute an external php script (call this script 2) when the user clicks a link, however I don't want the user to have to wait until script 2 finishes executing before he sees the output of script one... i know I can use the exec() command to do this, and use the & to run the command in the background.... but say i want to run 100 instances of script 2 when the user clicks the link (with different arguments)... i dont want to have all 100 processes running at the same time... what I would like to do is run 10 or so at once, and once those 10 are completed, run another 10...
View Replies !
Large Data Transfer Between 2 Processes
fist the context: I have a web server which query a mySql database. but as the number of parralel queries increase, the server slows down too much. I got 2 ideas, one of which is to run N deamons which effectively execute requests. the PHP uses message queuing(1) to queue queries request to the daemons. but the answer may be quite large, larger than messages the message queueing service can handle. I thought to open back a communication link between the current daemon and the waiting PHP to tranfer/process the result, using the message queueing service to send back info regarding the opened link. I thought to open a pipe between the current daemon and the PHP. is this possible? and if so, how? if not, is an IP link to localhost be as fast as a pipe?
View Replies !
Sending Signals To Processes As A Different User Than Owner Using Php
i know, it seems more to be a problem according to unix but i got it while developing software with php: i have 2 different users on a hp-ux machine that execute php scripts. they are both in the same group. these php scripts start background processes, i can communicate with using signals (sending with posix_kill, starting background processes via pcntl_fork). so i got severel background processes owned by my 2 users. the problem is i want to send signals as one of my 2 users to all my php background processes no matter who of my 2 users is the owner. is it possible other than using external tools like sudo? i'm using: PHP 4.3.4 (cgi) (built: Aug 18 2004 15:37:46) Copyright (c) 1997-2003 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies compiled with: ../configure' '--prefix=/usr/local/php-cgi-saprfc' '--enable-calendar' '--enable-filepro' '--with-gd' '--with-jpeg-dir=/usr/local' '--with-zlib-dir=/usr/local' '--without-mysql' '--enable-sysvsem' '--enable-sysvshm' '--with-pgsql=/usr/local/pgsql' '--enable-trans-sid' '--with-cpdflib=/usr/local' '--enable-sockets' '--with-ncurses=/usr/local' '--disable-shared' '--with-tsrm-pthreads' '--with-saprfc=/usr/local/rfcsdk' '--enable-pcntl
View Replies !
Max_execution_time Ignored, Multiple Apache Processes Spawned
I have an app that is going berzerk on its own; without any code or environmental changes of any kind, for some bizarre reason it will randomly just hang, spawn multiple Apache processes and completely ignore max_execution_time, literally running infinitely. Using PHP 5.2.0, Apache 1.3 and Win XP Is this normal "bizarre" behavior that can occur within this setup; if so, what workarounds have you found to combat this, other than the obvious (try to debug and fix code)?
View Replies !
Limiting The Number Of Spawned MySQL Child Processes
Need to know if there is any way to limit the number of spawned MySQL child processes in linux ? I have done my research at http://www.mysql.com and have not been able to find my answer. Have also looked at the source code (what i can understand of it). Using MySQL v.4.0.25-max. Using an older system and the 14 childern are just bogging the system down. I am the only one with access to the server so 14 childern is overkill.
View Replies !
Checkboxes - Loop That Takes The Values And Processes And Writes The Changes To The Database.
I generate a form page from my MySQL database. let's say the table structure is: Table A > ID, title, active the number of rows generated by the query is dynamic. If a field's value is 1, then the form output appears as <input type=checkbox name=$ID checked> $title and if not <input type=checkbox name=$ID> $title At the bottom of the form there is a submit button. The visitor can check/uncheck rows and then submit the form. I need to write a loop (possibly foreach) that takes the values and processes them and writes the changes to the database.
View Replies !
Keeping Spamers Out?
I'm building a web site for myself and some friends using php and MySQL. All I have coded so far are the index.php, the membership registration screen, and the log-in screen. Myself and one other person are the only two registered members because we are the only people in the world who even know the site exists yet. I'm an experienced C++ coder, but a php beginner, and my friend is a SQL expert but has no knowledge of php. But only two days after putting up the registration page I noticed the welcome screen said we had 3 members, instead of the 2 people who are working on the page. When I looked at the users table in MySQL the user name was this huge long string that read like a typical spam email, so obviously a bot saw a form on my page and tried to fill it with spam. What is the usual procedure for validating members to prevent bots from "registering"? Membership number (auto-indexed) is kind of a status thing, so we don't want the primo low numbers to get chewed up by bots before the site even goes live for the rest of the membership. How can I keep them out?
View Replies !
Keeping Total
I have a loop that runs through the reults of a query and it does $tot_feet += $feet(which keeps a running total). For some reason it will not process 110 rows of data so I had to break it down into three seperate queries with three seperate loops. I am wanting to keep a sum of all the loops. Im programming I would just create a global variable and use it but how would I do it in php? Since $tot_feet is withing the loop the value cannot be accessed outside the loop due to scope.
View Replies !
Keeping Value Static
Is there a way that I can keep the value at 0 (value="<? echo $wt_fee;?>">)rather than having to put the zero in every time before the form is commited to the database. <input name="wt_fee" type="text" id="wt_fee" value="<? echo $wt_fee;?>">
View Replies !
Keeping Passwords Secure
I'm hosting on a shared server. I need to know how I can keep my passwords, that are currently in the world readable scripts, secure. The problem isn't through the web, but rather that other users have telnet/ssh access to the machine. So they could cd to the directory and copy it see the plaintext password.
View Replies !
Keeping MySQL Connection
Is there a way to open a mysql connection and have it remain open while a user is at my site? Is it better to just keep a connection throughout their visit or connect only when the database is needed? Right now I have these two lines at the beginning of most pages (about 6 pages): mysql_connect($host, $user, $pwd) mysql_select_db($dbase) I was thinking something involving sessions would work, but I am having trouble with it...
View Replies !
Keeping Texts Outside Php Files
I want to keep all messages etc outside php to create a multilanguage site later. What is the best way to do this? I was thinking of a session variable language, and call the text output with a function that receives the messageid and language id and so returns the text. Is it wise to store all these messages in mysql or inside the function (if messageid=1 etc)? Does it make a difference in speed if the function handles all or if the message content is received by mysql query?
View Replies !
Keeping An Array In Memory
I'm afraid I don't know PHP well enough to figure this out. What I would like is to keep an array in memory so that it doesn't have to be reloaded each time a .php script is run. Is this possible? In Java, I could load the array from a file in the init() method of a servlet and it would stay in memory until the server is shutdown or restarted, etc.
View Replies !
Keeping Spam Bots Out
Is there a PHP-way of entering an email address on a .php webpage (as in "If you need info, email us at URL") with this address as a mailto link yet is NOT readable by spam bots who visit the site? I've searched the forum and found lots of "spam' references, but none of them talked about how to obfuscate a regular mailto link.
View Replies !
Keeping A User Authenticated
I've looked through most threads here about user authentication against a mySQL database, but I still have not figured out how to "keep" the authentication as the user browses through the restricted pages. Sessions and cookies seems to be involved, but I still don't understand how it is implemented and checked when a user goes to a different page after being authenticated. I got as far as authenticating the user against the database, but then...
View Replies !
Keeping The 'check' In 'checkbox'
I have a list of checkboxes that are built on the fly from the db. "SELECT id, name FROM $table_name WHERE name !='$startlocation'"; $boxes.="<input type='checkbox' name='attend[]' value='$id' $isChecked>$choosename<br>"; When the user checks one or many and then submits - I loop through the checkbox array to see which values get returned Like so ... $attend[] is the dynamic array for ($i=0;$i<count($attend);$i++) { $boxres.= "$attend[$i]";} Question is - when the user submits the form (to same page) - the checkboxes reset and selections are lost. Is there a way to "mark" checked to those initial selections after the user submits?
View Replies !
Keeping Session Alive
I've built an app for a client that allows selected users to input a load of product sales data, from which returns some handy stats. What's happening is that users are spending a long time over the form input so when the user hits submit (in one case over an hour later) the session has died, the user logged out and the data is lost. Is it possible to maintain a session for that length of time, either via .htaccess or some other cunning piece of PHP ingenuity? or do i have to go away and write a script which captures the form input when it times them out, so it's back there when the log in.
View Replies !
Keeping Values In Forms
I'm trying to process a form. In my data validation function i try and check for errors in the user submitted fields. In the fields in which are fine i want to be able to keep the values in the form when there are errors and clear the fields that have errors in them. For some reason i cannot get this to work. Here's my code, i've cut it down to the relevant parts. The first file is the index.php file which shows the form but first checks for errors. The second file has all the relevant php functions i call defined. In form.php i just show a small piece of the show form function where i try and present a text field with its default value. Code:
View Replies !
Keeping FTP Connections Open
I'm using PHPs FTP functions to transfer files etc to another server from an interactive environment. So I can put and get files, delete files, rename files etc. and after each action the PHP scripts displays the FTP UI. Currently for each action I do the following steps: Open connection Login Do action (delete, rename, ...) Close connection Is it possible to keep the connection open, doing step 1 and 2 only for the first action and skip them for all consecutive actions and step 4 only when I'm ready with all actions?
View Replies !
Keeping Form Data
o/s = xp php5, myqsl 4.1, apache 2 I have a small form for creating a new user. The page is setup to display the form for 3 possible situations: 1 first visit to page 2 if user name already exists in db 3 if any fields are empty The form action selects "check.php" for authorised session, existing user or empty fields. If all is ok the data is inserted in the db, else it returns to the form page with a variable sent with the URL which if set builds the correct form with a message to show the problem. Code:
View Replies !
Keeping Out Malicious Code
I have a "contact me" form which allows users to send comments. The form uses three fields: name, email, and comments. It's the "comments" field: Occasionally I get some junk coming through that contains URL's, or whatnot, and I'd like to filter those things out. (I can't tell if these junk contacts are human or machine generated). Ideally, I want to recognize the content and kill the process, perhaps redirecting the user. Code:
View Replies !
Keeping Selection Lists
I would like to create 2 single-select drop-down selection boxes on a page box1 - select academic year from 2001, 2002 , 2003 etc box2 - select semester from 1, 2, 3 etc As a result course details for all courses that satisfy these selection values get displayed below the boxes. The boxes remain availabel on the page. The user should be able to re-set these boxes to different values to generate different results. The boxes remain visible on the page. Is this possible ?
View Replies !
Keeping Form Fields Set
How can I ensue that if a user does not fill in a certain form field, that when I redirect the user back to the form, that the fields which he had filled in originally are still filled in? I presume that you might have to send the variable back to the form? For example, $email = $_POST['Email']; if (empty($email)) header( "Location: http://www.example.com/form.htm" ); If any other fields were filled out by the user, that data would be lost by reloading the form.htm.
View Replies !
Keeping Count In MySQL
I'm using checkboxes and trying to figure out how to keep a running total of what people have checked off after they hit the submit button. I posted a little bit of the script (below) that pulls the products from a table and provides a checkbox for each one. Works pretty good. I'm thinking about creating an extra column in my Products table. That extra column would just keep a total of the number of votes each product gets - like a survey or poll. I'm not sure what to do to insert a number or value for the checkbox and then insert that into the new column to keep score. I'm new to this stuff so I hope I'm making sense. while ($row=mysql_fetch_assoc($result)) { echo '<input name="checkboxName" type="checkbox" value="1" />' echo $row["product"];echo "<br>";
View Replies !
Keeping Code In MySQL DB
I would like to enter PHP code in a textarea and keep it in a DB field. When the time comes I would like to be able to call the code from the DB and use it (execute or include it). Is this possible?
View Replies !
Build A Page That Takes Form Data, Processes It In A Second Page
I'm trying to build a page that takes form data, processes it in a second page, then sends the user to a third,depending on data processing. On the second page, I am trying to get the page to have some sort of "Loading" message while the backend processes the data, but I can't seem to get anything to work. Does anyone know how I can get that Loading message to display?
View Replies !
Experimenting With Records Keeping With PhpWiki
How this would work in essence: User would be presented with, say, a "members" page containing an alphabetised list of member name links and an add member link. Each member name link would lead to the member's page and would provide for updating information about that member in the usual way for a wiki. However, the add member link would arrange to create a link for a new member--with initial contents in the linked page set from another file thereby making it possible to provide for collecting the same information about each member. I assume that this is not somehow built into PhpWiki. Does it seem possible (or would subvert some mechanism on which PhpWiki depends)? Does anyone know of an example of a system that works in this general way.
View Replies !
Keeping Script From Printing A New Row For Each Entry
My current script prints out a new row for each song title that matches the album_id and the list_id (or playlist id#). What I want to do is to have each song title printed on one row for each album in a given playlist, followed by a comma and a space (except for the last entry). Example--->http://www.twcfan.com/music/playlist.php3?id=1 In the case of this playlist, I would like the song titles "Weekend In Monaco" and "St. Tropez" to be in ONE row, not TWO. So the output on the line that says "Song(s):" would be like this.... Song(s): Weekend In Monaco, St. Tropez SQL query--->$result2=mysql_query("SELECT * FROM albums, songs WHERE album_id='$id' AND songs.song_id=albums.id order by 'artist' asc") or die("No Albums"); while ($row=mysql_fetch_array($result2)) {$bid = $row['album']; if(empty($bid)) { $bid=""; } else { $artist = $row['artist']; $album = $row['album']; ...etc.... I then have a variable called "$bid" that contains the HTML for each row....which I then print $bid.
View Replies !
Keeping The Variables From Form To New Page
On a web page that I am working on there is a lead generator on the left side that asks for the persons name, phone number and email address. Currently when someone fills in that information and clicks "continue" it will send an e-mail as well as inputs that data into mySQL database. What I want it to do is just that but then take the person to a continued form asking more questions, but without them having to re-fill in their name/phone/email. Basically this "continued form" can be accessed seperately, so it cannot be something where the continued form only works once someone fills out the mini form on the left side of any page on the site. Code:
View Replies !
Keeping Select Option Value Selected
I'm trying to learn how to keep the value "selected" once a form is set to read the values and then f-write them (all within a loop). The part that's giving me a problem is the part which would return the value of the form as "selected". PHP Code:
View Replies !
|