Re: [PHP] Help and Advice needed please.
Yep, a mysql database seems like the way to go. Thanks to all who have offered to help on this project. Perhaps we could get together and figure out what needs doing, assign jobs etc. I have hosting already sorted. Cheers guys. On Sun, Aug 24, 2008 at 5:05 AM, sean greenslade <[EMAIL PROTECTED]>wrote: > So Byron, what do you think? Do you like the idea of a mysql database? > > > On Sat, Aug 23, 2008 at 11:57 AM, Luke <[EMAIL PROTECTED]> wrote: > >> I'm up for helping too. Also, a big agree to Sean too, MySQL seems the >> best way to go here. >> >> 2008/8/23 sean greenslade <[EMAIL PROTECTED]> >> >> I would be willing to help with this project. Because of all the different >>> requirements of this, I would recommend a totally custom set of scripts, >>> and >>> a mysql database to hold all the data. >>> >>> On Sat, Aug 23, 2008 at 7:22 AM, Byron <[EMAIL PROTECTED]> wrote: >>> >>> > Hey. >>> > >>> > I do some part-time IT work for a voluntary paramilitary youth >>> > organisation, >>> > and we're loooking for a system to digitize the personell files of our >>> > members. Here's a features list, all advice on how to implement will be >>> a >>> > great help. >>> > >>> > * Web-accesable via login >>> > * Rank, Name, Phone Number, Address, Email Address, Physical Address. >>> > * Training History >>> > * Promotion History >>> > * Miscellanous Notes. >>> > * Different types of Administrator and notes that can be attached to >>> > personell files that are seen by different types of administrator. >>> > * Activity report page. I.e. This activity happenened on this date and >>> > these >>> > people attended from this time to this time. Attendance must be visible >>> on >>> > personell files. >>> > * Attendance Register and counter for attendances of members. >>> > * UI that a 65-year old who believes dialup is fast (the Unit >>> Commander) >>> > can >>> > find his way around. >>> > * Easily copiable and deployable. As in can be used by more than one >>> unit. >>> > >>> > -- >>> > I'm going out to find myself, if you see me here, keep me here untill I >>> can >>> > catch up >>> > >>> > If I haven't said so already, >>> > >>> > Thanks >>> > Byron >>> > >>> >>> >>> >>> -- >>> Feh. >>> >> >> >> >> -- >> Luke Slater >> > > > > -- > Feh. > -- I'm going out to find myself, if you see me here, keep me here untill I can catch up If I haven't said so already, Thanks Byron
[PHP] Adding a single php file to .htaccess.
On one particular server, all *.html files are written in Python. I uploading a few PHP files to the directory, but they must also have .html extensions (they are replacing files that _were_ python, but it is rather important that the filename stay the same and I'd rather avoid rewrite). I figured that it would be easy enough to add a separate line in .htaccess for each PHP file, but I'm not getting it for some reason. This is the .htaccess line that lets the system parse *.html files as Python: AddHandler cgi-script .html This is what I'm trying to add to have the system parse specific files as PHP: AddType application/x-httpd-php filename.html I know that I am doing something wrong, but I do not know what. Any ideas? Thanks! -- Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת ä-ö-ü-ß-Ä-Ö-Ü
Re: [PHP] Adding a single php file to .htaccess.
On 24 Aug 2008, at 15:05, Dotan Cohen wrote: On one particular server, all *.html files are written in Python. I uploading a few PHP files to the directory, but they must also have .html extensions (they are replacing files that _were_ python, but it is rather important that the filename stay the same and I'd rather avoid rewrite). I figured that it would be easy enough to add a separate line in .htaccess for each PHP file, but I'm not getting it for some reason. This is the .htaccess line that lets the system parse *.html files as Python: AddHandler cgi-script .html This is what I'm trying to add to have the system parse specific files as PHP: AddType application/x-httpd-php filename.html I know that I am doing something wrong, but I do not know what. Any ideas? Thanks! In theory all you need to do is add a hash-bang line to the start of the PHP scripts. This should work... #!/usr/bin/env php If that's the first line then Apache should execute the script with PHP. If that doesn't work try replacing it with... #!/path/to/php -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adding a single php file to .htaccess.
2008/8/24 Stut <[EMAIL PROTECTED]>: > In theory all you need to do is add a hash-bang line to the start of the PHP > scripts. This should work... > > #!/usr/bin/env php > Thanks, that's what I am doing right now. I was hoping to avoid that for portability, but if it is unavoidable then I can live with it. Thanks! -- Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת ä-ö-ü-ß-Ä-Ö-Ü
Re: [PHP] Adding a single php file to .htaccess.
On 24 Aug 2008, at 15:39, Dotan Cohen wrote: 2008/8/24 Stut <[EMAIL PROTECTED]>: In theory all you need to do is add a hash-bang line to the start of the PHP scripts. This should work... #!/usr/bin/env php Thanks, that's what I am doing right now. I was hoping to avoid that for portability, but if it is unavoidable then I can live with it. Thanks! If you use env then it should be pretty portable. The only other way to do it would be to specify each script individually or with a regex if that's possible in httpd.conf or .htaccess using a Files section to tell Apache to execute it with PHP. I don't see that as any more portable. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adding a single php file to .htaccess.
2008/8/24 Stut <[EMAIL PROTECTED]>: > If you use env then it should be pretty portable. The only other way to do > it would be to specify each script individually Yes, this is what I want to do, specify each file individually. > or with a regex No!!! (then I'd have two problems :)) > if that's > possible in httpd.conf or .htaccess using a Files section to tell Apache to > execute it with PHP. I don't see that as any more portable. If would keep the php file portable. -- Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת ä-ö-ü-ß-Ä-Ö-Ü
Re: [PHP] Adding a single php file to .htaccess.
On 24 Aug 2008, at 16:09, Dotan Cohen wrote: 2008/8/24 Stut <[EMAIL PROTECTED]>: If you use env then it should be pretty portable. The only other way to do it would be to specify each script individually Yes, this is what I want to do, specify each file individually. or with a regex No!!! (then I'd have two problems :)) if that's possible in httpd.conf or .htaccess using a Files section to tell Apache to execute it with PHP. I don't see that as any more portable. If would keep the php file portable. I'm confused. A #! line does not harm the portability of a PHP script in any way whatsoever, and if you use the env version rather than an absolute path then it should work out of the box on 99% of Linux servers and will also work everywhere else because that line will be ignored by the PHP interpreter. In what way do you think it harms the portability of the PHP file itself? -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adding a single php file to .htaccess.
2008/8/24 Stut <[EMAIL PROTECTED]>: > I'm confused. A #! line does not harm the portability of a PHP script in any > way whatsoever, and if you use the env version rather than an absolute path > then it should work out of the box on 99% of Linux servers and will also > work everywhere else because that line will be ignored by the PHP > interpreter. > > In what way do you think it harms the portability of the PHP file itself? > Because I have a few other files that do not have the shebang line that I will likely need to put on that server in the future, and I did not want to have to remember to add the shebang line for each one. However, the flaw in my thinking is that I would in any case have to add the line to .htaccess for each file, which means SSHing in instead of FTPing. So the shebang line is in fact best! In any case, I would still like to know what line to add to .htaccess to have it parse a specific file as php. But it is no longer critical for this project because I will use the shebang line. Thanks! -- Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת ä-ö-ü-ß-Ä-Ö-Ü
Re: [PHP] Adding a single php file to .htaccess.
On 24 Aug 2008, at 16:27, Ashley Sheridan wrote: By your own definition, this will not work on 1% of the Linux servers, and don't forget that Linux is not the only operating system that is capable of running a PHP server... "and will also work everywhere else" Windows will have no problem with this, nor will any other platform that don't try to use the #! line - the PHP interpreter knows to ignore this line. The only places it won't work is on servers that try to use the #! line but where env is not in /usr/bin, which will (AFAIK) only be the case when it's been moved manually (i.e. I don't know of any distribution stupid enough to move it. The 1% was plucked out of the air, and I'd be willing to bet it's closer to 0.1%, but there's no way to know. The point is that it's as portable as it can be. If you used the Apache config or .htaccess to achieve this you're cutting out portability to the vast array of alternative HTTP servers, so an env-based #! line *is* the best option for portability. -Stut -- http://stut.net/ From: Stut <[EMAIL PROTECTED]> Date: 24 August 2008 16:16:36 BST To: "Dotan Cohen" <[EMAIL PROTECTED]> Cc: php-general. Subject: Re: [PHP] Adding a single php file to .htaccess. On 24 Aug 2008, at 16:09, Dotan Cohen wrote: 2008/8/24 Stut <[EMAIL PROTECTED]>: If you use env then it should be pretty portable. The only other way to do it would be to specify each script individually Yes, this is what I want to do, specify each file individually. or with a regex No!!! (then I'd have two problems :)) if that's possible in httpd.conf or .htaccess using a Files section to tell Apache to execute it with PHP. I don't see that as any more portable. If would keep the php file portable. I'm confused. A #! line does not harm the portability of a PHP script in any way whatsoever, and if you use the env version rather than an absolute path then it should work out of the box on 99% of Linux servers and will also work everywhere else because that line will be ignored by the PHP interpreter. In what way do you think it harms the portability of the PHP file itself? -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adding a single php file to .htaccess.
On 24 Aug 2008, at 16:30, Dotan Cohen wrote: 2008/8/24 Stut <[EMAIL PROTECTED]>: I'm confused. A #! line does not harm the portability of a PHP script in any way whatsoever, and if you use the env version rather than an absolute path then it should work out of the box on 99% of Linux servers and will also work everywhere else because that line will be ignored by the PHP interpreter. In what way do you think it harms the portability of the PHP file itself? Because I have a few other files that do not have the shebang line that I will likely need to put on that server in the future, and I did not want to have to remember to add the shebang line for each one. However, the flaw in my thinking is that I would in any case have to add the line to .htaccess for each file, which means SSHing in instead of FTPing. So the shebang line is in fact best! In any case, I would still like to know what line to add to .htaccess to have it parse a specific file as php. But it is no longer critical for this project because I will use the shebang line. It depends what version of Apache you're using, but it would be a Files section something like this (Apache 2 filter in this example, but untested - I've never needed to do this)... SetOutputFilter PHP SetInputFilter PHP Repeat for each file. For other versions of Apache check the installation section of the PHP manual. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adding a single php file to .htaccess.
You can replace the Python files with .html files that just have a redirect header in them. Then you can just have the php files as .php. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Dotan Cohen wrote: > On one particular server, all *.html files are written in Python. I > uploading a few PHP files to the directory, but they must also have > .html extensions (they are replacing files that _were_ python, but it > is rather important that the filename stay the same and I'd rather > avoid rewrite). I figured that it would be easy enough to add a > separate line in .htaccess for each PHP file, but I'm not getting it > for some reason. This is the .htaccess line that lets the system parse > *.html files as Python: > AddHandler cgi-script .html > > This is what I'm trying to add to have the system parse specific files as PHP: > AddType application/x-httpd-php filename.html > > I know that I am doing something wrong, but I do not know what. Any > ideas? Thanks! > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Serving pages based on user input
On Sun, 2008-08-24 at 13:35 +0100, Ashley Sheridan wrote: > On Sat, 2008-08-23 at 22:17 -0400, Robert Cummings wrote: > > On Sun, 2008-08-24 at 01:32 +0200, Jochem Maas wrote: > > > Ólafur Waage schreef: > > > > You can read about the header function. > > > > > > > > http://is2.php.net/manual/en/function.header.php > > > > > > hi Ólafur, > > > > > > his situation doesn't require a redirect (he only thinks it does), > > > and redirects suck when used unecessarily. (plenty of info on the web > > > about why this is so ... hunt for a 'rant' by the formidable Richard Lynch > > > in the archives of this list for instance) > > > > Oh dear, not this BS again. If the content is different then perform a > > redirect. Do you really want your login page to be indexed as your > > homepage? Lynch's arguments on this were weak. > > > > Cheers, > > Rob. > > -- > > http://www.interjinn.com > > Application and Templating Framework for PHP > > > > > I thought the arguments were very valid, but can be take to the point of > extreme. Keep similar pages grouped into one PHP file. After all, this > is what PHP is for. Don't try to replicate your HTML pages as PHP pages, > thats a silly idea and takes more time to manage. You're confusing using a front page loader with redirection. The distinction being that I would suggest that you redirect to the URL that your front loader would use to load a given page rather than just presenting said page within another page's context to save a redirect. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Restore Leading Zeros in Zip Codes
George Bernard Shaw, an Irishman. tedd wrote: At 11:13 PM +0100 8/22/08, Ashley Sheridan wrote: Not to mention, but of the two major English speaking countries, both America and England have different address standards. All too often an American site seems to think that a postcode is the same thing as a zip code, and then rejects it in a form for being in the wrong format! Yeah, but that's to be expected. You Brits get everything wrong -- you drive on the wrong side of the street, you eat with your fork in the wrong hand, and your postal codes are all messed up. :-) As Churchill once said "We are two peoples separated by a common language." Cheers, tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Serving pages based on user input
tedd schreef: At 9:55 PM -0700 8/23/08, Prasad Chand wrote: This is off-topic, but the reason I was touchy about includes was because it could create seo problems. http://forums.digitalpoint.com/showthread.php?t=31519 any takers on how the above link was found? lol Bttt -- nope -- two different types of "includes". indeed, there is an SEO issue with URLs google et al see as being 'dynamic' i.e. with large numbers of params BUT 1. this is not at all black and white, and really unless your fighting tooth and nail with well clued up SEO pirates for every SERP hit ... your probably not going notice. 2. it's way above the OP's abilities ... good (& Honest[tm]) SEO is hard, well at least if your in a cut-throat market like real-estate (JMHO). 3. the OP was using a form to post a request for a certain bit of content ... I personally have never assumed that a search engine would go through a form, they might do that (occasionally?), but I'd personally make sure I'd have all pages I want indexed linked to via simple links and not hidden behind forms. The link above is discussing having data included the url and not php includes. The advice/code that Jochem gave you was using php includes which is a completely different critter. I use php includes for all my sites and don't have any problem whatsoever with SEO. I think the SEO argument stems from the fact that different content would seem to come from a single URL ... indeed not good for SEO, but that comes down to shit design it's not a fault of php includes. Cheers, tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Serving pages based on user input
Robert Cummings schreef: On Sun, 2008-08-24 at 13:35 +0100, Ashley Sheridan wrote: On Sat, 2008-08-23 at 22:17 -0400, Robert Cummings wrote: On Sun, 2008-08-24 at 01:32 +0200, Jochem Maas wrote: Ólafur Waage schreef: You can read about the header function. http://is2.php.net/manual/en/function.header.php hi Ólafur, his situation doesn't require a redirect (he only thinks it does), and redirects suck when used unecessarily. (plenty of info on the web about why this is so ... hunt for a 'rant' by the formidable Richard Lynch in the archives of this list for instance) Oh dear, not this BS again. If the content is different then perform a redirect. Do you really want your login page to be indexed as your homepage? Lynch's arguments on this were weak. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP I thought the arguments were very valid, but can be take to the point of extreme. Keep similar pages grouped into one PHP file. After all, this is what PHP is for. Don't try to replicate your HTML pages as PHP pages, thats a silly idea and takes more time to manage. You're confusing using a front page loader with redirection. The distinction being that I would suggest that you redirect to the URL that your front loader would use to load a given page rather than just presenting said page within another page's context to save a redirect. you wouldn't have to frakkin' redirect if the links used by said front controller were generated correctly to start with ... it's the whole using a select box to choose a page (unless it's to set window.location to the value of the selected option in the select box) ... that sucks. there is no need to use redirection in this case, it's just f'ing lazy. (to be clear ... I'm lazy now and again ;-) but at least I know it) redirection should be used sparingly, and fudging SE friendly urls back into your own application IS NOT such as case. no idea wtf you meant with the login page reference - way too obtuse an argument for me to follow. Cheers, Rob. yeah mine an ice cold one thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Serving pages based on user input
tedd schreef: At 10:02 PM -0700 8/23/08, Prasad Chand wrote: Thanks for that information. But in my case I need to serve pages based on selection of US states. There are 50 of them, so generating pages dynamically would have been a nice idea. WTF? do you have any idea why we write scripts as opposed to endless copy/pasting of plain (X|(x)HT)ML? and really you don't need to generate 50 pages, merely 50 URLs that end up triggering a single script (which in turn generates output based on the request URL). Really, there are 50 of them!?!? :-) unofficially there are 51, well Tony Blair would like to think so. You don't have to generate 50 pages dynamically to do it -- try this: http://webbytedd.com/bbb/map/ That demo is done with just pure css -- no php nor javascript. > Plus each one of those States can be linked to another page -- AND-- it is user friendly, validates, accessible, and SEO friendly. What more could anyone want? a version of europe actually :-P seriously how much time did you spend hacking that together? and how did your eyes bleed? If you don't know php, then I think the best way to ask a question on this list by telling us what you want to do rather than asking specific php questions trying to do something they way you think it might work. no. the best thing would be to RTFM and STFW for a few years, but hey hell will freeze over first ;-) Cheer, tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Serving pages based on user input
On Sun, 2008-08-24 at 21:53 +0200, Jochem Maas wrote: > Robert Cummings schreef: > > On Sun, 2008-08-24 at 13:35 +0100, Ashley Sheridan wrote: > >> On Sat, 2008-08-23 at 22:17 -0400, Robert Cummings wrote: > >>> On Sun, 2008-08-24 at 01:32 +0200, Jochem Maas wrote: > Ólafur Waage schreef: > > You can read about the header function. > > > > http://is2.php.net/manual/en/function.header.php > hi Ólafur, > > his situation doesn't require a redirect (he only thinks it does), > and redirects suck when used unecessarily. (plenty of info on the web > about why this is so ... hunt for a 'rant' by the formidable Richard > Lynch > in the archives of this list for instance) > >>> Oh dear, not this BS again. If the content is different then perform a > >>> redirect. Do you really want your login page to be indexed as your > >>> homepage? Lynch's arguments on this were weak. > >>> > >>> Cheers, > >>> Rob. > >>> -- > >>> http://www.interjinn.com > >>> Application and Templating Framework for PHP > >>> > >>> > >> I thought the arguments were very valid, but can be take to the point of > >> extreme. Keep similar pages grouped into one PHP file. After all, this > >> is what PHP is for. Don't try to replicate your HTML pages as PHP pages, > >> thats a silly idea and takes more time to manage. > > > > You're confusing using a front page loader with redirection. The > > distinction being that I would suggest that you redirect to the URL that > > your front loader would use to load a given page rather than just > > presenting said page within another page's context to save a redirect. > > you wouldn't have to frakkin' redirect if the links used by said front > controller were generated correctly to start with ... it's the whole using a > select box to choose a page (unless it's to set window.location to the value > of the > selected option in the select box) ... that sucks. > > there is no need to use redirection in this case, it's just f'ing lazy. > (to be clear ... I'm lazy now and again ;-) but at least I know it) > > redirection should be used sparingly, and fudging SE friendly urls back into > your own application IS NOT such as case. > > no idea wtf you meant with the login page reference - way too obtuse an > argument > for me to follow. Obtuse eh... I didn't realize your mind was so simplistic :B It has to do with correctness of the URL/content relationship. If you take the lazy approach and just output alternate content (yes redirection is NOT the lazy approach) then you run the risk that search engines will mismatch the URL with the wrong content and that browser bookmarks will record the wrong relationship. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Restore Leading Zeros in Zip Codes
At 7:47 PM +0100 8/24/08, ioannes wrote: George Bernard Shaw, an Irishman. tedd wrote: As Churchill once said "We are two peoples separated by a common language." And so did Oscar Wilde, Mark Twain, and Patton -- Google it and you'll find that everyone said it. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adding a single php file to .htaccess.
Stut schreef: On 24 Aug 2008, at 16:30, Dotan Cohen wrote: 2008/8/24 Stut <[EMAIL PROTECTED]>: I'm confused. A #! line does not harm the portability of a PHP script in any way whatsoever, and if you use the env version rather than an absolute path then it should work out of the box on 99% of Linux servers and will also work everywhere else because that line will be ignored by the PHP interpreter. In what way do you think it harms the portability of the PHP file itself? Because I have a few other files that do not have the shebang line that I will likely need to put on that server in the future, and I did not want to have to remember to add the shebang line for each one. However, the flaw in my thinking is that I would in any case have to add the line to .htaccess for each file, which means SSHing in instead of FTPing. So the shebang line is in fact best! In any case, I would still like to know what line to add to .htaccess to have it parse a specific file as php. But it is no longer critical for this project because I will use the shebang line. It depends what version of Apache you're using, but it would be a Files section something like this (Apache 2 filter in this example, but untested - I've never needed to do this)... SetOutputFilter PHP SetInputFilter PHP there is also ForceType directive that can be used in a Files directive to achieve pretty much the same thing ... an old trick I've used to force certain .css files through php whilst keeping the extension (which some browsers rely on [nice :-(], regardless of headers that you send to tell the browser it's CSS!!) also FilesMatch can be used with a regexp to match more than one file succintly ... and IIRC Files allows multiple file name arguments in the opening 'tag' Repeat for each file. For other versions of Apache check the installation section of the PHP manual. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Serving pages based on user input
At 10:02 PM +0200 8/24/08, Jochem Maas wrote: tedd schreef: You don't have to generate 50 pages dynamically to do it -- try this: http://webbytedd.com/bbb/map/ That demo is done with just pure css -- no php nor javascript a version of europe actually :-P I saw that after I had done mine. I'm not sure as to how they did theirs, but mine originally was javascript and then I changed it to pure css. seriously how much time did you spend hacking that together? and how did your eyes bleed? It was about two days of work. I spent a lot of my time making the graphics because the roll-overs had to be exact and the "hover" area had to match the graphic. I enjoyed doing it, as I do with all my other little demos. The only things I don't enjoy is when clients say : "Paint my house white" and after I'm done they say "I didn't mean that white. I was leaning toward more of an off-white. Oh well, it's just a minor color change. It shouldn't take you too long to redo, right?" And finally they say "What do you mean you have to repaint the entire house? I'm not paying for you to paint my house twice!" Sometimes I would like to have a client sit down next to me while I instruct him to do what's required to accommodate his minor changes. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie Q: How to say, "if the fileNAME is equal to...", or better yet, "if the fileNAME ends with '.jpg'"?
Hi all :-) It'll be fun to work here with you guys over the coming months. I have been out of the coding loop for 7 years, and I am totally new to PHP, but I should catch up not-too-slowly as I used to code HTML, WebDNA, and a little Visual Basic too. Kindly bear with me. First Q: This code does list the files in my dir just fine: $ThisDir = getcwd()."/thumbs"; $DirHandle = opendir($ThisDir); if ($DirHandle = opendir($ThisDir)) { echo "Directory handle: $DirHandle\n"; echo "Files:"; while ((false !== ($file = readdir($DirHandle))) & 1) { echo "$file"; } closedir($DirHandle); } But two of those entries are apparently named "." and "..". Feel free to enlighten me on that, but, always trying to be self- sufficient, I attempt to workaround by wrapping this line: echo "$file"; with an if statement that I want to only show the file if it ends with the extension ".jpg". I haven't yet found the 'string.ends_with' function in the docs, so I am just seeing if I can (to learn step by step) instead wrap that echo line with an if statement that says "if the name of the file is equal to (.jpg)", like so: $ThisDir = getcwd()."/thumbs"; $DirHandle = opendir($ThisDir); if ($DirHandle = opendir($ThisDir)) { echo "Directory handle: $DirHandle\n"; echo "Files:"; while ((false !== ($file = readdir($DirHandle))) & 1) { if (true == ($file=".jpg")) { echo "$file"; } } closedir($DirHandle); } But instead of printing only the name of the file which is equal to ".jpg", it seems to actually set the value of $file to ".jpg" on each iteration of the while loop, so what I get is a list of files all having the same name (".jpg") and their number is equal to the actual number of files in that dir (plus 2 - for the "." and ".." files). How to say, "if the fileNAME is equal to...", or better yet, "if the fileNAME ends with '.jpg'"? Thanks, -Govinda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie Q: How to say, "if the fileNAME is equal to...", or better yet, "if the fileNAME ends with '.jpg'"?
But two of those entries are apparently named "." and "..". Right. That's linux doing that, not php. If you jump into a ssh connection and do an $ ls -la you will see . and .. at the top. if ($filename == '.' || $filename == '..') { continue; } I haven't yet found the 'string.ends_with' function in the docs, so I am just seeing if I can (to learn step by step) instead wrap that echo line with an if statement that says "if the name of the file is equal to (.jpg)", like so: $ThisDir = getcwd()."/thumbs"; $DirHandle = opendir($ThisDir); if ($DirHandle = opendir($ThisDir)) { echo "Directory handle: $DirHandle\n"; echo "Files:"; while ((false !== ($file = readdir($DirHandle))) & 1) { if (true == ($file=".jpg")) { echo "$file"; } } closedir($DirHandle); } But instead of printing only the name of the file which is equal to ".jpg", it seems to actually set the value of $file to ".jpg" on each iteration of the while loop, so what I get is a list of files all having the same name (".jpg") and their number is equal to the actual number of files in that dir (plus 2 - for the "." and ".." files). Because you have: $file = 'xxx.jpg'; That is an assignment. What you want is a comparison: $file == 'xxx.jpg'; Note the double ='s. http://www.php.net/manual/en/language.operators.php In this case, I'd use the pathinfo function to break up the file/path: http://www.php.net/manual/en/function.pathinfo.php -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie Q: How to say, "if the fileNAME is equal to...", or better yet, "if the fileNAME ends with '.jpg'"?
Govinda schreef: Hi all :-) It'll be fun to work here with you guys over the coming months. fun? work? you must be new :-) I have been out of the coding loop for 7 years, and I am totally new to PHP, but I should catch up not-too-slowly as I used to code HTML, WebDNA, and a little Visual Basic too. Kindly bear with me. little bear or big bear? okay enough jokes (but now you know the list flavor at least) First Q: This code does list the files in my dir just fine: $ThisDir = getcwd()."/thumbs"; $DirHandle = opendir($ThisDir); if ($DirHandle = opendir($ThisDir)) { echo "Directory handle: $DirHandle\n"; echo "Files:"; while ((false !== ($file = readdir($DirHandle))) & 1) { echo "$file"; } closedir($DirHandle); } But two of those entries are apparently named "." and "..". they are quite common in most filesystem :-P Feel free to enlighten me on that, but, always trying to be like John Lennon said ... by heck you gotta save yourself (damn I said I'd stop with the jokes didn't I) self-sufficient, I attempt to workaround by wrapping this line: echo "$file"; with an if statement that I want to only show the file if it ends with the extension ".jpg". I haven't yet found the 'string.ends_with' function in the docs, so I am just seeing if I can (to learn step by step) instead wrap that echo line with an if statement that says "if the name of the file is equal to (.jpg)", like so: $ThisDir = getcwd()."/thumbs"; becareful with getcwd(), look into other methods of determining paths, e.g. dirname(__FILE__). $DirHandle = opendir($ThisDir); if ($DirHandle = opendir($ThisDir)) { echo "Directory handle: $DirHandle\n"; echo "Files:"; save yourself a million slashes: echo 'Files:'; double quotes interpolate variables, single quotes don't. while ((false !== ($file = readdir($DirHandle))) & 1) { if (true == ($file=".jpg")) { echo "$file"; this *could* be written as: echo $file, ''; just a thought. } } closedir($DirHandle); } But instead of printing only the name of the file which is equal to ".jpg", it seems to actually set the value of $file to ".jpg" on use == to test equality, = is to set a variable. each iteration of the while loop, so what I get is a list of files all having the same name (".jpg") and their number is equal to the actual number of files in that dir (plus 2 - for the "." and ".." files). there is is_dir() to check if it's a dir. but that's not what you want here. you could do something hackish like if (stripos(strrev($file), "gpj.") === 0) { echo $file; } note the ===, 3 equals signs here is very important! check the docs for why. or you could go a little more robust with regular expressions if (preg_match("#^.*\.(jpe?g|gif|png)$#i", $file) { echo $file; // any image file is echo'ed } if (preg_match("#^.*\.jpe?g$#i", $file) { echo $file; // any jpeg file is echo'ed } How to say, "if the fileNAME is equal to...", or better yet, "if the fileNAME ends with '.jpg'"? http://php.net/manual/en/ref.strings.php lists all the basic string funcs, have fun with inconsistent argument order in some of those! after 7+ years of php I still get the order wrong for some of them :-) Thanks, -Govinda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help and Advice needed please.
Byron schreef: Yep, a mysql database seems like the way to go. Thanks to all who have offered to help on this project. Perhaps we could get together and figure out what needs doing, assign jobs etc. I have hosting already sorted. Cheers guys. great, take it offlist please. this is not a forum to discuss your new pet project. any specific coding problems you encouter are welcome ... even paramilitary ones ;-) On Sun, Aug 24, 2008 at 5:05 AM, sean greenslade <[EMAIL PROTECTED]>wrote: So Byron, what do you think? Do you like the idea of a mysql database? On Sat, Aug 23, 2008 at 11:57 AM, Luke <[EMAIL PROTECTED]> wrote: I'm up for helping too. Also, a big agree to Sean too, MySQL seems the best way to go here. 2008/8/23 sean greenslade <[EMAIL PROTECTED]> I would be willing to help with this project. Because of all the different requirements of this, I would recommend a totally custom set of scripts, and a mysql database to hold all the data. On Sat, Aug 23, 2008 at 7:22 AM, Byron <[EMAIL PROTECTED]> wrote: Hey. I do some part-time IT work for a voluntary paramilitary youth organisation, and we're loooking for a system to digitize the personell files of our members. Here's a features list, all advice on how to implement will be a great help. * Web-accesable via login * Rank, Name, Phone Number, Address, Email Address, Physical Address. * Training History * Promotion History * Miscellanous Notes. * Different types of Administrator and notes that can be attached to personell files that are seen by different types of administrator. * Activity report page. I.e. This activity happenened on this date and these people attended from this time to this time. Attendance must be visible on personell files. * Attendance Register and counter for attendances of members. * UI that a 65-year old who believes dialup is fast (the Unit Commander) can find his way around. * Easily copiable and deployable. As in can be used by more than one unit. -- I'm going out to find myself, if you see me here, keep me here untill I can catch up If I haven't said so already, Thanks Byron -- Feh. -- Luke Slater -- Feh. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quick question regarding getcwd() and directory location.
Micah Gersten schreef: What is the point of figuring that out? If we knew that, we might be able to help you with a solution. As it stands what you want is not possible AFAIK. you know wrong. he has all the info needed. 1. the document root of the site (/var/www/example.com) 2. the requested URL (http://www.example.com/foo/bar) extract the path from the URL and stick into to the document root, problem sorted. No? do this: var_dump($_SERVER, $_REQUEST); read the output it contains, it should have everything you need although you will have to do some munging. for more esoteric setups you will have to test the code for completeness and possible expand it's capability to be able to tackle those situations. take it a step at a time. me thinks I made it sound more complicated than it is for most scenarios ... reading your last post it seems the answer is (for now) quite straight forward. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Ólafur Waage wrote: I am within a certain directory of the server via the browser. Example: http://www.example.com/foo/bar would be /var/www/example.com/foo/bar And Apache's DirectoryIndex feature is opening a index.php file that is located at /var/www/example.com/test/index.php And from that file i need to figure out the full local path of /foo/bar (which would be /var/www/example.com/foo/bar ) or any other directory i browse too. Ólafur Waage -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] stream_select
Damien Churchill schreef: Is there a known issue with using stream_select with apache2 mod_php? I have a script (http://php.pastebin.com/m601965d) that when run with mod_php doesn't work, but when run with php-cgi from the command line works fine. define "doesn't work". what exact php & apache version? are you using shared hosting thats blocking all sorts of stuff form being done via the apache process? have you checked bugs.php.net for anything resembling your problem? you seem to be trying to connect to an imap server, have you tried the imap_*() functions as an alternative? http://php.net/imap Thanks in advance, Damien -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forward slashes and header requests
Dave M G schreef: Ashley, Thank you for responding. best way to fix it was to use $location = str_replace('//','/', $_SERVER['REQUEST_URI']); Unfortunately the trim() command I use seems to destroy all slashes anyway, so this doesn't seem to have an impact. Thank you for the suggestion, though. Anyone have any other ideas? if (empty($userRequest)) $userRequest = '/'; header("Location: http://{$serverName}{$userRequest}";); exit; note that redirects according to spec must contain an absolute URI (i.e. including the protocol and domain) ...although with works nicely in every modern browser. PS - can't believe I just wrote that given the rant about redirect I just let loose on the world. oh well, it is a CMS ... different rules apply ... or I'm just inconsistent or ... well Cumming no doubt has something to say about it ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forward slashes and header requests
Jochem Maas schreef: ... apply ... or I'm just inconsistent or ... well Cumming no doubt has something to say about it ;-) that should have been Cummings as in Robbert. don't you just hate it when you see a typo after you hit send and before the email leaves the screen :-P -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php not reading file properly
sean greenslade schreef: I have this snippet of code that is supposed to read the apache access log and display it: For some reason, it displays the logs when I run the php file thru terminal: php -f /web/apache.php but not when I access it thru the web. when I browse to it, it just displays the static text ("This weeks apache log (clears every sunday morning):"), not the log text. you fixed the problem, but I have to ask: why on earth you want to do this? Very confused, zootboy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie Q: How to say, "if the fileNAME is equal to...", or better yet, "if the fileNAME ends with '.jpg'"?
Should I send replies to just the list?, or is the etiquette to reply- to-all? fun? work? you must be new :-) new to PHP; could get boring after a long time with it, sure... but I have that 'coder's bug'... i.e. once fluent, then creatively solving problems is fun! okay enough jokes (but now you know the list flavor at least) Thank God! ..for lightness/humor. :-P ..esp. in these otherwise dry circles of coding! becareful with getcwd(), look into other methods of determining paths, e.g. dirname(__FILE__). The page I am making needs to work in any old PHP-enabled dir we stick it in. (It's only for internal html generation, for now.) double quotes interpolate variables, single quotes don't. this *could* be written as: echo $file, ''; use == to test equality, = is to set a variable. all your time and precision will always be appreciated! if (stripos(strrev($file), "gpj.") === 0) { echo $file; } note the ===, 3 equals signs here is very important! check the docs for why. == means 'equals', and === means 'is identical to'. Seems like they would do the same thing when comparing '0' to 'the position in the string where that substr is found'. Why not? or you could go a little more robust with regular expressions if (preg_match("#^.*\.(jpe?g|gif|png)$#i", $file) { echo $file; // any image file is echo'ed } ahhh reg expressions. So looking forward to when I can see PHP properly/clearly enough to throw them in too! (meanwhile I better get the basics first ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] WHERE is syntax doc'ed for saying: if (expr1 *OR* expr2 *AND* expr3)
I swear I am RTFM, but it's an art in itself (at first anyway)/ WHERE is the syntax doc'ed for saying: if (expr1 *OR* expr2 *AND* expr3) { ? I got *AND* to work with "&", but "|" does not seem to work for *OR* -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie Q: How to say, "if the fileNAME is equal to...", or better yet, "if the fileNAME ends with '.jpg'"?
if (stripos(strrev($file), "gpj.") === 0) { echo $file; } note the ===, 3 equals signs here is very important! check the docs for why. == means 'equals', and === means 'is identical to'. Seems like they would do the same thing when comparing '0' to 'the position in the string where that substr is found'. Why not? 0 can mean false in php: $found = 0; if (!$found) { echo "File not found"; } If a substr comparison matches at char 0: $string = '12345'; $pos = substr($string, '1'); then without the '===' it would give the wrong result as $pos would be converted to false in this example. -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] WHERE is syntax doc'ed for saying: if (expr1 *OR* expr2 *AND* expr3)
Govinda wrote: I swear I am RTFM, but it's an art in itself (at first anyway)/ WHERE is the syntax doc'ed for saying: if (expr1 *OR* expr2 *AND* expr3) { ? I got *AND* to work with "&", but "|" does not seem to work for *OR* Actually & is a bitwise operator in php, not what you want. You want && http://www.php.net/manual/en/language.operators.logical.php -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php not reading file properly
Well, if you really want to know, I have to go to many places that do not have internet access. For those places, I have a PDA. I have Avantgo software on the PDA, and I wanted it to be able to store a copy of the log file to review it when I do not have internet access. All I needed was a webpage to access it, and the Avantgo software automatically downloads a copy of it before I leave. On Sun, Aug 24, 2008 at 7:42 PM, Jochem Maas <[EMAIL PROTECTED]> wrote: > sean greenslade schreef: > > I have this snippet of code that is supposed to read the apache access log >> and display it: >> >$myFile = "/var/log/httpd/access_log"; >>$fh = fopen($myFile, 'r'); >>$theData = fread($fh, filesize($myFile)); >>fclose($fh); >>echo >>"This weeks apache log (clears every sunday morning):". >>substr($theData,0,2000); >> ?> >> For some reason, it displays the logs when I run the php file thru >> terminal: >> php -f /web/apache.php >> >> but not when I access it thru the web. when I browse to it, it just >> displays >> the static text ("This weeks apache log (clears every sunday morning):"), >> not the log text. >> > > you fixed the problem, but I have to ask: > > why on earth you want to do this? > > >> Very confused, >> zootboy >> >> > -- Feh.
Re: [PHP] WHERE is syntax doc'ed for saying: if (expr1 *OR* expr2 *AND* expr3)
I had been to that page, tried this: if (stripos(strrev($file), "gpj.") === 0) || (stripos(strrev($file), "fig.") === 0) || (stripos(strrev($file), "gnp.") === 0) { (yes, Jochem, the regExp solution is best, but I am practicing things ;-) and got Parse error: syntax error, unexpected T_BOOLEAN_OR in... You want && http://www.php.net/manual/en/language.operators.logical.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] WHERE is syntax doc'ed for saying: if (expr1 *OR* expr2 *AND* expr3)
if (stripos(strrev($file), "gpj.") === 0) || (stripos(strrev($file), "fig.") === 0) || (stripos(strrev($file), "gnp.") === 0) { You have too many parenthesis: if (stripos(strrev($file), "gpj.") === 0) <-- this ends the if statement; the next || is unexpected. Also, at the end, you're missing a parentheses at the end: (stripos(strrev($file), "gnp.") === 0) should be(stripos(strrev($file), "gnp.") === 0)) -- GREG
[PHP] int(1) and int(11)
Hi all, Is there any difference between int(1) and int(11) when creating a table? I checked the mysql manual and got that 1 and 11 are used to specify the display width of an column. Is there any other difference? Any ideas appreciated. Thx. -- With best regards, Shelley Shyan http://phparch.cn
Re: [PHP] RE: Sale 79% OFF !!!
I hate to admit to this, but some 15 years ago I was consulting for a company doing oil exploration in Nigeria and I received a very elaborate and believable Nigerian scam. It was complete with signed and official documents from both the Nigerian Government and the Bank of Nigeria. I passed the proposal through two attorneys and the decision was to participate. Of course nothing happened and we did not lose anything. But the first Nigerian scams were very believable. Heck! Always wanted to "meet" someone who feel for the Nigerian scams, would never have thought you would be the one Tedd! Can you give me mroe details of the scam? Is it like the ones we get via email everyday or different? Cheers! Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DB] int(1) and int(11)
Shelley wrote: Hi all, Is there any difference between int(1) and int(11) when creating a table? I checked the mysql manual and got that 1 and 11 are used to specify the display width of an column. Is there any other difference? Straight from the manual: The display width does not constrain the range of values that can be stored in the column, nor the number of digits that are displayed for values having a width exceeding that specified for the column. For example, a column specified as SMALLINT(3) has the usual SMALLINT range of -32768 to 32767, and values outside the range allowed by three characters are displayed using more than three characters. As the manual says also, be careful using different sizes with zerofill. http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] concatenating with "." or ","
easy to find our about concatenating with "." in the docs... but not so with "," what is the difference? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP editor for linux
Hi, I use gPHPEdit and bluefish, it makes PHP easy. -- Swapnil Jain -- E-mail: [EMAIL PROTECTED] MSN : [EMAIL PROTECTED] GTalk : [EMAIL PROTECTED] Skype : sj1410 YIM : sj1410 Shawn McKenzie wrote: It flance wrote: Hi, What do you think is the best php editor for linux. I'm using the Debian distribution. Thanks I use Aptana which is based on eclipse and has built-in HTML/JS/PHP?SVN stuff. Also a cool plugin that lets you easily develop for the iPhone and preview it. -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP editor for linux
Check the result at http://phparch.cn. And you are encouraged to make your choice. 2008/8/19 Pavel <[EMAIL PROTECTED]> > I use Zend Studio (shareware, but i couldn't find better things). There are > some plugins for Eclipse,but if you used Zend before, you will be cunfused > by > that plugins... > > P.S. Sorry for my English... > > > -- > === > С уважением, Манылов Павел aka [R-k] > icq: 949-388-0 > mailto:[EMAIL PROTECTED] > === > А ещё говорят так: > В каждом толстом человеке сидит худой и требует, чтобы его выпустили. >-- Сирил Коннолли > [fortune] > -- With best regards, Shelley Shyan http://phparch.cn