Re: [PHP] Google using PHP @ "Google Store"
On Jan 24, 2006, at 9:41 PM, Peter Hoskin wrote: Its hosted from 85.13.206.209.reverse.coreix.net - somehow I don't think this is a google owned site. It's implied right on the front page it's not directly run by Google. "Produced for Google Inc. by Merchandise Mania Limited" My guess is this is an outsource deal Google did because they don't want to get into the business of manufacturing t-shirts and coffee mugs. If you do a Google search for "Google Store" this site will show up as a sponsored link. -dan -- Any event, once it has occurred, can be made to appear inevitable by a competent historian. -Lee Simonson
Re: [PHP] Redirects Safari vs Others
On Dec 6, 2005, at 2:55 PM, Mark Steudel wrote: Sorry it took me so long, I wasn't sure where the problem lay and couldn't get you the exact code, but I figured out why (sorta) this was happening. // Causes only Safiri to bomb header("location: ".$_SERVER['PHP_SELF']."?action=listentries&categoryid=". $id."&page=".$pagei d); exit; FWIW, I tried to duplicate this and wasn't able to. Here's a short test script: When I hit that page, it behaves as expected, redirects to the same page with ?action.. and then it responds by printing 'ok'. This is using PHP 4.3.10 and Safari v2.0.2 (416.13). [EMAIL PROTECTED]:~{0}% telnet dev.tangledhelix.com 80 Trying 205.196.219.129... Connected to dev.tangledhelix.com. Escape character is '^]'. GET /php_self/ HTTP/1.1 Host: dev.tangledhelix.com HTTP/1.1 302 Date: Tue, 06 Dec 2005 20:15:53 GMT Server: Apache/1.3.33 (Unix) DAV/1.0.3 mod_fastcgi/2.4.2 mod_gzip/ 1.3.26.1a PHP/4.3.10 mod_ssl/2.8.22 OpenSSL/0.9.7e X-Powered-By: PHP/4.3.10 Location: /php_self/index.php?action=list&cat=id Transfer-Encoding: chunked Content-Type: text/html 0 GET /php_self/index.php?action=list&cat=id HTTP/1.1 Host: dev.tangledhelix.com HTTP/1.1 200 OK Date: Tue, 06 Dec 2005 20:16:10 GMT Server: Apache/1.3.33 (Unix) DAV/1.0.3 mod_fastcgi/2.4.2 mod_gzip/ 1.3.26.1a PHP/4.3.10 mod_ssl/2.8.22 OpenSSL/0.9.7e X-Powered-By: PHP/4.3.10 Transfer-Encoding: chunked Content-Type: text/html X-Pad: avoid browser bug 2 ok 0 -- To announce that there must be no criticism of the President, or that we are to stand by the President, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public. -Theodore Roosevelt, 1918 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is echo tag reasonably portable?
On Nov 15, 2005, at 8:39 AM, Greg Donald wrote: On Tue, 15 Nov 2005, Jim Moseby wrote: It will be when you have to sort through 1,000,000 lines of code in 400 files to change 'it right to start with, no? for file in *.php; do cp $file $file.tmp sed -e "s/$file rm $file.tmp done ... Wouldn't catch this case: -dan -- Black holes are where God divided by zero. -Steven Wright -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending arrays from page to page
On Nov 15, 2005, at 12:07 PM, Ben Miller wrote: I am trying to learn how to work with arrays, and have the basic concept down for working within a single page, but I am having trouble sending an array from one page to another. For example, I can send a variable from page to page using either the URL, such as www.domain.com/?foo=bar, or using a form, but can I send an array from one page to another using a form so that all the values in the array will be sent? Such as: The easy way to do this is with sessions; be it strings, numbers, arrays, whatever. And then any page with session_start() should load all the values stored in $_SESSION on subsequent pages. Much easier than messing around with forms and submitting from page to page. Since $_SESSION itself is an array, you can load it up with anything you want - strings, numbers, other arrays, other nested arrays, etc. -dan -- To announce that there must be no criticism of the President, or that we are to stand by the President, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public. -Theodore Roosevelt, 1918 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array varible problems
On Aug 13, 2005, at 8:35 AM, [EMAIL PROTECTED] wrote: for($i=1;$i<5;$i++) This means: * Start with $i = 1 * End loop if $i is less than 5 * Increment $i each time around So your loop is ending at the first check because $i is less than 5. You want $i > 4 instead, I think. -dan { } Only display the result of zero array, eg : f1[0] f2[0] f3[0] f4[0] So, how to write the source (Web page - when user click the submit button) by using loop ? -- Hey, did you hear? They took "gullible" out of the dictionary! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 4.3 Install on Solaris
On Friday, January 31, 2003, at 08:13 PM, Weston Houghton wrote: I seem to be getting a silly error on Solaris when trying to do a PHP 4.3 make. I get an error that looks to me like the liner arguments are just too long. to be honest, I'm a bit stupified as to why this is happening or how to fix it. FWIW, I have compiled 4.23 just fine on that box. I built 4.3.0 on Solaris 2.6 and Solaris 8 without trouble. But as another poster suggested, I am using GNU utils (sed, make, etc). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] continue after break
You are misunderstanding how break and continue work. When you call break, the loop ends. When you call continue, the loop starts over, skipping the part between continue and the end of the loop. When you call break, you're ending the loop. You never even get as far as continue (let alone as far as the second block). On Thursday, January 23, 2003, at 12:02 AM, Remon Redika wrote: I have put Image inside of my loop... and that image located between and I want the image not doing loop too. cause i just need one image.., I just do looping for my data: and John W. Holmes writes: The solution is to take out your break... why is it there?? ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -Original Message- From: Reymond [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 22, 2003 10:45 PM To: [EMAIL PROTECTED] Subject: [PHP] continue after break Hi everyone, I made a while loop and i'd like to know how to continue looping after I break it, and . Here is my script : I found just break looping on my page, can't continue :( while ($row = mysql_fetch_array($myquery)){ ?> cellspacing="0"> } ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] continue after break
On Wednesday, January 22, 2003, at 10:44 PM, Reymond wrote: Hi everyone, I made a while loop and i'd like to know how to continue looping after I break it, and . Here is my script : I found just break looping on my page, can't continue :( break ends a loop. That's what it does. If you don't want to end a loop, don't call break. Take a look at your code; it boils down to this: while (...) { break; continue; } Generally speaking you would break or continue based on some condition. Your usage as shown below doesn't make any sense to me. Perhaps you need to re-read the documentation on while, break and continue. http://www.php.net/manual/en/control-structures.while.php http://www.php.net/manual/en/control-structures.break.php http://www.php.net/manual/en/control-structures.continue.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Speed comparison of PHP vs. PERL (not conclusive)
Previously, Manuel Lemos wrote: > > Your measures do not distinguish between the compile time and execute time. > > I don't know about Perl, but since PHP 4, Zend engine first compiles PHP > code into opcodes and only then it executes the code. Perl is compiled internally prior to execution. -- The process for understanding customers primarily involves sitting around with other marketing people and talking about what you would to if you were dumb enough to be a customer. -Scott Adams, "The Dilbert Principle" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] (Unlink(file) == rm file) ? (ignore this mail):(explain diffs);
Previously, Jimmy Lantz wrote: > > (Unlink(file) == rm file) ? (ignore this mail):(explain diffs); > > Does PHP unlink function handle deletion of files equally as the "rm" > command on the system in my case FreeBSD. > Or does it involve caching/handling files in any different way? It just uses the system call unlink() which is what rm does. That means the link is removed. If that's the only link to that file (inode), the file goes away. If there are multiple links, then only the link is removed and the file (inode) remains with the one or more other links. This is exactly what rm does, though. -dan -- The process for understanding customers primarily involves sitting around with other marketing people and talking about what you would to if you were dumb enough to be a customer. -Scott Adams, "The Dilbert Principle" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] chmod trouble
Previously, Nikola Veber said: > > What chmod value gives the read-only premission to the file ? (777 is the > read-write) 0400 would be read-only and visible only to the owner 0444 would be read-only, visible to anyone 0644 would be read-only to anyone but the owner (r/w to owner). -dan -- I didn't have time to write a short letter, so I wrote a long one instead. -Mark Twain -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Protecting include files
Previously, John Meyer said: > > BTW, .inc files can include PHP code that is executed, right? Any file can contain such code, if the server is configured to interpret the file as a PHP file, or if another file which is PHP include()'s the file in question. The ".inc" extension just happens to be a popular choice that a lot of people tend to use for "included" PHP code. But typically as far as the server cares they're just text files. -dan -- It's been said that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now thanks to the Internet, we can say that this is not true. -Unknown -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] How to stop images preloading in netscape?
Previously, Kelly Corkill said: > Define the height and width for each graphic, otherwise how does the browser > know how to draw the screen? With height/width netscape will allocate space > for the missing images and fill them in as the files complete, without - it > waits until all are done before drawing to the screen. Hint: use GetImageSize() to get the height/width info. http://php.net/manual/en/function.getimagesize.php -dan -- "Contrariwise", continued Tweedledee, "If it was so, it might be; and if it were so, it would be; but as it isn't, it ain't. That's logic." -Lewis Carroll -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Problems with split
Previously, Ville Mattila said: > --- > $invdate = "14.8.2001"; > echo "$invdate\n"; > list($day, $month, $year) = split(".", $invdate); > echo "$year-$month-$day"; > --- > Somehow, the second echo outputs only "--" as it should be "2001-8-14". > Any idea why this happen and how this could be avoided? Change the third line to read: list($day, $month, $year) = split("\.", $invdate); -dan -- What do you do when you see an endangered animal eating an endangered plant? -George Carlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Dealing with a file
Previously, John Meyer said: > I haven't had much experience with dealing with uploaded files. Are there > any links that would help me to deal with these files using PHP from a > server-side. http://www.php.net/manual/en/features.file-upload.php -- If carpenters made buildings the way programmers make programs, the first woodpecker to come along would destroy all of civilization. -Weinberg's Second Law -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] ldap
Previously, Johan Vikerskog (ECS) said: > > How do i list the email for that entry? Ill get one answer from this, now > i want to print out the email adress for that entry. > How do i do that? > > $sr=ldap_search($ds, $dn, $filter, $justthese); > $info = ldap_get_entries($ds, $sr); > print $info["count"]." entries returned"; This should do what you want; just stick it at the end of the code you already had in this email. for ($i = 0; $i < $info['count']; $i++) { print $info[$i]['mail'][0] . ''; } That's assuming there is always only one value for "mail" in a given entry. -dan -- The main reason Santa is so jolly is because he knows where all the bad girls live. -George Carlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] ereg questions
Previously, Ker Ruben Ramos said: > hmm, got a little question. > 1. what's that \\1 and \\2? got any info on where u got that from? Expands to whatever the parentheses surrounded during the match. So in this case you have: Match pattern: "" Replace pattern:"" There are two places in the match pattern where there are (). These are memorized (rather whatever they actually matched was memorized) and then you can spit it back out in the replacement pattern using \\1, \\2, etc. -dan > 2. what if it's just href="anything.html" ? i mean.. something like it got > lots of subdirectories or not. > > Thanks > - Original Message - > From: "Mark Maggelet" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, May 24, 2001 1:19 AM > Subject: Re: [PHP] ereg questions > > > > On Thu, 24 May 2001 01:01:16 +0800, Ker Ruben Ramos > > ([EMAIL PROTECTED]) wrote: > > >How do i change all '' to ' > >href="file.php?file=anythinghere.php">' > > >any help out there? > > > > I would go: > > > > $string = ereg_replace( > > "", > > "", > > $string); > > > > - Mark > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- If carpenters made buildings the way programmers make programs, the first woodpecker to come along would destroy all of civilization. -Weinberg's Second Law -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Variable Passing
Previously, Internaut said: > Thankx for your reply, would you recommend setting the register_globals to > on, would this be safe to do this? It's not any more or less "safe" than using the $HTTP_POST_VARS or $HTTP_GET_VARS arrays instead, but it could be less typing :-) Note that for the arrays mentioned here to work, track_vars must be on. In recent versions of PHP (4.0.1 and later, I think?) that is always the case. -dan -- If you had to identify, in one word, the reason why the human race has not achieved, and never will achieve, its full potential, that word would be "meetings." -Dave Barry, "16 Things That Took Me 50 Years to Learn" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] regex
Previously, Gyozo Papp said: > metacharacter. > > > Is a '.' inside of a [] a literal '.', or a 'any character' A period inside a character class (i.e. inside a [] block) is just a period, and not a metacharacter. -dan -- Don't let it end like this. Tell them I said something. -Pancho Villa's last words -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] pulling data out of a string
Previously, Richard Kurth said: > > That my problem www is not always the host when it is a sub-domain it > would be like mysit.domain.net or sometimes people put a few extra > periods in the domain name like www.my.test.net I thought maybe I > could look at the string and find out how many periods are in it then > if there is a www before the first period if not treat it like a > sub-domain. The last period is is any thing after it would be the tld. > How would I count the periods This is a little ugly, maybe, but it works: "; print "suffix= $suffix"; print "middle= $middle"; ?> Will output: prefix= www middle= myhost.test suffix= com -d -- If God dropped acid, would he see people? -George Carlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] still not friends with RegExps..
Previously, Zef Hemel said: > $string = preg_replace("/[\\\*\+\-;]/s","",$string); > > I think, you might have to escape the ; too You don't need to escape * or + inside a character class since they don't have a special meaning inside a character class. You will need to use '' to match a backslash, however. And if you move the hypen to the last position in the character class, it loses its magic property as a range specifier and no longer needs to be quoted either. This should do what you want: $string = preg_replace("/[;*+-]/s", "", $string); -dan -- The process for understanding customers primarily involves sitting around with other marketing people and talking about what you would to if you were dumb enough to be a customer. -Scott Adams, "The Dilbert Principle" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] installing PHP on a sun box
Previously, Joseph Bannon said: > I'm installing PHP on a sun box and when type in "make" and i get "not > found". How can I run make if it's not found? make is usually in /usr/ccs/bin/ However, you probably have no compiler (unless you bought one from Sun). Try typing "cc" - if you get the "software package not installed" error, download GCC from www.sunfreeware.com to get a compiler. That has nothing to do with make itself; that's still in /usr/ccs/bin/. You can get GNU make if you want, also at www.sunfreeware.com, but Sun's make will work for most things. You might want to add /usr/ccs/bin to your $PATH somewhere because ld is also sitting in there and you'll need that at some point too. -dan -- Viagra: Strong enough for a man, but made for a woman. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] ssh
Previously, Dennis Gearon said: > > ***AND*** getting the certificate to work for it? > My provider that runs php/mysql/etc only lets people use SSH connections > for telnet, which I agree with. As others have mentioned, PuTTY is the way to go. You can use key files with it, or passwords (or both, using phrase-coded keys). You can also use pscp, an scp clone for Windows (although it doesn't use keys AFAIK). For file transfer needs, check out WinSCP: http://winscp.vse.cz/eng/ It's quite nice for copying files, and uses the familiar two-pane file manager format that many FTP clients such as WS_FTP use. Users of Windows Explorer will be able to pick it up easily. It's freeware, and quite nicely done. However, I don't think it supports the use of keyfiles for authentication. -dan -- If one synchronized swimmer drowns, do the rest have to drown too? -George Carlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP & Mail (SMTP)
Previously, Jason Caldwell said: > There's a setting in the PHP.INI file called [Mail Function] - SMTP > Can I programmatically set this? Or, am I for now restricted to this .INI > entry? ini_set("SMTP", "smtp.server.name"); ini_set("sendmail_from", "[EMAIL PROTECTED]"); -d -- What was the best thing before sliced bread? -George Carlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Defining the Return-Path in an email header?
Previously, Kevin Price-Ward said: > > I am setting up a php emailer facility using the 'mail' function, I have > defined the 'Return-Path:' in the fourth argument of 'mail', but this keeps > getting overwritten by sendmail: > > my code says: > $headers .= "Return-Path: <[EMAIL PROTECTED]>\n"; > > but the source on the resulting email says: > Return-Path: <[EMAIL PROTECTED]> > > (Where vweb9.hiway.co.uk is our ISP's server) > > the problem with this is that emails that might have delivery problems, > don't get returned to me and I will never know that they haven't been > delivered. Return-Path can't be reliably set on the source system; it is commonly set by the destination system using the value from MAIL FROM obtained during the SMTP transaction. You may be better off not using mail() and instead exec'ing a copy of sendmail (or equivalent) with the "-f" flag (or equivalent). Such as: sendmail [EMAIL PROTECTED] You can do this in a few different ways, but it's not any different than opening any other process and piping data to it. -dan -- If the police arrest a mime, do they tell him he has the right to remain silent? -George Carlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Passing variables to another page - newbie
Previously, Dean Martin said: > Thanks to everyone for the help - unfortunately my problem seems to be the > function I'm using to do the redirecting. header() is supposed to be the > first item passed. What I'm trying to do is use a line of code well down > into the logic of my script to redirect the user to another page along with > the necessary variables. Use output buffering. http://www.php.net/manual/en/function.ob-start.php -dan -- "Contrariwise", continued Tweedledee, "If it was so, it might be; and if it were so, it would be; but as it isn't, it ain't. That's logic." -Lewis Carroll -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Really easy question
Previously, biscut said: > Thanks very much for your help on this, turns out there wasnt anything > "wrong" with it, I was trying to view the page with Netscape 4.7 on hte > Linux machine and getting blank pages, if I viewed it with IE 5.5 on a > windows machine then everything works fine...I have no idea why this is > happening but at least it works and I am not going completely mad... You probably forgot to close a table with the tag. IE bends the rules a bit and allows that to be omitted, Netscape doesn't, and an unclosed table in Netscape is invisible. -dan -- If one synchronized swimmer drowns, do the rest have to drown too? -George Carlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Cant add new Header
See ob_start(). http://php.net/manual/en/function.ob-start.php Previously, Andy said: > > I tryed it like that: > HEADER("Location:http://$HTTP_HOST/admin/admin.php?content=upload";); > > But I did get an errormessage which said that I already have sent a header > ( which was a body tag). -- If it happens once, it's a bug. If it happens twice, it's a feature. If it happens more than twice, it's a design philosophy. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] checking if e-mail address and syntax are valid
Problem with this is that many people use '+' in email addresses along with other strange characters (a friend of mine has an apostrophe in her address at General Electric). Bottom line, trying to catch all valid email addresses using a regex is a really ugly thing to try to do. The one shown here will probably work for 95% or more of them though. As an aside, underscores in domain names are illegal (more correctly, underscores in MX-related DNS records are illegal). As such, you don't need to have underscore to the right of the @ sign in this regex. -d Previously, Nikhil Goyal said: > I wrote a similar script of my own... Works fine for me > > function email_valid($email) { > > $pattern="^[0-9a-zA-Z_-]+(\.[0-9a-zA-Z_-]+)*@[0-9a-zA-Z_-]+(\.[0-9a-zA-Z_-]+ > )+$"; > return ereg($pattern, $email); > } > > (returns false if email is not valid, true if it is) -- It's been said that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now thanks to the Internet, we can say that this is not true. -Unknown -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] DOCUMENT_ROOT
Previously, Jordan Elver said: > > I'm not using virtual hosts on my local machine but I am on the production > machine. What should DOCUMENT_ROOT return? I though it returns the directory > of the current script. So if I had a site in > /usr/local/apache/htdocs/cha/script.php then I would expect DOCUMENT_ROOT to > return /usr/local/apache/htdocs/cha/, is that right? No, if you want to fetch that then do this: $my_directory = dirname($PHP_SELF); If you don't have register_globals on then you might have to do this instead: $my_directory= dirname($HTTP_SERVER_VARS['PHP_SELF']); Should end up with "/usr/local/apache/htdocs/cha" in $my_directory (in this particular case). $DOCUMENT_ROOT is whatever your httpd.conf file says DocumentRoot is. Even if you don't use virtualhosts, there should be a DocumentRoot in one of your Apache config files. I believe Apache will complain loudly on startup if that parameter is missing. -dan -- Plan to be spontaneous - tomorrow. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] link variables space problem in netscape
urlencode() will turn a space into "+". If you want the real full codes like "%20" you need to use rawurlencode() instead. http://www.php.net/manual/en/function.rawurlencode.php -dan Previously, John Huggins said: > IE may tolerate it, but you should transpose those spaces into the URL > encoded equiv. I think this is %20 for a space, but check your hex table to > be sure. > > Here is your function to do this. > > http://www.php.net/manual/en/function.urlencode.php -- Never underestimate the power of stupid people in large groups. -George Carlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Looping through variables
Previously, Ashley M. Kirchner said: > > I have a bunch of variables (through a POST form) that I need to > loop through and check for content. Right now, each one is being > evaluated separately: > > if ($var1 == '') { > $url .= "&var1="; > $error = 1; > } else { > $url .= "&var1=".urlencode(stripslashes($var1)).""; > } > > Then repeat for $var2, $var3, etc., etc... > > Is there a better way of doing this looping instead of writing the > same routine over and over again? // List of variable names $var_list = array ( 'var1', 'var2', 'var3', 'var4' ); while (list($key,$val) = each($var_list)) { if ($$val == '') { $url .= "&".$val."="; $error = 1; } else { $url .= "&".$val."=". urlencode(stripslashes($$val)) .""; } } Of course, if this is all POST variables then you should be able to just use the pre-built array $HTTP_POST_VARS (if track_vars is on). Then you'd do something like this instead: while (list($key,$val) = each($HTTP_POST_VARS)) { if ($val == '') { $url .= "&".$key."="; $error = 1; } else { $url .= "&".$key."=".urlencode(stripslashes($val)).""; } } If you're using GET rather than post, just subtitute $HTTP_GET_VARS. -d -- If a man is standing in the middle of the forest speaking and there is no woman around to hear him... is he still wrong? -George Carlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Use of special characters in filenames results in IE problems
rawurlencode() - http://php.net/rawurlencode '; $enc = rawurlencode($str); print $enc . ''; ?> -dan Previously, Floyd Piedad said: > > I discovered a bug in my program for uploading files, which stores the > filename in the database in order to create a link for it on the web page in > the future. The bug is when the filename makes use of special characters > (e.g. Oplæg). When I create a link to the file, the link works with > Netscape. With IE however, it says that file is not found. I discovered that > if I use the "encoded" version of the file name ("Opl%e6g") it works on both > IE and Netscape. What function or code is used to convert to this format? -- If carpenters made buildings the way programmers make programs, the first woodpecker to come along would destroy all of civilization. -Weinberg's Second Law -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] cgi vs. module
Previously, Franklin Hays said: > > RE: PHP as a CGI or Module Generally people will almost always use the module because it's faster and simpler, and gives you some IPC kind of advantages that the CGI doesn't have ("internal" cross-talk with Apache). Reasons to use the CGI: 1. Windows servers must use CGI form 2. If you want to use command-line PHP scripts you need the CGI form 3. If you want suExec support I believe you need to use the CGI form -dan -- If you try to fail, and succeed, which have you done? -George Carlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP3 and PHP_SELF
Tried this on a host running 3.0.16: Worked just fine. -dan Previously, Alan Ward said: > Does the variable $php_self work in PHP3? I am helping a friend with some > forms, and their host still uses PHP3. -- If man evolved from monkeys and apes, why do we still have monkeys and apes? -George Carlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] ldap_search...no results!
Previously, Miguel Carvalho said: > if a do > ldapsearch -o ",o=xyz" "ent=entry1,uid=ldap,ou=People,o=xyz", it > works just fine. > > How can i access the entry "ent=entry1,uid=ldap,ou=People,o=xyz" using > ldap_search/ldap_list or ldap_read? > > I have tried ldap_search... but i can not find how to write the filter. $host = 'localhost'; $bindcred = 'uid=admin';// adjust for your system $bindpass = 'somepasswd'; // adjust for your system $base = 'o=xyz';// where to start in tree //$base = 'uid=ldap,ou=People,o=xyz'; // more specific... and // probably faster too $filter = 'ent=entry1'; // what to search on $conn = ldap_connect($host); if (! $conn) die('LDAP connection failed!'); $result = ldap_bind($conn, $bindcred, $bindpass); if (! $result) die('LDAP BIND failed!'); $result = ldap_search($conn, $base, $filter); if (! $result) die('LDAP SRCH failed!'); $numentries = ldap_count_entries($conn, $result); print 'Found ' . $numentries . 'matches'; if ($numentries > 0) $info = ldap_get_entries($conn, $result); for ($i = 0; $i < $info['count']; $i++) { print $info[$i]['uid'][0]; } // $info is a multidimensional array with your result set. // you can use another attribute name in place of 'uid'... // for multivalued attributes (such as 'objectclass') you can use // numbers higher than 0 in the last set of brackets to see the // other values... i.e. // // $info[$i]['objectclass'][0]; // $info[$i]['objectclass'][1]; // $info[$i]['objectclass'][2]; // // .. etc -- Why don't sheep shrink when it rains? -George Carlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Parse error - script help.
Previously, Dddogbruce (@home.com) said: > > fwrite( $fp, "fwrite( $fp, "http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]