[PHP] Reading a file from another server
Hi Everyone. I'm having problems creating code to read a file from another server. 1. Is this even possible? with a secure server aswell? 2. I have tried using fopen()but this always gives me an error: Warning: stat failed for http://www.domain.com/test.txt (errno=2 - No such file or directory) in /home/domain/public_html/php/testphp/test.php on line 4 this is my code: http://www.domain.com/test.txt";; $handle = fopen ($filename, "r"); $content = fread($handle, filesize ($filename)); fclose($handle); echo $content; ?> can anyone help me. I need to put this on my server, and read this other file form a game serverbut I can't seem to do it. Cheers for any help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reading a file from another server
if I use: readfile("ftp://username:[EMAIL PROTECTED]/test.txt"); It doesn't have any errors and comes up blank. If I put: $result = readfile("ftp://username:[EMAIL PROTECTED]/test.txt"); print ($result); it ends up showing a '0' by iteself. that's it. and I knwo the txt file is full of info. I'm stumped again. Cheers. for your help. Thomas "Chris Shiflett" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > --- Thomas <[EMAIL PROTECTED]> wrote: > > I'm having problems creating code to read a file from another > > server. > > > > 1. Is this even possible? with a secure server aswell? > > Yes. > > > this is my code: > > > $filename = "http://www.domain.com/test.txt";; > > $handle = fopen ($filename, "r"); > > $content = fread($handle, filesize ($filename)); > > fclose($handle); > > echo $content; > > ?> > > This code can be replaced with: > > readfile('http://www.domain.com/test.txt'); > > As far as debugging problems related to this, check your php.ini and make sure > the URL wrapper is enabled. Otherwise, you will be restricted to your local > filesystem only. > > Hope that helps. > > Chris > > = > Become a better Web developer with the HTTP Developer's Handbook > http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reading a file from another server
I know the url is good, cause I can go on to this domain and look at all my files. I guess I should explain a little further... This server is a game server for Counter-Strike. I'm trying to read a file on there called "mapcycle.txt". This server is a secure server, so I would need to use a username and password to get on. I I've tried a bunch of different things, and now I find that it has a problem connecting to secure servers. DO you know of a different way to connect to a secure server anhd get information other than the way I have been trying? This is what I'm usuing right now: ftp://";; $username = "myUsername"; $password = "**"; $url = "server.username.gameserver.com/"; $filename = "test.txt"; $result = readfile($prefix . $username . ":" . $password . "@" . $url . $filename); print ($result); ?> // OUTPUT 0 if I use anythign other than the ftp:// for a prefix (like http. or https) I get an error. Cheers. "Chris Shiflett" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > --- Thomas <[EMAIL PROTECTED]> wrote: > > readfile("ftp://username:[EMAIL PROTECTED]/test.txt"); > > > > It doesn't have any errors and comes up blank. > > > > If I put: > > > > $result = > > readfile("ftp://username:[EMAIL PROTECTED]/test.txt"); > > print ($result); > > > > it ends up showing a '0' by iteself. > > The readfile() functions outputs the contents of the file and returns the size > of the file in bytes. So, when you assigned $result to the return value, you > demonstrated that readfile() output 0 bytes (which explains why you didn't see > anything). > > I'm pretty sure your php.ini is set to allow this, otherwise you would receive > an error. I'm doubting whether that URL actually contains any content. How have > you tested to be sure it does? > > Chris > > = > Become a better Web developer with the HTTP Developer's Handbook > http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP - Flash problem
Hello everyone, I'm trying to pass some info into Flash. this worked fine with another funciton call instead of Players(); But for some reason it will only pass the first name into flash..that's it. however, when I check it just in a browser, it works fine. I'm not sure why this one won't specifically work. this is what I have. // Includes etc... // Create new Class $server = new Rcon(); // Connect & Retrieve Info if($server->Connect($config_server_ip, $config_server_port, $config_server_password)) { $player_results = $server->Players(); $server->Disconnect(); } // Output to Flash $player_info = Array(); for ($i=1; $i<=count($player_results); $i++) { $player_info[($i-1)] = implode(",", $player_results[$i]); } $player_info2 = implode("|", $player_info); print ($player_info2); This works to browser, but not to Flash. it really doesn't make sense. Any help? Cheers. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] imap_headerinfo() - problem
hi all, i have a problem I have an email if in "to" or "cc" have more than 100 addresses when I tried to call the function: imap_headerinfo() ($info = @imap_headerinfo($this->conn, $msg_id);), the browser return: "zero sized reply" or "The page cannot be displayed" (in IE) any ideea? have fun thomas
Re: [PHP] $_SERVER[REMOTE_ADDR]
$_SERVER["REMOTE_ADDR"] If the user have a proxy the real IP is: $_SERVER["HTTP_X_FORWARDED_FOR"] have fun thomas - Original Message - From: John To: [EMAIL PROTECTED] Sent: Thursday, April 03, 2003 1:26 AM Subject: [PHP] $_SERVER[REMOTE_ADDR] Makes me think.. what exactly the $_SERVER[REMOTE_ADDR] is doing Cause it does not really show the actual IP address instead IP address within its range e.g. 66.87.25.122 output 66.87.25.2 any idea how to get their actual IP add and if possible the name of their computer Also, is it also possible to get or trace the IP add? many thanks, John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php http://felicitari.mymail.ro/
[PHP] Submit Image Button
I have a problem with my php. I have a form and in that form there is an image submit button. When I click on it, it won't tell me if the submit button is clicked. It works fine with a normal one. sample: If I use This works finedo I need to do something else with the code? Help is very appreciated. Cheers. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Submit Image Button
ok, sorry I'm a newb...what do I do with that info? I saw that page, but it makes no sense to me Thomas "John Coggeshall" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > http://www.php.net/manual/en/language.variables.external.php > > > > This creates variables $_GET['sub_x'] and $_GET['sub_y'] containing the > X/Y cordinate where the button was clicked (assuming it was GET method > form submission) > > John > > -~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~- > John Coggeshall > john at coggeshall dot org http://www.coggeshall.org/ > -~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~- > > > >-Original Message- > >From: Thomas [mailto:[EMAIL PROTECTED] > >Sent: Wednesday, April 02, 2003 9:27 PM > >To: [EMAIL PROTECTED] > >Subject: [PHP] Submit Image Button > > > > > >I have a problem with my php. > > > >I have a form and in that form there is an image submit > >button. When I click on it, it won't tell me if the submit > >button is clicked. It works fine with a normal one. > > > >sample: > > > > > if (!$submit) { > >?> > > > > > > > > >src="../News/themes/xFClan/button_submit.gif" > >border="0" name="submit" value="Login" width="55" height="19" > >alt="Submit"> > > > > > > >} else { > >echo "you clicked"; > >} > >?> > > > >If I use This works finedo I > >need to do something else with the code? Help is very appreciated. > > > >Cheers. > > > > > > > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, visit: 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] Submit Image Button
AwesomeThank you so much. Cheers. Thomas "John Coggeshall" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Well you can ignore it if you don't need the X/Y cord... But you can use > it to make sure the button was clicked: > > If(!$_GET['sub_x'] || !_GET['sub_y']) { > // display form > } else { > // it was submitted > > -~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~- > John Coggeshall > john at coggeshall dot org http://www.coggeshall.org/ > -~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~- > > > >-Original Message- > >From: Thomas [mailto:[EMAIL PROTECTED] > >Sent: Wednesday, April 02, 2003 9:39 PM > >To: [EMAIL PROTECTED] > >Subject: Re: [PHP] Submit Image Button > > > > > >ok, sorry I'm a newb...what do I do with that info? I saw > >that page, but it makes no sense to me > > > >Thomas > > > > > >"John Coggeshall" <[EMAIL PROTECTED]> wrote in message > >news:[EMAIL PROTECTED] > >> > >> http://www.php.net/manual/en/language.variables.external.php > >> > >> > >> > >> This creates variables $_GET['sub_x'] and $_GET['sub_y'] containing > >> the X/Y cordinate where the button was clicked (assuming it was GET > >> method form submission) > >> > >> John > >> > >> > >-~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~- > >> John Coggeshall > >> john at coggeshall dot org > >http://www.coggeshall.org/ > >> > >-~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~- > >> > >> > >> >-Original Message- > >> >From: Thomas [mailto:[EMAIL PROTECTED] > >> >Sent: Wednesday, April 02, 2003 9:27 PM > >> >To: [EMAIL PROTECTED] > >> >Subject: [PHP] Submit Image Button > >> > > >> > > >> >I have a problem with my php. > >> > > >> >I have a form and in that form there is an image submit > >button. When > >> >I click on it, it won't tell me if the submit button is clicked. It > >> >works fine with a normal one. > >> > > >> >sample: > >> > > >> > >> > if (!$submit) { > >> >?> > >> > > >> > > >> > > >> > >> >src="../News/themes/xFClan/button_submit.gif" > >> >border="0" name="submit" value="Login" width="55" height="19" > >> >alt="Submit"> > >> > > >> > > >> > >> >} else { > >> >echo "you clicked"; > >> >} > >> >?> > >> > > >> >If I use This works finedo > >I need to > >> >do something else with the code? Help is very appreciated. > >> > > >> >Cheers. > >> > > >> > > >> > > >> > > >> >-- > >> >PHP General Mailing List (http://www.php.net/) > >> >To unsubscribe, visit: http://www.php.net/unsub.php > >> > > >> > > >> > > > > > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, visit: 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] Submit Image Button
It works either way apparently...plus, I need the $POST not $_GET. but it works aswell. "-{ Rene Brehmer }-" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Wed, 2 Apr 2003 21:41:02 -0500, John Coggeshall wrote about "RE: [PHP] > Submit Image Button" what the universal translator turned into this: > > >Well you can ignore it if you don't need the X/Y cord... But you can use > >it to make sure the button was clicked: > > > >If(!$_GET['sub_x'] || !_GET['sub_y']) { > > // display form > >} else { > > // it was submitted > > If you can't click the button without getting both a X and Y coordinat, > wouldn't it make more sense to use AND instead of OR in the above logex?? > > So it would be: > > If(!$_GET['sub_x'] && !$_GET['sub_y']) { > // display form > } else { > // it was submitted > > Plus you're missing a $ in the second $_GET... > > Rene > > -- > Rene Brehmer > > This message was written on 100% recycled spam. > > Come see! My brand new site is now online! > http://www.metalbunny.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] intermediate pre-parsed or compiled PHP files possible?
Hello there, I was wondering if there was any intermediate format I could compile my PHP scripts to in order to gain speed. For example, having the format/validity of the scripts already formatted, function locations ready in an index, PHP function calls, etc etc. Sortof like "obj" files for C++. Is this available? If not, what is the easiest way to link in a few of my own fully compiled functions to be used from PHP? Thanks to everyone who has any clue what I am talking about :), Thomas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: intermediate pre-parsed or compiled PHP files possible?
> did you check www.zend.com and their caching/optimizing products? They dont seem to have anything free, I need something free. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] using semaphores problem
Hello there, I am using semaphores to synchronize access to specific database records. Problem is, it does not seem that the semaphores are being released. Not only am I using sem_release() but the PHP manual says it will release all semaphores that are still acquired at the end of the PHP page loading. Here is my simple code: function writeLock($mid) { if(!$mid) mydi('attempt to lock data 0'); if(!($lock_id = sem_get(2500+200+$mid%100)) || !sem_acquire($lock_id)) mydi('locking match.'); return $lock_id; } =AND= function unwriteLock($lock_id) { if(!$lock_id) mydi('attempt to unlock 0'); if(!sem_release($lock_id)) mydi('unlocking information.'); } Suggestions? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: using semaphores problem
Ok, I got it working so long as sem_release is SPECIFICALLY called. Problem is I have a lot of "die" calls throughout my scripts and I would rather not have exit hooks on every script (not sure how reliably those will ALWAYS be called, and would be a hassle to store a list of all semaphores to be released later). Why isn't PHP releasing them automatically like the manual says it should? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: semaphores not automatically releasing at end of script
The following code fails after the first call: if(!($lock_id = sem_get(2501)) || !sem_acquire($lock_id)) die('failed to get semaphore') ..do something, error triggers "exit;".. sem_release($lock_id) But having sem_release right after acquire makes everything work ok. I use FreeBSD and see there was some report of a similar problem at bugs.php.net, but there is no solution, patch, work arounds, etc posted. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: semaphores not automatically releasing at end of script
ANYONE CAN HELP WITH THIS PLEASE??? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: HOW to download PHP files without the use of a FTP client
I had a similar situation, I just made a simple editor on a PHP website, and then edited the files from any other computer. You can the editor script over a SSL secure connection or at least have it passworded if you are worried about security, but either way its safer and simpler than FTP. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Help wih select boxes pls
This is a client-side situation, so PHP probably wont help much. Some people do it with javascript and others use it by submitting forms and refreshing the page everytime it is changed. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Looking for content writers for new IT magazine
I might be interested, I will email you about doing a column. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Binary Header
You need to send a Content-Type header, I believe it is octet-stream or something similar to that. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Mutex Access Available?
Is there any mutex access with PHP or just the SysV semaphores? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: copy image from database
"copy" copies file to file, not data to a file (creating files). You should look at using fopen() and fwrite() instead. You may also want to check the returned value from these functions to see if an error occurred. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] DB calls vs Session solution
Hi there, Quick question on performance: I have got some expensive sql queries (doing lots of LEFT JOINS) that result in anything between 10 to 1 results. I need to do paging on those. So far I have used a LIMIT solution which will not do anymore because you don't get the whole total. Now, the idea is to store the results (or the sql query string?) in the session to avoid too many db calls (on paging). The question now is: is the serializing/unserializing more expensive than another db call? Thanks, T SPIRAL EYE STUDIOS P.O. Box 37907, Faerie Glen, 0043 Tel: +27 12 362 3486 Fax: +27 12 362 3493 Mobile: +27 82 442 9228 Email: [EMAIL PROTECTED] Web: www.spiraleye.co.za -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Multiple inserts as a single string?
Hi there, I have a bit of strange question: when wanting to insert multiple records into the db, instead of looping through the set and executing mysql_query (which will then call the db n times), is it not better to concat a string with all the insert statements and let mysql handle the inserting, that way we don't call the db n times from php. Does that make any difference? Maybe I am just stupid . Thomas
RE: [PHP] Multiple inserts as a single string?
Hi Chris, Thanks, I thought so. You are quite right with the errors, I ran into some where it looked like that php does not allow you to execute such a concated string ... the error started at the second insert statement with no apparent reason. Is that a ph restriction? Thomas -Original Message- From: Shaw, Chris - Accenture [mailto:[EMAIL PROTECTED] Sent: 02 June 2005 12:20 PM To: Thomas; php-general@lists.php.net Subject: RE: [PHP] Multiple inserts as a single string? Thomas, If you're inserting alot of rows, (eg millions) then concating them and calling the db once probably would give a small speed advantage, because of the database handshaking. But I would look at the load the database is under, if there is alot of users hitting the database with small inserts/queries then the database is going to suffer as opposed to the same number of users hitting the database once with a script. The only problem I can think of, from php (client) point of view, if the script (concated inserts) errors, then you will need to handle where it went wrong, if it was loop, you know exactly what went wrong by outputing the current insert statement. C. -Original Message- From: Thomas [mailto:[EMAIL PROTECTED] Sent: 02 June 2005 10:20 To: php-general@lists.php.net Subject: [PHP] Multiple inserts as a single string? Hi there, I have a bit of strange question: when wanting to insert multiple records into the db, instead of looping through the set and executing mysql_query (which will then call the db n times), is it not better to concat a string with all the insert statements and let mysql handle the inserting, that way we don't call the db n times from php. Does that make any difference? Maybe I am just stupid . Thomas This message has been delivered to the Internet by the Revenue Internet e-mail service * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: 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] Multiple inserts as a single string?
Thanks Richard that makes it clear. Thomas -Original Message- From: Richard Davey [mailto:[EMAIL PROTECTED] Sent: 02 June 2005 12:43 PM To: php-general@lists.php.net Subject: Re: [PHP] Multiple inserts as a single string? Hello Thomas, Thursday, June 2, 2005, 10:20:11 AM, you wrote: T> I have a bit of strange question: when wanting to insert multiple T> records into the db, instead of looping through the set and T> executing mysql_query (which will then call the db n times), is it T> not better to concat a string with all the insert statements and T> let mysql handle the inserting, that way we don't call the db n T> times from php. Does that make any difference? Sure.. mysql_query doesn't support more than one query in the sql statement. If you want to do that then upgrade to PHP 5 (if you're not using it already) and use mysqli_multi_query instead. I guess packages like Pear DB may offer similar functionality, but I don't know for certain. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services "I do not fear computers. I fear the lack of them." - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] tidy question
Hi there, I was wondering if it is possible to let tidy repair and format only parts of your html without putting the and stuff in. I.e. only the content of the page between the tags. The reason for that is twofold: 1. I want to cache that repaired string so I don't have to call that repair function on every page call, 2. I am using xhtml1.1 as DOCTYPE and tidy only gives me the 1.0 transitional version. Thanks, Thomas
[PHP] Flexy help
Hi there, I would like to find out about the usage of custom tags in Flexy. I would like to do something like , or similar. The documentation is very scarce about this. It would be great if you could help me, otherwise refer me to a good documentation page (the one in the pear manual is not sufficient). Thanks Thomas
[PHP] DB relationship chart generator?
Hi there, Is there an app out there that can easily create a relationship (flow) diagram of a given database? Thomas
[PHP] Conceptional question
Hi there, I have a conceptional question about storing images/files on a server. When the application gives users a possibility to store up to 20 images, would it be better to create a new folder for each signed-up user to store the images in, or use one large folder. I have done the last quite often (just renamed the files to the insert id) with good success. Any ideas? Thomas
[PHP] Tracking a mobile phone
Hi there, I was wondering if anybody has attempted to track a mobile phone through a country. I know that this is usually more a case for the FBI . a friend of mine is going on a 4 month bike tour and I would like to 'track' him for locations. I thought of an sms receiving system, but if could do any other way would be great. Any ideas? Thomas
[PHP] dynamically selecting a function
Hi there, How can I do something like this: [snip - theoretical code] if( isset($step) ) echo step.$step() ) [/snip] $step would be an int (I would check that before) and then I would have all sorts of functions like step1(), step2() . etc. Any ideas? Thomas
RE: [PHP] Re: dynamically selecting a function
Thanks Burhan. Is there much overhead? Norbert: that's what I am doing now, just wanted to save some code. :-) Thomas -Original Message- From: Norbert Wenzel [mailto:[EMAIL PROTECTED] Sent: 08 August 2005 11:18 AM To: php-general@lists.php.net Subject: [PHP] Re: dynamically selecting a function Thomas wrote: > Hi there, > > > > How can I do something like this: > > > > [snip - theoretical code] if( isset($step) ) echo step.$step() ) [/snip] > > > > $step would be an int (I would check that before) and then I would have all > sorts of functions like step1(), step2() . etc. > > > > Any ideas? > > > > Thomas What about switch / case? switch($step) { case 1: step1(); break; case 2: step2(); break; default: defaultStep(); break; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php as standalone?
Hi there, I am going to take that chance now to ask if it is viable to create a standalone app with php and gtk+, fully realizing that this IS the php list ;-) I was thinking of php/gtk+ because I need that as a cross-platform application. What I really would like is to have .rpm's and .exe's created, so one can include them in the OS startup. Is this possible at all with php? Has anyone worked with php to create standalone apps? I essentially want to be able to auto update and synchronize a local xml based database with an online one (ok, plus doing some viewing and creating of reports, and so on, and so forth . ) Alternatives could be: mono, qt (arrgh), mozilla/xul (any done that?) or Java :-( . Any thoughts on that? Thomas
[PHP] Protecing files
Hi there, How can I protect all files with extension .xml from being accessed by the outside? For Apache can one use .htaccess (if yes, how?), is there a generic way of keeping stalkers from viewing your config files? Thomas SPIRAL EYE STUDIOS P.O. Box 37907, Faerie Glen, 0043 Tel: +27 12 362 3486 Fax: +27 12 362 3493 Mobile: +27 82 442 9228 Email: [EMAIL PROTECTED] Web: <http://www.spiraleye.co.za> www.spiraleye.co.za
RE: [PHP] Protecing files
Hey guys, Thanks for all the answers. I had not considered leaving the xml file outside the webroot (duh!). However, in this case I don't think it would work, as the project is working through a svn structure (and some boxes run Linux, otherwise Win). I thought that the .htaccess would have been the best (apparently not?). Anyway, I will give the filtering out of the .whatever a shot. One thing on that: how about portability? What if I didn't have access to the httpd.conf file of Apache on the live server? How will I enable such rules (without having to bother the server dude, who may or may not like to do that)? From that question, .htaccess files seemm the most portable solution. Thanks again. t -Original Message- From: Rory Browne [mailto:[EMAIL PROTECTED] Sent: 29 August 2005 07:59 PM To: Thomas Cc: php-general@lists.php.net Subject: Re: [PHP] Protecing files Personally I reckon that you should simply place them outside the webroot. If you are either too lazy to do this, or too paranoid for this alone, then you could consider renaming them from filename.xml to .ht_filename.xml. There is a section in most default apache config files to make filenames beginning with .ht to be unaccessable. I would recommend against filtering out .xml files. Whilst they may only be config files at the minute, you may in future wish to serve up xml files. I would instead suggest that you change your naming scheme to have config files ending in .conf, .config, .settings, or .set or something else non-standard, and fileter out that. A file doesn't have to be called something.xml to contain xml. If for example you want to filter out pages ending in .conf, then you could do something like this(assuming my understanding of apache regex is correct - big assumption but I'm sure someone will enlighten us if it's incorrect): Order allow,deny Deny from all You could also shove that into a .htaccess file, but apache docs recommend against it(or rather they recommend against the enabling of .htaccess. On 8/29/05, Thomas <[EMAIL PROTECTED]> wrote: > > > > Hi there, > > How can I protect all files with extension .xml from being accessed by the > outside? For Apache can one use .htaccess (if yes, how?), is there a generic > way of keeping stalkers from viewing your config files? > > Thomas > > > > > > SPIRAL EYE STUDIOS > P.O. Box 37907, Faerie Glen, 0043 > > Tel: +27 12 362 3486 > Fax: +27 12 362 3493 > Mobile: +27 82 442 9228 > Email: [EMAIL PROTECTED] > Web: <http://www.spiraleye.co.za> www.spiraleye.co.za > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] intval() vs. (int)
Hi, On checking form fields that they are of type int, what is best to use: intval() or type casting (int)? In terms of speed, would (int) not be better, because we save a function call (especially on very large sql statements)? Thanks. Thomasx` SPIRAL EYE STUDIOS P.O. Box 37907, Faerie Glen, 0043 Tel: +27 12 362 3486 Fax: +27 12 362 3493 Mobile: +27 82 442 9228 Email: [EMAIL PROTECTED] Web: www.spiraleye.co.za -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] __FILE__ and __LINE__ of calling scripts?
Hi, I want to find out if it is possible to get the file name and the line number of a calling script (__FILE__, __LINE_) from a calling class automatically. Let me explain: I have a db class which gets called in other classes. Now, when an sql error occurs I would like to find out which file and on which line it was. E.g.: [snip] class DB { function doQuery( $inq ) { ... if( !this_result ) { $this->drawError(**want the __FILE_ and __LINE__ of the calling script here** ..); ... } } } class Caller { function sql_doQuery() { $SQL->doQuery('SELECT me FROM WHERE id=0'); } } [/snip] The drawError function outputs the error report to the browser and halts the script (developer debug). Currently I get the __FILE__ and __LINE__ of the DB class, i.e. where the query error happened (as in doQuery()). Instead I would like to get something like caller.fileName, caller.lineNumber (pseudo code). Is that at all possible without having to pass the file name and the line number into the query function manually? Thanks Thomas SPIRAL EYE STUDIOS P.O. Box 37907, Faerie Glen, 0043 Tel: +27 12 362 3486 Fax: +27 12 362 3493 Mobile: +27 82 442 9228 Email: [EMAIL PROTECTED] Web: www.spiraleye.co.za -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] __FILE__ and __LINE__ of calling scripts?
Hi, I know I should not top post, but here it goes anyway: just wanted to say thanks and let others know that it is SOLVED. Cool thing this function! Gotta love PHP (thank heavens I don't need to use jsp right now ...) T -Original Message- From: Mikey [mailto:[EMAIL PROTECTED] Sent: 27 September 2005 03:20 PM To: php-general@lists.php.net Subject: Re: [PHP] __FILE__ and __LINE__ of calling scripts? Thomas wrote: >Hi, > >I want to find out if it is possible to get the file name and the line >number of a calling script (__FILE__, __LINE_) from a calling class >automatically. > >Let me explain: > >I have a db class which gets called in other classes. Now, when an sql error >occurs I would like to find out which file and on which line it was. > >E.g.: > >[snip] >class DB { > function doQuery( $inq ) { > ... > if( !this_result ) { > $this->drawError(**want the __FILE_ and __LINE__ of >thecalling script here** ..); > ... > } > } >} > >class Caller { > function sql_doQuery() { > $SQL->doQuery('SELECT me FROM WHERE id=0'); > } >} >[/snip] > >The drawError function outputs the error report to the browser and halts the >script (developer debug). > >Currently I get the __FILE__ and __LINE__ of the DB class, i.e. where the >query error happened (as in doQuery()). > >Instead I would like to get something like caller.fileName, >caller.lineNumber (pseudo code). > >Is that at all possible without having to pass the file name and the line >number into the query function manually? > >Thanks > >Thomas > > >SPIRAL EYE STUDIOS >P.O. Box 37907, Faerie Glen, 0043 > >Tel: +27 12 362 3486 >Fax: +27 12 362 3493 >Mobile: +27 82 442 9228 >Email: [EMAIL PROTECTED] >Web: www.spiraleye.co.za > > > Have you tried looking up debug_backtrace() in the manual? HTH, Mikey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] serializing result sets or what?
Hi, Having spent a little time on Google (and reading unrelated articles ...) I would like post my question here again (as advice on the list is always very valuable indeed!): Q: What would be the best way to save db calls for large result sets? I thought about serializing the data and then caching it (with Cache_Lite - maybe there will be a future inclusion of such a caching scheme into the php core or pecl?). I was not sure about performance though (no time for benchmarking this). The issue is that as this system grows we get 2 - 3 db calls on the server (which is too much in my opinion), but will serializing be cheaper or simply the lesser of two evils? Thanks already (as top posting is a sin) for your replies ... T SPIRAL EYE STUDIOS P.O. Box 37907, Faerie Glen, 0043 Tel: +27 12 362 3486 Fax: +27 12 362 3493 Mobile: +27 82 442 9228 Email: [EMAIL PROTECTED] Web: www.spiraleye.co.za -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] serializing result sets, or what?
Hi, Having spent a little time on Google (and reading unrelated articles ...) I would like post my question here again (as advice on the list is always very valuable indeed!): Q: What would be the best way to save db calls for large result sets? I thought about serializing the data and then caching it (with Cache_Lite - maybe there will be a future inclusion of such a caching scheme into the php core or pecl?). I was not sure about performance though (no time for benchmarking this). The issue is that as this system grows we get 2 - 3 db calls on the server (which is too much in my opinion), but will serializing be cheaper or simply the lesser of two evils? Thanks already (as top posting is a sin) for your replies ... T SPIRAL EYE STUDIOS P.O. Box 37907, Faerie Glen, 0043 Tel: +27 12 362 3486 Fax: +27 12 362 3493 Mobile: +27 82 442 9228 Email: [EMAIL PROTECTED] Web: www.spiraleye.co.za -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] serializing result sets or what?
Thanks, that looks good. But what do I do if OS is WinDoze? The install of the pecl only gives a .so *feeling sorry not everything runs on xp* ... I will take the time to benchmark the serializing vs db calls ... is there a good benchmark tool out there (without having to use microtime inside the scripts)? Thanks T -Original Message- From: Jasper Bryant-Greene [mailto:[EMAIL PROTECTED] Sent: 28 September 2005 11:41 AM To: php-general@lists.php.net Subject: Re: [PHP] serializing result sets or what? Thomas wrote: > Q: What would be the best way to save db calls for large result sets? > > I thought about serializing the data and then caching it (with Cache_Lite - > maybe there will be a future inclusion of such a caching scheme into the php > core or pecl?). I was not sure about performance though (no time for > benchmarking this). > > The issue is that as this system grows we get 2 - 3 db calls on the server > (which is too much in my opinion), but will serializing be cheaper or simply > the lesser of two evils? A very similar question was asked recently on this list. You might like to consider caching whatever you create from those result sets rather than the result sets themselves, but APC [1] is worth looking at as I believe it can cache (some?) PHP vars without serialisation, using apc_store() and apc_fetch(). The only way to know whether such a scheme would help in your specific situation is to benchmark. Go on, it won't take long! [1] http://php.net/apc -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: 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] Web Service Php - Currency Conversion
I have used nusoap and a xmethods service. You can get the ziped files here: http://www.thomash.co.za/uploads/forex/forex.nusoap.zip Hope that helps BTW: also had issues with the PEAR package. T -Original Message- From: Sylvain Gourvil [mailto:[EMAIL PROTECTED] Sent: 28 September 2005 12:57 PM To: php-general@lists.php.net Subject: Re: [PHP] Web Service Php - Currency Conversion Jasper Bryant-Greene wrote: > Sylvain Gourvil wrote: > >> I am looking of a webservice whiwh could permit to convert euro price >> in dollar and uk pounds on my php website ! > > > http://pear.php.net/package/Services_ExchangeRates > Thanks for that but there is a bug in installation. It seems to be great. If someone has something else, I'll be pleased Have a good day ! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: 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] template systems
Hi, Templating systems are really a matter of taste. You have a few options, depending also on the paradigm you want to use (Model2, MVC ... maybe read up on that as that is good general knowledge). Also, please check the archives as this question has already been discussed at length ;-) Anyway, I will give my 5c worth, when I say that I have gotten to like HTML_Template_Flexy (a pear package) quite a lot. This paradigm forces you to do almost all of your logic stuff on the php side, whilst nicely separating html and php code (you can really end up with some pretty straight forward html pages, with a little Flexy code - cool things is also that you can use Flexy code inline (as in ) makes for neat code!) Another plus for Flexy is that it is not bloated like Smarty. Fair enough, Smarty is pretty cool, but it just gives you too many ropes to hang yourself with. Not sure how easy integration with Quickform is ... should not be a problem as most things happen on the code side anyway. Hope that helps. -Original Message- From: Eternity Records Webmaster [mailto:[EMAIL PROTECTED] Sent: 05 December 2005 11:00 AM To: php-general@lists.php.net Subject: [PHP] template systems Hi... I was wondering if there are any template systems out there that are fairly easy to use (that don't require hours and hours reading books) and that are fairly good as well? I need one also that works with pear packages since I use html_quickform a lot. I considered checking out smarty but wasnt for sure if that one would be the best. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: 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] Migration from MySQL to MS-SQL Server
Hi Behzad, It's not as easy as simply replacing the names. I went through a cycle like that myself. It is right to check your sql statements first (because 10 to 10 they will differ at some point). Be also mindful that with mssql you don't have an _insert_id() function, you would have create that first yourself, making a separate db call. Another option is to use odbc_ instead of mssql. That way you are somewhat independent of your db server (but it is more of a mission to convert). Greatest pain I had was the connection to SQL Servers. We switched to odb_ functions for that reason (but then again, we might have been stupid :-)_ If you are rewriting the project, why don't you implement a DB abstract layer, like PEAR:DB or adodb_lite? Will take you a while but will make your code look so much better. Cheers Thomas -Original Message- From: AmirBehzad Eslami [mailto:[EMAIL PROTECTED] Sent: 09 December 2005 12:56 PM To: php-general@lists.php.net Subject: [PHP] Migration from MySQL to MS-SQL Server Hi List, I want to re-implement a PHP-driven package named ATutor (http://atutor.ca) to work with MS-SQL Server. Currently, it works with MySQL. Unfortunately, authors of "ATutor" have not defined a class for database connectivity. In other words, they call each mysql functions directly in their code. It seems that I must change every line of code to make ATutor work with MS-SQL Server. 1) Is it suffice to replace every "mysql_FUNCTION" with "mssql__FUNCTION" in the code? I realized that most of MSSQL functions are very similar to MySQL functions, but their prefixes are different. (I should kindly thank the PHP Development Team for this) 2) I have not worked with MS-SQL Server before. Is there anything else which I should keep in mind? Thank you in advance, Behzad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] help me plz
Hey Suresh, You could use AJAX to populate your dropwdown boxes without reloading your browser. I used something like that in a project just now. Essentially, you will call a php script that would select your second box's data according to the value of the first. You can also do this with javascript (if you do not need 'fresh' data) Thomas -Original Message- From: Robert Graham [mailto:[EMAIL PROTECTED] Sent: 19 January 2006 09:34 AM To: suresh kumar Cc: php-general@lists.php.net Subject: Re: [PHP] help me plz suresh kumar wrote: > hi, >i am using 2 combo box one for country & another > one for city.when i select country name from combo box > their corresponding city names has to be changed in > their corresponding combo box.i dont know how 2 > implement this.pz give me some idea.its urgent. > A.suresh > > Send instant messages to your online friends http://in.messenger.yahoo.com > > Hi Suresh Have a look at QuickForm ( PEAR Module), and make use of the HierSelect option. Have a look at the following page for more info: http://www.thelinuxconsultancy.co.uk/quickform.php Regards Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP / Apache + Error 500
Hi there! I am sitting with something of a mystery and was wondering if there is someone out that might have dealt with this before: I have developed a site that runs well and fine on my machine (XP/Apache2/PHP5/MySQL5). I am using PEAR::HTML_Template_Flexy as well as Cache_Lite. The site has been put up on the live server and works (mostly) fine there too, with the exception of Internal Server errors 500, ever so often. It's pretty random and can happen to any of the scripts (they all run through a single index.php script that instantiates objects that then spit out the resulting html). I had a look at the Apache log file I got from the SP ... no clue. All I know is that they use Apache 1.x/PHP5/Linux/MySQL(v4?). They say that it is not their server but my scripts, however, if that was the case I would get these errors on my machine too. Also, the randomness of this also indicates that it can't really be my php scripts, otherwise it would happen all the time. Does anybody have any suggestion as to how I can solve this issue? I know this is pretty vague information, but it's all I have (hence the confusion). Thanks, Thomas SPIRAL EYE STUDIOS P.O. Box 37907, Faerie Glen, 0043 Tel: +27 12 362 3486 Fax: +27 12 362 3493 Mobile: +27 82 442 9228 Email: [EMAIL PROTECTED] Web: www.spiraleye.co.za -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP / Apache + Error 500
Hi Jochem, PHP5.0.4, on both systems. I suspect that either of the PEAE modules cause some server id10t error (if indeed the issue is on my side). Thomas -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: 25 January 2006 03:00 PM To: Thomas Cc: php-general@lists.php.net Subject: Re: [PHP] PHP / Apache + Error 500 Thomas wrote: > Hi there! > > I am sitting with something of a mystery and was wondering if there is > someone out that might have dealt with this before: > > I have developed a site that runs well and fine on my machine > (XP/Apache2/PHP5/MySQL5). I am using PEAR::HTML_Template_Flexy as well as php5.WHAT? > Cache_Lite. it's not completely impossible that HTML_Template_Flexy or Cache_Lite run on either php5.1 and above OR on php5.0.4 and below but not both. > > The site has been put up on the live server and works (mostly) fine there > too, with the exception of Internal Server errors 500, ever so often. It's > pretty random and can happen to any of the scripts (they all run through a > single index.php script that instantiates objects that then spit out the > resulting html). > > I had a look at the Apache log file I got from the SP ... no clue. All I > know is that they use Apache 1.x/PHP5/Linux/MySQL(v4?). php5.WHAT? I would suggest getting both systems to run the same version of the software packages you mention. it might cut out a few unknowns. > > They say that it is not their server but my scripts, however, if that was > the case I would get these errors on my machine too. Also, the randomness of > this also indicates that it can't really be my php scripts, otherwise it > would happen all the time. > > Does anybody have any suggestion as to how I can solve this issue? I know > this is pretty vague information, but it's all I have (hence the confusion). > > Thanks, > Thomas > > > SPIRAL EYE STUDIOS > P.O. Box 37907, Faerie Glen, 0043 > > Tel: +27 12 362 3486 > Fax: +27 12 362 3493 > Mobile: +27 82 442 9228 > Email: [EMAIL PROTECTED] > Web: www.spiraleye.co.za > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sockets (again)
Hi, I really need some help here because I am going to lose my mind otherwise!! A script that was running fine Friday has decided not to work for no apparent reason today. The problem seems to be with a socket_create that just stops the script, so I created a simple test script as shown below to see what happens. When I run this is simply drops out at the socket_create, no error message, nothing. Again this worked fine Friday and nothing has changed on my machine. I am running 4.2.3 on Win2K... any ideas? Help!! G. $zone = "192.168.0.60"; $port = "1"; $command = "play"; echo('here'); $slip_socket = socket_create (AF_INET, SOCK_STREAM, 0); echo('here 2'); if ($slip_socket < 0) { echo "socket_create() failed: reason: " . socket_strerror ($slip_socket) . "\n"; } else { $result = socket_connect ($slip_socket, $zone, $port); if ($result < 0) { echo "socket_connect() failed.\nReason: ($result) " . socket_strerror($result) . "\n"; } } $command=$command."\n"; echo('Sending command: '.$command.' for '.$zone.'\n'); socket_write ($slip_socket, $command, strlen ($command)); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: imap
On Mon, 25 Nov 2002 14:14:54 -0500 [EMAIL PROTECTED] (Greg) wrote: > Can I user php to create IMAP mailboxes? I'm using Cyrus and php and apache > are running on the same computer as Cyrus. Thanks! > -Greg > > Maybe something like that would fit your needs: http://www.delouw.ch/linux/web-cyradm/ Thomas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] re-writing to the same socket
Hi, I have some code that writes data to a socket (works fine) and stores the resource id created in a table with the column defined as varchar (80). Then the next time I need to write data to the same IP I retrieve the resource id and reuse it. Problem is that the socket_write seems to work fine (it returns no error) and yet the data appears to disappear into the ether...I am using 4.2.3 client on Win2K and server on Linux. Anyone have any ideas. Any help much appreciated. G. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] help with session variables
"; } include ('./footer.php'); ?> What i need is to declare the arrays $names and $prices And select the prodid as key and the title as val how can I do this? I tried "select prodid as key, title as val but that doesnt work. thx for any help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Guestbook
Hi, you give less information. How do you compute the entry number and how do you save the entries and so on. Normally you will have to live with the gaps but sure, you can touch every entry and change its number ;-). Thomas On Sun, 1 Dec 2002 10:33:45 - [EMAIL PROTECTED] (Vicky) wrote: > Hiya ^_^ > > I have a guestbook I coded myself using PHP. In the corner it keeps record > of the entry number, but when I delete and entry the entries posted after it > don't go back to catch up. So the entry numbers skip from 22 to 24, for > example. > > Is there anyway to stop this happening, so if i delete an entry the next one > will follow on instead of being the number it would have been if i hadn't > deleted the entry? > > Thanks ^_^ > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Trouble-Ticket-Systems?
Hi folks, I already searched through the web but couldn't find any which provide the features I want. What I would want to see in such a system: - adding TroubleTickets through webinterface or sending an email to an support email-address - adding answers to troubletickets to their parent - nice admininterface to answer support-requests and add comments (not sent to visitors) - open/close/stalled/bogus ... and so on tags for the system - ... So the question is, does anyone know any good troubleticket/helpdesk-systems written in PHP? Thanks, Thomas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Trouble-Ticket-Systems?
Sounds interesting. I used RT at work but it was a nightmare to install and since my machine is a pure PHP-Apache I don't want to install mod_perl-support as well. Let me know if you need help on some parts. Thomas On Sun, 1 Dec 2002 14:33:02 -0500 [EMAIL PROTECTED] (Jonathan Chum) wrote: > I actually spent all day last Wednesday for looking for such a tool to > integrate into a web hosting control panel we've built, but there really > isn't a good one out there. PerlDesk is a free one that is template based, > yet it's lacking a few features. At work, we use Response Tracker v2 (RT) > which is also Perl based, but the template engine is nightmare to give it a > new look. It has everything you mention below, but the interface and > installation is the drawbacks. > > So, I spent my Thanksgiving weekend working on PHP port of RT2 which at the > moment is able to authenticate technicians, create a new ticket, > reply/comment to tickets, activity logging, queue stats, and a few other > things. > > I haven't done the client side yet, but shouldn't be too hard since the DB > schema is complete and I can safely reuse templates in the technician screen > for the client area with a small bit of changing out the WHERE clauses in > the SQL querying. > > The DB layer is ADODB so it can be ported over to PostGreSQL later on. > Smarty is the template class I'm using with custom error pages on all > errors, warning, or notices. > > Until the web interface is hardened, then I'll work on email parser to pipe > it into database and parse MIME attachments. . . I'd like to see it evolve > into something like cyracle.com where there is a knowledge base in which the > visitor can rummage through before submitting in a ticket. > > "Thomas Seifert" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hi folks, > > > > I already searched through the web but couldn't find any which provide the > features I want. > > > > What I would want to see in such a system: > > - adding TroubleTickets through webinterface or sending an email to an > support email-address > > - adding answers to troubletickets to their parent > > - nice admininterface to answer support-requests and add comments (not > sent to visitors) > > - open/close/stalled/bogus ... and so on tags for the system > > - ... > > > > > > So the question is, does anyone know any good > troubleticket/helpdesk-systems written in PHP? > > > > > > Thanks, > > > > Thomas > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: print to file
$fp=fopen("filename","a"); fputs($fp,"text to the file"); fclose($fp); Regards, Thomas On Mon, 2 Dec 2002 15:52:23 -0800 (PST) [EMAIL PROTECTED] (Bryan Koschmann - Gkt) wrote: > Okay, this is probably stupid, but how do you print to a file? > > Thanks, > > Bryan > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL Server
"mysql"-database contains all the system tables and users. Users are only inserted there and defined for which database they are made. As Jason suggested, look at mysql.com they have a fine manual with tutorials and long descriptions which lead to easy solutions to create users. i.e. search for the "grant"-statement. Thomas On Tue, 3 Dec 2002 16:56:40 -0700 [EMAIL PROTECTED] (Chase) wrote: > Thanks for the info... As it turns out, I am just a blithering idiot... I > didn't know that I had to create a separate user... As I said, that shows > my newbieness... > > However, this has lead me to another question... The default database, > "mysql," comes with a "users" file already... How do I create that in a new > database?? Or can I just copy the existing to a new database? > > Chase > > > "Jason Wong" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > On Tuesday 03 December 2002 23:09, Chase wrote: > > > I am the first to admit that this question belongs on a MySQL newsgroup > > > instead of here, but I can't seem to find a newsgroup that will answer > > > me... > > > > www.mysql.com > > > > > Here is a newbie question. I am running a Win2K Advanced Server with > IIS > > > 5, PHP4, and MySQLmax 3.23.53. I am by no means experienced in > setting > > > up any of these items, but my simple question is, how do I determine the > > > name of the MySQL server so I can get PHP to connect to it? > > > > If they're all on the same server use 'localhost'. > > > > -- > > Jason Wong -> Gremlins Associates -> www.gremlins.biz > > Open Source Software Systems Integrators > > * Web Design & Hosting * Internet & Intranet Applications Development * > > > > /* > > My father was a God-fearing man, but he never missed a copy of the > > New York Times, either. > > -- E.B. White > > */ > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Checking for Overlapping Dates
Hi, Background: I've created a vacation-request application for our company's intranet. When an employee requests a vacation, he has to list the name of another employee who will 'fill in' for him while he is gone. Before a vacation request can be saved in MySQL, I need to check to make sure that the person listed as the employee's replacement during this time has not already requested a vacation during the same time period...to check to be sure that the two vacation periods do not overlap. Date Ranges: I have fields saved in MySQL called unixStartDate & unixEndDate that are unix timestamps for the first day of the employee's vacation and the last day of the emplosyee's vacation. I have tried to do a check using purely SQL, but this doesn't account for all possibilities of overlapping dates: (unixStartDate is the unix timestamp for the replacement, whereas the PHP var $unixStartDate is the unix timestamp for the employee who wants to post a new vacation request) $checkSQL = "SELECT * from $DB_TBLName WHERE (Trim(WorkerEmail)='$userReplacementEmail') AND (Status < 40) AND ( ( ($unixStartDate = unixStartDate) ) OR ( ($unixEndDate = unixEndDate) ) OR ( ($unixStartDate = unixEndDate) ) OR ( ($unixEndDate = unixStartDate) ) OR ( (unixStartDate < $unixStartDate) && (unixEndDate > $unixEndDate) ) OR ( (unixStartDate > $unixStartDate) && (unixEndDate < $unixEndDate) ) ) "; So I think what I instead need to do is use PHP code instead of SQL to check for overlapping dates in the 2 date ranges I have. My two ranges would be like this: Replacement's Date Range: $unixStartDateReplacementVacation ...to... $unixEndDateReplacementVacation Employee's Date Range: $unixStartDateEmployeeVacation ...to.. $unixEndDateEmployeeVacation ...so i need to check that none of the dates occuring in the first date range listed above appear in the second date range. unfortunately, i have no basic idea of how i should go about doing this...should i use arrays of dates, for-loops, or what? thanks a whole lot in advance, Tom
[PHP] socket timeout
Hi, I am attempting to timeout a socket_read() that is part of a handshaking process using socket_set_timeout(). Problem is it doesn't seem to work at all. If I switch of the handshaking write on the server side the read just sits there and doesn't time out at all. I have tried socket_set_timeout($socket,1) which I believe is 1 second and it never times out... Any thoughts on this would be most appreciated. Gareth -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: socket timeout
Hi, apparently this does not work with socket_read() but only with higher level socket functions (fread etc). However I have found a function called socket_set_nonblock(socketname) which apparently does something very similar, it prevents the socket_read from waiting to receive data. I simply built my own timeout loop into the code and voila!! Gareth "Gareth Thomas" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, > > I am attempting to timeout a socket_read() that is part of a handshaking > process using socket_set_timeout(). Problem is it doesn't seem to work at > all. If I switch of the handshaking write on the server side the read just > sits there and doesn't time out at all. I have tried > socket_set_timeout($socket,1) which I believe is 1 second and it never times > out... > > Any thoughts on this would be most appreciated. > > Gareth > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Just Curious
Mail/News-Client Sylpheed On Sat, 7 Dec 2002 23:31:57 -0500 [EMAIL PROTECTED] (Conbud) wrote: > I was just curious, but what program or website do you all use to view and > reply to the newsgroups with ? > > Lee > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Pls Help: Moving script from Win to Linux
If you do not want to re-write all your code and your web server is Apache and your host allows the use of .htaccess files you can turn register_globals = on programmatically: http://www.php.net/manual/en/configuration.directives.php#ini.register-globa ls (php_flag register_globals = ON;) i think. Just a thought, -Craig >>-Original Message- >>From: Rodney Green [mailto:[EMAIL PROTECTED]] >>Sent: Tuesday, December 10, 2002 11:35 AM >>To: Shane; [EMAIL PROTECTED] >>Subject: Re: [PHP] Pls Help: Moving script from Win to Linux >> >> >>Needs to be changed to the following if your forms are using the GET >>HTTP method: >> >>if(!isset($_GET["var"])){ >>// do nothing >>}else{ >>// VAR IS SET.. DO SOMETHING >>} >> >>If your forms use the POST HTTP method then it needs to be changed to: >> >> >>if(!isset($_POST["var"])){ >>// do nothing >>}else{ >>// VAR IS SET.. DO SOMETHING >>} >> >> >> >>> I can pass variables till I am blue in the face, even >>> see them in the URL but they are still showing up as (!isset) >> >>Are you accessing these variables through $var or $_GET["var"]? >> >>I am accessing them as $var. >> >>Example (from memory) >> >>if(!isset($var)){ >>// do nothing >>}else{ >>// VAR IS SET.. DO SOMETHING >>} >> >>Real basic stuff, but if I echo out the value so I see if it matches >>what I see in the above URL I get... >> >>(SAMPLE URL) blah/my_url.php?submit=submit >> >>(SAMPLE CODE) >> >>(SAMPLE RESULTS) Submit = >> >>Thanks gang! >> >>I have never needed to use $_GET["var"] >>What is the main difference? >>Would this be a setting difference between a WIN setup of PHP and a >>Linux setu of PHP? >> >>- over >> >>-- >>PHP General Mailing List (http://www.php.net/) >>To unsubscribe, visit: http://www.php.net/unsub.php >> >> >> >>-- >>PHP General Mailing List (http://www.php.net/) >>To unsubscribe, visit: 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] Re: Help please: Unable to get $_POST["variable"]; to work in a form.
Using $_REQUEST[""] works because the vars are in the http request, but $_POST[""] contains nothing as the other poster noted: mehtod="post" >>-Original Message- >>From: David Scott [mailto:[EMAIL PROTECTED]] >>Sent: Tuesday, December 10, 2002 1:20 PM >>To: [EMAIL PROTECTED] >>Subject: [PHP] Re: Help please: Unable to get $_POST["variable"]; to >>work in a form. >> >> >>Using $_REQUEST["variable"] causes the script to work. >>Why is this? And, why can I not use $_POST? >> >>"David Scott" <[EMAIL PROTECTED]> wrote in message >>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]... >>> I am going through the introductory tutorial on >>http://www.php.net/ and am >>> stuck on this page: >>> http://www.php.net/manual/en/tutorial.forms.php >>> >>> I have been able to get all of the examples up to this point to work. >>> >>> The form is simple: it asks for a text "name", a text "age" and has a >>submit >>> button. The information is submitted to action.php. >>> >>> Action.php contains this code: >>> Hi . >>> You are years old. >>> >>> I saved action.php as a text file with only the information above. >>> >>> When I enter JoeBob into the name field and 27 into the age field, I get >>> this for output: >>> Hi >>> Notice: Undefined index: name in c:\inetpub\wwwroot\action.php on line 1 >>> . You are >>> Notice: Undefined index: age in c:\inetpub\wwwroot\action.php on line 2 >>> years old. >>> >>> What can I do to remedy this? >>> >>> >> >> >> >>-- >>PHP General Mailing List (http://www.php.net/) >>To unsubscribe, visit: 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] Pls Help: Moving script from Win to Linux
>>Can't be done at run-time. See table in manual. Perhaps "programmatically" was the wrong word. Using .htaccess files it can be set per directory/site. http://www.php.net/manual/en/security.registerglobals.php (read to the BOTTOM of the page). -Craig >>-Original Message- >>From: Jason Wong [mailto:[EMAIL PROTECTED]] >>Sent: Tuesday, December 10, 2002 2:04 PM >>To: [EMAIL PROTECTED] >>Subject: Re: [PHP] Pls Help: Moving script from Win to Linux >> >> >>On Wednesday 11 December 2002 02:38, Craig Thomas wrote: >>> If you do not want to re-write all your code and your web >>server is Apache >>> and your host allows the use of .htaccess files you can turn >>> register_globals = on programmatically: >>> >>> >>http://www.php.net/manual/en/configuration.directives.php#ini.regi >>ster-glob >>>a ls >>> >>> (php_flag register_globals = ON;) i think. >> >> >>-- >>Jason Wong -> Gremlins Associates -> www.gremlins.biz >>Open Source Software Systems Integrators >>* Web Design & Hosting * Internet & Intranet Applications Development * >> >>/* >>A government that is big enough to give you all you want is big enough >>to take it all away. >> -- Barry Goldwater >>*/ >> >> >>-- >>PHP General Mailing List (http://www.php.net/) >>To unsubscribe, visit: 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] Re: Problems connecting to a MySQL database
>>previous page. Try putting the log in information and anything >>else needed >>in hidden fields in your form. YIKES!...hidden form fields are viewable in the html source generated. session_register() anyone? I thought you were trying to re-use the db connection? if so, use mysql_pconnect() if the mysql.allow_persistent directive is enabled. -Craig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP + MySQL looping question
>>The problem is I have to reset the SQL result array on each for >>loop. How do >>you do that? $myNewArrayFullofSqlResultsThatICanLoopOverAsManyTimesAsIWant = mysql_query($sql); -Craig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP + MySQL looping question
Set the new array before your for loops, then loop over the array. -Craig >>-Original Message- >>From: Mark McCulligh [mailto:[EMAIL PROTECTED]] >>Sent: Thursday, December 12, 2002 4:56 PM >>To: [EMAIL PROTECTED] >>Subject: Re: [PHP] PHP + MySQL looping question >> >> >>If I understand you if you use the mysql_query($sql) again won't >>it rerun my >>SQL again, not just reprint. >> >>Example: >> >>$result = mysql_query($sql); >>for ($i = 1; $i <= 3; $i++) { >> while ($row = mysql_fetch_array($result)) { >>//Some Code >>echo $row['filed']; >>} >> //Reset result array >> $result = mysql_query($sql); >>} >> >>-- >>_____ >>Mark McCulligh, Application Developer / Analyst >>Sykes Canada Corporation www.SykesCanada.com >>(888)225-6824 ex. 3262 >>[EMAIL PROTECTED] >>"Craig Thomas" <[EMAIL PROTECTED]> wrote in message >>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]... >>> >>The problem is I have to reset the SQL result array on each for >>> >>loop. How do >>> >>you do that? >>> >>> $myNewArrayFullofSqlResultsThatICanLoopOverAsManyTimesAsIWant = >>> mysql_query($sql); >>> >>> -Craig >>> >> >> >> >>-- >>PHP General Mailing List (http://www.php.net/) >>To unsubscribe, visit: 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] MySQL error
>> $mysql_result = mysql_query($query, $mysql_link); I am not sure if this is your only problem or not, but mysql_result(); is a function in php. Using a function name as a variable seems like it will just lead to confusion to me. I'd try to avoid it. >>--> line 36 while($row = mysql_fetch_row($mysql_result)) Anyway, where do you define $row? HTH -Craig >>-Original Message- >>From: GWAD Mailinglist [mailto:[EMAIL PROTECTED]] >>Sent: Thursday, December 12, 2002 6:01 PM >>To: [EMAIL PROTECTED] >>Subject: [PHP] MySQL error >> >> >>Hi, >> >>I have following problem: >> >>list.php3 >> >>> >>// connect to db >>include("connect_db.php3"); >> >> // get everything from catalog table >> >>$query = "SELECT * FROM yritykset ORDER BY ynimi ASC"; >> >> $mysql_result = mysql_query($query, $mysql_link); >> >>// get each row >> >>--> line 36 while($row = mysql_fetch_row($mysql_result)) >> >>{ >> >>//get columns >> >> $id = $row[0]; >> $ynimi = $row[1]; >> $ylahi = $row[2]; >> $ypostios = $row[3]; >> $ypostitmp = $row[11]; >> >> print("\n"); >> print("\n"); >> >> print("$ynimi, $ylahi, $ypostios >>$ypostitmp\n"); >> print(">HREF=\"tarkenna.php3?id=$id\">MUOKKAA> - >HREF=\"poista.php3?id=$id\">POISTA>"); >> >> print("\n"); >> print("\n"); >> >>} >> >>// disconnect >>mysql_close($mysql_link); >>?> >> >>when run, i'll following error messages: >> >>Warning: mysql_fetch_row(): supplied argument is not a valid MySQL >>result resource in /www/domains/lammidb.phnet.fi/public_html/kaikki.php3 >>on line 36 >> >> >> >>-- >>PHP General Mailing List (http://www.php.net/) >>To unsubscribe, visit: 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] MySQL error
--> line 36 while($row = mysql_fetch_row($mysql_result)) >> >>Anyway, where do you define $row? >> >>HTH >> >>-Craig DOH! it's been a long one... -Craig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] function/class for updating multiple-tables automatically?
Hi folks, I'm looking for a function or class which is able to automatically update multiple tables. The hard thing on this is, I only want to give it some predefined arrays which define the table-structures (and maybe aliases for some fields) and on execution it only gets some field-names and their corresponding values. It should compute then the required tables to update based on the involved fields and update them with the values given. I know I could do it on my own with some work but I'm hoping someone has already developed something like that. Thanks, Thomas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: function/class for updating multiple-tables automatically?
oh, some addendum, I would need it for MySQL if its dependend. Thomas On Mon, 16 Dec 2002 21:46:34 +0100 [EMAIL PROTECTED] (Thomas Seifert) wrote: > Hi folks, > > I'm looking for a function or class which is able to automatically update > multiple tables. > > The hard thing on this is, I only want to give it some predefined arrays which > define the table-structures (and maybe aliases for some fields) and on execution > it only gets some field-names and their corresponding values. > It should compute then the required tables to update based on the involved fields > and update them with the values given. > > I know I could do it on my own with some work but I'm hoping someone has already > developed something like that. > > > Thanks, > > Thomas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Inserting tab delimited textfiles into mysql
I got a tab delimited file which looks like this: let us call it items.txt TypeCatalog NumberItem DescriptionSide BProducer 12 AAA502 Afu Ra-D&D Soundclash Mic Stance, Premeir,Curt Cazall 12 AC725 Roc Raida/Wayne-O - Gong Show Burn That Ass Roc Raida I want to take all this info and insert it into my mysql dbase. The type is in a table named categories. The rest should go into the table named items. With also the id number off the categorie in it. I have been looking for info on how to do this but I can't find a decent article about it. First off I dump all the records which were already in the dbase. And then it needs to get filled up with the new items.txt I would appreciate your help greets -- Thomas Goeminne -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Writing byte 0A to a file (LF / CR related)
from the manual: Note: On systems which differentiate between binary and text files (i.e. Windows) the file must be opened with 'b' included in fopen() mode parameter. Thomas On Wed, 25 Dec 2002 11:43:13 +0100 [EMAIL PROTECTED] (Bbun) wrote: > Hey, > > I am trying to write some binary data (image) to a file, but using fputs, > every 0A byte will be written as 0D 0A. This is because of the windows > representation of a new line (\r\n), but I'm not writing a text file! I'm > writing binary data! Does anyone know how I can make this work correctly? > > Thanks > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] imap_set_quota function
an excerpt from php man pages says that: "This function requires the imap_stream to have been opened as the mail administrator account. It will not work if opened as any other user. ... ... $mbox = imap_open ("{your.imap.host:143}", "mailadmin", "password"); " my question is, where do i set this admin called 'mailadmin' with password 'password'. do i set it in courier/uw for example? -- __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Repeats of values
On Tue, 31 Dec 2002 10:47:57 -0600 [EMAIL PROTECTED] (Anthony Ritter) wrote: > while($line = mysql_fetch_array($result)){ > print "\t\n"; > while(list (,$value) = each ($line)) { Thats just wrong, mysql_fetch_array returns an array with all the fields accessible per field-id and field-name so you have each field twice. You can try this print_r($line); to see that. either access the rows by using mysql_fetch_row (only an enumerated array is returned so each value only once) or better access the values in the array directly: while($line = mysql_fetch_array($result)){ print "\t\n"; print "".$line['level']."\n"; print "".$line['pm']."\n"; print "".$line['date']."\n"; print "\t\n"; } Regards, Thomas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How To Delete Multiple Items Of Multiple Tables Using PHPand MySQL
there is no need to close and open the connection for every query. just run the mysql_query again and again and again on the open connection. Still Stephen's quote is true, you can't run more than one query by one call to mysql_query. Thomas On Tue, 31 Dec 2002 16:30:38 -0600 [EMAIL PROTECTED] (@ Nilaab) wrote: > I was hoping for better news. Thanks for the suggestion, but it will put a > very big strain on my application since every DELETE query will open and > close the mysql connection everytime. Think about deleting 100s of records > one at a time. Surely someone has thought of a better way to do this with > MySQL 3.23. Also, I don't want to run persistent connections, as I only have > a limited number of simultaneous connections to the database currently. Is > there a better way to do all this? Anyone? > > > -Original Message- > > From: Stephen [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, December 31, 2002 1:10 PM > > To: @ Nilaab > > Cc: PHP List > > Subject: Re: [PHP] How To Delete Multiple Items Of Multiple Tables Using > > PHP and MySQL > > > > > > From experience, I don't think you can run more then one SQL statement at > > once in a single time. Try assigning each variable with delete, then query > > them all seperately. I also don't think you need the ; in the SQL > > statement... > > > > > > - Original Message - > > From: "@ Nilaab" <[EMAIL PROTECTED]> > > To: "Php-General" <[EMAIL PROTECTED]> > > Sent: Tuesday, December 31, 2002 1:36 PM > > Subject: [PHP] How To Delete Multiple Items Of Multiple Tables > > Using PHP and > > MySQL > > > > > > : Hello Everyone, > > : > > : I want to DELETE multiple items of multiple TABLES in a MySQL > > database. My > > : version of MySQL is 3.23, which means this version doesn't support the > > : DELETE functionality on multiple tables. The following is my PHP code, > > where > > : $item_id is a multi-dimensional array containing the ids of the items I > > want > > : to delete from the table. > > : > > :# DELETE records > > :for ($i = 0; $i < count($item_id); $i++) { > > : $query_item2 .= "DELETE QUICK FROM item_dimension WHERE item_id = > > : '".$item_id[$i][0]."'; "; > > : $query_item2 .= "DELETE QUICK FROM item_popup WHERE item_id = > > : '".$item_id[$i][0]."'; "; > > :} > > : > > : When I run this through the database using PHP, it returns a > > syntax error > > in > > : the SQL. So what I did was echo out $query_item2, then copied and pasted > > the > > : SQL into the MySQL application manually, and ran it through. Well the > > exact > > : same SQL statement that I used in PHP worked when I entered it > > manually in > > : MySQL. In other words it didn't work doing it through PHP, but it worked > > in > > : MySQL directly. What gives? Is there a better way to delete > > multiple items > > : from multiple tables with one SQL string? I don't want to > > separate the two > > : DELETE functions and run them through two separate times because of > > overhead > > : concerns. I tried looking on the MySQL and PHP website for > > better ways of > > : using DELETE syntax on multiple tables, but I had no luck > > finding anything > > : useful with my version of MySQL. Any help would be greatly appreciated. > > : > > : > > : -- > > : PHP General Mailing List (http://www.php.net/) > > : To unsubscribe, visit: http://www.php.net/unsub.php > > : > > : > > : > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] signal handler to ignore kill of parent
Hi, i need some way for child-processes to ignore the kill of their parent. Any idea? Thanks, Thomas 'Neo' Weber --- [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 2 servers for mail implementation
dear all, i have 2 servers that were *given* to me to setup and implement webmail solution for our client. i have done some groundwork in terms of the backend applications that are needed to do this. what i wanted to know is, how best can i distribute the backend applications between those 2 servers to achieve a balance and fast response. can i go like this: server A ldap courier-imap server B apache php qmail for mysql, i have an existing server that i will use for database queries. appreciate your kind advice. best rgds. roger __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] signal handler to ignore kill of parent
I am using the pcntl_ fork() from PHP. The problem with exec() is that i need the variables and socket-descriptors from the parent. Thomas 'Neo' Weber --- [EMAIL PROTECTED] [EMAIL PROTECTED] - Original Message - From: "Michael J. Pawlowsky" <[EMAIL PROTECTED]> To: "PHP-List" <[EMAIL PROTECTED]> Sent: Thursday, January 02, 2003 7:42 PM Subject: Re: [PHP] signal handler to ignore kill of parent > > Actually let me try to be a bit more helpful... nut not much though :-) > > Did you write the code for the fork(); > > Can you modify it? Read the fork, exec and clone man pages. > This might help you a bit understand the behaviour. > > If so just call exec from the forked process... this will create a new process instead of a child one. > Then call exit() in your forked process. > > Mike > > > > > > > *** REPLY SEPARATOR *** > > On 02/01/2003 at 7:05 PM Thomas Weber wrote: > > >Hi, > > > >i need some way for child-processes to ignore the kill of their parent. Any > >idea? > > > >Thanks, > >Thomas 'Neo' Weber > >--- > >[EMAIL PROTECTED] > >[EMAIL PROTECTED] > > > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: 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] ftp_put: permission denied
it may be, that destiny is wrong. the error-message tells that you don't have access to where you are trying to upload the file to. Thomas On Wed, 08 Jan 2003 20:59:02 +0100 [EMAIL PROTECTED] (Oliver Witt) wrote: > I uploaded that script with a common ftp program on my server in the > internet. > FOr the host, user and pw, I use the same data as I use to log in with > my ftp program. So the mistake can't be there. > This is how that script basically works: > > if(isset($destiny)){ > $ftp_server = "host"; > $benutzername = "user"; > $passwort = "pw"; > $connection_id = ftp_connect("$ftp_server"); > $login_result = ftp_login($connection_id, "$benutzername", "$passwort"); > > $upload = ftp_put($connection_id, $destiny, $local_file, FTP_ASCII); > if (!$upload) { > echo "It didn't work";} > else { > echo "It did work";} > ftp_quit($connection_id);} > ?> > > > > > > > > > > > > > > > > > > > "Timothy Hitchens )" schrieb: > > > Using ftp_login() ?? > > > > Timothy Hitchens (HiTCHO) > > Open Platform Consulting > > e-mail: [EMAIL PROTECTED] > > > > > -Original Message- > > > From: Oliver Witt [mailto:[EMAIL PROTECTED]] > > > Sent: Thursday, 9 January 2003 5:30 AM > > > To: [EMAIL PROTECTED]; Timothy Hitchens ) > > > Subject: Re: [PHP] ftp_put: permission denied > > > > > > > > > "Timothy Hitchens )" schrieb: > > > > > > > I am assuming you have testing from a desktop client. > > > > > > > > Are you sure that the PHP script has been logged in?? > > > > > > > > Can you see via a log file of the successful authentication?? > > > > > > > > > > I logged in using the same information as I used to upload > > > that script. > > > > > > if ((!$conn_id) || (!$login_result)) { > > > echo "Not logged in"; > > > die; > > > } else { > > > echo "Logged in"; > > > } > > > > > > That script returned Logged in. > > > Olli > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] apache and php
I am trying to run a PHP page from my browser (Mozilla) and each time I load the page it is attempting to force a dowload of the page instead, based on the mime-type. I had been developing a command line PHP application which works fine and then had just started on a web interface and realised that Apache may not be configured correctly. So I edited httpd.conf and added the Add Type line for x-type-httpd .php. I am running Apache 2.0.40 on RedHat 8 and PHP 4.3.0pre2. Can anyone tell me what I am doing wrong? What should the modifications be to httpd.conf for PHP? Thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] apache and php
Tim, thanks but it still doesn't work. What puzzles me is that last night I reinstalled a 'vanilla' install of RedHat 8 from the distribution where I selected PHP and Apache. So now I am running PHP 4.2.2 and Apache 2.0.40, I make the change you recommened to httpd.conf, stop and restart the service and it still simply ignores the PHP code...this is driving me insane. Gareth "Timothy Hitchens )" <[EMAIL PROTECTED]> wrote in message 007101c2b784$652736b0$0500a8c0@bambino">news:007101c2b784$652736b0$0500a8c0@bambino... > Your settings should be something similar to this: > > > AddType application/x-httpd-php .php .html > AddType application/x-httpd-php-source .phps > > > Do you have the page remotely available to see what is happening for > you?? > > > > Timothy Hitchens (HiTCHO) > Open Platform Consulting > e-mail: [EMAIL PROTECTED] > > > -Original Message- > > From: Gareth Thomas [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, 9 January 2003 12:03 PM > > To: [EMAIL PROTECTED] > > Subject: [PHP] apache and php > > > > > > I am trying to run a PHP page from my browser (Mozilla) and > > each time I load the page it is attempting to force a dowload > > of the page instead, based on the mime-type. I had been > > developing a command line PHP application which works fine > > and then had just started on a web interface and realised > > that Apache may not be configured correctly. So I edited > > httpd.conf and added the Add Type line for x-type-httpd .php. > > I am running Apache 2.0.40 on RedHat 8 and PHP 4.3.0pre2. Can > > anyone tell me what I am doing wrong? What should the > > modifications be to httpd.conf for PHP? > > > > Thanks in advance > > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Using $vars from include()d functions in the main programm andother functions
They should show up but still think of the order in which they are loaded. You can access vars which are not yet loaded. Also you can't access variables which are initialized in a function (if they are not global). Including adds the contents of the files as if it was directly in main.php4, they are not new namespaces Thomas On Sat, 11 Jan 2003 12:49:15 +0100 [EMAIL PROTECTED] (Ben9000) wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hello List, > > a simple problem turned out to be not so simple as I thought. > > Here the situation: > main.php4 > | > +-include() mainhtml.php4 > | > +-include() functions.php4 > | > +a function does include() languagevars.php4 > > I can see the included $vars from languagevars.php4 in functions.php4 > but not in main.php4. > > Using "global $var" just seems to work top->down but I'm not able to > bring the $vars up to the main.php4 or to the mainhtml.php4. > > This time, I just wanted to write not one scary large PHP4-Page with > around ~100kb in size. But I'm really stuck - all the books, pdfs and > web information just want to bring the $vars down. > > Or is there just a failure in thinking?! > > Any hint is highly appreciated. > Ben :) > -BEGIN PGP SIGNATURE- > Version: GnuPG v1.2.1 (GNU/Linux) > > iD8DBQE+IATAROwluvOuI4ARApiOAJ9EyDo2ER3YROGZ120CgllOkjM8tgCfUIeD > pxtKmzi71xC3n8Tpb0FSQ7w= > =BZcc > -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Change Date
http://de.php.net/manual/en/function.mktime.php The most important part is "mktime() is useful for doing date arithmetic and validation, as it will automatically calculate the correct value for out-of-range input." Thomas On Sun, 11 Jan 2004 16:12:01 +0330 [EMAIL PROTECTED] (Sadeq Naqashzade) wrote: > Hi, > How can I find time stamp for example 125 next days. or 03:30 hours next? > > Regards, > S. Naqashzade > PS: Sorry for my bad english :-( > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Change Date
i.e. // getting the current time in an array $timeval=localtime(); // we want the time 3 hours in the future $timeval[2] = $timeval[2]+3; // calc the new timestamp $timestamp=mktime ($timeval[2], $timeval[1], $timeval[0], $timeval[4], $timeval[3], i$timeval[5]); An even better solution, you are talking about a unix-timestamp, right? just add or subtract the the seconds from the current timestamp, i.e. // get the current timestamp $timestamp=time(); // 1 minute = 60 seconds, 1 hour = 60 minutes, therefore 1 hour = 60*60 = 3600 seconds // so we add 3600*3 to have the time in 3 hours $timestamp = $timestamp + (3600*3); // you can convert this time back to a readable format using strftime Regards, Thomas On Sun, 11 Jan 2004 16:22:08 +0330 [EMAIL PROTECTED] (Sadeq Naqashzade) wrote: > > So Thanks, but can you get me some example code? > > Regards, > Sadeq > > "Thomas Seifert" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > http://de.php.net/manual/en/function.mktime.php > > > > The most important part is > > "mktime() is useful for doing date arithmetic and validation, as it will > automatically calculate the correct value for out-of-range input." > > > > > > > > Thomas > > > > On Sun, 11 Jan 2004 16:12:01 +0330 [EMAIL PROTECTED] (Sadeq Naqashzade) wrote: > > > > > Hi, > > > How can I find time stamp for example 125 next days. or 03:30 hours > next? > > > > > > Regards, > > > S. Naqashzade > > > PS: Sorry for my bad english :-( > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Make thumbnail online
how about just reading the docs which are available online? http://de.php.net/manual/en/ref.image.php and especially http://de.php.net/manual/en/function.imagecopyresized.php will help. Thomas On Sun, 11 Jan 2004 16:32:36 +0330 [EMAIL PROTECTED] (Sadeq Naqashzade) wrote: > Hi every one, > I want to create thumbnail of a photo stored in MySQL table online. > > Best Wishes, > S. Naqashzade > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] imap quota
i am referring to imap_get_quota manpages at http://www.php.net/manual/en/function.imap-get-quota.php it gave a short script (see bottom). question: in a qmail-ldap/courier-imap environment, who is that mailadmin ? -- script start -- $mbox = imap_open("{your.imap.host}","mailadmin","password",OP_HALFOPEN) or die("can't connect: ".imap_last_error()); $quota_values = imap_get_quota($mbox, "user.kalowsky"); if(is_array($quota_values)) { $storage = $quota_values['STORAGE']; print "STORAGE usage level is: " . $storage['usage']; print "STORAGE limit level is: " . $storage['limit']; $message = $quota_values['MESSAGE']; print "MESSAGE usage level is: " . $message['usage']; print "MESSAGE usage level is: " . $message['limit']; /* ... */ } imap_close($mbox); -- script endz -- -- roger __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] --with-mcal=/usr/local/mcal compilation issue
php-4.3 libmcal-0.5 (i intend to use Horde's Kronolith and the README said it cannot work with libmcal-0.6) configure gave this error: checking for MCAL support... yes configure: error: Unable to locate your libmcal header files - cal_misc.h should be in the directory you specify or in the include/ subdirectory below it - default search location is /usr/local please advise. __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail () error
The mail-server has to respond that it received the mail. Maybe you've set the firewall only one-way open? Thomas On Fri, 17 Jan 2003 15:29:32 -0500 [EMAIL PROTECTED] (Stephen Goehler) wrote: > Thanks, the server was relaying, but it turned out to be the firewall that > was rejecting the request. > > Now I have a new problem thought, my mail () command will send the mail (and > I receive it) but it will just hang there and eventually return this: > > Fatal error: Maximum execution time of 30 seconds exceeded > > The email goes through, but it won't process any of the code after it. Is > it waiting for a response from the mail server? Can I disable that? > > Steve > > "John W. Holmes" <[EMAIL PROTECTED]> wrote in message > 004901c2be5a$a384f910$7c02a8c0@coconut">news:004901c2be5a$a384f910$7c02a8c0@coconut... > > > Anyone know what causes this error? > > > > > > Warning: mail ()[function.mail]: Failed to receive > > > > > > Can it not find the mail server? > > > > When I got this error it was because the server was rejecting the email, > > saying it wouldn't relay the message. Maybe check your relay setting in > > your SMTP server? > > > > ---John W. Holmes... > > > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > > today. http://www.phparch.com/ > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL+php
it doesn't change it in the database, just in the output. Thomas On Sun, 19 Jan 2003 03:17:04 +0200 (EET) [EMAIL PROTECTED] (Paul Marinas) wrote: > something like that only i don't whant to alter the database, the fields > in the database must remains unchanged, only, on page i whant to display > diferent data. > > On Sun, 19 Jan 2003, Sean Malloy wrote: > > > If you want to do it within the query itself, take a look at the mysql > > replace command > > > > REPLACE(str,from_str,to_str) > > > > SELECT REPLACE(,,) FROM table > > > > or you can do it using PHP once the query has executed, on a record by > > record basis, within a while/for loop or whatever. > > > > -Original Message- > > From: Paul Marinas [mailto:[EMAIL PROTECTED]] > > Sent: Sunday, 19 January 2003 11:07 AM > > Cc: [EMAIL PROTECTED] > > Subject: [PHP] SQL+php > > > > > > Dose anyone know how to search and replace a string in a > > mysql_query output. > > > > Thanks, Paul > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Thomas Seifert mailto:[EMAIL PROTECTED] http://www.MyPhorum.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: 4.3.0 cpu load raise
Hmm, I didn't see this effect but I only tried on a development machine. I benchmarked a app there with both php-versions and it was nearly 20% faster with php-4.3.0. But that may depend on the application. Thomas On Mon, 20 Jan 2003 18:30:05 +0100 [EMAIL PROTECTED] (Philipp) wrote: > Hello ! > > > i upgraded PHP last week. I used 4.2.3 and now > i am using 4.3.0. The System is Linux running > a 2.4.20 kernel and Apache 1.3.27 with PHP > statically compiled in. > > I recognized a significant load-raise. it seems > that the new version needs more CPU power > to complete its tasks. > > i will evaluate my atsar logs to verify my assumption, > but i like to know if others experienced similar behavior > on their webservers. > > > Thank you very much, > Philipp -- Thomas Seifert mailto:[EMAIL PROTECTED] http://www.MyPhorum.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HELP please quickly
"file" already returns an array so this would be best for that :). Thomas On Wed, 22 Jan 2003 14:00:09 + [EMAIL PROTECTED] (Didier McGillis) wrote: > > Cool I'll report back what I have found. Question. I have tried fopen and > file and was wondering for opening the file and loading it into an array > which one is better? > > > > > > > >From: "Timothy Hitchens \(HiTCHO\)" <[EMAIL PROTECTED]> > >Reply-To: <[EMAIL PROTECTED]> > >To: "'Didier McGillis'" <[EMAIL PROTECTED]>, > ><[EMAIL PROTECTED]> > >Subject: RE: [PHP] HELP please quickly > >Date: Wed, 22 Jan 2003 23:26:10 +1000 > > > >You first file just requires loading into an array and you can use > >unique array functions to remove > >duplicates etc.. > > > >The other files simply load into an array and use preg to strip out what > >you want and follow the same > >checking and removal of duplicates. > > > >Checkout: preg_match and array functions in the www.php.net manual. > > > > > > > >Timothy Hitchens (HiTCHO) > >Open Source Consulting > >e-mail: [EMAIL PROTECTED] > > > > > -Original Message- > > > From: Didier McGillis [mailto:[EMAIL PROTECTED]] > > > Sent: Wednesday, 22 January 2003 11:22 PM > > > To: [EMAIL PROTECTED] > > > Subject: [PHP] HELP please quickly > > > > > > > > > Here is a brief description of what I want to do. I want to > > > use PHP to grab > > > a list of numbers in one file. Check it against a bigger > > > file and strip the > > > ones that match out of the bigger file, into a "holding" file. > > > > > > > > > so here is what it might look like. > > > > > > file1.txt > > > 456789 > > > 456790 > > > 456791 > > > 456792 > > > 456793 > > > 456794 > > > . > > > > > > file2.log > > > some time stamp code=001;number=456784;name=blahblah;date=012403; > > > some time stamp code=001;number=456785;name=blahblah;date=012403; > > > some time stamp code=001;number=456786;name=blahblah;date=012303; > > > some time stamp code=001;number=456789;name=blahblah;date=012503; > > > some time stamp code=001;number=456789;name=blahblah;date=012503; > > > some time stamp code=001;number=456789;name=blahblah;date=012503; > > > some time stamp code=001;number=456789;name=blahblah;date=012503; > > > some time stamp code=001;number=456789;name=blahblah;date=012503; > > > some time stamp code=001;number=456790;name=blahblah;date=012603; > > > some time stamp code=001;number=456791;name=blahblah;date=012703; > > > > > > notice there might be more then one of the same number, I > > > only need one so I > > > need to ignore the rest, rip out the time stamp, which is a > > > seperate line. > > > > > > file3.txt > > > code=001;number=456789;name=blahblah;date=012503; > > > code=001;number=456790;name=blahblah;date=012603; > > > code=001;number=456791;name=blahblah;date=012703; > > > > > > can anyone help, any suggestions? > > > > > > > > > > > > > > > > > > _ > > > MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. > > > http://join.msn.com/?page=features/virus > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > _ > Add photos to your messages with MSN 8. Get 2 months FREE*. > http://join.msn.com/?page=features/featuredemail > -- Thomas Seifert mailto:[EMAIL PROTECTED] http://www.MyPhorum.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Fw: [PHP] $header = "Location:........" being ignored!
give some output in the if-construct to see if it even matches. I believe there is some problem with the variables used in there, the location should work though. On Tue, 21 Jan 2003 06:09:01 -0600 [EMAIL PROTECTED] (Rick Emery) wrote: > if ( $_POST['passwd'] != $db['password'] ) > {header("Location: loginfailed.html"); exit; > } > - Original Message - > From: "Shams" <[EMAIL PROTECTED]> > To: <> > Sent: Tuesday, January 21, 2003 3:48 AM > Subject: [PHP] $header = "Location:" being ignored! > > > Hi Group, > > I basically have some simple code such as: > > == > > if ( $_POST['passwd'] != $db['password'] > {header("Location: loginfailed.html"); > } > > //else > > $header = "Location: success.html"; > > == > > however, when I run this code, using a to submit password, username, > etc.. if the passwords do not match, the page is forwarded to > success.html ! > > Is there anything obvious that I am doing wrong? > > Thanks, > Shams > > p.s. I don't want to use else{} because I have lots of if() checks! > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- Thomas Seifert mailto:[EMAIL PROTECTED] http://www.MyPhorum.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Variable Declare
try: if (isset($_POST['frmAction']) && $_POST['frmAction'] == "formmail") instead of your line. Thomas On Wed, 22 Jan 2003 09:47:46 -0500 [EMAIL PROTECTED] (Stephen Goehler) wrote: > Hey guys, > > Thanks in advance for your help. > > I'm working on emailing the contents of a form using php. It worked fine, > until I turned global_variables off in an attempt to secure the form (I > still have yet to write the data validation part). > > Anyway, I have an IF statement that fires depending on a hidden variable in > the form. If the > variable is empty, it loads the form. If the variable contains the hidden > value I give it during form creation, then it emails the contents on the > form and displays a thank you msg instead of displaying the form. > > The problem I have run into, involves the hidden value for the form. I > didn't have to declare it before when I had global_variables turned on, but > now I have to. I searched the manual and tried statements like "global > $variablename" but the code wouldn't run properly. I've searched through > the newsgroups as well, but I'm new to PHP so it was tough to figure out > what to search for. I'm sure all I'm missing is one line of code. I > included my code below. The problem exists in this line: > > if ($_POST['frmAction'] == "formmail") > > which is before where the form is created so the $frmAction variable isn't > declared yet. I'm > getting a variable not declared error, which I know, but if I declare the > variable earlier in the document, then it resets the value that I give it > before I submit the form. How do I make this work? > > Thanks so very much!! > > Steve > > > > > > **HTML stuff here** > > // error handler > function e($type, $msg, $file, $line) > { > $errorLog = "error.log"; > **Error Handler code here** > } > > error_reporting(E_ERROR | E_WARNING); > set_error_handler("e"); > > $TO = "[EMAIL PROTECTED]"; > $MP = "mail.mailserver.com"; > ?> > > if ($_POST['frmAction'] == "formmail") > { > > > $fd = popen($MP,"w"); > fputs($fd, "To: $TO\n"); > fputs($fd, "From: $_POST['name'] <$_POST['email']>\n"); > fputs($fd, "Subject: $_POST['inforequest']\n"); > fputs($fd, "X-Mailer: PHP3\n"); > fputs($fd, "Name: $_POST['name']\n"); > fputs($fd, "Business: $_POST['business']\n"); > fputs($fd, "Phone: $_POST['phone']\n"); > fputs($fd, "Email: $_POST['email']\n"); > fputs($fd, "Details: $_POST['details']"); > pclose($fd); > > ?> > > **HTML thank you msg here** > > > exit; > } else { > > ?> > > > > Select Info Source > Option 1 > Option 2 > Option 3 > Option 4 > > > > > > > > > > > > > > > > > > > > > rows="8"> > > > > > > > > > > > > } > ?> > > **last bit of HTML here** > > > > -- Thomas Seifert mailto:[EMAIL PROTECTED] http://www.MyPhorum.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Variable Declare
it won't work the way you are doing this. Try something like that line (changed from yours): fputs($fd, "From: ".$_POST['name']." <".$_POST['email'].">\n"); Don't ask arrays directly in a string. Thomas On Wed, 22 Jan 2003 11:15:35 -0500 [EMAIL PROTECTED] (Stephen Goehler) wrote: > Now it gets more confusing.I added: > > print ''; > > print_r($_POST); > > print ''; > > to my form and the variables are displayed properly, but only generate > errors when I try to add it to fputs().any ideas? > > > "Stephen Goehler" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Thanks!! That worked perfectly. Neat little function there to check if a > > variable exists. Also I am set to "E_ERROR & ~E_NOTICE" already. > > > > The form loads correctly and then when you click submit goes to the thank > > you screen. The only problem now is that it says that my variables don't > > exist that I pass using the form and as a result, won't email them. When > it > > gets to the code to email the results the variables like $_POST['name'] > > won't exist. What puzzles me is that the frmAction is passed, but none of > > the textbox...etc. variables are. Do I need to add in the form name > > somewhere to show where the variables are coming from? > > > > > > > > "Thomas Seifert" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > try: > > > if (isset($_POST['frmAction']) && $_POST['frmAction'] == "formmail") > > > > > > instead of your line. > > > > > > > > > > > > Thomas > > > > > > On Wed, 22 Jan 2003 09:47:46 -0500 [EMAIL PROTECTED] (Stephen Goehler) > > wrote: > > > > > > > Hey guys, > > > > > > > > Thanks in advance for your help. > > > > > > > > I'm working on emailing the contents of a form using php. It worked > > fine, > > > > until I turned global_variables off in an attempt to secure the form > (I > > > > still have yet to write the data validation part). > > > > > > > > Anyway, I have an IF statement that fires depending on a hidden > variable > > in > > > > the form. If the > > > > variable is empty, it loads the form. If the variable contains the > > hidden > > > > value I give it during form creation, then it emails the contents on > the > > > > form and displays a thank you msg instead of displaying the form. > > > > > > > > The problem I have run into, involves the hidden value for the form. > I > > > > didn't have to declare it before when I had global_variables turned > on, > > but > > > > now I have to. I searched the manual and tried statements like > "global > > > > $variablename" but the code wouldn't run properly. I've searched > > through > > > > the newsgroups as well, but I'm new to PHP so it was tough to figure > out > > > > what to search for. I'm sure all I'm missing is one line of code. I > > > > included my code below. The problem exists in this line: > > > > > > > > if ($_POST['frmAction'] == "formmail") > > > > > > > > which is before where the form is created so the $frmAction variable > > isn't > > > > declared yet. I'm > > > > getting a variable not declared error, which I know, but if I declare > > the > > > > variable earlier in the document, then it resets the value that I give > > it > > > > before I submit the form. How do I make this work? > > > > > > > > Thanks so very much!! > > > > > > > > Steve > > > > > > > > > > > > > > > > > > > > > > > > **HTML stuff here** > > > > > > > > > > > // error handler > > > > function e($type, $msg, $file, $line) > > > > { > > > > $errorLog = "error.log"; > > > > **Error Handler code here** > >
[PHP] Re: MySQL 4.0 + PHP 4
I'm running it in production since MySQL-4.0.2 and without any problems. Thomas On Wed, 22 Jan 2003 11:21:40 -0800 [EMAIL PROTECTED] (Joe Stump) wrote: > Anyone out there have anything to share as to using PHP4+MySQL4. I've been > hearing good things on the MySQL list about v4.0 and I'm thinking of > upgrading, since I run a rather small server. > > Thanks! > > > --Joe > > ps. PHP list responders please respond directly. I'm not currently > subscribed. > > -- > Joe Stump <[EMAIL PROTECTED]> > http://www.joestump.net > > -- Thomas Seifert mailto:[EMAIL PROTECTED] http://www.MyPhorum.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] get current username from the windows system
Hi. is their a possibilty to get the windows username of the current logged on user with php. I want this to make a logon dialog more comfortable. Thanks for an answer and a little example if it's possible. Thomas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] linux cpu usage
Hi all, I have a command line PHP script that is in a continous loop to monitor a particular database event. I am running RedHat 8 and the only problem I am finding is that it hogs the CPU. I developed the script originally on Windows and it worked better there. Is there a way to limit CPU resource for a PHP command line script in Linux? Gareth -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: MySQL/PHP Associative Array Insert
On Sat, 01 Feb 2003 10:26:10 -0600 [EMAIL PROTECTED] (Cditty) wrote: > A co-worker is teaching me to move to the next level in php. I have > started using associative arrays for my scripts, but I am having a problem > using them to do an insert into MySQL. Can someone give me an example of > how to do an insert to the database using these arrays? My array is > this...$item['itemID'] try something like that: mysql_query("INSERT INTO items SET itemcolumn='".$item['itemID']."'"); or just mysql_query("INSERT INTO items (itemcolumn) VALUES('".$item['itemID']."')"); Regards, -- Thomas Seifert mailto:[EMAIL PROTECTED] http://www.MyPhorum.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Possible PHP/MySQL Bug?
On Sat, 1 Feb 2003 13:28:00 -0800 [EMAIL PROTECTED] (Tim Lan) wrote: > The following code is supposed to migrate data from an old database to a new > one, but produces the error: > > Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result > resource in C:\...\convertdb.php on line 17 > > The code: > [...] > Any idea? Yeah, read out mysql_error() after sending the query and before doing fetch... to see what mysql thinks is wrong. Regards, -- Thomas Seifert mailto:[EMAIL PROTECTED] http://www.MyPhorum.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php