Re: [PHP] Server Uptime
Hello Brad, Monday, February 7, 2005, 3:21:26 PM, you wrote: BC> What is the function, or how do you make a script that displays BC> the server's uptime? If you're on Windows you could do this: ** function serverUptime() { $uptimeStamp = filemtime('c:/pagefile.sys'); $uptime = time() - $uptimeStamp; $days = floor($uptime / (24*3600)); $uptime = $uptime - ($days * (24*3600)); $hours = floor($uptime / (3600)); $uptime = $uptime - ($hours * (3600)); $minutes = floor($uptime /(60)); $uptime = $uptime - ($minutes * 60); $seconds = $uptime; $theUpTime = $days." days, ".$hours." hours, ".$minutes." minutes and ".$seconds." seconds"; $lastReBoot = date("r", $uptimeStamp); RETURN $theUpTime; } ** It'll give you an output like this: 21 days, 6 hours, 48 minutes and 49 seconds Note: I didn't write this code, this is how WinSysInfo does it. It works very well. He's got a lot of neat code in his beta 2 version for pulling all sorts of info off Windows systems. If you're not on a Windows server, *nix might have a file other than pagefile.sys that you could do the same thing with. Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [NEWBIE] Trying to combine array into one string
Hello Dave, Tuesday, February 15, 2005, 8:37:02 AM, you wrote: D> while ($tantoData = mysql_fetch_array($tantoResult)) D> { D> $tantoEmail = $tantoEmail . "," . $tantoData; D> } D> mail($tantoEmail, $subject, $mailcontent, $addHeaders); Everything looked good up to here. $tantoEmail = $tantoEmail . "," . $tantoData['email']; I'm not that great at SQL syntax, but this should work. That'll at least get your e-mail addresses in there. The next problem is that, and for purposes of demonstration we'll say you pulled out three addresses, you're going to have a comma before the first e-mail address. i.e. ,address1,address2,address3 because the first time through the while, $tantoEmail is empty, then you put a comma and the first address. So, you'd need to $tantoEmail = ltrim($tantoEmail, ","); that. You can further shorten that to: $tantoEmail .= "," . $tantoData['email']; but you'd still need to ltrim that to get rid of the first comma. Another way to do this to avoid having to worry about that pesky comma. while ($tantoData = mysql_fetch_array($tantoResult)) { if ($tantoEmail != "") $tantoEmail .= "," . $tantoData['email']; else $tantoEmail = $tantoData['email']; } -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Many forms in one php file
Hello NSK, Tuesday, February 15, 2005, 8:21:43 AM, you wrote: N> After the user completes and submits Form1, the script will process N> it and display a different form. etc... There's a boatload of ways to do this, but here's a real simple one to get you rolling. I'll leave it up to you to make it better. > //Your form stuff > //Your form stuff > //Your form stuff -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Post method HTTP 404
Hello Stefan, Wednesday, February 16, 2005, 12:32:55 AM, you wrote: S> I've a strange problem When I try to send a form with method="POST" S> to a php-file I always get an HTTP 404 error. I really don't know S> why, because the file exists on the server. Can you show us the code for the form? -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sentence case
Hello Jay, Wednesday, February 23, 2005, 11:05:51 AM, you wrote: >> How can I convert sentences like this. To be upper and lower case. J> http://www.php.net/ucfirst That won't work because it'll only capitalize the first letter of the string. Since his string contains more than one sentence he needs to be able to capitalize the first letter of each sentence. I'm thinking something like: 1. strtolower() the string 2. explode() on the period 3. Loop through the resulting array a. trim() whitespace on each element b. ucfirst() on each element of the array c. Concatenate the string back together, putting a period and a space at the end of each element. That's the long way. Anyone know the shortcut! -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sentence case
Hello Chris, Wednesday, February 23, 2005, 11:49:32 AM, you wrote: C> And on top of that he'll need to convert all 'i' to 'I' because of C> step 1. You and Mattias both have valid points. The only other thing I can think of is a regexp that is searching for a period and a space then does a ucwords() on the following word, but that's a lot of work to pull things apart like that! -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sentence case
Hello Mattias, Wednesday, February 23, 2005, 12:35:21 PM, you wrote: M> Oh, and sentences may end with other characters, too. Notably "!" M> and "?". Nuh-u Prove it!(Oh dang..) -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Wierd PHP Problem
Hello Will, Wednesday, February 23, 2005, 2:39:27 PM, you wrote: W> On this subject, is there anything 'wrong' with using $_REQUEST W> instead of specifying between $_POST and $_GET? $_REQUEST includes POST, GET, and cookies. It basically boils down to knowing where the information is coming from. If they should *only* be able to log in from a login screen and the form method is POST, then you should only be checking POST variables for a match. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Identifying a user who previously created a profile
Hello Jacques, Thursday, February 24, 2005, 3:02:09 AM, you wrote: J> I thought of capturing his IP Address and checking this value J> against my users table in my database where I have captured IP J> Addresses of users who have previously registered. Good luck. There isn't a way that I know of that is 100%. For instance, using the IP address could bite you because a new user might come from the same ISP as an already registered user and they ended up pulling the same IP address from the pool when they connected. It's remote, but possible. A more likely problem with this is if someone was behind a NATted firewall (corporate users) where they all have the same IP address, or people who use proxy servers. I guess, the best way is a cookie, but a user can delete their cookies (people sometimes do this to cheat on voting systems so they could place more than one vote.) You could try a combination of things. logging their IP, setting a cookie and maybe using javascript to pull some of the client machine information and log that into a DB. If say two or more criteria match then you refuse the second account creation. Of course all that would fail if they used a different machine altogether to create the second account. You can make it more difficult to create a second account, but you can't really prevent it. Even if you had a manual process in place where they had to give you a valid phone number, address and e-mail address, I could give you my cell number, my neighbor's or parents address, and any e-mail account I had created. I guess you could have them FAX you a photo ID, but still, if someone was really determined, that can be gotten around too. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what does this mean?
Hello Diana, Friday, February 25, 2005, 7:07:29 AM, you wrote: D> on which page of php.net can I find out what this code does? D> $a = $b? $a :"dian"; It's called a ternary operator, basically an if-else statement. There really isn't a page (that I've found) that explains in on php.net, but check out the user contributed notes on this page. http://us4.php.net/manual/en/control-structures.alternative-syntax.php -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with adding
Hello Jay, Thursday, February 24, 2005, 8:39:16 AM, you wrote: J> I have messed with this for a couple of days and cant get it right. J> Maybe I need sleep :-) J> The question is, how would I take add each of these numbers (10+5+25)? for ($i = 1; $i <= $sendnum; $i++) { $qty = $_POST['qty'.$i]; $tot += $qty; echo $qty . ' --- Total so far is: ' . $tot . ''; } -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Difficulty with SQL LIKE clause
Hello David, Friday, February 25, 2005, 1:27:54 PM, you wrote: D> Can the '*' be used? What am I doing wrong. It's the % symbol, not the *. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what does this mean?
Hello Jason, Friday, February 25, 2005, 12:42:30 PM, you wrote: J> Note to self: write "ternary" on the blackboard 100 times. You're telling me. I knew what it was but it took me like five minutes to remember what it was called! -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] combining values
Hello Bret, Tuesday, March 1, 2005, 11:43:18 AM, you wrote: B> why wouldn't B> $birthday = "$day.$month.$year"; B> work as well. Because in PHP the unencapsulated period means to concatenate. i.e. $var1 = "Hello"; $var2 = "there"; $var3 = "Bret"; echo $var1 . $var2 . $var3; Would net you: HellothereBret if you put: echo $var1 . " " . $var2 . " " . $var3; You'd get: Hello there Bret So, to put periods in something you have to encapsulate it with quotes. So: echo $var1 . "." . $var2 . "." . $var3; would get you: Hello.there.Bret See? -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] combining values
Hello Bret, Tuesday, March 1, 2005, 11:43:18 AM, you wrote: B> why wouldn't B> $birthday = "$day.$month.$year"; B> work as well. Whoops... Disregard my previous post. I missed your quotes. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Document root, preferred way to find it???
Hello Al, Wednesday, March 2, 2005, 12:21:58 PM, you wrote: A> What do you guys use for you docroot? I ran into the same problem and also asked here for any ideas. I finally ended up writing my own function to do it. You can find the tutorial here: http://www.devtek.org/tutorials/dynamic_document_root.php I'm still looking for a better way, cause this is kludgy. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Document root, preferred way to find it???
Hello Richard, Thursday, March 3, 2005, 1:15:38 PM, you wrote: RL> include_path In the php.ini? But wouldn't that affect every virtual host on the server? Meaning I'd have to put all the includes for every virtual host in the same place? Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Document root, preferred way to find it???
Hello Chris, Friday, March 4, 2005, 9:58:05 AM, you wrote: C> .htaccess Right.. But if you're on a hosted server running Sambar which is configured to ignore .htaccess, then what? (I'm not being facetious, this is actually an issue I've run across for a client). My point I guess, is that there should be a simple way in PHP to reliably pull the DOC_ROOT for a virtual host that doesn't require fixing "x" number of pages if you move the site to another server or to another folder. PHP is great in terms of portability, but this seems to be a major sticking point in making it less portable. A webserver always knows where it is (i.e. external CSS declarations). -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Document root, preferred way to find it???
Hello Richard, Friday, March 4, 2005, 11:41:29 AM, you wrote: R> http://php.net/set_include_path Ok... Maybe I should put all this together in one e-mail so that all the issues can be looked at... The problem: Finding a reliable method to include files, keeping in mind the following: 1. The site could be moved to a completely new host which could be of a different OS, and/or web server software, and could either be the one and only site on that host (dedicated server), or could be a virtual host (shared server). 2. The site could remain on the same host but is required to move to a new path. i.e. from htdocs/mysite to htdocs/mynewsite 3. The web host may or may not allow the use of .htaccess (Some Sambar configurations for example). 4. The method used would not affect any other virtual hosts. Meaning, the method used must be independent for each virtual host. 5. The method used would not utilize a folder where other virtual hosts could gain access to the included file (php.ini include_path). 6. The method (and this is the important one IMHO) would not require editing "x" number of pages in a site to change some static path that was set on each page. 7. The method used would not require a dedicated "include" file in every single folder of the site that could be included because it's in the same folder as the page needing it, because those would all have to be edited to fix the path if condition 1 or 2 was met. Previously proposed solutions: 1. PHP.ini include_path This affects all virtual hosts and would require administrative overhead to prevent the owners of each virtual host from gaining access to other virtual host's include files. I suppose you could set it to something like: include_path="/php/includes" and have a separate subfolder under that for each virtual host. But since that folder is outside the web folder, there would have to be some mechanism (additional FTP account) for each person to gain access to their own include folder to add/edit/delete files in that folder. Then if the site is moved and they aren't using an include_path, you have to fix all your pages. 2. set_include_path This means if your site moves, you must edit "x" number of pages in the site to correct the path. 3. An include file in every directory to set the include path. You'd have to edit "x" number of these files to correct the path if the site moves. This would be much less work than the previous item, but it could be a lot of work on very big sites where you don't have shell accounts to do some scripted find/replace with. 4. Use the full URL to the file in the include statement. See item 2. 5. $_SERVER["DOCUMENT_ROOT"] and $_SERVER['PATH_TRANSLATED'] Not always available or incorrect see mid:[EMAIL PROTECTED] I may have missed some things, and if I've misunderstood how something should work, then please let me know. I'm just looking for a more or less foolproof method which doesn't require fixing code if the site is moved. The closest I can come to it is the function I wrote but is a pain because you have to put it in every page where you need an included file. Granted, you only have to do it once, and then you're done and a site move wont affect it, but it's still kludgy if you ask me. *** *** and then calling it as such: include(dynRoot() . 'includes/db_connect.php'); I've had to move client sites between Sambar, Apache, IIS and Windows, Linux. Most times I've had to go in and fix include paths because one of the above solutions were originally used and wasn't viable on the new host. Thanks. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with REGEXP please
Hello Shaun, Friday, March 4, 2005, 12:54:34 PM, you wrote: S> Please could someone tell me how i can extract the information from S> a string that is after 'ID_' and before '_FN' This will match any upper or lowercase letter and number. If you have other characters like _ , etc, then you'll need to put those in the [a-z0-9_,] too. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Document root, preferred way to find it???
Hello Richard, Friday, March 4, 2005, 1:25:35 PM, you wrote: R> If *those* are broken, you might as well just not use that host. R> :-^ Your solution seems to be pretty bulletproof. I definitely appreciate it. Just wondering though for posterity sake, have you or anyone ever run into a host that had both $_SERVER['path_translated'] and $_SERVER{'documentRoot'] broke? I've seen $_SERVER{'documentRoot'] not being correct, but has anyone seen it not correct and not having $_SERVER['path_translated'] available? Previously, when I saw $_SERVER['documentroot'] incorrect, I didn't know about $_SERVER['path_translated'] so I don't know if it was good or not. R> It's a bit of a hack, but cuts the number of config files to one R> (1) for a transfer/install. Looks like it'll work. Thanks. Maybe one day the people at PHP will fix it so we don't have to work around it. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Document root, preferred way to find it???
Hello Tom, Friday, March 4, 2005, 9:13:41 PM, you wrote: TR> This will set the include path just before the document root: H. Not quite what I'm looking for. I set up some test folders and files on a development machine to play with your script. Here's how it was laid out: The document root for the test site: "c:\sambar\docs\test" A subfolder of the doc root "folder1" A subfolder of the above folder1 "folder2" Placing a file called test.php (containing your script) in all three places (doc root, folder1, folder1/folder2) gives you the following respectively. Root: c:\sambar\docs\test\test.php Document root: c:\sambar\docs\test\test.php Base: test.php Include: c:\cambar\docs\test\include OS: winnt Include: c:\cambar\docs\test\include;.;C:\php5\pear Ultimately, this would be the correct folder I would want, but see the below two tests. Root: c:\sambar\docs\test\folder1\test.php Document root: c:\sambar\docs\test\folder1\test.php Base: test.php Include: c:\sambar\docs\test\folder1\include OS: winnt Include: c:\sambar\docs\test\folder1\include;.;C:\php5\pear Root: c:\sambar\docs\test\folder1\folder2\test.php Document root: c:\sambar\docs\test\folder1\folder2\test.php Base: test.php Include: c:\sambar\docs\test\folder1\folder2\include OS: winnt Include: c:\sambar\docs\test\folder1\folder2\include;.;C:\php5\pear I don't see where your script is giving me the include folder I want. Thanks though. Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Document root, preferred way to find it???
Hello Marek, Sunday, March 6, 2005, 4:23:51 PM, you wrote: MK> dirname(__FILE__) MK> and then get rid of the subpath where the check is made MK> ('/include' for example) I'm not sure I'm completely following you. Let's say I had the following: Site root" "c:\apache\htdocs\test" A subfolder of site root "folder1" A subfolder of the above folder1 "folder2" If I call dirname(__FILE__) from a page in each folder I'll get the following respectively: "c:\apache\htdocs\test" "c:\apache\htdocs\test\folder1" "c:\apache\htdocs\test\folder1\folder2" I don't see where that tells me where the include folder would be. Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Document root, preferred way to find it???
Hello Marek, Sunday, March 6, 2005, 7:08:24 PM, you wrote: >> I don't see where that tells me where the include folder would be. MK> If you know how the files are layed out in your application, you do. No... You missed the point of this whole thread which was explained in point 1 and point 2 of the "Problem" section. Restated in different words is how do you write some code which is dynamic enough to withstand reorganization of folders either on the same host, a different host (maybe with a different OS too), or a mixture of any. In HTML, a css declaration as follows: works regardless of where the page is, where it's moved to, and regardless of how many folders down it is as long as there is indeed a folder off the site root called "includes" and as long as there is a file in that folder called "site.css". How do we mimic that capability in PHP so pages don't have to be re-written if point 1 or point 2 of the "Problem" are met? Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Document root, preferred way to find it???
Hello Tom, Sunday, March 6, 2005, 6:18:54 PM, you wrote: TR> and let me see what it prints Still not quite there. Site root ** File name: C:\Sambar\docs\test\test.php Script: /test.php Document root: C:\Sambar\docs\test\test.php Base: test.php Include: C:\Sambar\docs\test\include OS: winnt Include: C:\Sambar\docs\test\include;.;C:\php5\pear ** Site root/folder1 *** File name: C:\Sambar\docs\test\folder1\test.php Script: /folder1/test.php Document root: C:\Sambar\docs\test\folder1\test.php Base: test.php Include: C:\Sambar\docs\test\folder1\include OS: winnt Include: C:\Sambar\docs\test\folder1\include;.;C:\php5\pear *** Site root/folder1/folder2 *** File name: C:\Sambar\docs\test\folder1\folder2\test.php Script: /folder1/folder2/test.php Document root: C:\Sambar\docs\test\folder1\folder2\test.php Base: test.php Include: C:\Sambar\docs\test\folder1\folder2\include OS: winnt Include: C:\Sambar\docs\test\folder1\folder2\include;.;C:\php5\pear *** Thanks. Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SOLVED: Re: [PHP] Document root, preferred way to find it???
Hello Tom, Sunday, March 6, 2005, 10:00:17 PM, you wrote: TR> Ok I see where is is going wrong, try this: Oh, very close. Although you have it at $document_root and all that needs to be added is '/include' like below: $include = $document_root . '/include'; Otherwise it's one directory too far up because you're replacing the site root 'test' (in this case) with 'include'. We wanted: 'C:/Sambar/docs/test/include' Here's from your script. Site root: ** File name: C:/Sambar/docs/test/test.php Script: /test.php Document root: C:/Sambar/docs/test Base: test Include: C:/Sambar/docs/include OS: winnt Include: C:/Sambar/docs/include;.;C:\php5\pear ** Site root/folder1 ** File name: C:/Sambar/docs/test/folder1/test.php Script: /folder1/test.php Document root: C:/Sambar/docs/test Base: test Include: C:/Sambar/docs/include OS: winnt Include: C:/Sambar/docs/include;.;C:\php5\pear ** Site root/folder1/folder2 ** File name: C:/Sambar/docs/test/folder1/folder2/test.php Script: /folder1/folder2/test.php Document root: C:/Sambar/docs/test Base: test Include: C:/Sambar/docs/include OS: winnt Include: C:/Sambar/docs/include;.;C:\php5\pear ** After my change: File name: C:/Sambar/docs/test/folder1/folder2/test.php Script: /folder1/folder2/test.php Document root: C:/Sambar/docs/test Base: test Include: C:/Sambar/docs/test/include OS: winnt Include: C:/Sambar/docs/test/include;.;C:\php5\pear The other two folders moving back up the tree are the same result. So the final looks like: if(isset($_SERVER["SCRIPT_FILENAME"])){ $file_name = str_replace('\\','/',$_SERVER['SCRIPT_FILENAME']); echo "File name: $file_name"; $script = str_replace('\\','/',$_SERVER['SCRIPT_NAME']); echo "Script: $script"; $document_root = str_replace($script,'',$file_name); echo "Document root: $document_root"; $base = basename($document_root); echo "Base: $base"; //$include = str_replace($base,'include',$document_root); $include = $document_root . '/include'; echo "Include: $include"; $os = strtolower(PHP_OS); echo "OS: $os"; $lk = ':'; $org_include = ini_get("include_path"); if(preg_match('/^win/i',$os)) $lk = ';'; ini_set("include_path",$include.$lk.$org_include); echo "Include: ".ini_get("include_path").""; } It's a great effort and looks bulletproof. Can you shoot any holes in mine? A full explanation at: http://www.devtek.org/tutorials/dynamic_document_root.php I only throw mine back out there because it's shorter. I think it's solid, but only because I haven't broken it yet. :-) Both our solutions suffer the same problem. They have to be on every page that requires an include, because we can't rely on a new host having our code in their auto_prepend file ** function dynRoot() { $levels = substr_count($_SERVER['PHP_SELF'],"/"); for ($i=0; $i < $levels - 1; $i++) { $relativeDir .= "../"; } return $relativeDir; } include(dynRoot() . 'includes/somefile.php') ** Thanks again! Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SOLVED: Re: [PHP] Document root, preferred way to find it???
Hello Tom, Sunday, March 6, 2005, 11:20:04 PM, you wrote: T> I do this for security as I have things in include that I don't T> want to be avaiable directly to the browser Also you don't need a T> path for include files you can just do: Don't necessarily disagree with you there other than if you place the includes outside the web accessible folders how do you address the managers of virtual hosts for the ability to modify, delete or add to their particular include file? Additionally, how do you address the naming convention of the include file. i.e. Site 'A' is using config.php Site 'B' is using config.inc.php Site 'C' wants to use config.php T> include('somefile.php'); T> and it will be found regardless of where the script is located. That's true enough.. BTW, good to see another TheBat! user here. Thanks again. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] recommended way for server side validation - include in same file or have a different file
Hello Vinayakam, Tuesday, March 8, 2005, 4:11:43 AM, you wrote: V> However in the second case, in case of an error, displaying the V> data becomes an issue. V> Any recommended ways for server side validation I usually do the updates in the same file unless there are a lot of different things going on (inserts, updates, deletes etc), then I'll break it out into separate files. However, I do almost always have an included file with all my error checking code. So, let's say in the main page(let's call it index.php) where we're filling out a form, we have the following three items: formFirstName formLastName formEmployeeNumber We submit and the action is PHP_SELF At the top of index.php is an include for errorhandler.php which only happens if $_POST['submit'] == "Submit" errorhandler.php includes functions.php at the top and errorhandler.php looks like this: validateString('firstName', $_POST['formFirstName'], 25) validateString('lastName', $_POST['formLastName'], 25) validateNumeric('EmployeeNumber', $_POST['formEmployeeNumber'], 5) functions.php contains all my commonly used functions, and validateString() might look like this: function validateString($fieldName, $fieldValue, $size) { global $errors[]; if ($strlen($fieldValue) <= $size) { if (does not contain any undesirable characters) { $errors['$fieldname'] = 0; } else { $errors[0] = "1"; $errors[$fieldName] = "You may only use letters and hyphens."; } } else { $errors[0] = "1"; $errors[$fieldName] .= "This field is limited to $size characters."; } return; } Then back in index.php I test $errors[0] to see if there was an error, if so, I skip over the insert, update or delete and just go back down to the form and display the error where appropriate. Note: I didn't test the above code for this explanation. It gets a bit harder when you have separate files but it's doable. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Document root, preferred way to find it???
Hello Jochem, Tuesday, March 8, 2005, 3:30:19 AM, you wrote: J> J> I'm pretty sure the url is ./includes/site.css i.e. the include J> subdir of the dir in which the html file that includes the link tag J> is in. if you move the html file up or down a dir then the link to J> the css file will break J> maybe browsers are smart enough to also check /includes/site.css Oops, my bad. I missed the slash in front. I've never run into a problem using this: and I've never placed a period at the beginning. But you raise an interesting point. Is the server telling the browser where the doc root is, or is the browser just guessing by dumping everything after the domain name and using what's left as the doc root. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quite a basic question
Hello Mário, Tuesday, March 8, 2005, 8:18:34 AM, you wrote: M> How can i solve this ? M> Any help would be apreciated. Because you're outputting javascript to the browser before doing the redirection. You can't output *anything* to the browser before a redirect. M> echo" M> M> window.open (\"http://www.google.com\";, \"mywindow\", \"status=1, M> toolbar=0, resizable=0, M> width=200, height=200\"); M> "; You output the above, then doing the below won't work. M> header("Location: http://www.dte.ua.pt/cv/";); -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] bulk emailer
Hello Richard, Friday, March 11, 2005, 3:34:01 PM, you wrote: RL> The mail() function is designed for quickie one-off emails, not RL> sending out thousands. Hell, it can't even handle dozens, not RL> reliably, at least not on some hardware/connections. I've used it to send a little over 3,000. On one of my TheBat lists, we had a user subscribe with one of those confounded challenge/response e-mail addresses and the challenge didn't show what the e-mail address was that the challenge was for, so I wrote a script to send an e-mail to each subscriber and in the subject and message body I echo'd out the e-mail address being e-mailed to. Within an hour I had the challenge showing the e-mail address in the subject line and we summarily unsubscribed them. Granted this was on a Windows system which was using Mercury and not SendMail though. Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] multidimensional array sort
Hello Ashley, Monday, March 14, 2005, 12:12:19 PM, you wrote: A> I need to do a sort on the whole thing in such a way that: A>a) all the Dir#'s are in ascending order, and A>b) all the User#'s are in ascending order with each Dir#, and A>b) all the File#'s are also in ascending order within each User# http://us3.php.net/manual/en/function.array-multisort.php It's funny, I was in the exact same boat this morning with regards to generating a sign-in sheet for a class where I had pulled out all the students into a multi-dimensional array and needing to sort them by last name ascending. I was just about to delve into array-multisort when it dawned on me that this would be the perfect opportunity for a table join. So, I learned how to do a MySQL join (my first) a few hours ago. It works great! Much less headache too. $sqlRegisteredStudents="SELECT s.id, s.firstName, s.lastName, s.phone, s.email, s.divisionOrFacility, s.supervisorName " . "FROM " . $tbl_registrations . " r JOIN " . $tbl_students . " s " . "ON r.studentId = s.id " . "WHERE courseId='" . $_POST['courseID'] . "' " . "ORDER BY s.lastName ASC"; -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] build an array of checkbox
Hello Tomás, Friday, March 18, 2005, 1:31:40 PM, you wrote: T> I have a doubt, I want to build an array of checkbox, why? well T> because I list a recordset from data base, and I want to delete the T> current record when the check is selected by the click mouse. for T> example the editor of mail.yahoo.xx, that you can delete any mail T> when you selected any checkbox. delete becomes your array i.e. print_r($_POST['delete']); $r['id'] is the record id from the DB. Then do a foreach through the delete array and delete out records where id = the "as" variable used in the foreach. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.9.7 Return (pre-beta) under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-WIN] setting php for accepting the urls... phpinfo.php/extra/information/
Hello Rob, Saturday, March 19, 2005, 2:39:08 AM, you wrote: R> could someone possibly point me in the right direction for allow R> PHP on IIS 6 to accept urls with the query string seperated by R> slashes.. This is called "slash arguments" and IIS can not natively handle it. I ran into this issue setting up a Moodle <http://www.moodle.org> installation for a client. There is a 3rd party app you can install on an IIS server which will allow you to do this. It is free for a single website, but if you are virtual hosting, it costs money. It's called ISAPI Rewrite <http://www.isapirewrite.com/> I finally ended up building them an Win2K, Apache2, MySQL, PHP5 box so they could use Moodle to the fullest with slash arguments. Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] access violation
Hello Rob, Monday, March 21, 2005, 10:32:36 PM, you wrote: R> Anyone else had a problem like this? I couldn't find anything in the R> php or apache bug databases that sounded like the same problem. R> Windows XP pro SP2 R> Apache/1.3.33 (Win32) R> PHP/4.3.10 I have something similar on one webserver where PHP is throwing the Access Violations and it happens during refresh of POST data. It is intermittent in terms of exactly when the first one occurs, but once it happens then I can usually get it to throw again every 2nd or 3rd refresh of a POST. The only system stuff we have in common is the OS. The webserver is Sambar, and PHP is 5.0.3. It didn't start having this issue till I updated the PHP to 5.0.3, so I'm going to reinstall it at some point to see if that helps any. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.9.7 Return (pre-beta) under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting form name
Hello j, Tuesday, March 22, 2005, 10:13:50 AM, you wrote: j> I'm trying to get the name of a form. I tried the following code, j> but I guess the data in $_POST only contains data on the form j> elements that go inside the form tags, but not info from the form j> tag itself. Any suggestions on how to get the form name? j> echo ""$ IIRC, form name is not sent by any browser, so it won't show up in POST / GET / COOKIES or anywhere else. The easiest way is to set a hidden field which contains that information.. i.e. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.9.7 Return (pre-beta) under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] access violation
Hello Rob, Tuesday, March 22, 2005, 4:14:55 PM, you wrote: R> That's interesting - it also started happening for me after R> installing PHP 5.0.3. But I have reverted to 4.3.10 for now, and I R> can't see how installing 5.0.3 into an entirely separate directory R> can break my old php install. Hmm.. R> Incidentally, are you using Pear at all? No, I'm not doing anything with Pear (just haven't gotten around to it). I did the same thing you did, installed into a separate directory and fixed all the references in the webserver, and have deleted any PHP 4.3 files from the Windows/System folder. Luckily it doesn't appear to be a big security problem as it only displays the access violation in the browser window (no paths or anything). A reboot fixes it until I do something like refreshing POST data a few times again. Until I get the problem resolved, I don't refresh POST data anymore on that server. The frustrating thing is that the "crash" doesn't show up in any logs. Even the Windows system logs. I also didn't do any major changes from the default php.ini except to enable some extensions I needed, set up the SMTP stuff, and that's really about it. I am running 5.0.3 on other servers (various web servers and MySQL versions, but all Windows), and am not experiencing this problem. The only difference with those servers is that 5.0.3 was installed fresh (no previous PHP). I'm wondering if I missed one of the extension files somewhere from 4.3. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.9.9 Return (pre-beta) under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] html image
Hello delos, Thursday, March 24, 2005, 11:48:50 AM, you wrote: d> i would like to produce a script that can make an image d> ("screenshot") based only on the site url. so that i enter an URL d> and php makes the picture. Hmmm. It can be done. See http://www.whois.sc/www.php.net But I'm just not sure quite how. I can think of a lot of scenarios, but I don't know if I'm even in the right ballpark. You might be able to e-mail those guys and ask how they do it. You might get lucky. If you figure it out, let us know though. It's kinda neat. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.9.9 Return (pre-beta) under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirection, same host, two domains
Hello Alexandru, Friday, March 25, 2005, 9:36:12 AM, you wrote: AM> Okay, here is my problem. I had a site hosted on a sub domain AM> (mysite.domain.com) , now I registered my own domain, mysite.com . AM> The thing is mysite.com is still hosted on mysite.domain.com. What AM> i want to do is : If people type in their browsers AM> mysite.domain.com redirect to mysite.com and if they type AM> mysite.com to display the page. I'm guessing it should be AM> something like this : if ( refferer = mysite.domain.com ) { AM> redirect to mysite.com } else { my html code } http://www.devtek.org/snippets/index.php#domainRedirection The only difference in your case is you don't need the second check, and you'll just place your mysite.com HTML below the PHP. Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP CODE TO DISPLAY ISP
Hello jenny, Monday, March 28, 2005, 9:36:07 AM, you wrote: j> i am making a website in php and i will appreciate if anybody can j> tell me the php code to : j> - (1)display isp name, One problem you're going to run into is that by using $_SERVER['REMOTE_ADDR'] oftentimes, you'll end up with just the IP. I wrote the below to give me the hostname, which generally gives you the ISP information too, to fix a problem on a project I was doing. If it won't resolve to a name (which does happen sometimes for machines behind corporate firewalls), I just displayed "No Reverse DNS" Hostname: Latency: Geez, it's amazing when you dig back through old code you realize how much your coding skills sucked back then! -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.9.9 Return (pre-beta) under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include literal
Hello Jeremy, Monday, March 28, 2005, 1:36:10 PM, you wrote: J> -- J> I would like the output of Document B to be: J> J> instead of something here. J> -- highlight_file('Document A'); -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.9.9 Return (pre-beta) under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail with acknowledgement of delivery
Hello marc, Wednesday, March 30, 2005, 8:31:48 AM, you wrote: m> I got a problem with mail function. I want to know if it's possible m> to send a email in php and to get back an acknowledgement of m> delivery. My problem is that i want to know if my emails are m> delivered successfully to recipients. About the only way to do that is to add a Return-Path header to the e-mail so if it bounces the Return-Path address gets the bounce message. There is no way to do it more or less real-time because some SMTP servers will try to send the message to the recipient for sometimes five days before generating a bounce. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.9.9 Return (pre-beta) under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to format every secound row in a database result
Hello Georg, Wednesday, March 30, 2005, 8:05:30 AM, you wrote: G> I wish to format the output of a database select. The result is G> presented in a table, in which i'd like to present everey secound G> row with a different background color. My idea was to test if the G> remaining number of rows where a prime number or not, and by that G> determent if the background color should be white or som ivory-like G> color to improve the readability in the result table... http://www.devtek.org/tutorials/alternate_row_colors.php -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.9.9 Return (pre-beta) under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Retrieve URL of website
Hello HarryG, Friday, April 1, 2005, 7:42:25 PM, you wrote: H> I want to retrieve the complete url in my php script. How can I do this? H> eg. www.mysite.com/mydirectory/mypage.php H> Result should either be www.mysite.com/mydirectory/mypage.php or /mydirectory/mypage.php If you mean on your own site, use $_SERVER['PHP_SELF'] Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's the going rate for making websites ?
Hello -{, Sunday, April 3, 2005, 4:51:29 PM, you wrote: RB> What do y'all charge when you do sites for people ??? ... In the RB> past I've only done pro-bono work (because they usually don't RB> require much work, so it's not a problem getting it done while RB> working on other projects), but I've never actually done paid work RB> before... It's more that I just recently moved to Canada (from RB> Denmark) so I have no feeling with what the prices and rates are RB> overhere ... You really need to have him lay out a scope of work for you. If you don't know what he want, there's no way you can give him an estimate. If he wants ten static pages, then quote him that. If he wants a dynamic site with a forum and shopping cart, then that's a huge difference in what I would charge. I don't know what they normally charge there, but here's what I've seen here in the US for the following under contract for State gov't. - Roughly 20 pages (customer provides content) - Dynamic pulling from a MySQL backend (news, current items etc). - Admin / Editor pages to add / edit / delete the dynamic content - Supporting Section 508 and WCAG 1.0 - Considered work for hire (customer owns source afterwards) Cost: $18,000 (Actual figure I saw on a quote). They weren't even going to provide the hosting space for the site nor the MySQL backend. They were going to develop basically the framework for the group to add their own content and the DB tables. I was pretty stunned when I saw that. According to the people who showed me the quote that wasn't even the highest one. I do a lot of work as a project manager for various application / web development. One thing I will tell you that you need to really drive home to your customer is sticking to the scope of work. When you both sign the dotted line as to what is expected from the project make sure they fully understand that deviations from that will cost more. It took me about three or four projects where scope creep *positively* killed me before I learned my lesson. It always starts small, a change to a color here, moving an image just a bit this way or that, then they throw a real wrench in the works by deciding they want to do something like add a whole new layer of people with certain rights in the application which blows away your existing authentication / security model. This person might be a friend (or father-in-laws friend), but I can't stress the importance of having a contract in place for both of your protection. Also make sure both parties understand what's to be paid for and what isn't. A deliverables model will help with that. i.e. I get this much money for adding this functionality to the site. This way if something goes sour you can be paid for the work already completed. Also, make sure you keep the customer in the loop. After certain milestones, show them where you're at to make sure you're still on the same page. This opens you up a bit more to scope creep, but making a relatively small change in the beginning is a whole lot better than nearly starting over at the end. Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Set session variable if link is clicked, do not want to use GET
Hello Kent, Monday, April 4, 2005, 6:21:41 PM, you wrote: K> It would have been easy if i would have used a normal FORM and K> would have had a button called "Add to cart". But i would like it K> to be in url-style or using some which i understand that K> the BUTTON item does not support (or am i wrong?). Button images are fine: http://www.mompswebdesign.com/html/button_tag.html (just picked that one at random). Another option is to set a unique SESSION variable each time they visit, and that unique variable is only good during that session. You pass that variable in the GET request and then match it on the following page. If they don't match then you know they bookmarked it or fudged the GET request. Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] OT - Re: [PHP] Anybody getting these also?
Hello John, Wednesday, April 6, 2005, 10:29:48 AM, you wrote: J> First requirement is to still have in your possession, a computer from J> the Atari/Commodore/Timex days. Root on your mail server helps too. Heheh... I've still got (and most still working): Commodore 64 Commodore 128 Atari 2600 Apple IIe TI-99 Old boxMac (the cube looking one, forget the model). Compaq Luggable (looks like a sewing machine) I used to have a TRS-80 Model I (the first computer I ever owned), but my parents threw it out before I realized I wanted to keep it. Used to have a cassette tape player hooked up to it for secondary storage before we upgraded it with a floppy drive. I've also got a 300 baud acoustically coupled modem and an 8" floppy. We're going to be moving to a bigger house sometime in August and I look forward to pulling all that stuff out of the garage and setting them up in the computer room again. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.9.13 Return under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anybody getting these also?
Hello Kim, Thursday, April 7, 2005, 3:22:19 AM, you wrote: K> Nevertheless the _f*ker_ who are using this should be thrown OFF K> the list! It must be possible to see, who was added to the list K> just before the first activewireinc mail came... I hate those challenge/response systems. We get them time to time on some of the lists I run. That's why I wrote a quick probe a while back to tell me which address it is. http://www.devtek.org/snippets/index.php#mailingListProbe -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.9.13 Return under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sorting table columns dynamically on normalized MySQL tables
Hello php-general, I've been wrestling with this one for a bit and wanted to see if anyone had a nice magic bullet (yeah right) to do this. Let's just keep it simple (my DB is a bit more complex). We have a DB called Courses with three tables. Instructors - id name Locations id name Course - id name instructorID - From Instructors table locationID - From Locations table So let's put in some data Instructors - id name 1Bill 2Dave 3Jessica Locations - id name 1Middle School 2High School 3Elementary School Course - id name instructorID locationID 1Basket Weaving2 2 2Math 2 1 3Science 1 3 4Biology 3 1 Just in case, I'm actually dealing with three more tables, so I don't think doing weird joins will work, but I'm trying to keep this simple. Further, the instructors table actually has six fields, the Locations table has four fields. Those extra fields are descriptive pieces for each, i.e. phone numbers, e-mail address, office number, address etc for each instructor. Now, I want to display all the courses and have the names instead of id numbers show up, so I'd select from Courses and output that. course instructor location Basket Weaving Dave High School Math Dave Middle School Science Bill Elementary School Biology Jessica Middle School I've done this by building arrays previous to doing the select on Course and in the While loop to list the courses pull the name from the instructors array and locations array based on the matching id. It works fine. No problem. I then got a requirement that stated they wanted to be able to sort alphabetically ascending on the following columns: course, instructor, location So I built in the ability to do that using a self referencing hyperlink on the column name with a variable for the column name they wanted to sort on, and then used that in my SELECT statement to ORDER BY on the column they chose ASC. This works just fine too. Here's where the problem is. Since the DB is normalized, it's sorting by the ID number which has no relation to being sorted alphabetically. i.e. If they sort on Location, they get the records back like this course instructor location Math Dave Middle School Biology Jessica Middle School Basket Weaving Dave High School Science Bill Elementary School Because Middle is id 1, High is id 2, and Elementary is id 3. That's not what they want obviously. So far the only thing I've come up with is to build an array of course records in which I replace the ids with the corresponding names, then sort the array based on the sort order the user wants, then loop through the array to show the courses to them. I can do that, but is there a better way? How do you all handle dynamic sorting of normalized DBs? How I got into this mess was by trying to do the right thing and normalize my DB. It wasn't until they threw the sorting deal at me that I realized I probably should have used the instructor name and location name in the Course.instructorID and Course.locationID fields. It would have saved me some grief, but part of the problem is that the location name can be something like this: Rio Bravo Elementary School and it didn't seem right to me at the time to use that as the id in the Course table for Location. At any rate, just looking for some ideas. Thanks. Tagline of the day: Small town sign: "Speed Limit 15 MPH: Our kids can't run any faster." -- Leif Gregory Development Supervisor Licensing, Regulation and Small Projects Section Application Development and Support Bureau Information Technology Services Division Runnels Building S3407 V: 505.827.2748 F: 505.827.2695 The Information Technology Services Division leads the State of New Mexico in customer-focused IT services as it supports the Department of Health in building a healthy New Mexico. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sorting table columns dynamically on normalized MySQL tables [LONG]
27; . $arrInstructors[$rCourses['instructorId']]['name'] . ''; echo ''; ******** Basically what happens is that the lookup builder creates an array like this: Array ( [1] => Array ( [name] => Leif Gregory [email] => [EMAIL PROTECTED] [phone] => 505-123-4567 ) [2] => Array ( [name] => Jenny Craig [email] => [EMAIL PROTECTED] [phone] => 505-222- ) [6] => Array ( [name] => Billy horton [email] => [EMAIL PROTECTED] [phone] => 505-839-1234 ) So. $arrInstructors[$rCourses['instructorId']]['name'] If the instructorId from the Course table was '2', then the above would give me: "Jenny Craig". You can probably figure that out yourself, but I'm trying to make sure everyone completely understands what's going on. Thanks. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.9.17 Return under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sorting table columns dynamically on normalized MySQL tables
Hello Kim, Tuesday, April 19, 2005, 6:44:58 PM, you wrote: K> If you are still looking for "tips" and want to get K> complicated/fancy, I have seen columns used called sort_order more K> than a few times. This should not be too hard to maintain for K> things like a few buildings, etc., where the lookup table does not K> change much over time. You would then have another option for your K> "oder by" clause. I understand what you mean, but I'm still in the same boat. There is no join between the four tables (mainly because I didn't think you were supposed to do joins on four tables. I've written a couple other replies which I think more clearly state where my problem is so I won't retype them here. Thanks though. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.9.17 Return under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sorting table columns dynamically on normalized MySQL tables
Hello Richard, Tuesday, April 19, 2005, 9:12:14 PM, you wrote: R> Just build a JOIN query and do one query. Doing a join on four tables is ok? (serious question, not being facetious). R> No, it is *NOT* sorting on the ID number. I can definitely say it is sorting on locationID, categoryID, or instructorID. It's not alphabetical. When I view the listing after a sort on say locationID, it's not alphabetical but ordered by which class has the lowest numerical value in the locationID field and then ASC from there. R> By definition, in SQL, if you don't specify a sort order (or in R> this case a second order) then the SQL engine can and will output R> the records in any order it feels like. Really? I didn't know that. I thought it started at record 0 and then output them in the order they appeared in the table data view (using something like PHPMyAdmin.) R> In that case of MySQL and ISAM tables, that *HAPPENS* to be the ID R> order, because the under-lying SQL engine happens to find it R> convenient to have them in that order. Ahhh. Ok, there we go. R> If you *DELETE* an ID number, then put another one in, but force it R> to be the same ID number you'll probably see the records come out R> in a different order. It's usually a really Bad Idea to do that R> (forcing an ID to be re-used) but for the purposes of R> learning/demonstration you can do it. I'll give it a shot sometime to see. It'll be interesting to find out. R> At any rate, MySQL is *NOT* sorting by ID number. It's not sorting R> *AT* *ALL* except for what you told it to sort. It just spews out R> the records in any old order at all after "location" is done -- R> Which happens to be ID order, but that's more like coincidence than R> plan [*]. Maybe I confused you with the "ID" nomenclature. I mean to say it's sorting by locationID, categoryID, instructorID (whichever column I clicked on), and since those are integer values they aren't sorted alphabetically). >> That's not what they want obviously. R> Why not? R> What *DO* they want, then? If they sort by location, they want the course records to show up in alphabetical order based on location. Right now it does sort by location, but it's not alphabetical because the Course.locationID, Course.instructorID, and Course.categoryID are integers which relate to three other respective tables. There is no join, and I didn't think you were "supposed" to do a join on four tables. R> Do you want, perhaps, to have a DEFAULT sort order, which kicks in R> after their chosen ordering? By default it sorts by Course date. R> Perhaps you could do (here's your magic bullet): R>$default_sort_order = "course, instructor, location"; R> . R> . R> . R> $query .= "ORDER BY $_GET[order_by], $default_sort_order "; ?>> I'm kinda doing that already as: if (isset($_GET['orderBy'])) $orderBy = $_GET['orderBy']; else $orderBy = 'courseDate'; R> Then, oddly enough, by "location" again, but that's kinda R> irrelevant. It won't *hurt* anything [**], mind you, it's just R> kinda silly, since you have already sorted by location in the very R> first place. Got it. R> [**] Technically, it's a little inefficient to have that extra R> bogus "location" in there at the end, but you're probably not R> sorting enough rows for it to make any measurable difference in R> your results... And MySQL might even be smart enough to optimize it R> out anyway. True enough. I'm guessing they'll be maybe 30 to 50 records at any one time. R> You did the right thing. :-) Tell me that again once I get the sorting working right! R> You just needed to go farther down the road you are on, instead of R> stopping partway. Only stopped because I got stuck... :-) Thanks. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.9.17 Return under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sorting table columns dynamically on normalized MySQL tables
Hello Chris, Tuesday, April 19, 2005, 1:23:53 PM, you wrote: C> Firstly, what DB are you using? MySQL. C> SELECT C> course.name, C> location.name, C> instructor.name C> FROM C> course C> INNER JOIN location ON location.id = course.locationID C> INNER JOIN instructor ON instructor.id = course.instroctorID C> ORDER BY instructor.name C> (or location.name or course.name). C> It should be as simple as that... So joining on four tables isn't considered bad practice? Technically it's going to be five tables because the whole HTML table layout changes to include "enroll" and "disenroll" buttons once they log in and based on if they are enrolled or not in a particular course which comes from the registrations table, which is simply their the "id" from the Students table and the "id" from the Course table. Thanks. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.9.17 Return under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Accessible HTML - OT
Hello Mary-Anne, Monday, May 9, 2005, 5:15:27 PM, you wrote: MAN> Check out Joe Clarkes website: http://joeclark.org. Joe is an MAN> expert in web accessibility issues. I'm not claiming to be even remotely as good as Joe, but looking at his site, I didn't see much in the way of helpful examples (maybe I didn't look hard enough). Recently I decided to write a tutorial on Web Accessibility and XHTML 1.0 Strict so that I could learn them. If you're interested, it's at: http://www.devtek.org/test Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to know whether web server of a remote machine is running or not
Hello balwant, Tuesday, May 10, 2005, 5:59:15 AM, you wrote: b> is there any method to know whether the other webserver is running b> or not. http://us2.php.net/fsockopen You'll be doing what's termed an HTTP Ping. You make a socket connection to the other server, perform a GET request on a page (preferably small), examine the returned headers for a Status 200 (which means OK). If you get that, the webserver responded and served up the page. You might just be able to do a HEAD request, but I haven't tried it. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.5 Return RC5 under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] number format?
Hello Dustin, Tuesday, May 10, 2005, 9:34:10 AM, you wrote: D> I have a number like -56.98 D> I need to convert it to -5698. I tried Add50 = " . $add50; $sub50 = $newNum -50; echo "Sub50 = " . $sub50; ?> If you still need to do math on it, just remember you don't have a decimal anymore. See example above. Make sure you do any math you need to do before the str_replace. If you're just displaying it, then no problem. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.5 Return RC5 under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re-initiating an autostarted session
Hello Ville, Wednesday, May 11, 2005, 12:32:07 PM, you wrote: V> session_destroy(); V> session_regenerate_id(); V> session_write_close(); V> Header("Location: ..."); V> exit; I honestly don't know if it's the right way, but I ran into a similar issue a while back. I did it this way: session_destroy(); session_start(); session_write_close(); Header("Location: ..."); exit; I never tried regenerate. Just started a new session again. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.5 Return RC7 under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using require
Hello Cima, Friday, October 14, 2005, 12:33:57 PM, you wrote: C> any info will be highly appreciated!! The easiest way to handle this is to set a session variable once they're authenticated and on all your pages you have something like this: session_start(); if (!$_SESSION['isAuthenticated'] == "Yeppers") include('auth.php'); IIRC you have to use include() vs. require() because a require() would force auth.php regardless of the outcome of the if statement. I'm pretty sure I remember reading this somewhere, but I could be wrong. By using the session variable you only force an auth for people who already haven't authenticated. If you're not familiar with sessions, the key thing to remember is you need to do a session_start(); somewhere in the page prior to reading or writing session variables. Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] upload videos (might be a bit 0T)
Hello Ryan, Thursday, May 19, 2005, 10:57:55 AM, you wrote: R> Any suggestions on how to do this? Normal upload form with PHP and R> increase timeout on server? or some P2P method? I dont think they R> know much about FTP or i would have given them a directory on the R> server to upload to. Have them burn it to a CD and mail it to you, then you put it on the server for download. Most people's upstream rates are abysmal unless you paid extra for synchronous DSL / Cable. If they're sitting on a T1 or something maybe a different story. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.5 Return RC9 under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Bar codes
Hello Emil, Friday, May 20, 2005, 4:45:49 AM, you wrote: E> I've never done anything like this before, do you know of any good E> starting points? I don't know anything about bar codes. http://www.phpclasses.org and search for barcode -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.5 Return RC9 under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can I prevent Server variables from being spoofed ?
Hello Graham, Friday, May 20, 2005, 12:46:28 PM, you wrote: G> Can the server variable 'user agent' be modified/spoofed by the G> user? Oh yeah Firefox and Opera are easy to change. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.5 Return RC9 under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Displaying MySQL results on runtime
Hello Mário, Wednesday, September 27, 2006, 10:25:31 AM, you wrote: > Is there a way to display the MySQL actions at runtime, i. e., > display the MySQL commands while they are being executed ? Echo the sql statements... -- TBUDL/BETA/DEV/TECH Lists Moderator / PGP 0x5D167202 __ Geocaching:http://gps.PCWize.com ( ) ( ___)(_ _)( ___) TBUDP Wiki Site: http://www.PCWize.com/thebat/tbudp )(__ )__) _)(_ )__) Roguemoticons & Smileys:http://PCWize.com/thebat ()()()(__)PHP Tutorials and snippets:http://www.DevTek.org See - the thing is - I'm an absolutist. I mean, kind of ... in a way. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Send process to background
Hello André, Friday, October 13, 2006, 10:42:58 AM, you wrote: > Evidently, this will take a while. My first requirement was that it > should _NOT_ deppend on external libraries (ie. pecl, modules and > such). It has to be self-sustained. As such, it will take a bit > longer to execute. Not knowing what OS, this may or may not be possible, although I'm betting since it is via Windows, that Linux can definitely do it too. Instead of running a script in the background, create a request through the Windows scheduler (or CRON in Linux, I think). What you stick in the scheduler to run is your choice. Could be a PHP script, a .BAT file, .sh file or whatever. You can set the scheduler task to run immediately, or within 'x' time. Whatever you want. Here's a reference to the Windows AT command: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/at.mspx Does that fit your need? -- TBUDL/BETA/DEV/TECH Lists Moderator / PGP 0x5D167202 __ Geocaching:http://gps.PCWize.com ( ) ( ___)(_ _)( ___) TBUDP Wiki Site: http://www.PCWize.com/thebat/tbudp )(__ )__) _)(_ )__) Roguemoticons & Smileys:http://PCWize.com/thebat ()()()(__)PHP Tutorials and snippets:http://www.DevTek.org If you try to fail, and succeed, which have you done? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Comment management
Hello tedd, Monday, October 23, 2006, 1:53:41 PM, you wrote: > Well... I was afraid that someone would say that (paint me into a > corner). I just wanted to check before launching my own home-grown > solution and then having everyone say "Why didn't you use > so-and-so's 'comment manager' "? Sorry, wasn't paying attention earlier. I recently wrote a comment manager that you include on the page you want to do comments. It uses one MySQL table with an id that relates to the page the comments pertain to. i.e. it uses the same code and DB table for multiple pages where the comments may all be different. It's cake easy to implement (one php file to display and save new comments) and I'd be interested in any comments you might have about it. PM me and I'll send it to you. If you want to see it in action, take a look at http://trucks.pcwize.com/ubiquirack.php (at the bottom). I need to setup a test page for this somewhere on my devtek.org site. -- TBUDL/BETA/DEV/TECH Lists Moderator / PGP 0x5D167202 __ Geocaching:http://gps.PCWize.com ( ) ( ___)(_ _)( ___) TBUDP Wiki Site: http://www.PCWize.com/thebat/tbudp )(__ )__) _)(_ )__) Roguemoticons & Smileys:http://PCWize.com/thebat ()()()(__)PHP Tutorials and snippets:http://www.DevTek.org Stock news: Certs shareholders breathe easier. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mailto members..?
Hello John, Wednesday, March 1, 2006, 11:38:15 AM, you wrote: > Outside of being a major spam flag, and possibly reaching the limits > of your smtp server. Agreed... Sending mass mail via BCC is going to be nothing but headaches. I've been down that road a number of times. -- TBUDL/BETA/DEV/TECH Lists Moderator / PGP 0x6C0AB16B __ Geocaching:http://gps.PCWize.com ( ) ( ___)(_ _)( ___) TBUDP Wiki Site: http://www.PCWize.com/thebat/tbudp )(__ )__) _)(_ )__) Roguemoticons & Smileys:http://PCWize.com/thebat ()()()(__)PHP Tutorials and snippets:http://www.DevTek.org For people who like peace and quiet: a phoneless cord. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problems with authentication (I think)
Hello all, What I have: Windows webserver running PHP 4.34 and MySQL 4.0.17. The knowns: Doing the PHP test works and I get back all sorts of information, and PHPBB2 works as advertised with no problems, so does PHPMyAdmin. My Problem: I've tried a number of PHP scripts to do various things (some just to play around and learn, and some because I really want them on my web server.) The three problems I usually encounter with the problematic PHP scripts are: 1. When I hit the page, it just returns a blank page. This happens with: PHPTest http://www.resynthesize.com/code/phptest_info.php Proxy http://sourceforge.net/projects/sbp/ 2. When I hit the page, it needs some authentication for login, and even though it appears to take the login, nothing really happens (i.e. it didn't log me in, so I can't go anywhere. This happens with: Scubaman Dive Log http://www.ivains.com/scubaman Directory Indexer http://autoindex.sourceforge.net (only when I enable the authentication for user logon, otherwise it works fine) 3. Parts of the PHP script work, but others don't. This happens with: GoRedirector http://www.studentplatinum.com/scripts/ (It will return the values from MySQL that are in there, but I can't delete, add, or administer it in any way, nor does the actual PHP redirector itself work.) I don't know enough about PHP yet to really know where to start looking. Any help would be greatly appreciated. I thought it had something to do with Global Variables being disabled in the php.ini file, but I re-enabled that to test it, but it didn't help. Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with authentication (I think)
Hello Leif, Monday, February 16, 2004, 7:13:30 PM, you wrote: LG>PHPTest http://www.resynthesize.com/code/phptest_info.php Just a followup. I found out that the PHPTest showing just a blank page was a mistype in my config.inc.php file. It now shows me the login screen, but when I login it does not do it. If I create a new user via the PHPTest interface, it does indeed create the new user, but I can't login with that one either. I know I'm asking about a specific app here, but the problem spans a few apps, and the problem is the same with all of them (namely, authentication won't work). Thanks again. Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with authentication (I think)
Hello Comex, Tuesday, February 17, 2004, 11:15:07 AM, you wrote: C> What does phpinfo say? It says tons of stuff. Anything in particular I should be looking for? Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] resubmitting $POST data to another script
Hello Charlie, Tuesday, March 2, 2004, 1:54:43 PM, you wrote: CFI> I'm creating a form with 170 fields, and I'd like to create an CFI> intermediary page so the user can review their info before CFI> submitting it again to the emailing script. Just a thought. I'm guessing you are dumping this stuff to a database for the final result. Why don't you create an intermediate table to hold those fields (keeping track of the record ID in a hidden input field), then re-read that data back on the validation page, then when they submit it there, the changes are added to the real table. My only thinking on this is to keep it simple rather than carrying over a ton of hidden fields. It may not be the most efficient method, but it'd work. Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to argue with ASP people...
Hello Richard, Monday, January 3, 2005, 11:27:05 AM, you wrote: RL> ASP has no include function. This makes life very very very RL> difficult to write decent code. Not that I like ASP, and I'm not an ASP guru by any means, but this statement is incorrect AFAICS. I use to do this all the time in ASP. Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to argue with ASP people...
Hello Richard, Tuesday, January 4, 2005, 10:28:18 AM, you wrote: RL> Or am I mis-remembering the horrors of ASP? It's been awhile since RL> I've used it, and you don't have enough money to make me use it RL> again. You're telling me!!! I wrote three, count 'em, all of three ASP database front ends before I'd even heard of PHP. I then got into PHP and just a month ago I was asked to make a few changes to one of those ASP apps I did a cpl years back and I sat there staring at the code going "Where the H*ll did all the opening and closing curly braces go?" I can't tell where a while statement ends and a for loop begins. It actually took me a while of staring at it before anything started coming back to me. After I made the changes, I just felt, well, so dirty ;-) Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sorting mysql results
Hello Sebastian, Monday, January 10, 2005, 2:38:18 PM, you wrote: S> if the $row['type'] is music i want to output an and the S> results below it but below the files results.. makes sense? i S> thought i remember doing this once using a dummy var but cant S> remember how. i guess i could always run a second query, but would S> like to avoid that. As you loop through the recordset, just concatenate. i.e. while ($r=mysql_fetch_assoc($result)) { if ($row['type'] == "Music") $musicRows .= $row['name'] . '-' . $row['type'] . ''; elseif ($row['type'] == "Files") $fileRows .= $row['name'] . '-' . $row['type'] . ''; elseif ($row['type'] == "Pictures") $pictureRows .= $row['name'] . '-' . $row['type'] . ''; } echo 'FILES-' . $fileRows . ''; echo 'MUSIC-' . $musicRows . ''; echo 'PICTURES' . $pictureRows . ''; I threw PICTURES in there just for GPs. Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] URL-funtion - returnvalue into variable...?
Hello Wiberg, Wednesday, January 12, 2005, 1:40:26 AM, you wrote: W> Another company wants me to access their productinfo thorugh URL, something W> like this: W> https://www.anothercompany.com/returnValueOfProductID=1043 Oddly enough I just happened to run across something that might be useful while looking for something else completely. http://www.tutorio.com/tutorial/php-alternative-to-mod-rewrite-for-se-friendly-urls Once the page loads, scroll down a bit. There's a weird navigator. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] delete part of array
Hello Sebastian, Wednesday, January 12, 2005, 5:22:20 PM, you wrote: S> how do i delete keys from an array if it has no values? S> eg, this: array_merge($name); Try it that way first. If not, $name = array_merge($name); But I think I remember the first way working for me. Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-WIN] HTML in PHP to a File
Hello MikeA, Wednesday, January 12, 2005, 6:46:46 PM, you wrote: M> echo "The test is starting"; M> $echowrite = "echo "; M> $echowrite."This is the first line."; M> echo "You should have seen the first line by now."; M> Did not work! Hey I'll try anything to get this to work! LOL Not sure how to do the pagebreaks, but the reason your script didn't do anything is that you never echo'd $echowrite. $echowrite would have output: ******** echo This is the first line. Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] delete part of array
Hello Jochem, Wednesday, January 12, 2005, 8:08:09 PM, you wrote: JM> read the manual entry first (see below) - and understand what the JM> function actually does - never just assume because its giving you JM> the result you want now that it will always work the way you JM> expect. Don't be a 'tard... Just because someone doesn't explicitly state they didn't read the manual entry first don't assume they didn't because you know what they say about assume. So to make a troll happy, here's exactly what it does with one array given as an argument: "If only one array is given and the array is numerically indexed, the keys get reindexed in a continuous way." Wow... Oddly enough that sounds exactly like what he wanted, and hence my suggesting it to him. JM> you think??? Now.. On to the part where the "I think" applies.. Since they do not give an example of a single array being used as an argument, I had to rely on memory from when I needed to do that nearly four months ago. I know I used array_merge(), but I didn't remember if I had to assign it to a variable or not. JM> hit the manual: http://www.php.net/array_merge (thats 30 chars to JM> type in the addressbar of your favorite browser and then you'd be JM> sure) No duh and if you're using Firefox, you can even do something really weird like give the php.net website a keyword (oh, "php" seems to work nicely), and set your location to "http://www.php.net/%s"; and amazingly enough you can just type in "php array_merge" and automagically it takes you right there. That's only 15 chars... Much more efficient than your suggestion. JM> probably array_merge() will do what he wants but there maybe JM> side-effects that will bite him in the ass later on, same goes for JM> my (previous) suggestion of array_values() as it happens . His array is numerically indexed. It does exactly what he wants. Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php editor
Hello William, Thursday, January 13, 2005, 9:02:12 AM, you wrote: W> I'm quite new with writing php code. I was considering of using W> some kind of php editor program to help with the syntax. Know any W> goog ones? There are a few. http://www.pspad.com is my favorite, and it'll syntax highlight a good number of programming languages. Plus you can download the PHP documentation in .chm format from php.net and use it from within PSPad. It's freeware too. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] delete part of array
Hello Jochem, Thursday, January 13, 2005, 10:55:35 AM, you wrote: J> heh but who says I'm not a bar steward ;-) I'll take a beer then! I need one after today. J> sorry if it came accross a little harsh, but I stand by the point J> that the onus is on the person asking the question to give an J> indication as to what he has done to try and help him/her-self - J> spoonfeeding is for babies, not programmers. I apologize too. Here I am, the moderator and owner of five other lists harping on my users to not reply too quickly, and here I go and do it. Isn't that one of the moderator credos though? "Do as I say, not as I do?" :-) I agree that handing someone the silver platter every time they ask isn't the right way to do it, but I don't mind sharing what I've learned either. J> so my point stands - if your going to help why not grab the nearest J> shell and test by way of a php -r ''? takes just along J> as writing both versions in the mail and makes _you_ look better J> IMHO. True 'nuff. J> indeed it is! thanks for the tip :-) , np :-) J> I might add though that people choose a close/fast mirror rather J> than www.php.net itself to help offload some of the traffic - my J> preferred mirror is always way faster the www.php.net, which is a J> nice when your hitting the manual 20+ times a day. I can agree with that. I'll fix mine. J> BTW: took me a few mins to figure out where to set this: in the J> bookmarks details dialog (via the bookmark manager - and possibly J> other routes) if anyone else is interested. Do you reckon you can handle two "I think"'s is a 24 hour period? I think you can do this in IE too, but it's more difficult. When I used to use IE way back when, I think I set up google as my search engine instead of MSN and did something like that. It coulda all been a dream too... :-) J> I personally couldn't tell what exactly he wanted to filter out of J> his array (false, '' or NULL) or whether he cared about the J> difference in this case. I was merely trying to encourage porper J> understanding of the function rather than using something which J> works under the current conditions I wasn't quite sure either but thought I'd give it a shot. At any rate, getting OT. Talk at you later. It's time to go home and play with the baby's mama. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-WIN] including an HTML file
Hello Gaetano, Thursday, January 13, 2005, 5:53:04 PM, you wrote: >> So i must do all manually >> i write this [snip] >> where $corpo is a variable for the name of the file. >> if the file not existe the page have a blank body I don't know of another way to do what you asked, which was to include only the information contained between the and tags. You could put and else clause to your if(file_exist) which would include the contents of some other file if that condition happens. That file could just be some default content. Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Obtaining the base dir of a file in a web server
Hello Juan, Monday, January 17, 2005, 2:23:23 AM, you wrote: JAG> I use this sentence ($htmlFile = $_SERVER['DOCUMENT_ROOT'] ) for JAG> obtaining the complete route of a file in my web server, but JAG> inserts a white space to final char and i need remove it. I use JAG> the trim function but it continue there. How can i remove it? Can JAG> it be anohter char? See if this does it. $htmlFile = trim($_SERVER['DOCUMENT_ROOT']); Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-WIN] Weird windows error
Hello Louis, Tuesday, January 18, 2005, 4:51:49 AM, you wrote: LY> LoadLibrary("php_mssql.dll") failed - The specified module could LY> not be found. Because this DLL has a dependency on ntwdblib.dll. Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] NT domain info
Hello Bruce, Wednesday, January 19, 2005, 6:06:28 PM, you wrote: BD> i'm not a guru... but this sounds like something that someone BD> should have already done (or thought about) in perl. you might BD> find that there's already a perl app/solution that gets you close BD> to what you need, that would allow you to either use the perl BD> solution, or rewrite what it does in php... They have in PHP... I learned a lot from this: http://www.phpldapadmin.com/product_info.php/products_id/29 Free to home users. Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regular expressions ?
Hello Zouari, Thursday, January 27, 2005, 7:33:04 AM, you wrote: Z> I need to verify if $x is between 1 and 20 and i need to do that Z> with regular expressions ? If you *need* to do it with regexp, try this: if (preg_match("/[2-19]/",$x)) echo "It is!"; If 1 and 20 are values you want to verify too, change 2-19 to 1-20. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cannot connect to Database
Hello Supersky, Thursday, January 27, 2005, 8:55:04 AM, you wrote: S> But I cannot, and I see Fatal error: Call to undefined function S> mysql_connect() in 1. Make sure you uncomment the extension=php_mysql.dll in your php.ini 2. Copy the php_mysql.dll to your Windows/System folder 3. Restart Apache. You might look at: To see before and after (Look for the section on MySQL.) -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regular expressions ?
Hello Zouari, Thursday, January 27, 2005, 8:53:55 AM, you wrote: Z> doesnt work ! Z> this is working fine : Z> if (eregi("^-?([1-3])+$",$x) Z> echo "x is 1 or 2 or 3"; Whoops. Sorry.. That's what I get for throwing out an answer while on the run: Try this: "; else echo "It's not!" . $i . ""; } ?> The for loop is just for show. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regular expressions ?
Hello Rick, Thursday, January 27, 2005, 12:36:39 PM, you wrote: R> /^(1?[1-9]|[12]0)$/ works too. The first part covers 1-9, 11-19; R> the second part gets you 10 and 20. R> Plus, it's ever so slightly shorter! And isnt' that what's most R> important? :P Purty :grin: -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cannot connect to Database
Hello Supersky, Thursday, January 27, 2005, 1:37:12 PM, you wrote: S> Thank you for your help. I have done what you told me to do. But it S> doesn't work. Does phpinfo(); output anything like below (except it looks prettier! :grin: )? mysql MySQL Support enabled Active Persistent Links 0 Active Links0 Client API version 4.1.7 Directive Local Value Master Value mysql.allow_persistent On On mysql.connect_timeout 60 60 mysql.default_host no valueno value mysql.default_password no valueno value mysql.default_port no valueno value mysql.default_socketno valueno value mysql.default_user no valueno value mysql.max_links Unlimited Unlimited mysql.max_persistentUnlimited Unlimited mysql.trace_modeOff Off If you don't see that in the phpinfo(); output, then it didn't get loaded correctly. Hmmm. It's been a bit since I've installed PHP. Find libmysql.dll and dump that in your windows/system folder too. See: http://php.mirrors.powertrip.co.za/manual/en/install.windows.extensions.php However, I checked my system folder and I do not have that one in there. It might be pulling it from my path somewhere though. I'll have to check when I get home. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-WIN] Random
Hello SargeTron, Wednesday, January 19, 2005, 10:10:20 AM, you wrote: S> rand() only returns an int (number), but I would like something S> like dd75$6*, you know, containing any character. I would like it S> only to do a certain string ONCE, so there are no duplicates (in a S> for loop). Hopefully I won't need to do a huge array. Any S> suggestions? Take a look at this random e-mail address generator (hasn't everyone written one of these? ) that I wrote a bit back. You should be able to see how to do exactly what you want from it. http://www.devtek.org/software/randmail/index.php $upperLowerNumber = rand(1,10); controls the so called seed for the script because I placed constraints on how often uppercase and numbers could appear. Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [PHP-WIN] Random
Hello trobi, Saturday, January 29, 2005, 12:05:33 PM, you wrote: t> whatabout uniqid()? He also wanted symbols [EMAIL PROTECTED]&*() etc. Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site <http://www.PCWize.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php forum and (almost certainly 0T) client editor
Hello Ryan, Tuesday, May 31, 2005, 7:59:10 AM, you wrote: R> Can anybody recommend a real bare bones forum that i can modify or R> a tutorial for creating a forum or URLs/Classes etc to help me R> create a simple forum? ??? That's a hard question to answer. You could make it real bare bones and just display the entries in reverse order by date / time entered from the DB. R> I checked on google but I couldnt find any tutorials or code, went R> to hot-scripts and saw a _c r a p l o a d_ of forums (for free and R> otherwise) but I have a client who insists I build him a forum R> which must fall _exactly_ to his specifications and work of our R> currently registered users database. Again, without knowing what those specifications are, it's a hard question to answer. R> I will need a kind of "client editor" for when people write their R> messages into the forum, eg: make this bold and that italics and R> that centered and that with an image and so on FCKEditor http://www.fckeditor.net/ It rocks. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.5.20 under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [Files suffix] .inc.php files
Hello Martin, Sunday, May 29, 2005, 9:24:00 PM, you wrote: M> I saw files like "file.inc.php" and "file.inc" M> What is the *.inc suffix good for ? It's good for a lot of trouble if the webserver hasn't been set up to parse .inc files as PHP. If it hasn't then someone can request that file in a broswer and see the code. I'd just stay away from using .inc for an include and do either of the below: config.inc.php or just config.php Whichever floats your boat. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.5.20 under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What Works Works Validator
Hello Richard, Wednesday, June 1, 2005, 3:16:50 PM, you wrote: R> Does anybody know of a "What Works Works Validator" which checks R> for maxiumum browser compatibility rather than the W3C standard? E. Got it listed on my XHTML test page at: http://www.devtek.org/test (In the resources section about validation services). I think it was the Hermish one. http://www.hermish.com/ Sorry, gotta run to pick up my daughter or I'd have checked it for you. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.5.24 under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Beautiful HTML Invoice -> Prints like crap! I need somesuggestions!
Hello Matt, Thursday, June 9, 2005, 2:47:51 PM, you wrote: M> Ok all - I've been playing with this print styl sheet thing. I can M> get the media="print" to behave correctly, but I cannot get table M> background colors set. I want to print the table bg colors and M> background images. I was hoping this was possible with CSS2. Does M> anyone have any input on this? I build some diagrams using html and M> graphics which are on the invoice, and I use bgcolor on my tables M> to show the separator lines in the line item section with the M> prices and such. I don't know how to proceed best, or if I am M> heading down a dead end with this. Anyone have any more input on M> this? Everything I have read so far has been very helpful and I M> thank you for that. You realize that the printing of background colors is determined primarily by the user's browser right? In IE: Tools / Internet Options / Advanced / Under Printing section. In Firefox: File / Page Setup / Under Options -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.5.26 under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Beautiful HTML Invoice -> Prints like crap! I need somesuggestions!
Hello Matt, Thursday, June 9, 2005, 3:34:30 PM, you wrote: M> Yeah I do understand this. That is primarily what I was trying to M> find a workaround for. It doesn't seem like CSS will save me on M> this one. I can't seem to get table borders to look identical in M> ff/ie using CSS they render differently. My Diagrams mostly rely on M> bg colors, so I'm really up a creek right now - unless I convert M> the bg images to foreground image which would really suck...but M> could be done. There are some things (this one being an example) that you just can't control from the server side. Another one is forcing a page to print as landscape. I have long since given up on that one for sign-in rosters. I just put a big note next to the link to make sure to print it in landscape. As for IE / FF borders, that one drives me nuts too. I like to use outset and inset borders for a 3-D look, but in IE it's all stairstepped when I do nested borders. I'm sorry I don't have an answer for you other than I don't think you're going to achieve what you want with CSS. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.5.26 under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] need to convert field names into array for form submission
Hello Bruce, Friday, August 12, 2005, 1:39:54 PM, you wrote: > I believe this can be done with an array. > any assistance is greatly appreciated! I've been working on a validation function for quite a while now that does what you're asking. I keep adding to it as I run across stuff I didn't need before. It's not perfect, but it does work pretty good. It does not do addslashes() because I do that only when I need to store it in a DB. Ok... Let's see if I can put this together without it being too ugly. The function as functions.php: * function validate($fieldName, $value, $size, $type, $extra="0") { GLOBAL $errors; GLOBAL $safe; if ($value != "") { switch ($type) { case 'alpha': #Matches only letters and a hyphen (for last names) if (!preg_match("/^[a-z]+-?[a-z]+$/i", $value)) { $errors[0] = 1; $errors[$fieldName] = 'This field only accepts alphabetic input'; } break; //-- case 'numeric': #Matches numeric input if (!preg_match("/^[0-9\.]+$/", $value)) { $errors[0] = 1; $errors[$fieldName] = 'This field only accepts numeric input'; } break; //-- case 'phone': #Matches phonenumber in xxx-xxx- where area code and exchange do not start with a "1" if (!preg_match("/^[2-9][0-9]{2}-[2-9][0-9]{2}-[0-9]{4}$/", $value)) { $errors[0] = 1; $errors[$fieldName] = 'Phone number must be in xxx-xxx- format'; } break; //-- case 'email': #Should match 99% of valid e-mail addresses if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)[EMAIL PROTECTED](\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $value)) { $errors[0]= 1; $errors[$fieldName] = 'E-mail address ' . $email . ' doesn\'t appear valid, please verify'; } break; //-- case 'alphanumeric': #Matches strings with only alphanumerics if (!preg_match("/^[0-9a-z]+$/i", $value)) { $errors[0] = 1; $errors[$fieldName] = 'This field only accepts alphanumeric characters'; } break; //-- case 'descriptor': #Allows strings with alphanumerics, and other common #things you'd find in titles and descriptions $value = htmlentities($value); break; //-- case 'date': #Matches strings with dates as mm-dd- if (!preg_match("/^(0[1-9]|1[012])\/(0[1-9]|[12][0-9]|3[01])\/(19|20)\d\d$/i", $value)) { $errors[0] = 1; $errors[$fieldName] = 'Invalid date, enter as mm/dd/'; } break; //-- case 'time12': #Matches strings with dates as hh:mm if (!preg_match("/^([0]?[1-9]|1[0-2]):[0-5][0-9]$/i", $value)) { $errors[0] = 1; $errors[$fieldName] = 'Invalid time, enter as xx:xx'; } break; // -- case 'lat': #Matches strings with latitude as hddd mm.mmm if (!preg_match("/^-?([0-8]{1,3})\s([0-9]{1,2})\.[0-9]{1,3}$/",$value)) { $errors[0] = 1; $errors[$fieldName] = 'Invalid value, enter as ddd mm.mmm'; } $value = str_replace(".", "", $value); $value = str_replace(" ", ".", $value); if ($extra == "S") $value = "-" . $value; break; // -- case 'long': #Matches strings with longitude as hddd mm.mmm if (!preg_match("/^-?([0-9]{1,3})\s([0-9]{1,2})\.[0-9]{1,3}$/",$value)) { $errors[0] = 1; $errors[$fieldName] = 'Invalid value, enter as ddd mm.mmm'; } $value = str_replace(".", "", $value); $value = str_replace(" ", ".", $value); if ($extra == "W") $value = "-" . $value; break; //-- } //Common to all in switch if (strlen($value) > $size) { if (!isset($errors[$fieldName])) $errors[$fieldName] .= ''; else $errors[$fieldName] .= ''; $errors[0] = 1; $errors[$fieldName] .= 'Field limited to ' . $size . ' characters'; } if (isset($errors[$fieldName])) $errors[$fie
Re: [PHP] regular expression for time
Hello babu, Monday, August 29, 2005, 6:50:32 AM, you wrote: > how can i write regular expression for time in 24-hour format i:e, > HH:MM:SS. using preg_match. --TBUDL/BETA/DEV/TECH Lists Moderator / PGP 0x6C0AB16B __ Geocaching:http://gps.PCWize.com ( ) ( ___)(_ _)( ___) TBUDP Wiki Site: http://www.PCWize.com/thebat/tbudp )(__ )__) _)(_ )__) Roguemoticons & Smileys:http://PCWize.com/thebat ()()()(__)PHP Tutorials and snippets:http://www.DevTek.org Save your pennies. The dollars go to the I.R.S. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Any good free easy converting tool?
Hello Gustav, Wednesday, October 12, 2005, 12:55:11 PM, you wrote: > Someone know of any good free tool for converting from Access to > Mysql. I just need to import certain tables into an already > existance database. DBTools (freeware) http://www.dbtools.com.br/ I use it quite a bit. -- TBUDL/BETA/DEV/TECH Lists Moderator / PGP 0x6C0AB16B __ Geocaching:http://gps.PCWize.com ( ) ( ___)(_ _)( ___) TBUDP Wiki Site: http://www.PCWize.com/thebat/tbudp )(__ )__) _)(_ )__) Roguemoticons & Smileys:http://PCWize.com/thebat ()()()(__)PHP Tutorials and snippets:http://www.DevTek.org MCSE == Minesweeper Consultant / Solitaire Expert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Imap, reading the email-body
Hello Bruno, Wednesday, October 19, 2005, 10:08:24 AM, you wrote: > Look the main page and try to read any message... I dont know what > can i do to fix it... nl2br() (see php manual) -- TBUDL/BETA/DEV/TECH Lists Moderator / PGP 0x6C0AB16B __ Geocaching:http://gps.PCWize.com ( ) ( ___)(_ _)( ___) TBUDP Wiki Site: http://www.PCWize.com/thebat/tbudp )(__ )__) _)(_ )__) Roguemoticons & Smileys:http://PCWize.com/thebat ()()()(__)PHP Tutorials and snippets:http://www.DevTek.org Speak softly and carry a big aardvark. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Ugh, w32 anything is making me want to drink!
Hello Richard, Saturday, October 22, 2005, 6:37:14 PM, you wrote: > Otherwise, it's compiled into the DLL and you are stuck. > A Windoze "shortcut" WILL NOT WORK One of the easiest ways to ensure you're using the php.ini file you want is to create the following registry key: HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath I usually stick my php.ini in my php folder because I ensure that I (my user account) has sufficient rights to modify anything in the php folder whereas the server admin wouldn't give my user account rights to modify files in the Windows folder. You can read more here: http://docs.php.net/en/configuration.html#configuration.file In addition to setting the directives in the php.ini file for your extensions folder, I'd also add it to your Windows Path. You can do that by: Right-click My Computer Choose properties Advanced tab Click the Environment Variables button Under System variables, edit the Path At the end of the path line, add a semi-colon (if there isn't one) Then type in the full path to your extensions folder i.e. C:\PHP\ext Click, Ok, then Ok, then Ok. Restart your webserver, run phpinfo() and make sure that the ini path is the one you specified. Just FYI, you might add the main php folder to your path as well because some of the .dlls you want might be in that folder libeay32.dll for instance. -- TBUDL/BETA/DEV/TECH Lists Moderator / PGP 0x6C0AB16B __ Geocaching:http://gps.PCWize.com ( ) ( ___)(_ _)( ___) TBUDP Wiki Site: http://www.PCWize.com/thebat/tbudp )(__ )__) _)(_ )__) Roguemoticons & Smileys:http://PCWize.com/thebat ()()()(__)PHP Tutorials and snippets:http://www.DevTek.org What's the difference between ignorance and apathy? I don't know and I don't care. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Type of form element
Hello Shaun, Friday, October 28, 2005, 9:00:05 AM, you wrote: > Is it possible to loop through all $_POST values to see if it is a > checkbox? If so then for that element if it is equal to 'on' then > change it to 1 otherwise change it to 0? Yes and no. 1. You can't determine by the POST variable whether it was a checkbox or a text field unless you test for 1/0 or a string, but even then, what if someone types a 0 into a textbox that was supposed to be an address (input validation). The other option is to name the checkbox something like "question1_chkbox" and do a strstr() to see if the POST variable name contains "_chkbox". But you should know what the variable names of your checkboxes are anyways, so I don't know why you'd test to see if it was a checkbox. 2. Only set checkboxes (checked) are passed through POST and GET. This is fine if it's a one time form and you just need to know if they said "yes" to subscribing to your newsletter, but if it's a form they can go back into to modify settings (i.e. their account) then you need to test to see if they unchecked a box which will not be passed back to you via POST. Basically you'd set all the fields to 1 if the checkbox variable appeared in the POST, and set all the rest of the fields to zero (because if it wasn't in the POST variables, it was unchecked). -- TBUDL/BETA/DEV/TECH Lists Moderator / PGP 0x6C0AB16B __ Geocaching:http://gps.PCWize.com ( ) ( ___)(_ _)( ___) TBUDP Wiki Site: http://www.PCWize.com/thebat/tbudp )(__ )__) _)(_ )__) Roguemoticons & Smileys:http://PCWize.com/thebat ()()()(__)PHP Tutorials and snippets:http://www.DevTek.org Some days I feel like I'm just rearranging deck chairs on the Titanic. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php