[PHP] How does one reply to messages on this list?
If I just hit 'Reply' I'll send my reply to the individual who created the message. If I hit 'Reply All' my reply will be sent to: Govinda govinda.webdnat...@gmail.com, PHP-General List php-general@lists.php.net and the creator of the message. Neither option seems correct. What's up with that? Thanks
[PHP] PDO: good, popular?
Searching for PHP CRUD in hopes of learning the best way to access databases and to use PEAR or what I came across PDO. I want to know the communities opinion of PDO: everyone uses it or no one uses it or it's great or what? Thanks
[PHP] Parse info from 1,000 files to file
Can someone briefly point me to the functions I'll need to parse some information from thousands of files in a single directory and then prepare the extracted info into a single file for SQL import? Like file() or readfile() and some regex and writefile?? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] preg_replace insert newline
$string = 'text with no newline'; $pattern = '/(.*)/'; $replacement = '${1}XX\nNext line'; $string = preg_replace($pattern, $replacement, $string); echo $string; Outputs: text with no newlineXX\nNext line Instead of: text with no newlineXX Next line How does one insert a newline with preg_replace? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Tracking the progress of download
Hello to all! Who knows how to track the progress of the download using PHP and JavaScript? I have a script that downloads file from net to the server, and I want to the process including the speed to the clientside. How can I do that? Best regards, Sam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A PHP-driven script to determine if the environment is configured correctly (checklist)
Здравствуйте, AmirBehzad. Вы писали 17 декабря 2009 г., 17:46:59: Dear list, e-Greetings, I've developed some PHP-driven web applications. These applications will be installed on different linux-based servers (typically Debian and Redhat). Usually, after I copy the files to the server, they DO NOT WORK, so I spend hours to debug the problem. Problems are very funny, for example, the program is giving strange errors, and it is not working because short_open_tags are off ! I decided to write a PHP script to check if server's configuration meets my requirements. - checking whether some php extensions are loaded, eg. MCrypt. - checking wheather short_open_tags is ON - checking whether mod_rewrite is enabled - etc. Here's my question: - How do you check if .htaccess is working, *** via php code *** ? It's easy to check if .htaccess exists (@php: file_exists), but how to make sure if .htaccess is working?! - How do you check if AllowOverride is set to All in apache's configuration? Please let me know what do you think. Thank you in advance. -behzad Make sure that you did your scripts executable(chmod +x) You can check .htaccess that way: create .htaccess if folder with script, override some directive thru it, like php's max execution time. thencreatephpscript,getphp value that you've changed(max_execution_time), compare to the value you gave in .htaccess, if values are the same, .htaccess is working! -- Sam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Free tech talk by Percona tonight in Palo Alto, CA
You can see the slides from the talk here: http://assets.en.oreilly.com/1/event/27/Goal%20Driven%20Performance%20Application%20Paper.pdf Sam Ghods s...@box.net Box.net - Vice President of Engineering office: (877) 269-6736 ext. 60 fax: (650) 529-0392 On Nov 5, 2009, at 2:45 PM, Michael Shadle wrote: On Tue, Nov 3, 2009 at 10:17 AM, Sam Ghods s...@box.net wrote: Hi all, I would like to invite everyone to a Box.net sponsored free tech talk (and free dinner!) in Palo Alto tonight on Goal Oriented Performance Optimization, given by Peter Zaitsev of Percona, the leading MySQL/ LAMP performance consulting firm. Learn more about the event from our blog post http://blog.box.net/?p=1363 and RSVP here: got any slides? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Free tech talk by Percona tonight in Palo Alto, CA
Hi all, I would like to invite everyone to a Box.net sponsored free tech talk (and free dinner!) in Palo Alto tonight on Goal Oriented Performance Optimization, given by Peter Zaitsev of Percona, the leading MySQL/ LAMP performance consulting firm. Learn more about the event from our blog post http://blog.box.net/?p=1363 and RSVP here: http://www.socializr.com/event/665235025 Please be sure to RSVP so that we have enough food for everyone. Thanks, and hope to see you there! Sam Ghods s...@box.net Box.net - Vice President of Engineering office: (877) 269-6736 ext. 60 fax: (650) 529-0392
Re: [Fwd: [PHP] Sessions in databases]
If you are distributing your application over multiple servers, using a database for session tracking allows a user to continue there session regardless of which server their request bounces too. It prevents the need for 'sticky' network connections which time out anyways. Databases can make scaling applications to enterprise size considerably easier. There are other file based solutions that are dirty and require you to play with file locking and all that nastyness. You also don't need access to the php.ini file to implement session in a database, check out http://php.net/session_set_save_handler Il pinguino volante wrote: (There were some erroros in the previous email, I'm sorry) Hi to all. I have to realize an authentication system for a lot of users. I heard that someone uses to store session states (?) into a database. I'd like to know how and, expecially, WHY to do it and what's would be better (considering that I CANNOT -d'oh!- edit the php.ini file). Thanks in advance, Alfio. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What type of barcode used for document management system ?
As a matter of fact... For a while I was using a barcode generator to test out inventory system before getting them professionally made. I personally chose to go with Interleaved 2 of 5 as our barcode scanner was able to read them accurately and it was the same format as our campus ID cards. The trick with this is that it only supports numbers. Code128 has three different encoding tables, table B which is most commonly used, includes the characters 0-9, A-Z, a-z and a handful of symbols which I don't remember of the top of my head. I used a class someone else made which can be found here: http://www.phpclasses.org/browse/package/2176.html The code itself is quite ugly but as it was only needed temporarily it worked. It might be a good starting point for you though. aveev wrote: Hi, I'm new to using barcode I want to create an online registration in my application, where the user can fill in the form and the application will create a pdf file of the form with the barcode inserted on it. The user then brings the printed form to us and we scan the barcode. After scanning the barcode and verifying the user data, we will proceed to decide whether his/her application is approved or not. I'm using fpdf to create the pdf file and for the barcode, I'm still looking for suitable solution. I don't know what type of barcode I should use for this purpose (I've browsed internet and found out many types of barcodes..e.g 39, 93, ean-13, c128, etc). Has anyone used php and barcode generator with their application ?? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to strip empty lines out of a txt using preg_replace()
The following snippet is untested and using Ash's regex (it is accurate \s matches any white space). $content is what is getting stripped of the new lines and $filtered is the cleansed output. See if that does the trick for you. $lines = str_split(PHP_EOL, $content); $filtered = ''; foreach ($lines as $line) { if (!preg_match('^\s*$', $line)) { // Splitting on the PHP_EOL characters cause it to be removed be sure to put it back $filtered .= $line . PHP_EOL; } } Ralph Deffke wrote: the problem is some have got \t\n some are just \n\n\n using PHP_EOL is a must I thing must be something with the /../sm attributes to the regex, spend like half an hour, but didn't get it, I'm running against a dead line, doesn't seem to be that easy if regex is not the everydays need u have Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1252071327.24700.152.ca...@localhost... On Fri, 2009-09-04 at 15:28 +0200, Ralph Deffke wrote: ok preg_replace( /^\s*$/m, , $somestring) does not take empty lines out Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1252069539.24700.150.ca...@localhost... On Fri, 2009-09-04 at 14:58 +0200, Ralph Deffke wrote: Hi all, I'm a bit under stress, maybe somebody knows the regex on a snap. using PHP_EOL would be great. thanks ralph_def...@yahoo.de The regex that would match a line containing only whitespace would look like this: ^\s*$ Thanks, Ash http://www.ashleysheridan.co.uk Are the lines actually whitespace, or are they actually br/ tags that are inserting lines to format the page for HTML display? Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Re: Dan Brown
tedd wrote: Sam: That's interesting. I wasn't aware that paper could be used in such a fashion but I can't help but think that the cost of the paper would exceed the cost of optical disk storage for the same data. And paper is more sensitive to environmental exposure than DVD's. Cheers, tedd I don't know how successful it would be for using real backups by I personally use it to backup my private keys. It has held up to a coffee ring on the page so I imagine if it's protected by a metal filing cabinet it would be safe enough. Course if there was a fire... Sam Stelfox -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Dan Brown
tedd wrote: Everything is backed up at least three fold. I am considering online backup and waiting for the cost to go down. You should add paper backups to that list! http://ollydbg.de/Paperbak/ Sam Stelfox -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] EXEC and SYSTEM delay
Well if the server your running on is linux based (and I haven't tried this) you could try adding a nohup and background the task for example rather than doing: system('updatedb'); try system('nohup updatedb '); It should background the task and let it continue running even when the php script finishes it's execution. Like I said I haven't tested it. As a side note I used 'updatedb' in the example because it was the longest running task I could think of off the top of my head and requires root priveledges... You really shouldn't run your scripts as root. *A public server announcement* Alberto García Gómez wrote: Fellows: I'm experimenting problems with a call that I made to exec or system. The problem is that the script await for the function finish and that take's a lot of time. I need a way to use those functions in order to continue without await for it. Saludos Fraternales _ Atte. Alberto García Gómez M:.M:. Administrador de Redes/Webmaster IPI Carlos Marx, Matanzas. Cuba. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Website crawler auto image downloader
I need a script that will crawl a list of websites and download all .jpg, .gif, .png files. I can think of some ways how to start like, fopen() or maybe curl(). And it downed on me I'd need to handle files writing over with the same name. And it would be cool to save the full URL to the file in a database with the path on the local server where I'm saving them. I was hoping someone might say, Dude, that's simple, just do this... before I spent hours guessing. Anyone? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zend Framework...where to start? -- don't.
Daevid Vincent wrote: The pages are significantly slower than straight PHP by orders of magnitude: http://paul-m-jones.com/?p=315 http://www.codinghorror.com/blog/archives/001198.html I know this blog isn't specifically about PHP but he makes a good general point that can be applied to this conversation very well. For those who don't want to read the article it's about the cost of time spent programming vs hardware. Even if a framework will run slower than raw HTML or a simple PHP page on it's own, if that framework saves you a significant amount of time developing, and the server your running the application on isn't as responsive as you like, maybe it would be cheaper just to add another server and load balance the two. A lot of frameworks include stuff exactly for load balancing making your whole application a lot more flexible and able to withstand a lot more growth without you having to write any extra code.
Re: [PHP] Change tracking
I've always used a version field (just an incrementing id) rather than an effective date field. I can see the benefits of being able to look back and see when the changes were made and if done correctly make it so things don't change until a certain date. Hmmm nifty. Stephen wrote: -- On Fri, 10/31/08, Mike Smith [EMAIL PROTECTED] wrote: [INVENTORY_TABLE] fieldsexample data part 1027P serial543221-K qty 120 location G-5 I'd like to record what changed. Let's say they change the serial. One way would be a static changes table: Another way is to never change a record, but to add new ones. You also need to add an effectivity date field. Stephen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy Function Errors
It sounds to me like your problem is now about the authentication. By default most linux distributions do not give apache a password. I personally think using apache would be a bad idea. How about creating a user on the linux box your trying to put the files on to make it's primary group apache (make sure the group can write to the folder you are putting the files in) and give it a password that is a random string of 20 characters (http://www.goodpassword.com) that only your script knows. Try testing to make sure you can ftp to the server using a normal ftp client (ftp for the linux command line or http://filezilla-project.org/ is a good one if your using windows) using the account you created. Make sure you can put files in the directory you will be with the script. If this all works and your script using the new account is not, I'm sure we can help you debug it further :). Good luck! Wei, Alice J. wrote: Hi Alice... I just caught/saw this thread. I'm asuming you haven't found/solved what you're trying to do. So, What exactly are you trying to accomplish? What OS are you running on both the client/server machine? Are you trying to copy from a directory on one box, to a directory on another box? Is this a one time thing? Are the boxes on the same network (physically close together)? Are you able to login to the remote box from your initial server? Let me know what you're looking to do, and I can probably get you going. -regards... All I wanted to do is to copy the file that is sitting on a remote machine to have it copied it over to another remote machine. Since I put the code snippet below on the server that is supposed to accept the files, I would say I am downloading the file here from a remote server to a local server. It is weird, because I followed Robert's advice and cut out the http:// snippet in my ftp server address, and I have tried both the apache and root password of the actual log in of the FTP, which neither of them worked. Both of the servers have the firewall DNS set up properly, and in my PHP info page, it appears that my FTP is enabled. Is there something else I have missed? // define some variables $local_file = C:/Inetpub/wwwroot/test/$id/data.tar; $server_file = http://192.168.10.63/test/$id/data.tar;; // set up basic connection $ftp_server=192.168.10.63; $conn_id = ftp_connect($ftp_server); // login with username and password $ftp_user_name=root; $ftp_user_pass=xx!; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) { echo Successfully written to $local_file\n; } else { echo There was a problem\n; } // close the connection ftp_close($conn_id); Thanks in advance. Alice -Original Message- From: Boyd, Todd M. [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2008 2:28 PM To: Wei, Alice J. Cc: php-general@lists.php.net Subject: RE: [PHP] Copy Function Errors -Original Message- From: Wei, Alice J. [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2008 3:46 PM To: Robert Cummings Cc: php-general@lists.php.net Subject: RE: [PHP] Copy Function Errors ---8--- snip Is there something I could do here to allow my file be copied to the remote server? Use the ftp functions. Thanks for the tip. I have revised my code to: // define some variables $local_file = C:/Inetpub/wwwroot/test/$id/beamdata.tar; $server_file = http://192.168.10.63/test/$id/beamdata.tar;; // set up basic connection $ftp_server=http://192.168.10.63;; $conn_id = ftp_connect($ftp_server); // login with username and password $ftp_user_name=apache; $ftp_user_pass=x; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) { echo Successfully written to $local_file\n; } else { echo There was a problem\n; } // close the connection ftp_close($conn_id); I have put this snippet in the local server of where I want the files to be copied to. However, I see this on my remote server in the logs: 192.168.10.62 - - [16/Jul/2008:16:40:24 -0400] GET /beam_calculation.php?id=145no=16 HTTP/1.1 200 22 - Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727) Is there something I have missed here? Alice, Here are some Wikipedia articles that should give you a good start on understanding the fundamental differences between the two protocols you are confusing with each other: http://en.wikipedia.org/wiki/FTP http://en.wikipedia.org/wiki/HTTP HTTP itself does not intrinsically handle file uploads in a server/client relationship. Web forms that include file uploads generally have a handler function on the other end, and post files via a form
Re: [PHP] Copy Function Errors
You need to test using regular FTP, SFTP goes over SSH, while the PHP script your trying to use is making use of regular old FTP. Make sure that the linux machine has the ports open for FTP and that you have an FTP server running on it (SSH is not one). Wei, Alice J. wrote: It sounds to me like your problem is now about the authentication. By default most linux distributions do not give apache a password. I personally think using apache would be a bad idea. How about creating a user on the linux box your trying to put the files on to make it's primary group apache (make sure the group can write to the folder you are putting the files in) and give it a password that is a random string of 20 characters (http://www.goodpassword.com) that only your script knows. Try testing to make sure you can ftp to the server using a normal ftp client (ftp for the linux command line or http://filezilla-project.org/ is a good one if your using windows) using the account you created. Make sure you can put files in the directory you will be with the script. If this all works and your script using the new account is not, I'm sure we can help you debug it further :). Good luck! You are right, there is something terribly wrong with my authentication. I have added one user called test and gave it a fixed password. Since the information where I intend to extract from is a Linux machine, and the location where it is meant to copy to is the Windows server. I tested it using the SSH Shell from the Windows machine to make sure it is working. It does. I have modified the script where it does the authentication to the following: // set up basic connection $ftp_server=192.168.10.63; $conn_id = ftp_connect($ftp_server) or die (Failed to Connect); // login with username and password $ftp_user_name=somename; $ftp_user_pass=somepass; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass) or die (Failed to Login); // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) { echo Successfully written to $local_file\n; } else { echo There was a problem\n; } When I executed the script, it now prompts me back Failed to Connect as in the first die statement. I am confused because when I use the SSH with Filezilla or other SFTP clients, I used the same user and passwords here and have received no errors. I don't know if I should put the user_name and user_pass from this file to the httpd.conf, though. Currently, this is not set. Thanks in advance. Alice Wei, Alice J. wrote: Hi Alice... I just caught/saw this thread. I'm asuming you haven't found/solved what you're trying to do. So, What exactly are you trying to accomplish? What OS are you running on both the client/server machine? Are you trying to copy from a directory on one box, to a directory on another box? Is this a one time thing? Are the boxes on the same network (physically close together)? Are you able to login to the remote box from your initial server? Let me know what you're looking to do, and I can probably get you going. -regards... All I wanted to do is to copy the file that is sitting on a remote machine to have it copied it over to another remote machine. Since I put the code snippet below on the server that is supposed to accept the files, I would say I am downloading the file here from a remote server to a local server. It is weird, because I followed Robert's advice and cut out the http:// snippet in my ftp server address, and I have tried both the apache and root password of the actual log in of the FTP, which neither of them worked. Both of the servers have the firewall DNS set up properly, and in my PHP info page, it appears that my FTP is enabled. Is there something else I have missed? // define some variables $local_file = C:/Inetpub/wwwroot/test/$id/data.tar; $server_file = http://192.168.10.63/test/$id/data.tar;; // set up basic connection $ftp_server=192.168.10.63; $conn_id = ftp_connect($ftp_server); // login with username and password $ftp_user_name=root; $ftp_user_pass=xx!; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) { echo Successfully written to $local_file\n; } else { echo There was a problem\n; } // close the connection ftp_close($conn_id); Thanks in advance. Alice -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] xml reader/writer
So I don't have to reinvent anything, does such a thing exist anywhere that anyone knows of: I'm looking for a php script that will read any xml file, display the contents in html, with the option of adding an entry (in the same scheme, whatever that might be) or deleting existing entries. I think I could write this, but it would take a while. Thanks -§ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] FDF PDF - Content-type: application/vnd.fdf
When loaded into a browser that can display PDF files (Win IE and Firefox, Mac Safari) the FDF file (snip below) should open linked PDF and populated it with the data from the FDF file. It works fine when the FDF file is loaded from within the browser with Open File (or simply double-clicked from the desktop). It works fine in Win IE (because IE doesn't play by the rules). I just don't understand the header thing, the Content-type deal. Why is the FDF file loaded as plain text when loaded via a URL? http://arraymedia.com/csz/pdf/ud/JO_SAFARI_FORM_AND_DATA/ PHP creates the .fdf file: Content-type: application/vnd.fdf %FDF-1.2 %‚„œ” 1 0 obj /FDF /Fields [ /T (pg1_familyname1) /V (SMITH) ... dozens of other fields... /T (pdf_ExtraPages) /V (Additional other names from page 1 part 1 section C\rOTHER4 OTHER4 OTHER4 OTHER5 OTHER5 OTHER5) ] /F (http://www.citizenshipzip.local/pdf/ud/SAM_SMITH_FORM_AND_DATA/ sys/naturalization.pdf) /ID [ 138ff91476c2ae9c9f192e15ac50d7bf ] endobj trailer /Root 1 0 R %%EOF -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace \\1 yIKES!
On Jun 13, 2006, at 1:58 PM, tedd wrote: At 11:33 AM -0700 6/13/06, sam wrote: Wow this is hard I can't wait till I get the hang of it. Capitalize the first letter of a word. Try: ?php $word = yikes; $word[0]=strtoupper($word[0]); echo($word); ? This blows my mind. What should one think, everything is an array? Well, okay not every but everything that's in linear consecutive order; anything that can be indexed? I was trying to make an array from $word but explode() doesn't take an empty delimiter so I gave up and went for the preg_replace. And hey yo, Jochem, I did RTFM, for hours, I always do before I post to the list. I just missed all the answers in the fine manual this time. Cut me some slack. Where should I wire the Euros to? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace \\1 yIKES!
And hey yo, Jochem, I did RTFM, for hours, I always do before I post to the list. I just I'd tell you to RTFM (although I did tell you to read the manual regarding the specifics of using preg_replace()'s 'e' modifier after showing you a working example of how to use it, based on your original code snippet) Yes, I'm using your example right now to help me learn this preg_replace beast. The php.net page on preg_replace was just to overwhelming for the exhausted state of mind I was in. I did berate the fact that you waited no more than 7 minutes before sending a 'help me' reminder regarding your original post. No, that was a misunderstanding, I was just saying thanks to the guy who said, why not just use ulfirst(). (Which I also missed on the php.net page on strings.) missed all the answers in the fine manual this time. Cut me some slack. cut you slack? are you a graphic designer or something? How did you know? I was 'in' graphics for 30 years before I threw my hands up at that lunatic world and decided to become a programmer. I love the printing industry but ever since the Mac took over everybody went nuts. The printers are still mad, after 15 years, that the Mac took away their razor blades and rubylith. Checks in the mail. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] preg_replace \\1 yIKES!
Wow this is hard I can't wait till I get the hang of it. Capitalize the first letter of a word. echo preg_replace('/(^)(.)(.*$)/', strtoupper('\\2') . '\\3', 'yikes!'); // outputs yikes! Nope didn't work. So I want to see if I'm in the right place: echo preg_replace('/(^)(.)(.*$)/', '\\1' . '-' . strtoupper('\\2') . '-' . '\\3', 'yikes!'); //outputs -y-ikes! So yea I've got it surrounded why now strtoupper: Yikes! Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace \\1 yIKES!
for Eyes burning; caffein shakes; project overdue Thanks Why not just use ucfirst http://us2.php.net/manual/en/ function.ucfirst.php? -Original Message- From: sam [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 13, 2006 2:34 PM To: PHP Subject: [PHP] preg_replace \\1 yIKES! Wow this is hard I can't wait till I get the hang of it. Capitalize the first letter of a word. echo preg_replace('/(^)(.)(.*$)/', strtoupper('\\2') . '\\3', 'yikes!'); // outputs yikes! Nope didn't work. So I want to see if I'm in the right place: echo preg_replace('/(^)(.)(.*$)/', '\\1' . '-' . strtoupper('\\2') . '-' . '\\3', 'yikes!'); //outputs -y-ikes! So yea I've got it surrounded why now strtoupper: Yikes! Thanks -- 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] parsing out quoted text
$str='bass electric organ bagpipes'; $parser($str); $query=SELECT * FROM table WHERE tb_instr = bass AND tb_instr = electric organ //quoted phrase AND tb_instr = bagpipes; Anybody know where I can just copy code that will do the above? thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] reset a resource?
After I've looped through a resource do I have to run the query again to load up 'mysql_fetch_assoc' or is there some kind of reset function I can't find? $q = SELECT * FROM table; $s = mysql_query($q, $pe) or die(mysql_error()); while ($row_s = mysql_fetch_assoc($s)) { echo $i++; } outputs 12345... for each row of table while ($row_s2 = mysql_fetch_assoc($q)) { ... } outputs Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Editing an existing pdf?
I wanted to add texts from an html form to existing pdf. I was able to create a pdf but not to edit it. Please give me guidance how to. FDF is what you're after if I understand this brief post. Google FDF PDF PHP. PHP writes the FDF file which fills out a linked PDF form. Notice I said PDF form. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Editing an existing pdf?
Thankyou for the quick reply Sam. Infact I took this option at first but I didnot proceed because creating a pdf form is new to me. And also I donot have the tool. what do you advise me. I would like to hang out on a yacht off the coast of Saint Tropez where Paris Hilton and her friends stop by most afternoons because they love trying to beat me at strip poker but I'm poor and ugly, what do you advise. Seriously, you need to tools and the education. Get the Acrobat demo for free 30 days. http://www.adobe.com/products/acrobatpro/tryout.html There's a companion app called Designer that builds forms. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What's a Blog?
I have a client who wants to blog or he wants a blog on his website. I don't know anything about these blogs except it's sort of a fad I think. Isn't a blog just a simple web form with a big textarea on the blogger's side writing to a database and then the data is displayed in chronological order on the readers side of a website? I could create that in under an hour. What don't I know? I searched up some scripts, some were free some were $500! Somebody like to point me at a good script that would enlighten me? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to learn php
I started out by getting a reference manual, one with every function describing what the function does. Just like the php.net online function reference but one that can be read lying on the couch. Now when I need some code to do something I'll remember there's a function for it (maybe) and I go to php.net and search for it. I search for PHP examples online for more advanced stuff than I can do and study it. This gives me some knowledge of proper approach to coding; when to use what. Finally if the code looks funky I send a snip to this list and someone will suggest a better function or approach. Oh yea, this is great, I use Dreamweaver's (grimace) PHP coding abilities to get projects started. Dreamweaver can do the preliminary basic database connection stuff: INSERT, UPDATE, DELETE pages. Then I hack the Dreamweaver code. Doing a MySQL tutorial is a good idea too. hello i have been trying to learn php. what is the best approach to learning php for someone who has no programming experience? i am very familiar with html, xhtml, and css. i'm not an idiot when it comes to using computers. i have bought several books and have subscribed to a couple of the php mailing lists, but i feel that i could be doing more to learn php. what approach (and steps) did you take in learning this really cool scripting language? should i look into taking classes or stick with an autodidact approach? any advice and/or opinions would be greatly appreciated. thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] str_replace ? \r
From a textarea on a web form I'm attempting to convert all returns(\r), from the users input, to br /, for db INSERT, and then back again for display in the textarea. (They remain as br /s for normal HTML web page display.) code: // From textarea to db UPDATE function addBR($tv) { $tv = addslashes($tv); $tv = str_replace(\r,br /,$tv); // $tv = preg_replace(/(\r\n|\n|\r)/, br /, $tv); // $tv = preg_replace(/(\r\n|\n|\r)/, , $tv); return $tv;} // For display in textarea function remBR($tv) { $tv = str_replace(br /,\r,$tv); $tv = stripslashes($tv); return $tv; } IT ALL works fine accept if a return is entered in the form's textarea at the very beginning: mysql SELECT jbs_jobDesA FROM jobs WHERE jbs_ID=77 \G *** 1. row *** jbs_jobDesA: br /[the return is still here] Lesequam coreet la feum nulla feu facil iriure faccummolut ulput num augait 1 row in set (0.00 sec) the return is converted to br /\r (leaving the return). AND then when converted back for for the textarea both are stripped out, that is, there is nothing in front of the first character. When resubmitted for UPDATE: mysql SELECT jbs_jobDesA FROM jobs WHERE jbs_ID=77 \G *** 1. row *** jbs_jobDesA: Lesequam coreet la feum nulla feu facil iriure faccummolut ulput num augait 1 row in set (0.00 sec) Q. Why is that first return treated differently? All other returns are treated as expected. Thanks, sam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] shell_exec(zip.. ?
shell_exec(zip -r ddd ddd); // don't work safe_mode off, works from command line php. What could it be? Details: drwxr-xr-x 2 zamzmith zamzmith 512 Aug 3 18:34 execTest/ -rw-r--r-- 1 zamzmith zamzmith 107 Aug 3 18:33 mkdir.php mkdir.php: ?php shell_exec(mkdir ddd; touch ddd/fff;); ? execTest$ php mkdir.php execTest$ ls -l drwxr-xr-x 2 zamzmith zamzmith 512 Aug 3 18:36 ddd -rw-r--r-- 1 zamzmith zamzmith 109 Aug 3 18:36 mkdir.php #OK works from command line php Let's delete ddd and have the web server run it: http://dom.com/execTest/mkdir.php Nope, probably permissions: execTest$ chmod 777 ../execTest Try again: http://dom.com/execTest/mkdir.php Yup. Now let's see if we can delete it. rm.php: ?php shell_exec(rm -r ddd); ? http://dom.com/execTest/rm.php Yup, makes sense, user httpd created it. Now let's zip it. zip.php: ?php shell_exec(mkdir ddd; touch ddd/fff;); shell_exec(zip -r ddd ddd); ? http://dom.com/execTest/zip.php NOPE can't zip, must be something I don't know. drwxrwxrwx 3 zamzmith zamzmith 512 Aug 3 18:49 execTest/ drwxr-xr-x 2 httpd zamzmith 512 Aug 3 18:49 ddd -rw-r--r-- 1 zamzmith zamzmith 109 Aug 3 18:36 mkdir.php -rw-r--r-- 1 zamzmith zamzmith 109 Aug 3 18:44 rm.php -rw-r--r-- 1 zamzmith zamzmith 107 Aug 3 18:49 zip.php Let's try it form the command line php: Delete it first: execTest$ curl http://ssmith.com/execTest/rm.php execTest$ php zip.php Yup: drwxr-xr-x 2 zamzmith zamzmith 512 Aug 3 19:10 ddd -rw-r--r-- 1 zamzmith zamzmith 264 Aug 3 19:10 ddd.zip -rw-r--r-- 1 zamzmith zamzmith 109 Aug 3 18:36 mkdir.php -rw-r--r-- 1 zamzmith zamzmith 109 Aug 3 18:44 rm.php -rw-r--r-- 1 zamzmith zamzmith 107 Aug 3 18:49 zip.php Better check safe_mode anyway: phpinfo.php: ?php phpinfo(); ? execTest: php phpinfo.php | grep safe safe_mode = Off = Off safe_mode_exec_dir = no value = no value safe_mode_gid = Off = Off safe_mode_include_dir = no value = no value sql.safe_mode = Off = Off Supported ciphers = cast-128 gost rijndael-128 twofish arcfour cast-256 loki97 rijndael-192 saferplus wake blowfish-compat des rijndael-256 serpent xtea blowfish enigma rc2 tripledes safe_mode_allowed_env_vars = PHP_ = PHP_ safe_mode_protected_env_vars = LD_LIBRARY_PATH = LD_LIBRARY_PATH Hours lost, any help, Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PDF FDF $_POST
I need PHP fill out the form fields and prepare for download a PDF from an HTML form submission. One way would be to use a PDF with pre-configured form fields where an FDF is created from PHP. The FDF 'merges' with the PDF when the FDF is opened. I got all that from: http://koivi.com/fill-pdf-form-fields/. I have the scripts from koivi.com producing the FDF correctly but I don't know what to do with it next. The target PDF would need to be downloaded first because when you open the FDF is says, hey where's the target. fdf_open looked promising but the fdftk is not compiled in on the server. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] what is this: dirname(__FILE__)?
I don't recognize this something(__SOMETHING__) format. I know what it's doing but I don't know how it's doing it. The whole thing is $fdf_dir=dirname(__FILE__).'/results'; and of course it's setting that var $fdf_dir to the path to a file. Is there something significant about the double underscores __? Why the parentheses, it's not a function? Sorry lame question but I don't know this. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] if(true false) //??
I have some code that I barrowed that works but I don't get how it could possible work, obviously I don't understand how false works: How can this ever pass?: if (isset($_SESSION['PrevUrl']) false) { Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] phpMyAdmin authentication error
On OS X 10.3 I installed the latest MySQL from dev.mysql.com for OS X 10.3. It was a Apple style installer package with a binary of the server and the client. The docs weren't exactly written for OS X but I survived the set up and am able to login as the root MySQL user with the command line MySQL client. From version tracker I got phpMyAdmin-2.6.2-pl1.tar.bz2 which is just a .tar of a bunch of files you drop into the web server path. But phpMyAdmin gives the error, Client does not support authentication protocol requested by server; consider upgrading MySQL client. I don't see a way to change the auth protocol in the phpMyAdmin conf file: config.inc.php. If I create a MySQL user with no password phpMyAdmin works. Because the install was from mysql.com I don't want to believe the client is out of date. I also don't know how to install another client. Any one have any ideas? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MySQL: Collation?
I need a new book? What's up with this filtering thing, Collation in phpMyAdmin? It's defaulting to latin1_swdish_ci. What can I just set it to to forget about it till I can read up on it? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Best CC gateway
Any recommendation for the easiest credit card gate way for PHP running on FreeBSD? Authorize.net? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Editing PDF
I have an existing PDF file that I want to add text to or make changes to text with data from an HTML form via PHP. The PDF looks like this: 20 0 obj/Length 5586/Filter[/ASCII85Decode/FlateDecode]stream 8;X-DgMYb:(An746bc%oU,Mo*Snfn`(:.P:CnHNZLL%2;CCTp,[EMAIL PROTECTED]'+2VqIkV -$2%Ipq]A aoW]SN?epNo... That is, not in plain text. If I wanted to add text to the PDF, e.g., Mr. Jones, where the heck would it go and what would it look like? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Editing PDF
Sam Smith wrote: I have an existing PDF file that I want to add text to or make changes to text with data from an HTML form via PHP. The PDF looks like this: 20 0 obj/Length 5586/Filter[/ASCII85Decode/FlateDecode]stream 8;X-DgMYb:(An746bc%oU,Mo*Snfn`(:.P:CnHNZLL%2;CCTp,[EMAIL PROTECTED]'+2VqIkV -$2%Ipq]A aoW]SN?epNo... That is, not in plain text. If I wanted to add text to the PDF, e.g., Mr. Jones, where the heck would it go and what would it look like? Thanks it's a compressed pdf. make uncompressed pdf and you should see the raw text Got it. In the distiller settings file: /CompressPages false thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Server Uptime
There is no function, but you could shell out and grab the output from the uptime command and use regex to parse the resultsor use one command line with uptime piped to awk to pull out what you need. HTH! --Sam -Original Message- From: Brad Ciszewski [mailto:[EMAIL PROTECTED] Sent: Monday, February 07, 2005 3:21 PM To: php-general@lists.php.net Subject: [PHP] Server Uptime What is the function, or how do you make a script that displays the server's uptime? Thanks, Brad Ciszewski www.BradTechnologies.com Web Services -- 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] sessions
I've installed Apache 2 and PHP 5 on Windows XP, and I'm having some issues with sessions. Everything else I've tried to do in PHP works fine, but for some reason every time I try to use session_start() i get the following errors: Warning: session_start() [function.session-start]: open(C:\PHP\sessiondata\sess_29eb1a211c118cc8083168f24e32ee75, O_RDWR) failed: No such file or directory (2) in C:\Program Files\Apache Group\Apache2\htdocs\Games\main.php on line 3 Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\Games\main.php:3) in C:\Program Files\Apache Group\Apache2\htdocs\Games\main.php on line 3 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Program Files\Apache Group\Apache2\htdocs\Games\main.php:3) in C:\Program Files\Apache Group\Apache2\htdocs\Games\main.php on line 3 Any suggestions? Sam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Error... how to fix?
GH wrote: Hi All... Got a problem... here is the error: Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /var/www/html/ahrc_computerclub/ahrc_computerclub.php on line 42... I am not sure on how to fix it... line 42 is: TITLE $language['program_name'] /TITLE\n . The language.php file only has: $language['program_name'] = AHRC Computer Club Program Leader Information Managment; Thank you for any and all assistance provided This is the entire ahrc_computerclub.php file: ?PHP #AHRC Program Leader Information Management# #Copyright (C) 2004 by Gary H # #EMAIL INFORMATION HERE # # This project is intended for Gary's use only and not to be distributed # # include language file include_once(language.php); # DOCUMENT OUTPUT ##START # printHeader(); echo $language['program_name']; printFooter(); # DOCUMENT OUTPUT ##END # # FUNCTION DEFINITIONS SECTION# function printVersion(){ $version = 0.1; return $version; } function printHeader(){ echo !DOCTYPE HTML PUBLIC \-//W3C//DTD HTML 4.0 Transitional//EN\\n . \http://www.w3.org/TR/REC-html40/loose.dtd\;HTML\n . HEAD\n . meta name=\description\ content=\\ \n . meta name=\author\ content=\Gary H\\n . meta name=\keywords\ content=\\ \n . meta http-equiv=\Content-Type\ content=\text/html; charset=iso-8859-1\\n . TITLE $language['program_name'] /TITLE\n . /HEAD\n. BODY\n; } function printFooter(){ echo \n/BODY/HTML; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] if($var) vs. if(isset($var))
What's the difference between: if($var) and if(isset($var)) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MySQL Excel
I've got it working writing out a file (fopen) to CSV (comma delimited) and the header('Content-Disposition: attachment; filename=myFile.csv') method but it's clumsy for the user to figure out how to use the file. Is there some totally slick way of spitting out a file that Excel can open right up? thanks sam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] POST losing SESSION vars?
I have a page that will be redirected to a login page if the SESSION var 'authenticatedUser' is not set. The page has a form in it. When the page is loaded http://thePage the authentication works fine. When the submit button is pressed it doesn't. With POST it acts as if the required session var is not set. When redirected to the login page the login page DOES recognize the the session var and redirects back to the first page a logged in user would usually see. formPage.php ?php session_start(); if(!isset($_SESSION['authenticatedUser'])) { $_SESSION['loginMessage'] = You must first login.br ; header(Location: index.php); } ... form action=?php echo $HTTP_SERVER_VARS['PHP_SELF']; ? method=POST name=purch_form id=purch_form ... input name=Submit ... /form ? index.php ?php // FUNCTIONS function logged_on($errorMessage) { header (Location: authTest.php); //tmp Loc while testing } function login_page ($errorMessage) { require_once login.php; //page where login pair entered } // end FUNCTIONS // BEGIN authentication session_start(); // First visit if (!isset($_SESSION['loginMessage'])) { login_page(Registered users please login.); exit; } // PASS if(isset($_SESSION['authenticatedUser'])) { logged_on(need some control here); exit; } // FAIL else { login_page($_SESSION['loginMessage']); exit; } ? In other words the same page should load after the submit button is pressed but instead the authentication is redirecting. Thanks for any help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Square brackets tags
I was just reading a little on this. This is the way you build a template system. Smarty uses { }. Maybe you could check out the Smarty page and get an idea. http://smarty.php.net/ Or maybe you could just use Smarty, you can change the { } to anything you want. Hi All, I need to write a PHP extension or a PHP template system (this is the question) to parse some commands enclosed in square brackets inside web pages. Please note that the commands are in the form [command1] and not ?php [command1] ?. I want use PHP because these commands needs to be remapped with a web oriented language. Is it technically possible to remap these square brackets tags to php? And if yes, what is the best way? A custom template system or a C PHP extension? Get Smarty. If you get into Smarty could you let us know how 'steep' it was? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] textarea vs. type=text data difference?
##The data is the same. I've been up a long time. BUT something is still very weird. Doc1.php (loaded in web browser) //contents of Doc1.php include functions.php include formProcessor.php include form.php Calling the protectText() function in functions.php from formProcessor.php with data posted from form.php works on data posted from textarea fields but does NOT on data posted from type=text. //contents of functions.php ONLY works on textarea fields The fundtion in function.php is: function protectText($tv) { $tv = stripslashes($tv); $tv = str_replace(\,[QT],$tv); $tv = str_replace(\r,br,$tv); return $tv; } BUT if I put the same function in formprocessor.php it works!?? //contents of formprocessor.php THIS works on both function TSTprotectText($tv) { $tv = stripslashes($tv); $tv = str_replace(\,[QT],$tv); $tv = str_replace(\r,br,$tv); return $tv; } TSTprotectText($_POST['field']); Now how can that be? Can you be a little more specific on what differences you get? I normally use textarea for multi-line data and input type=text for one line, short data... the only difference you might encounter that I can think off the top of my head is maybe line break? - Original Message - From: Sam Smith [EMAIL PROTECTED] To: PHP [EMAIL PROTECTED] Sent: Sunday, October 10, 2004 3:28 PM Subject: [PHP] textarea vs. type=text data difference? I have a form with both textarea and text type fields. I submit it and do some processing on identical data and get different results. What's up with that. Thank you. -- 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] textarea vs. type=text data difference?
htmlentities! Thanks a lot for taking the time but it was just my nubie error. What had me going all off in the wrong direction was textarea fields don't need htmlentities to display quotes correctly like a text field does. you know like this: value=some text with important info Displays in textarea fine but in type=text of course you get some text What a female dog. Okay, so in other words... //Doc1.php include functions.php //this file contains the function definition for protectText() include formProcessor.php //this file contains the code that calls protectText() include form.php //this file gets the form data from user By any chance, are ANY of the include files classes? I'm not 100% sure(unless you put up some more code), but it sounds like it's maybe a scope error... especially if you define the function in formProcessor and it works fine... -Minuk - Original Message - From: Sam Smith [EMAIL PROTECTED] To: PHP [EMAIL PROTECTED] Sent: Sunday, October 10, 2004 4:25 PM Subject: Re: [PHP] textarea vs. type=text data difference? ##The data is the same. I've been up a long time. BUT something is still very weird. Doc1.php (loaded in web browser) //contents of Doc1.php include functions.php include formProcessor.php include form.php Calling the protectText() function in functions.php from formProcessor.php with data posted from form.php works on data posted from textarea fields but does NOT on data posted from type=text. //contents of functions.php ONLY works on textarea fields The fundtion in function.php is: function protectText($tv) { $tv = stripslashes($tv); $tv = str_replace(\,[QT],$tv); $tv = str_replace(\r,br,$tv); return $tv; } BUT if I put the same function in formprocessor.php it works!?? //contents of formprocessor.php THIS works on both function TSTprotectText($tv) { $tv = stripslashes($tv); $tv = str_replace(\,[QT],$tv); $tv = str_replace(\r,br,$tv); return $tv; } TSTprotectText($_POST['field']); Now how can that be? Can you be a little more specific on what differences you get? I normally use textarea for multi-line data and input type=text for one line, short data... the only difference you might encounter that I can think off the top of my head is maybe line break? - Original Message - From: Sam Smith [EMAIL PROTECTED] To: PHP [EMAIL PROTECTED] Sent: Sunday, October 10, 2004 3:28 PM Subject: [PHP] textarea vs. type=text data difference? I have a form with both textarea and text type fields. I submit it and do some processing on identical data and get different results. What's up with that. Thank you. -- 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] Quotes in form textarea fields
I swear I googled for an hour first. A user enters in a textarea field of FORM1.php: Bob is high Submitted to FROM2.php we get: Bob is \high\ In a hidden field in FROM2.php we store the value: type=hidden, value=? echo stripslashes($_POST['textarea']); ? Value now Bob is high Then from FROM2.php we Submit BACK to FROM1.php and enter it back into the textarea field with: type=textarea, value=? echo $_POST['hidden']); ? we have; Bob is Everything after the first double quote is clobbered. I can fix this by putting this in FORM2.php: $APParea1 = $_POST['textarea']; $APParea1 = str_replace(\,[QT],$APParea1); and then back by putting this in FORM1.php: $APParea1 = $_POST['hidden']; $APParea1 = str_replace([QT],\,$APParea1); type=textarea, value=? echo $APParea1; ? BUT THIS must have happened many times a long long time ago to many good people and some smart function was developed, right? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail() and Verizon
The solution was a simple -f (see it in the extra headers just before the last [EMAIL PROTECTED]). Sets the envelope sender address when using sendmail with the -f sendmail option. mail([EMAIL PROTECTED], [EMAIL PROTECTED], Testing the simple mail functions, Did you get this one?, From: [EMAIL PROTECTED] \n, [EMAIL PROTECTED]); I believe the problem is that Verizon checks the MAIL FROM address during the SMTP session against the domain portion of the From header. If they don't match, the mail is rejected (or dropped). This was an issue for a webboard I use... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail() and Verizon
The solution was a simple -f (see it in the extra headers just before the last [EMAIL PROTECTED]). Sets the envelope sender address when using sendmail with the -f sendmail option. mail([EMAIL PROTECTED], [EMAIL PROTECTED], Testing the simple mail functions, Did you get this one?, From: [EMAIL PROTECTED] \n, [EMAIL PROTECTED]); I believe the problem is that Verizon checks the MAIL FROM address during the SMTP session against the domain portion of the From header. If they don't match, the mail is rejected (or dropped). This was an issue for a webboard I use... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: mail() and Verizon
Hello, On 10/01/2004 12:47 AM, Sam Smith wrote: Can anyone tell why the mail (see below) is not being relayed to [EMAIL PROTECTED]: #Note: There were 2 To: addresses. Below is the header from the successful mail to the second address. Each address will receive different message copies. I wish. The problem is the first address is not receiving the message. I suspect the verizon mail server is rejecting it thinking it's spam because of something missing in the header. I put the Note in so no one would be confused by the fact the example mail *was* delivered successfully. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: mail() and Verizon
have you tried sending the same message, via the same path (i.e., smtp server), but not generated via php, to this recipient? by same that includes the same rfc821 from/return-path. I logged on to the web server where php is running and did telnet localhost 25 hello ... The mail was reported to have not been received. do make certain that your correspondent doesn't have some funky spam filtering of their own. Excellent idea. the bottom line, however, is that this isn't a php issue. you're successfully getting the message, so your script is working fine. Yes, thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mail() and Verizon
Can anyone tell why the mail (see below) is not being relayed to [EMAIL PROTECTED]: #Note: There were 2 To: addresses. Below is the header from the successful mail to the second address. header Return-Path: [EMAIL PROTECTED] Delivered-To: [EMAIL PROTECTED] Received: (qmail 70862 invoked by uid 399); 1 Oct 2004 00:49:10 - Received: from unknown (HELO web2.nsservers.org) (204.118.173.14) by mail.nsservers.org with SMTP; 1 Oct 2004 00:49:10 - Received: from web2.nsservers.org (localhost [127.0.0.1]) by geb2.nsservers.orw (8.12.9p2/8.12.8) with ESMTP id i910WJwe018715; Thu, 30 Sep 2004 17:32:19 -0700 (PDT) (envelope-from [EMAIL PROTECTED]) Received: (from [EMAIL PROTECTED]) by web2.nsservers.org (8.12.9p2/8.12.8/Submit) id i910WJDE018714; Thu, 30 Sep 2004 17:32:19 -0700 (PDT) Date: Thu, 30 Sep 2004 17:32:19 -0700 (PDT) Message-Id: [EMAIL PROTECTED] To: [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: Testing the simple mail functions From: [EMAIL PROTECTED] /header Could the mail server running on web2.nsservers.org be mis-configured? Is there something missing in the header? This mail is being generated from the PHP mail function in a web page. The PHP line is: mail([EMAIL PROTECTED], [EMAIL PROTECTED], Testing the simple mail functions, Did you get this one?, From: [EMAIL PROTECTED] \n); Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect does not connect
Raditha Dissanayake [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Sam Hobbs wrote: I have posted over 12,000 messages in the CodeGuru.com Visual C++ forum, Do you have a life ? I hope the moderators protest posts such as this. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect does not connect
Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Would you mind spilling the beans? I'm sure everyone is dying to know what the resolution of this thread is. I definitely mind. I don't believe in rewarding bad behavior. It is reasonable to contribute to the productive development of solutions, but the attitude in this group is not productive. I have the impression that the real reason you want answers is so that you can continue in unproductive directions. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect does not connect
Curt Zirzow [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] * Thus wrote Sam Hobbs: And the relevant portion of that says external access, which is not applicable here. I do not see anything else on that page that is relevant. what is relevant? only the last one? :sigh: I don't know. Ask them, not me. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect does not connect
Curt Zirzow [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Um.. you do realize you have more problems than php not being able to connect to the database. This is the type of unproductive comment that causes problems. The only reason you are saying this is because you are desperate to make me wrong. You have exhausted reasonable comments and must resort to unreasonable ones. That sure is a problem here. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect does not connect
Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Being obstinate and contrarian does nothing to help resolve your problem. This is more unnecessary and unproductive comments. Since you did not have something relevant and productive to say the best thing to do is say nothing. I hope the moderators agree. Would I be correct if I paraphrased the above as: The wrong way to get Sam Hobbs to try something that might help in solving his problem: [JD] The firewall might be blocking your attempts to connect to mysql. Try disabling it. [SH] Yeah and what makes you think that? I KNOW the firewal has nothing to do with it. Get real (and go away). The right way to get Sam Hobbs to try something that might help in solving his problem: [JD] The firewall has nothing to do with your problem. But try disabling it anyway. [SH] Yeah that sounds reasonable. Thanks, I'll try that. How silly is that? You paraphrased version is not accurate. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect does not connect
Steve Brown [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Sam, if you wouldn't mind answering a question: are you still unable to connect to your mysql server? I am able to connect now. I'm sorry that you feel its a time-consuming process. I'm sorry that you are confused about the involvement of the firewall. I'm sorry that you feel you know better than everyone on this list. Just try this and prove us wrong. The problem is that people's insistance. It was people's reaction when I said I thought it was not relevant. There was a lot of stuff said that was unnecessary. People could have simply said to try it, without the criticism. To the extent that I was wrong, the apporopriate thing to do is to state whatever facts are relevant and then give me a chance to use that information. I have posted over 12,000 messages in the CodeGuru.com Visual C++ forum, and about 99% of the messages were efforts to help people. I know that there are people that will not listen. When a person will not listen, it is a big mistake to insult them. The attitude in this group would cause a serious flame war if someone were truly not listening. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect does not connect
Matthew Sims [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] You should check as XP SP2 firewall is turned on by default. http://support.microsoft.com/default.aspx?kbid=842242 Saying You should check assumes I did not check. I did check. I said as far as I know it is off. I am sorry that that does not state explicitly that I checked, but if I had not checked it then I would have stated explicitly that I did not. What I meant is that I don't see anything saying that the firewall is on. When I go to whereever it is that the firewall is configured, it is off. The only reason I am confused is because there are events in the security log complaining about use of some ports and I don't understand that. The messages seem to be produced in spite of the Windows firewall being off. I did explicitly turn off the Windows firewall soon after installing ZoneAlarm over two years ago and again after SP2 was installed. Note that XP has always had a firewall, it just has been improved and made reasonably useful in SP2. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect does not connect
That is the type of comment that causes problems. Reasonable and knowledgable people know it is not true and saying it just causes problems. Of course, many people would advise to just ignore comments such as that and I will in the future. I just want to make it clear for the benefit of others that this is the type of comments that has caused problems. Jason Davidson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Windows XP Firewall, or any other firewall for that matter must be off. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: mysql_connect does not connect
Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Unfortunately (fortunately?) there are packages out there which install all Apache/MySQL/PHP for you or whatever. So unless you state which package you're using then typical is still meaningless. It's just helpful when posting to provide as much _relevant_ info as possible. I am sorry I did not know anything about the other packages. I assumed it was clear that I meant the installation provided by MySQL from there web site. I had no way of knowing that I needed to state what package. The MySQL documentation mentions only two ways of installing MySQL; either manually or by using the installation program they provide. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect does not connect
Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] The firewall is relevant depending on your circumstances. In any case it would take you all of one minute to disable your firewall to test out this wild far out suggestion. At the most you would have lost one minute but you would have either: - gained the satisfaction of saying I told you the firewall was irrelevant, now go away and stop wasting my time with your ridiculous suggestions or - you would have found the cause of your problem It definitely takes more than a minute. It takes nearly a minute just to logoff one user and I often have another user, the Administrator account, also logged in. If the Administrator account is not lgged in already, then I must log in to it to shutdown ZoneAlarm. Then the system must shutdown and restart. While that is happening, I must unplug the cable modem to ensure I get nothing from/to the outside, but that can be done in parrallel with system shutdown. However I must stay at the system while this is happening; I prefer to unplug the cable after the system disconnects from the modem. Then I must log in to at least one account and start a few things, such as Apache. Relatively speaking, Apache starts immediatley, so it is not very relevant, but it does take time for my system to start. Then after the test I must restart ZoneAlarm, restart the system and be sure to plug the modem back in while the system starts. The whole operation is likely to take nearly a half hour at least. Contrast that with the number of posts you have made denying that the firewall could be a problem, and stating adamantly that you will not do such-and-such a thing because it is 'not supposed' to happen like that. The problem is all the people that persist in saying the same thing. I am smart enough to think of the things being suggested. It is the type of thing that is very easy to suggest. I get frustrated by people suggesting things just because they are easy to suggest. Therefore when people make a suggestion that is more likely to be relevant it is difficult for me to determine which ones are worthwhile. And again, I am able to think of things such as eliminating the firewall as a possibility. It is okay for people to suggest that, but unless they can show me something that clearly says it is relevant, then they won't accomplish anything by insisting. One problem is that I get answers that are not accurate, so it is difficult to know which ones are accurate. The most important thing is that unless people give me a clear explanation of what they are saying, it is useless to insist. I don't mind a suggestion as much as it is the insisting that causes problems. Therefore from my point of view, it is the insistance by others that keep the discussion going (in useless directions). There is one person in particular that tries too hard to help and then when I politely say I am getting too much help I get criticized. That is not a productive attitude. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect does not connect
Markus Mayer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] It is our experience at my employer that the firewall in XP-SP2, as well as other firewalls that are available, are very relevant. Thank you. I have not seen anything that states that explicitly. I doubt that SP2 makes a difference; the main reason I mentioned it is just to be thorough. I am nearly certain that the XP firewall, including the XP-SP2 version, is turned off. We also have not seen any documentation about problems with such things after installing SP2, but we have problems. Things that worked before don't work any more, especially client side things. Our three small Windoze servers have given our Windoze administrator more than enough work recently. Supposedly there is something that is about 30 pages that lists hundreds of incompatibility problems. Therefore it is likely that most of the don't work any more problems are identified by Microsoft. flame blocked by firewall. Then ignore it. Just calling it a flame is likely to add fuel. I prefer to limit the discussion to facts, which is not happening in this discussion. The word flame is usually an unnecessary emotional expression SP2 is so new that its effects are still being evaluated by a lot of people. At the moment, I think the best place to get information about its effects is forums like this one. Formal documentation will be updated in time as more experience is gained. The info I got from our Windows admin is that with SP2, the MS SQL server on one machine was apparenty unaffected, but the MySQL on another was. Dropping the MS Firewall in SP2 allowed connections again. Client side, SP2 has caused nothing but problems for us to the point where we as administrators are now saying to our users it was working before you installed SP2, and after you installed SP2 it stopped working, so it's your problem. IE is especially problematic, and when someone calls up and says they have a problem with IE and have installed SP2, our response is that we no longer support IE and tell the users to install Mozilla, and if they still have problems when they try Mozilla, they can call us back. We haven't heard from any of them again, and our help desk girls have always been able to quickly sort out the problems users have when they first try Mozilla. Again, I doubt that SP2 is actually relevant, especially if I am correct that I am not using the firewall. If I am correct that it is not relevant, then dwelling on it is the type of thing causes confuson about what is usefull I am not aware of any problem caused by SP2 except that it makes a little more work for me due to it's increased security and ti complains about a few things that I see no reason for it to complain about. I hope that if it is causing a problem I will be able to determine that but so far I have no reason to believe SP2 is relevant here. I looked back in this thread and saw that you used Zone Alarm as a firewall. You need to allow MySQL connections to localhost, and that regardless of which firewall you use. If you filter such connections out, PHP scripts will not be able to connect to your MySQL server. This is because PHP makes a TCP connection to the MySQL server, also when it is running on the same machine as you PHP/Apache (at least this is my understanding). You can of course continue refuse all external (that is not from localhost) connections to whatever service is running on your machine. I think something to this effect has already been said in this thread, but at the moment I don't want to search for the post. Again, it is okay to say this once but it is not useful to keep insisting. I am smart enough to be aware of the possibility and if and when other possibilities have been exahausted I would have tried the possibility of disabling the firewall or whatever. Insisting upon it from others is not productive; it is more likley to polarize me in the opposite direction and get us to where we are now. It is the emotional commentary that is most unproductive. I try to explain (unemotionally and in a reasonable manner) that I don't need the additional assertion that I must try something and the response to that becomes emotional. While the flame war in this thread has been amusing to read, it's amusement value for me has more or less run out. My impression is that you still don't have the thing working, and the only solution left is to configure your firewall to allow connections to your MySQL server from localhost. If you would do this, and it works, please post to the list to reflect this. My experience as an administrator tells me with a 99% certainty that this is your problem. Again, it is unproductive to repeat the same thing over and over. When someone repeats it, I have a tendency to respond to that. We have now gotten to the point where the discussion is unproductive. It
Re: [PHP] mysql_connect does not connect
It is innacuracies such as this that make it difficult for me to pursue the useful suggestions. Chris Dowell [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] All this is irrelevant; while you're still trying to use MySQL 5 with mysql_connect() instead of mysqli_connect(), it WILL NEVER WORK Sort that out first before you start worrying about firewalls - you can't test the firewall if you can't ever have a successful test case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect does not connect
Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] IIRC the OP did have a successful test case when connecting from the mysql client. Yes, I did get it to work. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect does not connect
John Nichel [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] The MySQL functions work fine in php5. It just doesn't support all the features available in MySQL = 4.1.0. Unlike php4, support for MySQL isn't bundled in php5, but when enabled, it works. Thank you. I will try to remember that everything you say is very likely to be useful and accurate. As far as I can remember, all that I had to do to enable the mysql extension is to uncomment the line for the extension in php.ini and add php to my path. However I had problem initially and it was caused by the (Windows) registry entry that also specifies the path (to php.ini?), so for new installations that registry entry might be important too. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect does not connect
Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] IIRC the OP did have a successful test case when connecting from the mysql client. For whomever is interested, see my mess(ages) in the php internals. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: mysql_connect does not connect
Curt Zirzow [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] RTFM. mysql: This MySQL extension doesn't support full functionality of MySQL versions greater than 4.1.0. For that, use MySQLi. mysqli: The mysqli extension is designed to work with the version 4.1.3 or above of MySQL. What the manual says (as quoted) is either not relevant or is not clear. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: mysql_connect does not connect
Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I'm not familiar with MySQL under Windows, but I believe that there are different installers available from various sources. So saying Typical installation option doesn't really mean much. There is only one Windows installer available rom the MySQL web site and it has an option that explicitly says Typical. Therefore in this context Typical is extremely specific and relevant. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect does not connect
I appreciate your attempts to help, but you must understand that when attempts to help just cause time to be wasted, then it might be appropriate to not appreciate the help. Then when I try to explain that you are not helping, you make comments such as this, trying to blame me. If I am the only person you do this to, then I can live with it. If however you do this to others, then I hope you are told by others that you are trying too hard to help and that you resort to insulting others when you don't help. Perhaps there is some validity to what you are saying, but you are also saying some things that are not valid, which makes it difficult or impossible to determine what is valid. I do try to tell you in reasonably polite and useful ways that much of what you say is not helpful. Obviously I need to just ignore your help instead. Jason Davidson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] There is an issue with sp2 and loopback, you can argue all you like, but many have had this problem, and many have resolved it. Mysql will not connect through udp, it will use tcp. If you supply a hostname in your connect function, it will use tcpip to connect over a port, if oyu dont supply a hostname, or i beleive put a '.' in its place, it will attempt to connect through a named pipe which doesnt use the network. In the time you spend writing this email, you could have attemped a suggested solution. A little more acceptance to help would gain a lot more respect from me, not that you probably care about others respect. And for further note, for the sake of discussion, as you have mentioned to me on a certain forum. A firewall can absolutely interfere with a connection to mysql even if you are using localhost, if, and only if, that connection is being done over tcpip, which in unix, is rarely, but in windows, is not all that rare. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect does not connect
Greg Donald [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I lost track of who the original poster was, but anyway... Why not disconnect from the internet, turn off all the firewalls, and then see if it works. If it doesn't then post some error messages and code for what's being tried and failing. I am the original poster. The reason I avoid doing things like that is because it is a guess. It should not be necessary; the firewal should not be relevant. Sometimes people suggest things that are not likely to be a solution but are easy to suggest. However I also believe in being methodical and in verifying assumptions. It does help to eliminate possilities. Something that has not been mentioned is that I am using versions that are not fully tested, so it is possible that there are bugs. Apparently something is trying to use the internet that is not supposed to. If I am correct, then it is difficult to say what I should try except that I should eliminate possibilities in the manner you say. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: mysql_connect does not connect
Andrew Kreps [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Tue, 14 Sep 2004 10:11:24 -0700, Sam Hobbs [EMAIL PROTECTED] wrote: Also, are the warning messages documented? As I asked in my original question, is 10061 an error code? 10061 is a generic winsock error for a timeout, it's not PHP or MySQL specific. It means that the call couldn't connect to the socket you were trying to hit within the time allowed. Again, thank you. Apparently there is a problem with the internet being accessed. I tried to determine the problem but it is not clear. What I did to try to diagnose the problem is that I deleted from ZoneAlarm the configuration for the relevant programs. For those not familiar with ZoneAlarm, I essentially removed from it anything it knew about Apache, MySQL and php. I thne tried the mysql_connect, and ZoneAlarm asked if Apache could access the internet. However it behaved differently, depending on whether I was using an account with administrator privileges. If I was using administrator privileges, Apache tried to connect to address 0.0.0.0. If I was not using administrator privileges, Apache tried to connect to the DNS server address. However there are more details so assuming this is a bug I need to coordinate with someone to determine how to diagnose this. By removing Apache, MySQL and php from ZoneAlarm and then allowing Apache to access the internet when I did the mysql_connect, I am able to connect. I assume that this is not how it should be. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: mysql_connect does not connect
Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] So now are you fully convinced it's your firewall that's the root of your problem? No, not really. At the moment I am assuming it is a bug in something somewhere. The versions of php and MySQL that I am using are not fully tested. Therefore it is entirely possible that the problem I had is not supposed to be a problem. 1) How are you connecting using mysql_connect()? Do you use IP addresses or hostnames? 2) What are your exact connection parameters when connecting as an admin user? 3) What are your exact connection parameters when connecting as an normal user? I am not sure how to determine these things, except to say that I am using MySQL as it was installed by the Typical installation option. Oh, now I understand better. Sorry. The username admin confused me, but I should have known. There is a slight chance I used a different host than localhost. So to be absolutely sure, I will do the tests again when I make a fomal bug report, assuming that a bug report is needed. Other than that, I used the following for both my Administrator and my non-Administrator accounts: ?php $location = localhost; $username = root; $password = ; $database = mysql; $conn = mysql_connect($location, $username, $password); if (!$conn) die (pCould not connect to MySQL using $location, $username, $password/p\n); print pConnected to MySQL using $location, $username, $password/p\n; mysql_select_db($database, $conn) or die (pCould not open database/p\n); print pDatabase $database selected./p\n; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect does not connect
Greg Donald [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Yeah, seeing how we don't have physical access to your system that's all you will get is guesses and suggestions. If you want definative answers, hire a consultant, bring them to your pc, and pay them to fix it. I have posted many thousands (literally) messages in another forum trying to help people. So most of the time the roles are reversed. I know when others are guessing. In that forum, the few times that I asked questions, I got many guesses that were a waste of time. One way of defining a guess is something that I am able to think of myself. If you wanted us to know what versions of software you are using, no one is stopping you from saying so. I did! You just want to be critical! Since when does fully tested mean bug free? When I say untested, I mean that the developers of the software have defined these versions as being untested. It is their definition; there are also production versions of the software that is considered to be adequately tested. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect does not connect
Jason Davidson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Now that you have figured out, that it is possible its your firewall, which, many, and i think you claimed before was impossible, what exactly makes you sure i said anything invalid. It is my understanding that the firewall is not supposed to be relevant. I have not seen anything saying it is supposed to be. If it is true that it is not supposed to be relevant, then simply saying it is just causes confusion. If you had said that the firewall is not supposed to be relevant, but try disabling it anyway, then I would say that I am totally able to think like that too. It is reasonable to try things like that to diagnose a bug. If you can find something in the MySQL documentation saying that the firewall needs to be disabled eventhough the server and client are the same system, then that would sure help. I am not asking you to; I am saying that that is what would help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php/MYSQL remove duplicate records
I do that a lot using Microsoft Access. I just finished on a project where I had to eliminate duplicates from each of three or more queries, a couple of which have three keys. However I am not much more experienced han you are; Microsoft Access generates SQL for us so I am not sure what the SQL looks like. This is actually a SQL question; I think it can be solved entirely by SQL. However I don't know and it is not my responsibility to decide such things. You can (should) sort by email address of course. Then there is a function for getting the count of a field. The result will be records with the email address occuring only once. The following I think is a simplified version of something I have done: SELECT ITEMNO, COMP1, COMP2, Count(COMP2) AS CountOfCOMP2 FROM CostsMerge GROUP BY ITEMNO, COMP1, COMP2; However I have another duplicates removal query that uses Last but not Count, as in: SELECT Item, Comp1, Comp2, Last(Comp1Q), Last(Comp2Q) INTO MergedData FROM Merge GROUP BY ITEMNO, COMP 1, COMP 2; In both of the above, there are three keys: Item, Comp1 and Comp2; whereas you have just one key, the email address. Dustin Krysak [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi there - I have an extremely simple table that has a unique Id and an email address. what I am looking for is an example of a PHP script that will poll the MYSQL database and delete the duplicate records leaving only 1 unique (email) record. can someone point me to the right place? thanks! d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mysql_connect does not connect
Janbro [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi I connect to a MySQL 4.1 with the following String: if ($db_verbin=mysqli_connect($mysql_host,$mysql_user,$mysql_passw,$DB_n ame)) watch the i in mysqli_connect! I think I've read somewhere that you are required to use that for the 4.1 Versions, but you better look that up, I might be wrong there. Hope this helps JanBro Thank you. Yes I know that there are two versions of interfaces to MySQL and the newer version has the i in it. Perhaps I should use it, but I thought the older version works also. I am using mysql_connect because the tutorial I started using uses it. Obvioulsy mysql_connect is in php version 5 so it should work. So I hope no one thinks that my question has been answered. If there is something stating that mysql_connect is not supposed to be used then it would help to know where that is said. Otherwise it would help to know what to look for as possible causes, assuming that the host, user and password are correct. Also, are the warning messages documented? As I asked in my original question, is 10061 an error code? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mysql_connect does not connect
Janbro [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi I connect to a MySQL 4.1 with the following String: if ($db_verbin=mysqli_connect($mysql_host,$mysql_user,$mysql_passw,$DB_n ame)) watch the i in mysqli_connect! I think I've read somewhere that you are required to use that for the 4.1 Versions, but you better look that up, I might be wrong there. Hope this helps JanBro When I do try mysqli_connect, I get: Fatal error: Call to undefined function mysqli_connect() So obviously I need to do something to enable that. I will look into that later, but I am still trying to get mysql_connect to work. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect does not connect
Jason Davidson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Windows XP Firewall, or any other firewall for that matter must be off. Jason Can someone else confirm that this is correct? For one thing, when I use MySQL directly outside of a web page, it works. The sample C program works. For another thing, I doubt very immensely that everyone using mysql_connect does not use a firewall. Even if anyone else does, I will not. It would have been quite unreasonable for the developers of PHP to develop software with that requirement, but I doubt it was. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect does not connect
John Nichel [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I don't know anything about WindowsXP or it's 'firewall', but you _may_ have to open the port for which you have MySQL running on. I haven't followed this thread, but if MySQL, and your php enabled webserver are on the same box, then your firewall doesn't come into play. Yes, this is all one system, so I sure thought that a firewall is not relevant. Thank you for saying so. I don't (should not) have the Windows XP firewall turned on; I use ZoneAlarm. This is extraneous relevance, but there is a possibility that the Windows XP firewall got turned on due to Windows XP SP2 (the latest big batch of fixes and upgrades for XP). I doubt it, though; I have checked and such. However to the extent that a firewall is not relevant, this is tnot relevant. Something that might be relevant is the possibility of some other new security feature installed by the XP SP2. If so, then many others will be encountering it in the future; SP2 was released to the public sometime in the last couple of months, probably less than a month ago. Even so, I am surprised that I am the first to say anything if that is the problem. Probably if that was a problem, other systems that were working would have been broken by SP2 and people would know that SP2 is the cause. Using that logic, it is unlikely that SP2 is the problem. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect does not connect
Jason Davidson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Also, a google on the error returns hundreds of results.. http://www.google.ca/search?hl=enie=UTF-8q=Can%27t+connect+to+++MySQL+server+on+%27localhost%27+%2810061%29btnG=Searchmeta= Yes, I could have searched more first. And yes, that search does get an abundance of results. However I see no solutions relevant to my problem. Many of the solutions say things such as that the extension is not installed or that MySQL is not installed. Many (close to half I think) of the results are pages that have the error, so the abundance of results indicates it is a prevalent problem that is often not easily solved. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: mysql_connect does not connect
Andrew Kreps [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Tue, 14 Sep 2004 10:11:24 -0700, Sam Hobbs [EMAIL PROTECTED] wrote: Also, are the warning messages documented? As I asked in my original question, is 10061 an error code? 10061 is a generic winsock error for a timeout, it's not PHP or MySQL specific. It means that the call couldn't connect to the socket you were trying to hit within the time allowed. Thank you; that helps. So something that might help is for the PHP message to issue a more specific message indicating the timeout problem. This is just a suggestion for the developers. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect does not connect
Jason Davidson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Also, a google on the error returns hundreds of results.. http://www.google.ca/search?hl=enie=UTF-8q=Can%27t+connect+to+++MySQL+server+on+%27localhost%27+%2810061%29btnG=Searchmeta= One thing I did find in the results is that at least one person had problems using (I think) phpMyAdmin. It supposedly uses mysql_connect. I am not aware of installing phpMyAdmin in my system, so I will try installing and using it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect does not connect
The firewall I am using is ZoneAlarm, the free version. I am nearly certain that it does not allow specific ports to be opened, at least not for specific addresses. So if this were a requirement, probably many others would have that specific problem. However if nothing else works, I will try to look into this further when I have time. At the moment I must spend time on something else. Jason Davidson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] The webpage of coarse, is not local, regardless of where its hosted, so a firewall will come into play when trying to connect. You dont have disable it, i should have been specifc i suppose, you must allow for the mysql port to be open. :) Whats for others to confirm, try it yourself and see if it works. Jason Sam Hobbs [EMAIL PROTECTED] wrote: Jason Davidson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Windows XP Firewall, or any other firewall for that matter must be off. Jason Can someone else confirm that this is correct? For one thing, when I use MySQL directly outside of a web page, it works. The sample C program works. For another thing, I doubt very immensely that everyone using mysql_connect does not use a firewall. Even if anyone else does, I will not. It would have been quite unreasonable for the developers of PHP to develop software with that requirement, but I doubt it was. -- 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_connect does not connect
Note that there is a difference between the php_mysqli and the php_mysql extensions. I have both php_mysqli.dll and php_mysql.dll in my PHP501\ext directory, but I don't have the extension=php_mysqli.dll line in my php.ini file. Is that something that should be in the php.ini (with a ; to comment it out) file for php 5.0.1? I will try adding the extension=php_mysqli.dll line in my php.ini file later when I have time. I did not try earlier since the commented version is not in the php.ini file, either commented or uncommented. Chris Dowell [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Sam Your problem probably does stem from the extension not being installed. You say you're using (IIRC) mySQL 4.1 This requires you to use the mysqli extension, not the mysql extension As you're on windows, it's probably just a case of uncommenting the extension=php_mysqli.dll line in your php.ini, but I'm not sure as I don't have much experience configuring PHP for windows. Anyway - as far as I can tell from what you've said, that's likely to be your problem - your timeout is occurring because the mysql extension cannot connect, not because of any firewall issues. From the manual entry on MySQL (http://www.php.net/mysql): This MySQL extension doesn't support full functionality of MySQL versions greater than 4.1.0. For that, use MySQLi. If you then look at the entry for MySQLi (http://www.php.net/mysqli), you'll see this: The mysqli extension allows you to access the functionality provided by MySQL 4.1 and above. Then this page (http://www.php.net/manual/en/install.windows.extensions.php) about installing extension on windows should get you the rest of the way. Cheers Chris Sam Hobbs wrote: Jason Davidson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Also, a google on the error returns hundreds of results.. http://www.google.ca/search?hl=enie=UTF-8q=Can%27t+connect+to+++MySQL+server+on+%27localhost%27+%2810061%29btnG=Searchmeta= Yes, I could have searched more first. And yes, that search does get an abundance of results. However I see no solutions relevant to my problem. Many of the solutions say things such as that the extension is not installed or that MySQL is not installed. Many (close to half I think) of the results are pages that have the error, so the abundance of results indicates it is a prevalent problem that is often not easily solved. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect does not connect
John Nichel [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Jason Davidson wrote: The webpage of coarse, is not local, regardless of where its hosted, so a firewall will come into play when trying to connect. You dont have disable it, i should have been specifc i suppose, you must allow for the mysql port to be open. :) Whats for others to confirm, try it yourself and see if it works. Jason You understanding of how this works is a bit off Jason. If you make a call to one of my web sites from your machine via a browser, the _only_ port I need to have open to the outside is 80 (or whatever port I have my web server running on), even if I make 1000 calls to a local db, but this has nothing to do with how the web server talks to MySQL. What is meant by local here, is that the MySQL db and web server are on the same machine. A firewall comes into play when your web browser requests a page from my web server, but does not come into play when that page has to connect to a local db before sending content to you. Your remote machine never talks to my local MySQL db. Thank you. As I said previously, I did think that the firewall would not be relevant. I don't know a lot about the TCP/IP stuff but I do know enough to write a couple of simple programs. They are actually UDP programs. An example is my UDP Send and Receive Using CAsyncSocket at: http://simplesamples.info/MFC/UDPSendReceive.php Using it, I can send and receive UDP packets within my system using 127.0.0.1 without any problem from my firewall. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect does not connect
And the relevant portion of that says external access, which is not applicable here. I do not see anything else on that page that is relevant. Jason Davidson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] ok, well, i just posted a link for you to check out, it gives insight on how mysql connects on different platforms, this will of use to you i think, the last few bullets in the page i linked to are of some importance to your error msg which says, cant connect to localhost, and not, cant connect through socket... again, link,, http://dev.mysql.com/doc/mysql/en/Can_not_connect_to_server.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql_connect does not connect
I have: PHP Version 5.0.1 MySQL 5.0.1 Apache 2.0.48 Winows XP Pro SP2 MySQL is working fine as best as I can see; I have tried the various samples in the MySQL manual and I have executed the myTest sample provided with MySQL. They all work. However I can't get mysql_connect to work; when I try: $conn = mysql_connect(localhost, root); I get: Warning: mysql_connect() [function.mysql-connect.chm]: Can't connect to MySQL server on 'localhost' (10061) The host and user should be correct; I have not changed anything such as that after installation. The password should still be blank. However I have tried many, many other combinations but nothing that works. Is 10061 an error code? I can't find it in the PHP documentation. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] get_class_vars
Using the code shown below, I get nothing from get_class_vars but I do get very useful results from get_class_methods. I realize that this is how it is supposed to be, but it would be useful to be able to get the property members of the class. The reason I want to see the properties of DOMDocument is because they are not documented. There are some methods of the DOMDocument class that exist in other implemntations of the DOM but not the PHP 5 implemntation. Probably the equivalent is available using properties to get data instead of methods. Due to the absence of documentation of the properties, it would help to have a function that shows the properties. I will look for the source code and I assume I can find the answer there, so I assume I don't need help with that. Unless there is some other function that will show the properties of a class in the manner I am looking for. pre?php function ShowClass($class_name) { print Class $class_name properties:\n; $class_vars = get_class_vars($class_name); sort($class_vars); foreach ($class_vars as $name = $value) echo $name : $value\n; print \nClass $class_name methods:\n; $class_methods = get_class_methods($class_name); sort($class_methods); foreach ($class_methods as $name = $value) echo $name : $value\n; } ShowClass(DOMDocument); ?/pre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with front page files downloaded to dev machine OT
John Nichel [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] How about middle posting? I have noticed that usually when people say things like don't top post, the reasons provided for not doing it apply equally as much to bottom-posting. What they really maen is that they want us to snip the extraneous portions and then reply inline (middle posting), but they don't say that. I really, really feel that people would be more effective if they did not say things such as simply Please don't top post.. I think comments such as that, without explanation, is the type of thing that starts flames. It is entirely possible to be more reasonable. Sure it might require an extra minute of time, but the world would be so much nicer if people would do more things like that. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP to replace javascript
Jack Gates [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Javascript can open a separate and specifically sized window from a web page when a user clicks on a link that might reference a note or picture etc. Can this be done with PHP? If yes, will someone tell me where in the manual on the php.net site I can find the information to learn how to do this? I have been looking through the manual on the site but without knowing the name or names of what I am looking for it is real hard to find it. I am new to PHP also but there is some fundamental understanding of PHP that is likely to make things much more clear. PHP is a server-side facility. PHP executes before the HTML is (considered to be) complete. Then the HTML is sent to the client. By the time that the user clicks on the page, PHP is totally gone (for the purposes of the page). This concept is quite easy to explain and to understand, yet you are likely to spend many, many hours of reading before you read enough to understand this. In other words, I am sure you can understand it, but this is the type of concept that documentation seldom makes clear. You can, instead, put resize code (using PHP or nearly any language) in the page that shows the image. This is also a more object-oriented solution. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Popup with recent IE updates
Lester Caine [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] So don't know what goes wrong, but were running Apache 2.0.50, PHP5.0.0 on XP-SP1 and probably style sheets were going wrong. Switch back to W2k SP3 and all is fine (SP4 screws up various other network apps) so we stay with that until Linux is acceptable :) I think the problem is not that IE (as you said elsewhere) is crap. Probably it is your assumtion that it is crap that caused you to avoid adequate diagnosis of the problem. You sure did not provide an adequate description of the problem, which is a very likely cause of not getting a response (from Microsoft). In particular, XP SP2 does have popup blocking capability that works by showing a small window at the top of a page. This is similar to what you described, but if what you were encountering was the XP SP2 popup blocker, then you sure did not understand the problem. If you do not describe a problem well, then it is impossible to get useful help. If your pages use popups then XP SP2 will block them at the client end unless the client's owner chooses to see them. This probably is upsetting for you, but don't blame Microsoft for simply doing what is wanted by most of their customers. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Is a PECL a black whole?
It took me a while to find an explanation of what a PECL is. I kept reading comments about things being moved to a PECL but I saw nothing about what is in a PECL or how to get anything out of a (the?) PECL. As far as I knew, there is a danger of all of PHP being in a PECL. I could not (and cannot) find an explanation of a PECL when I start by going to the main php.net page and looking for one. So I searched for PECL and got a few results; one result is for vpopmail: http://us4.php.net/vpopmail From that page I clicked on the link for the PECL and then modified the address for the page to get to the pecl.php.net page. Now when I search, I do see in the results the PHP.net: A Tourist's Guide page. That appears to be a very useful page. And now that I know to look for it, I do see a link to that page from the main PHP page. So people should be able to find an explnation of what a PECL is, but I just want to say that it might help to make it easier for new people to find the PHP.net: A Tourist's Guide page. Perhaps a link to it could be put into the box on the left under What is PHP?. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is a PECL a black whole?
Curt Zirzow [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] * Thus wrote Sam Hobbs: It took me a while to find an explanation of what a PECL is. I kept reading comments about things being moved to a PECL but I saw nothing about what is in a PECL or how to get anything out of a (the?) PECL. As far as I knew, there is a danger of all of PHP being in a PECL. There is documentation on the way for what to do with these PECL extension on how to install and upgrade them. Perhaps you did not read everything I said, since there is more to what I said than what you quoted, and in the other part of what I said, I did say there is documentation as you say. Is that more or less muddy? So in other words, yes, there is documentation. The point I was making is that the documentation is not as easy to find as it could be. So the issue is not about use of PECL as much as it is use of the PHP documentation to find the PECL (documentation). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Copying HTML from a document to another document
Sam Hobbs [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] foreach($ContentsDocument-childNodes as $Node) $Cell-appendChild($Node); If there is not a different solution that should be used instead, then can anyone confirm this should work? In other words, does this appear to be a bug? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is a PECL a black whole? OT
Jay Blanchard [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] [snip] black whole? [/snip] As in, Is PECL the wholeness of black? or Is PECL all that is black? *snicker* It just struck me funny, but everyone knew that you meant black hole. I already replied to you, Jay, offline from the group. I would have replied here instead but it is taking me a while to become familiar with the occasional fragmentation of discussions in the newsgroup. However, yes, I meant black hole; such as the thing astronomers are surprised to find at the center of all galaxies, including ours. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php