Re: [PHP] passing an object using session var
Try that: --script1--- ?php include(TestClass.php); session_start(); $obj = new TestClass(); $obj-setName('MyName'); $obj-display();// outputs 'MyName' $str_object = serialize($obj); //-- You need to serialize an object ( see php.net manual ) in order to make an object working via session $_SESSION['obj'] = $str_object: //-- save serialized string in the session,note: Use $_SESSION instead of session_register(); header(Location: http://localhost/~lr/webProj/photoAlbum2/sessionReceiveObj.php;); // re-direct to script2 ---script 2 ?php include(TestClass.php); session_start(); $newObj = unserialize($_SESSION['obj']); //-- convert string back into object $newObj-display(); // MyName on Wednesday 29 November 2006 16:18, list arama wrote: Why am I not able to access the obj name field in script 2? thanks in advance, --script1--- ?php include(TestClass.php); session_start(); session_register('obj'); ob_start(); $obj = new TestClass(); $obj-setName('MyName'); $obj-display();// outputs 'MyName' header(Location: http://localhost/~lr/webProj/photoAlbum2/sessionReceiveObj.php;); // re-direct to script2 ob_flush(); ? ---script 2 ?php include(TestClass.php); session_start(); $newObj = $HTTP_SESSION_VARS['obj']; $newObj-display(); // no output, meaning no data? $newObj-setName('Michael'); $newObj-display(); // outputs 'Michael' using obj methods ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Read Through PHP Files
You cannnot just open those files. That things that you see are not 'rubish' or whatever. Those files are in a binary format. You need to understand the .doc format and the .pdf format. You can get this infromation by using google and search for 'Binary word format' and so on. Then you have to parse the file with the HEX codes etc and so on. This is pretty complex and I'm sure you dont wanna do that :D. Maybe there is allready a libary also in PHP that does it for you. But in generaly, you have to think in a different way. If you dont unserstand what binary formats are and how to parse them, its pretty hard and its better if you dont try it :) on Friday 10 November 2006 11:55, Kevin wrote: Hi, I am using the function fopen to open a word document, loading the contents into a variable and then using a substr_count to count the number of times a certain string is found, this is allowing me to search through the file and say how many times the word appears, I can even use str_replace to highlight certain words. However Microsoft word seems to put a lot of rubbish in the header and footer, I am wondering is it possible to filter this rubbish out to get the exact document. I also tried using fopen to open a PDF file, but as PDF is handled differently it came up completely different with no words at all, just full of rubbish. Is there anyway I can get this information using a simple fopen? I am basically trying to create a search engine which can read within files similar to google. The only problem I would have after I have done all this is actually weighting the search results, however I would probably have to create the results first and then finally go through the results to try to weight them. Does anyone else have any experience in this or could help me out with any of the problems I am having? Thanks Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Frameworks
I personal prefer Frameworks. I tried some of them. But in my opinion, those are not made to create application fater, no. With Frameworks, you can maintaine your application better. You have a global place where everything can be changed on one file. Ofc, its also possible that this improves the Application development, which is ofc good, but the main thing is you can maintain it easy. A good example is your comment regarding loading lot of staff into memory.. In my company we also have a bigger framework, with a lot of includes and so on. But it is still damn, fast. If you include now 100 or 1000 files, you allmost dont see it as PHP proccesses them very fast. And if you have to change for example now a filename that is required by other fiels, that a Framework is your friend as you dont have to go to each file and change the filename, no, you only have to change it on one place, result in: easy maintaining. Ofc, this is only one example, but there exists other things too where a framework can improve your work and save you time in changing things . on Thursday 02 November 2006 16:37, [EMAIL PROTECTED] wrote: I know this subject has been covered in the past, but my question is why use them? I'm hoping to not create a religious war... I see that frameworks would probably help you develop some things faster, but most of the time they don't do the things the way I would want them to work. If I did use one, it almost seems like I would use it to get through something until I had time to do things the way I wanted/needed to do them. There's a lot of talk about frameworks lately, and especially the Zend Framework, so I'd like to look into what it's all about. I think I might be missing out the framework issue, so I'd like to hear other people's opinions. I do like the mail, pdf, and a few other parts of the Zend Framework. I also like that it's more like a set of tools than a monolithic beast that would take a lot of memory just to load up into your application. Your thoughts? Thanks, Ray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Comment management
Maybe you mean a bug tracker? checkout http://flyspray.rocks.cc/ on Monday 23 October 2006 17:12, tedd wrote: Hi: I posted this on the web-design list, but didn't receive any leads. I want to continue what I've been doing, which is to offer various code solutions for people via my web site, but I would like to add a feature where people can comment on the code. Such as if they found it useful, or found an error, or general comment -- you know, you've seen this before. Also, I want the code to be secure and allow me to edit users comments. Does anyone have any recommendations or can point me to a simple content manager for such a purpose? I know I could write it myself, but I would rather not reinvent the wheel, if possible. Thanks. tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] add functions to a class
This will not work. $this-bla(); This is a PHP Syntax and tries to get the Class method, PHP dont look for a variable name at all! It seams me strange also, that you try this, you should create the method for the class itself, or extend it. But this shoul work: class Test { function Test () { $funcName = 'writeFoo'; $$funcName = create_function ('', 'echo (foo.\n);'); $writeFoo (); $writeFoo2 = $writeFoo; $writeFoo2 (); $this-writeFoo = $writeFoo; return call_user_func($this-writeFoo, 'arg1, arg2'); } } on Wednesday 20 September 2006 15:07, Kelsang Tsenle wrote: Hi all, I tried to add functions to a class, but it doesn't seem to work. Here's an example: ? class Test { function Test () { $funcName = 'writeFoo'; $$funcName = create_function ('', 'echo (foo.\n);'); $writeFoo (); $writeFoo2 = $writeFoo; $writeFoo2 (); $this-writeFoo = $writeFoo; $this-writeFoo (); } } $test = new Test (); ? This outputs: foo. foo. PHP Fatal error: Call to undefined method Test::writeFoo() in /test.php on line 11 Both $writeFoo () and $writeFoo2 () are executed, so it principally works, but once used in the object, it doesn't work anymore. Any idea how that is supposed to work? Gratefully, Tsenle -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Extension in free pascal - OT
Pascal?? this is a PHP list, you are on the wrong place! on Thursday 21 September 2006 11:12, Bronislav Klucka wrote: Hi, does anybody know how to write extension in FreePascal? Brona -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Extension in free pascal - OT
PHP is written in C. If you want to write a extension, you have to writte it in C. I dont think its possible, except you tranbslate the PHP C code to Pascal and start from scratch there :) So- no, not possible on Thursday 21 September 2006 11:22, Bronislav Klucka wrote: Of course I want to write extension for PHP :) but I want to write it in FPC... Brona Thomas Munz wrote: Pascal?? this is a PHP list, you are on the wrong place! on Thursday 21 September 2006 11:12, Bronislav Klucka wrote: Hi, does anybody know how to write extension in FreePascal? Brona -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Extension in free pascal - OT
Well, depends. If you wanna create build-in extensions ( as far as i know those works a bit faster ), you have to use C. In case you wanna make a dynamic extension it can work 'Theoretically'. But you need to load the PHP shared headers also so the compiler understand the DLLs as far as i know, and you dont have them in Pascal. It is also a really BAD idea to writte it in a different language then it is orginaly written in my opinion. on Thursday 21 September 2006 11:32, Bronislav Klucka wrote: Extensions are basically dll/so files. There is generally no problem to take dll file written in C and use it in program written in FPS and vice versa (it's all about rewriting function's headers). So my question is, if this is possible generally, can it be done for PHP? Thomas Munz wrote: PHP is written in C. If you want to write a extension, you have to writte it in C. I dont think its possible, except you tranbslate the PHP C code to Pascal and start from scratch there :) So- no, not possible on Thursday 21 September 2006 11:22, Bronislav Klucka wrote: Of course I want to write extension for PHP :) but I want to write it in FPC... Brona Thomas Munz wrote: Pascal?? this is a PHP list, you are on the wrong place! on Thursday 21 September 2006 11:12, Bronislav Klucka wrote: Hi, does anybody know how to write extension in FreePascal? Brona -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Class question
Use 'extends' syntax for sub classes class A { var $some_var; var $class_B; function A(){ $this-class_B = new B(); $this-some_var=2; } } class B extends A { var $class_C; function B(){ $this-A(); $this-class_C = new C(); // $this-some_var= some_var_from_class_A; -- $this-some_var contains the value allready } } class C extends A { function C(){ $this-A(); // $this-some_var= some_var_from_class_A; -- $this-some_var contains the value allready } } on Friday 15 September 2006 11:01, Roger Helgesen wrote: I have 3 classes, CLASS A,B and C class A { var $some_var; var $class_B; function A(){ $this-class_B = new B(); $this-some_var=2; } } class B { var $some_var; var $class_C; function B(){ $this-class_C = new C(); $this-some_var= some_var_from_class_A; } } class C { var $some_var; function C(){ $this-some_var= some_var_from_class_A; } } How can class B and C get the value of $some_var_class_A without using $this-class_B = new B($some_var); roger helgesen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php-general mailing list active?
maybe you should resubscribe :) on Tuesday 22 August 2006 16:31, [EMAIL PROTECTED] wrote: Would someone kindly let me know if there is activity on [EMAIL PROTECTED] I have not gotten posts for a few days now, and I'm having no luck connecting to the help, owner or admin addresses. Thanks, David [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] AES client side
What do you need exaclty? Do you wanna encrypt the datas, that will be transfered to the client Or do you wanna encrypt the source code, that will be displayed on the client? For reason 1 you can use SSL connection to encrypt the transfered datas. For reason 2: forget it. The Browser needs to know the source code, so he can display it :) Except you use JS to tell the browser the correct HTML code :) But as you said JS is slow, so not possible as far as i know :) on Monday 31 July 2006 13:59, Andrew Senyshyn wrote: Hi all, I need to implement AES decryption algorythm on client side (in browser). I tried javascript but it is too slow. Does anybody have others ideas how to decrypt data transfered by from server to client in browser? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Stop process when user close window browser
By default, PHP will also stop execution when the browser is closed. See: http://de.php.net/manual/en/features.connection-handling.php on Friday 30 June 2006 09:06, weetat wrote: Hi all, I am using PHP 4.3.2 and MYSQL database. I think this question has been asked many times, however not solutions. The problem is that I have a php script which connect to db and update data to db which took length of time to be completed. However sometimes user accidentally close the window browser or kill the window browser. The php which a server script language will not know that the window browser has been closed , so the program execution is keep running . This will choke the memory in the server and thus choke the web page. So ,are there ways to stop program from executing when user close the browser window. Thanks - weetat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] bug in php 5.1.4
There must be a special code in your script that causes it like this bug: http://bugs.php.net/bug.php?id=37926 on Friday 30 June 2006 11:39, Alain Roger wrote: Hi, I' ve discovered a bug in PHP 5.1.4. This version of PHP create a new session everytime you refresh the same php page or that you switch from 1 page to another page. I downgraded it to PHP 5.1.2 and it works correctly. It could be interesting to fix this bug. if you want moredetail, contact me. Alain -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Stop process when user close window browser
What kind of connection you use ( persistent ?) and which PHP and MySQL version? Normaly, PHP exit after the browser gets closed, but sended SQL to MySQL get finished executed. on Friday 30 June 2006 11:54, weetat wrote: Hi Thomas, Yes. I read the manual regarding the connection handling. However ,in my php program , the execution did not stop , because i have logger which log sql statement INSERT statement when inserted data to database is ok . When i close the browser , the sql execution still running, statement is logged. Any idea how to stop it ? Because it cause my web page to be slow. Thanks. Thomas Munz wrote: By default, PHP will also stop execution when the browser is closed. See: http://de.php.net/manual/en/features.connection-handling.php on Friday 30 June 2006 09:06, weetat wrote: Hi all, I am using PHP 4.3.2 and MYSQL database. I think this question has been asked many times, however not solutions. The problem is that I have a php script which connect to db and update data to db which took length of time to be completed. However sometimes user accidentally close the window browser or kill the window browser. The php which a server script language will not know that the window browser has been closed , so the program execution is keep running . This will choke the memory in the server and thus choke the web page. So ,are there ways to stop program from executing when user close the browser window. Thanks - weetat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Control GET data ( not php related )
Thats not PHP related. Its normal HTML/JS 2 Ways: 1) Make form to use 1 field:; form method=GET action=file.php input name=name type=text / /form 2) Use JS to manipulate the target url dynamicaly on Wednesday 07 June 2006 21:20, Steffen Mazanek wrote: Hello, I want to provide two input text fields lastname and firstname and if the user pushes the submit button the generated url should be ...?name=firstname_lastname. Is this possible and how? Thank you for helping a php newbie. Steffen Mazanek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Ajax (xmlHttpRequest) and session_start() problem.
session_write_close(); Ex: session_start(); $asdf = $_SESSION; //-- get all datas session_write_close(); //-- close session on Wednesday 17 May 2006 16:36, Mathijs wrote: Robert Cummings wrote: On Wed, 2006-05-17 at 10:11, Mathijs wrote: I Have an very strange problem. When i execute an very simple Ajax request to an PHP script wich just print one line and i put an sleep(20) infront of it, it works perfectly when i refresh the page. BUT.. When i put session_start() at the top, i can't refresh the page anymore. It won't refresh untill the server responed. When i remove the session_start(), i can refresh anytime i want. Is this a know problem? Does someone knows an solution? PHP sessions use locking to avoid race conditions. So you sleep for 20 seconds keeps the lock for just as long, this has the effect of blocking all other scripts for the same session. To avoid this, grab the session data you need, and close the session as fast as possible. Additionally, it's probably a very bad idea to keep the web server waiting for 20 seconds for no good reason. Why not have your javascript do the waiting? Cheers, Rob. This whas just an test example i talked about. irl, i have an script that does an search on the server for texts in files. This search goes through an ajax request. The page that is requested uses $_SESSION. Therefore i need session_start(). This search can take a while, and if i want to refresh the page, because i want to have an other search or whatever, i just can't. This because, for some reason, when session_start() gets called, it locks the refreshing capeabileties of the browser. Also, you say to close the session, mabye a stupid question, but how If you need more info, just ask :).. Thx for the quick reply :). Kind Regards, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions - session_start()
put ob_start(); on the first line of your page on Monday 15 May 2006 15:53, Jonas Rosling wrote: Hi, I've been building a site with PHP 5 on my develop machine. I've been woring alot with session handling. For example I've been using session_start() now and then depending on where the user/vistor are or are doing. But now I've moved the site to a host server with PHP 4.3.8 and now I keep getting error messages all the time where I use session_start(). The error message looks like this: Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /var/www/html/index.php:9) in /var/www/html/index.php on line 82 But I found out that if I put the tag in the absolute top of every page it seems to work. But then I need to do alot of changes on all the pages. Does anyone know if there's any workaround for this? Thanks in advance // Jonas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Book/Site for internernal PHP5 Core Developing
hi list! Does someone know a good Book/website for Develop own C-Extensions for PHP5? http://us2.php.net/manual/en/zend.php This site are just basic things, but i wanna do more things. Someone may help me? thx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP with Oracle
Only the main US Server. Try: http://us2.php.net/ on Wednesday 19 April 2006 15:13, Brad Bonkoski wrote: Assuming the PHP web page is available, anyone else having problems connecting to php.net? -B Jay Blanchard wrote: [snip] is there a ready script that handle entering user name and password for authentication by extracting the Data from Oracle10g DB without showing the URL in the address bar...I am thinking of using a popup window Spec. [/snip] Please RTFM at http://www.php.net/oracle and have a look at oci_connect -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OT - PHP Webhost Dedicated Server
www.ixwebhosting.com www.hostexcellence.com on Tuesday 11 April 2006 15:18, Suhas wrote: Hello, Any suggestions for Dedicated PHP Webhost. The current service provider is ok but Customer service is unsatisfactory. Very bad experience. Thanks for your help in advance, SP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] open / check SSL activation
if request come from port 443, SSL = Active you can get the port from $_SERVER[SERVER_PORT] on Wednesday 05 April 2006 15:12, Alain Roger wrote: Hi, I would like to ebsure that my user has SSL activated. for that i would like to do something like that : 1. after lo-in button click, application will check if SSL is already activated. 1.a if no, php code should activate SSL 1.b if yes, php code should control login and password entered. 2. how from PHP code, can i test if SSL is activated and if need activate SSL ? thanks a lot, Alain -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirect using php
Function that will work also, when JS is not activate and headers are allready send :) : ?php function chrome_redirect($url) { // redirect the page if (headers_sent()) { // perform JS redirect echo 'script type=text/javascript language=javascript !-- document.location.href=\'' . $url . '\'; // -- /script noscript meta http-equiv=refresh content=0; url='$url' / /noscript'; } else { // no headers sent... much nicer header redirect header('location: ' . $url); die(); } } ? on Wednesday 05 April 2006 15:30, Dan Parry wrote: If it helps here's the code I use to redirect ?php function chrome_redirect($url) { // redirect the page if (headers_sent()) { // perform JS redirect echo 'script type=text/javascript language=javascript!-- document.location.href=\'' . $url . '\'; // --/script'; } else { // no headers sent... much nicer header redirect header('location: ' . $url); die(); } } ? HTH Dan - Dan Parry Senior Developer Virtua Webtech Ltd http://www.virtuawebtech.co.uk -Original Message- From: Mark Kelly [mailto:[EMAIL PROTECTED] Sent: 05 April 2006 14:19 To: php-general@lists.php.net Subject: Re: [PHP] redirect using php On Wednesday 05 April 2006 13:55, Chris Shiflett wrote: Mark Kelly wrote: You can also use something like: echo meta http-equiv=\Refresh\ content=\0;url=$from_page\; There's no need to use a meta tag to mimic HTTP headers. PHP provides the header() function. I have been using that method when I got part-way through some processing that produces output, and hit something that requires a redirect. As I understand it headers are no use to me here. I'm very much a beginner, so if this is the wrong way to do this, I'd appreciate pointers. Thanks for the reply, either way. Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ NOD32 1.1454 (20060321) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] require_once hell
Forgot the ?php tag in the second class? on Wednesday 29 March 2006 12:48, Adrian Bruce wrote: Hi this may be a stupid moment but i cant find an help on google so.i am including two classes in my code using the require_once(path to file) method. this works fine for the first class but when including the second it simply outputs the contents on to the page. I feel I must be missing something stupid so i have not included any example code, any general ideas? Thanks in advance Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date addition problem
Cause 9th month have 30 days but 10th month have 31 days. You don't check the amount of day there... :) on Wednesday 29 March 2006 14:51, Adrian Bruce wrote: Hi I am having an unusual problem when trying to calculate dates in advance from a start date. the code below shows a loop where by on each run an increasing number of weeks is added to the start date, this works as expected up untill the 8th time where for some reason it produces 01-11-05 instead of 02-11-05. I am at a loss as to why this would happen when it works perfectly for all the other dates. where am i going wrong? [snip] ?php echoh1 date test/h1; $start = 05-09-07; $start = explode('-',$start); $startmk = mktime(0,0,0,$start[1],$start[2],$start[0]); $startdate = date('d-m-y',$startmk); for($i=0;$i10;$i++){ $nextdate = date('d-m-y',$startmk + ($i*604800)); echoh1$i: $startdate -- -- --$nextdate/h1; } ? OUTPUT: 0: 07-09-05 -- -- --07-09-05 1: 07-09-05 -- -- --14-09-05 2: 07-09-05 -- -- --21-09-05 3: 07-09-05 -- -- --28-09-05 4: 07-09-05 -- -- --05-10-05 5: 07-09-05 -- -- --12-10-05 6: 07-09-05 -- -- --19-10-05 7: 07-09-05 -- -- --26-10-05 8: 07-09-05 -- -- --01-11-05 9: 07-09-05 -- -- --08-11-05 [/snip] Thanks a lot Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] object oriented syntax in php
echo $ping_result[_raw_data][5]; Hi there, I do have problems with object oriented syntax as this is not familar to me. There is following output: object(net_ping_result)(11) { [_icmp_sequence]= array(1) { [61.117):]= string(1) 7 } [_target_ip]= string(9) y2.php.ne [_bytes_per_request]= string(2) 64 [_bytes_total]= int(192) [_ttl]= string(6) _seq=2 [_raw_data]= array(7) { [0]= string(72) PING php.net (66.163.161.117) from 192.168.1.114 : 56(84) bytes of data. [1]= string(72) 64 bytes from y2.php.net (66.163.161.117): icmp_seq=1 ttl=47 time=211 ms [2]= string(72) 64 bytes from y2.php.net (66.163.161.117): icmp_seq=2 ttl=47 time=206 ms [3]= string(0) [4]= string(31) --- php.net ping statistics --- [5]= string(55) 2 packets transmitted, 2 received, 0% loss, time 1008ms [6]= string(55) rtt min/avg/max/mdev = 206.299/209.139/211.979/2.840 ms } [_sysname]= string(5) linux [_round_trip]= array(3) { [min]= string(7) 209.139 [avg]= string(7) 211.979 [max]= string(5) 2.840 } [_transmitted]= string(1) 2 [_received]= string(1) 2 [_loss]= int(0) } Now I would like to retrieve my needed info out of it. How do I do this? (sounds a bit silly this question, sorry :-) I tried: $ping_result = $ping-ping('php.net'); echo $ping_result[net_ping_result][_raw_data][5]; But this and other tries did not work. My goal is to find out wheter a specified site is reachable. Can anybody give me a hint on this one? Thank you in advance, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] call a php script in a php script
I personaly use proc_open() to run PHP Scripts. on Tuesday 28 March 2006 12:14, nicolas figaro wrote: Hi, I'd like to run a php script in another php script. (the first is lauched from the command line). Is there a way to do it better than system (/path/to/php script_included.php options). ? the goal is to run several scripts with several options. the result of the included script should be a returning code with a message. (but it hasn't been fixed yet). Thanks a lot. Nicolas Figaro -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Fwd: Re: WG: Bitte weiterleiten
-- Weitergeleitete Nachricht -- Subject: Fwd: Re: WG: Bitte weiterleiten Date: Freitag, 24. März 2006 15:29 From: Thomas Munz [EMAIL PROTECTED] To: [EMAIL PROTECTED] -- Weitergeleitete Nachricht -- Subject: Re: WG: Bitte weiterleiten Date: Freitag, 24. März 2006 15:27 From: Thomas Munz [EMAIL PROTECTED] To: [EMAIL PROTECTED] Am Freitag, 24. März 2006 14:09 schrieben Sie: _ Von: Peter Seyerl [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 24. März 2006 08:50 An: [EMAIL PROTECTED] Betreff: WG: Bitte weiterleiten -Ursprüngliche Nachricht- Von: patrikk [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 24. März 2006 08:39 An: Weber Stefan; Schatzi; Peda; Mani; Ludwig Buchinger; Kleiss; Florian Lettner; Fabiii; Atzmüller Manuel; Astrid; Aisti Betreff: WG: Bitte weiterleiten -Ursprüngliche Nachricht- Von: Peter Seyerl [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 24. März 2006 08:33 An: [EMAIL PROTECTED] Betreff: WG: Bitte weiterleiten -Ursprüngliche Nachricht- Von: Rainer Königseder [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 24. März 2006 08:03 An: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; Princess of Asia; [EMAIL PROTECTED]; Petra Punzenberger; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; Armin Holenia; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Betreff: Fw: Bitte weiterleiten - Original Message - From: KÖNIGSECKER Matthias mailto:[EMAIL PROTECTED] To: KÖNIGSECKER Matthias mailto:[EMAIL PROTECTED] Sent: Thursday, March 23, 2006 8:08 PM Subject: WG: Bitte weiterleiten _ Von: Joachim Scherb [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 23. März 2006 15:51 An: Susanne Oberhuber; Elke Krist; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; Johannes Leitner; Ralf Kemetmüller; Harald Herber; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; Mandi-Sonja Freudenthaler-Affenzeller; [EMAIL PROTECTED]; [EMAIL PROTECTED] Betreff: WG: Bitte weiterleiten Mit freundlichen Grüßen Joachim Scherb Pappas Automobilvertriebs GmbH Ein Unternehmen der Pappas Gruppe 4030 Linz, Mayrhoferstrasse 36, Austria T: +43-732-3849-119, F: +43-732-3849-118 [EMAIL PROTECTED] - Weitergeleitet von Joachim Scherb/LNZ/Pappas am 23.03.2006 15:48 - Fölser Michael [EMAIL PROTECTED] 23.03.2006 14:40 An Haiderer Günter [EMAIL PROTECTED], Knoll Klaus [EMAIL PROTECTED], [EMAIL PROTECTED], Joachim Scherb [EMAIL PROTECTED], [EMAIL PROTECTED], michaela gahleitner [EMAIL PROTECTED], Claudia Fölser [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED] Kopie Thema WG: WG: Bitte weiterleiten _ Von: Thomas Fölser [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 23. März 2006 14:41 An: Markus Maier; Alois Aufreiter; Fölser Michael; Claudia Fölser; Gabriele Alberndorfer; Seiberl Andreas (RCA); Markus Fölser Betreff: WG: WG: Bitte weiterleiten - Nachricht von Gerald HAYBOECK [EMAIL PROTECTED] auf Thu, 23 Mar 2006 14:11:08 +0100 - An: [EMAIL PROTECTED],Thomas Fölser [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED], g [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED] m x.at,[EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED], g [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED] w est.at,[EMAIL PROTECTED],[EMAIL PROTECTED], h [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED],klemens . [EMAIL PROTECTED],[EMAIL PROTECTED] Thema: WG: Bitte weiterleiten - Weitergeleitet von Gerald HAYBOECK/34277/RBGO/AT am 23.03.2006 14:10 - Erlinger Reinhold [EMAIL PROTECTED] An: Vondra Christopher [EMAIL PROTECTED], xperts.com [EMAIL PROTECTED
Re: [PHP] Fwd: Re: WG: Bitte weiterleiten
Sorry! Was mistakly commited, should go to the list in my address book but not here! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code stoped working after upgrading from 4 to 5
Do you set this vars before somewhere in the code? Because if you get some datas from a from you have to use $_POST/$_GET to get the values... Hi, I have this simple piece of code that worked like a chram in PHP 4.x Now that i've moved to PHP 5 it doesn't work anymore. I always get 0 for $form_ok even if all fields are filled. The variables come from a form in a previous page. Any ideas on where the problem might be ? I have register_globals = Off in php.ini Any help would be apreciated. // test if all fields were filled if (($email == '') || ($name == '') || ($pass == '') || ($pass2 == '') || ($magic_number == '') || ($answer == '')) $form_ok = 0; Warm Regards, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP5 Class problem
I'm using PHP 5.0.3 and if a problem if a class method. I'm initializing a class like that: $o_SessionHandler = new SessionHandler(); var_dump($o_SessionHandler-getOrgSession());exit; Now it get the error message: Fatal error: Using $this when not in object context in /srv/www/htdocs/SessionHandler.class.php on line 68 I try to debug that but that looks like a bug in the parser. The class looks like that: ?php //-- interface for SessionHandler Class interface SessionHandlerI { //-- functions static public function checkTime(); static public function checkSession(); static public function defineVar(); static public function getVar(); static public function isLogined(); static public function getOrgSession(); } //-- define SessionHandler Class class SessionHandler implements SessionHandlerI { //-- define var that keeps the original Session alive private $a_session_org; //-- initialize function public function SessionHandler() { $this-a_session_org = $_SESSION; } //-- function that checks how long the user don't do something static public function checkTime() { //-- check if time var exists if(isset($_SESSION['time_last_clicked'])) { //-- check the time differents if(time() - $_SESSION['time_last_clicked'] TIME_LOGOUT_IF_NO_CLICK) { //-- set new time $_SESSION['time_last_clicked'] = time(); } else { //-- block to login site Blocker::BlockToLoginSite(); } } else { //-- set var $_SESSION['time_last_clicked'] = time(); } } //-- function that checks if the Session Structur is correct static public function checkSession(){} //-- function that defines a var in the Session static public function defineVar(){} //-- functino that returns a session var static public function getVar(){} //-- check if the user is logined based on the session static public function isLogined(){} //-- returns the original login static public function getOrgSession() { //-- return var return $this-a_session_org; } } The getOrgSession() function is inside of a class so the $this should be avaible... any ideas? thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP5 Exception tutorial
Does anybody know a good PHP5 Exception Tutorial that explain this new function step by step? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP5 sprintf() function borken
Today i think i found an bu in the PHP5 version 5.0.3 ( allready exits also in the version 5.0.2 , i try this version also ). When tryo one of this scripts: $i_test = 0.085007667542; $tm_total = sprintf('%.2f', $i_test); echo $tm_total; $i_test = 0.085007667542; $tm_total = sprintf('%.2f', $i_test); echo $tm_total; $i_test = 0.085007667542; $tm_total = sprintf('%.2f', floatval($i_test)); echo $tm_total; i always get an other result. Some time it get a result like that: -2681561585988522000.00 my friend try it also and have the same problems... is that a bug in php5? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unpacking $_POST when example[1], example[2] in form.
$_POST[example][1] $_POST[example][2] If I have a form with elements like input type=text name=example[1] input type=text name=example[2] If example was not an array it would be accessed using $_POST[example] But how do I access the varable if it is an array like above. Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_REQUEST
Be carfull with this super var. This var is a merge of the GET, POST and FILES, and so only 1 index can only exists. If you have an index in the POST field called 'test' and also and index calles test in the FILES or GET var, than only one index of them is avaible and the other are gone I recommend to use the GET, POST and FILES var instead of the REQUEST var.. Am Montag, 10. Januar 2005 13:33 schrieb Benjamin Edwards: Trying to get my head around relationship between/use of $_GET, $_POST and $_REQUEST. It seems to me that $_REQUEST is most useful as if it is used in place of $_POST/$_GET it would be possible to change posting method without changing the code. I am kind of assuming that $_REQUEST is and aggregate of $_POST, $_GET and $_FILES. Is this correct or are there differences. Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Firefox/IE (sometimes) wants to download .php files from my Apache2 server
I have the same problem. This problem occured i PHP crashes. Do you upgrad your PHP to a newer version or do you compile a PHP source and have RPMs installed? Hi All, I have a rather odd problem. Since a few days, my otherwise perfect SuSe 9.0 Apache2 server started to do some funny stuff. In general, php works fine, and I can do anything I want... after a little while Firefox/IE starts asking me whether I want to download/run the php file instead of rendering it in the browser. Sometimes even this doesn't happen, and I just get a regular Apache2 page stating 'Object not found' (with accompanying lines in my server's error_log). A few minutes later, everything works fine again. (restarting apache also tends to help) I think the biggest problem is that it is intermittent: sometimes it works, and sometimes it doesn't... no way for me to diagnose it. weird. Any ideas? Cheers, Rinke -- -- Rinke Hoekstra [EMAIL PROTECTED] T: +31-20-5253499F: +31-20-5253495 Leibniz Center for Law,Law Faculty University of Amsterdam, PO Box 1030 1000 BA Amsterdam,The Netherlands -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Firefox/IE (sometimes) wants to download .php files from my Apache2 server
This is not an Mime-type problem. What apache version your runnging. What RPMs of PHP4 you have installed? What PHP Apache module you have installed? If it works most of the time, just not all the time... it can't really be the mime-types, or can it? -Rinke Stephan Fiedler wrote: Hi Rinke, check Mime-Types.. Stephan Rinke Hoekstra wrote: Hi All, I have a rather odd problem. Since a few days, my otherwise perfect SuSe 9.0 Apache2 server started to do some funny stuff. In general, php works fine, and I can do anything I want... after a little while Firefox/IE starts asking me whether I want to download/run the php file instead of rendering it in the browser. Sometimes even this doesn't happen, and I just get a regular Apache2 page stating 'Object not found' (with accompanying lines in my server's error_log). A few minutes later, everything works fine again. (restarting apache also tends to help) I think the biggest problem is that it is intermittent: sometimes it works, and sometimes it doesn't... no way for me to diagnose it. weird. Any ideas? Cheers, Rinke -- -- Rinke Hoekstra [EMAIL PROTECTED] T: +31-20-5253499F: +31-20-5253495 Leibniz Center for Law,Law Faculty University of Amsterdam, PO Box 1030 1000 BA Amsterdam,The Netherlands -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Firefox/IE (sometimes) wants to download .php files from my Apache2 server
Not more PHP modules? like php4-4.3.3 php4-mysql-4.3.3 php4-zlib-4.3.3 ?? Do you compile PHP4? ... Thomas Munz wrote: This is not an Mime-type problem. What apache version your runnging. Apache/2.0.48 What RPMs of PHP4 you have installed? What PHP Apache module you have installed? apache2-mod_php4 version 4.3.3 mod_php4-core version 4.3.3 phpdoc 4.3.0 Thanks for all the help! -Rinke If it works most of the time, just not all the time... it can't really be the mime-types, or can it? -Rinke Stephan Fiedler wrote: Hi Rinke, check Mime-Types.. Stephan Rinke Hoekstra wrote: Hi All, I have a rather odd problem. Since a few days, my otherwise perfect SuSe 9.0 Apache2 server started to do some funny stuff. In general, php works fine, and I can do anything I want... after a little while Firefox/IE starts asking me whether I want to download/run the php file instead of rendering it in the browser. Sometimes even this doesn't happen, and I just get a regular Apache2 page stating 'Object not found' (with accompanying lines in my server's error_log). A few minutes later, everything works fine again. (restarting apache also tends to help) I think the biggest problem is that it is intermittent: sometimes it works, and sometimes it doesn't... no way for me to diagnose it. weird. Any ideas? Cheers, Rinke -- -- Rinke Hoekstra [EMAIL PROTECTED] T: +31-20-5253499F: +31-20-5253495 Leibniz Center for Law,Law Faculty University of Amsterdam, PO Box 1030 1000 BA Amsterdam,The Netherlands -- -- -- Rinke Hoekstra [EMAIL PROTECTED] T: +31-20-5253499F: +31-20-5253495 Leibniz Center for Law,Law Faculty University of Amsterdam, PO Box 1030 1000 BA Amsterdam,The Netherlands -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Text tools
This is not possible with PHP, you must do that with JavaScript. Hello, I was just wondering how to build a text editing tool with php. I mean a tool that can help users to format their texts in the pages. I mean something like paste the text in a text box. Select some part of the text and hit a button to, for example, bold the selected part of the text. Or align the text to left or right side of the table. Little bit like you can see in a text editor progs like MS Word. I've seen a few applications like this but I have no idea how they are made and can this be done using php. Any ideas or guidelines how to get started? Thanks Will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Attempted to unsubscribe to no avail
http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sql syntax problem
This is the PHP mailing list, not the SQL mailing list ;) but here is the syntax ( not tested ): SELECT c.name AS city FROM geodb_locations AS c, user AS u WHERE u.user_id = 4 AND c.plz LIKE u.plz; Hello everybody, I am trying to create a sql query with php and I do have a syntax problem with the mysql query. One row is called plz and I would like to search for a value inside that with a like statement. Problem is, the system takes the u.plz as a character not as a table element: LIKE %u.plz% Has anybody an idea how the correct sytnax is? I am lost here. Thank you in advance, Merlin PS: This is the complete statement: SELECT c.name AS city FROM geo_de.geodb_locations AS c, fix.user AS u WHERE u.user_id =4 AND c.plz LIKE %u.plz%; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set doesn't work
your set it to '-1'!!! thats not allowed. You must habe a value highter than zero. Its better you set it in generall to 60. And you forgot the 'M' fater the number like ini_set(memory_limit,-1M); set it better to that: ini_set(memory_limit,60M); hello, what do I have to change in php.ini, to allow thr ini_set(memory_limit,-1); command? It doesn't work in my script... regards Joerg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Objects and sessions
I think, its not possible to init an Objeect on a session. Session will be rebuild on each reload of the site based on the session id, i think... Maybe here the object can't be rebuild anymore... Following code: ?php class SessionTestC { protected $value; function __construct ( $val ) { $this-value = $val; } function GetValue () { return $this-value; } } if ( isset ($_SESSION['TestObj'])) { echo 'Session Test is set to: '.$_SESSION['TestObj']-GetValue().'br'; } else { session_start (); echo 'Session Test was not set.br'; $_SESSION['TestObj'] = new SessionTestC ( 'This is a test' ); echo a href='.basename($_SERVER['PHP_SELF']).'Click here./abr; } ? Gives me an error of incomplete object on second access, like this: *Fatal error*: main() [function.main http://localhost/sfcms/Scripts/function.main]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition SessionTestC of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in */home/fmmarzoa/Develop/Stradivarius/Scripts/SessionTest.php* on line *16 *But as it can be seen, the class is defined in the script SessionTest.php itself, so... ?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Making variables with an iteration? STILL
I think you can use the export() function for that.. Here's the full code and the driving page: http://rsossam-lap.ces.ncsu.edu/leadership/test.html snip ?php for ($i=1; $i10; $i++) { if (isset ($_POST['choice'.$i])) { for ($j=1; $j5; $j++) { $tempChoice = choice . $j; $$tempChoice = $_POST['choice'.$i]; } } } echo $choice1; echo $choice2; echo $choice3; echo $choice4; ? /snip The problem seems to be that it is only doing this on the last one, no matter which one it is... I know it is in the iterations, but I can't place my finger on where I need to change things up. -- Robert Sossomon, Business and Technology Application Technician 4-H Youth Development Department 200 Ricks Hall, Campus Box 7606 N.C. State University Raleigh NC 27695-7606 Phone: 919/515-8474 Fax: 919/515-7812 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PARSE ERROR, unexpected T_$VARIABLE
you forgot the ' in the $fname= $_POST[fname]; $lname= $_POST[lname]; $addie= $_POST[addie]; $city= $_POST[city]; fields!!! error, expecting `T_VARIABLE' or `'$'' in c:\fourh\leadership\registration_post.php on line 29 The HTML page: http://rsossam-lap.ces.ncsu.edu/leadership/registration2.php The processing Script SNIP ?php $fname= $_POST[fname]; $lname= $_POST[lname]; $addie= $_POST[addie]; $city= $_POST[city]; $state= $_POST[state]; $zip= $_POST[zip]; $county= $_POST[county]; $dphone= $_POST[dphone]; $ephone= $_POST[ephone]; $email= $_POST[email]; $first_conf= $_POST[first_conf]; $payment= $_POST[payment]; $PreConference= $_POST['PreConference']; $Conference= $_POST['Conference']; $choices = $_POST['choice']; array_splice($choices,4); $j=1; for ($i=0; $i count($choices); $i++) { $value = $choices[$i]; $tempChoice = choice . $j; $$tempChoice = $value; $j++; } $0405distoffice= $_POST['04_05_dist_office']; //line29 $0506distoffice= $_POST['05_06_dist_office']; $former= $_POST[former]; $achieve= $_POST[achieve]; ? /SNIP I pulled out the iterations above that line of code and tested it separately. Everything worked OK, so I copied it into the rest of the PHP processing. This thing is driving me bonkers. Any suggestions? -- Robert Sossomon, Business and Technology Application Technician 4-H Youth Development Department 200 Ricks Hall, Campus Box 7606 N.C. State University Raleigh NC 27695-7606 Phone: 919/515-8474 Fax: 919/515-7812 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cleaner way to do this?
foreach ( $_POST as $key = $value ) { while ($key != submit) { \$$key = $value; $addtocart .= ,'\$$key'; } } The problem is that it seems to be hanging at the while loop. Is there a cleaner way to write the foreach loop so that it will dump out the submit key? I've been trying different combinations, and am sure it is something simple I have boffed. Thanks, Robert -- Robert Sossomon, Business and Technology Application Technician 4-H Youth Development Department 200 Ricks Hall, Campus Box 7606 N.C. State University Raleigh NC 27695-7606 Phone: 919/515-8474 Fax: 919/515-7812 [EMAIL PROTECTED] foreach ( $_POST as $key = $value ) { if($key != submit) { $addtocart .= ,$key; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirect after download
I am writing a file download system and I need to be able to do a redirect after the download is finished. Basically, the user will be presented with a simple HTML page that contains a link to download the file (href=/download.php?fileid=143). I have the code to send the file working just fine, but I can not figure out how to do a redirect after the download is complete. I have spent the last hour searching the archives, and the closest I have found is: http://marc.theaimsgroup.com/?l=php-generalm=106128750620349w=2 But I can't seem to find a way to actually do a Location style redirect. Even static HTML does not display the way one would expect. Using a small text file to download, I can view source from NS and see the everything that was sent to the browser, and everything is there (the ---Boundary(s), the text file, and the simple HTML line). So my question is: How can I perform a redirect after the file has been sent. Thanks, Justin Here is a snippit of download.php (send_file() was found reading the comments to the fread function in the PHP documention): header(Content-Type: multipart/mixed; boundary=\-Boundary-12399\); if(!send_file($file)) { die(File transfer failed!); exit; }else{ print(\n); print(---Boundary-12399\r\n); print(Content-Type: text/html\r\n); print(\r\n); print htmlheadtitleSuccess/title/headbodybFile transfer s uccessful!/b/body/html; print(\r\n---Boundary-12399\r\n); print(\r\n); exit; } function send_file($file) { // read file and send to user $status = FALSE; if ( (!is_file($file['filelocation'])) or (connection_status()!=0) ) return(FALSE); print(---Boundary-12399\r\n); print(Content-type: application/octet-stream\r\n); print(Content-Disposition: inline; filename=\ . $file['filename'] . \\r\n); print(Content-length: . $file['filesize'] . \r\n); print(Expires: . gmdate(D, d M Y H:i:s, mktime(date(H)+2, date(i), date(s), date(m), date(d), date(Y) ) ) . GMT\r\n); print(Last-Modified: . gmdate(D, d M Y H:i:s). GMT\r\n); //print(Cache-Control: no-cache, must-revalidate\r\n); //print(Pragma: no-cache\r\n); if ($fh = fopen($file['filelocation'], 'rb')) { while(!feof($fh) and (connection_status()==0)) { print(fread($fh, 1024*8)); flush(); } $status = (connection_status()==0); fclose($fh); } return($status); } How about go directly to the site where you want to locate and make there the file downloadable... ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse error: parse error, expecting `']'' in
Parse error: parse error, expecting `']'' in file.php I've been working on this script, and can't see why it fails here, but I have another page that uses the same coding and it works correctly. OK, here's the code: $cart1 = ; $cart1 = '$_POST[nutrition_program_assistant]','$_POST[County]','$_POST[ERS_entry_d ate]','$_POST[ERS_exit_date]','$_POST[Group_ID]','$_POST[wname_of_group]','$ _POST[select]','$_POST[Contact_person]','$_POST[Telephone]','$_POST[Group_Ad dress]','$_POST[city]','$_POST[zip]','$_POST[Volunteer_1]','$_POST[Volunteer _2]','$_POST[Volunteer_3]','$_POST[Volunteer_4]','$_POST[Program_start_date] ','$_POST[Projected_end_date]','$_POST[Actual_end_date]','$_POST[Eval_Pre_te st]','$_POST[Eval_post_test]','$_POST[number_meetings]','$_POST[number_conta ct_hours]','$_POST[wname_1]','$_POST[sex_1]','$_POST[race_1]','$_POST[res_1] ','$_POST[bday_mo_1]','$_POST[bday_day_1]','$_POST[bday_yr_1]','$_POST[grade _1]','$_POST[4_h_1]','$_POST[wname_2]','$_POST[sex_2]','$_POST[race_2]','$_P OST[res_2]','$_POST[bday_mo_2]','$_POST[bday_day_2]','$_POST[bday_yr_2]','$_ POST[grade_2]','$_POST[4_h_2]','$_POST[wname_3]','$_POST[sex_3]','$_POST[rac e_3]','$_POST[res_3]','$_POST[bday_mo_3]','$_POST[bday_day_3]','$_POST[bday_ yr _3]','$_POST[grade_3]','$_POST[4_h_3]','$_POST[wname_4]','$_POST[sex_4]','$ _POST[race_4]','$_POST[res_4]','$_POST[bday_mo_4]','$_POST[bday_day_4]','$_P OST[bday_yr_4]','$_POST[grade_4]','$_POST[4_h_4]','$_POST[wname_5]','$_POST[ sex_5]','$_POST[race_5]','$_POST[res_5]','$_POST[bday_mo_5]','$_POST[bday_da y_5]','$_POST[bday_yr_5]','$_POST[grade_5]','$_POST[4_h_5]','$_POST[wname_6] ','$_POST[sex_6]','$_POST[race_6]','$_POST[res_6]','$_POST[bday_mo_6]','$_PO ST[bday_day_6]','$_POST[bday_yr_6]'; $cart2 = ; $cart2 = '$_POST[grade_6]','$_POST[4_h_6]','$_POST[wname_7]','$_POST[sex_7]','$_POS T[race_7]','$_POST[res_7]','$_POST[bday_mo_7]','$_POST[bday_day_7]','$_POST[ bday_yr_7]','$_POST[grade_7]','$_POST[4_h_7]','$_POST[wname_8]','$_POST[sex_ 8]','$_POST[race_8]','$_POST[res_8]','$_POST[bday_mo_8]','$_POST[bday_day_8] ','$_POST[bday_yr_8]','$_POST[grade_8]','$_POST[4_h_8]','$_POST[wname_9]','$ _POST[sex_9]','$_POST[race_9]','$_POST[res_9]','$_POST[bday_mo_9]','$_POST[b day_day_9]','$_POST[bday_yr_9]','$_POST[grade_9]','$_POST[4_h_9]','$_POST[wn ame_10]','$_POST[sex_10]','$_POST[race_10]','$_POST[res_10]','$_POST[bday_mo _10]','$_POST[bday_day_10]','$_POST[bday_yr_10]','$_POST[grade_10]','$_POST[ 4_h_10]','$_POST[Attend_1_1]','$_POST[Attend_2_1]','$_POST[Attend_3_1]','$_P OST[Attend_4_1]','$_POST[Attend_5_1]','$_POST[Attend_6_1]','$_POST[Attend_7_ 1]','$_POST[Attend_8_1]','$_POST[Attend_9_1]','$_POST[Attend_10_1]','$_POST[ Attend_1_2]','$_POST[Attend_2_2]','$_POST[Attend_3_2]','$_POST[Attend_4_2]', '$ _POST[Attend_5_2]','$_POST[Attend_6_2]','$_POST[Attend_7_2]','$_POST[Attend _8_2]','$_POST[Attend_9_2]','$_POST[Attend_10_2]','$_POST[Attend_1_3]','$_PO ST[Attend_2_3]','$_POST[Attend_3_3]','$_POST[Attend_4_3]','$_POST[Attend_5_3 ]','$_POST[Attend_6_3]','$_POST[Attend_7_3]','$_POST[Attend_8_3]','$_POST[At tend_9_3]','$_POST[Attend_10_3]','$_POST[Attend_1_4]','$_POST[Attend_2_4]',' $_POST[Attend_3_4]','$_POST[Attend_4_4]','$_POST[Attend_5_4]','$_POST[Attend _6_4]','$_POST[Attend_7_4]','$_POST[Attend_8_4]','$_POST[Attend_9_4]','$_POS T[Attend_10_4]','$_POST[Attend_1_5]','$_POST[Attend_2_5]','$_POST[Attend_3_5 ]','$_POST[Attend_4_5]','$_POST[Attend_5_5]','$_POST[Attend_6_5]','$_POST[At tend_7_5]','$_POST[Attend_8_5]','$_POST[Attend_9_5]','$_POST[Attend_10_5]',' $_POST[Attend_1_6]','$_POST[Attend_2_6]','$_POST[Attend_3_6]','$_POST[Attend _4_6]','$_POST[Attend_5_6]','$_POST[Attend_6_6]','$_POST[Attend_7_6]','$_POS T[Attend_8_6]','$_POST[Attend_9_6]','$_POST[Attend_10_6]','$_POST[Attend_1_7 ]', '$_POST[Attend_2_7]','$_POST[Attend_3_7]','$_POST[Attend_4_7]','$_POST[Atte nd_5_7]','$_POST[Attend_6_7]','$_POST[Attend_7_7]','$_POST[Attend_8_7]','$_P OST[Attend_9_7]','$_POST[Attend_10_7]','$_POST[Attend_1_8]','$_POST[Attend_2 _8]','$_POST[Attend_3_8]','$_POST[Attend_4_8]','$_POST[Attend_5_8]','$_POST[ Attend_6_8]','$_POST[Attend_7_8]','$_POST[Attend_8_8]','$_POST[Attend_9_8]', '$_POST[Attend_10_8]','$_POST[Attend_1_9]','$_POST[Attend_2_9]','$_POST[Atte nd_3_9]','$_POST[Attend_4_9]','$_POST[Attend_5_9]','$_POST[Attend_6_9]','$_P OST[Attend_7_9]','$_POST[Attend_8_9]','$_POST[Attend_9_9]','$_POST[Attend_10 _9]','$_POST[Attend_1_10]','$_POST[Attend_2_10]','$_POST[Attend_3_10]','$_PO ST[Attend_4_10]','$_POST[Attend_5_10]','$_POST[Attend_6_10]','$_POST[Attend_ 7_10]','$_POST[Attend_8_10]','$_POST[Attend_9_10]','$_POST[Attend_10_10]','$ _POST[TE_CT_1]','$_POST[TE_CTL_1]','$_POST[TE_CT_2]','$_POST[TE_CTL_2]','$_P OST[TE_CT_3]','$_POST[TE_CTL_3]','$_POST[TE_D_1]','$_POST[TE_LT_1]','$_POST[ TE_ A_1]','$_POST[TE_FA_1]','$_POST[TE_H_1]'; $cart3 = ; $cart3 = '$_POST[TE_D_2]','$_POST[TE_LT_2]','$_POST[TE_A_2]','$_POST[TE_FA_2]','$_P OST[TE_H_2]','$_POST[TE_D_3]','$_POST[TE_LT_3]','$_POST[TE_A_3]','$_POST[TE_