Re: [PHP] question about forum
This is my suggestion Start with making your user management...setup design and layout management, then do the browsing, then your viewing, then different catagories, then do other little bits... - Original Message - From: Jason Wang [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, July 23, 2001 5:05 PM Subject: [PHP] question about forum Dear all, I want to set up an online forum by using PHP. But I don't have a clue. Could somebody kind enough tell me where to start? thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] question about forum
have a look at other people's codes. you can start by looking at my forum, which is pretty simple to install and work with : http://www.wde.org/me/php/ /sunny -Original Message- From: Jason Wang [mailto:[EMAIL PROTECTED]] Sent: 23 July 2001 08:06 To: [EMAIL PROTECTED] Subject: [PHP] question about forum Dear all, I want to set up an online forum by using PHP. But I don't have a clue. Could somebody kind enough tell me where to start? thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Question about hosting
Hello everyone- I need some expert advice so I turn you to all! :) I'm am currently in the process of making 7 web sites using PHP and MySQL backend. I'm porjecting that all of these sites combined will get a million plus hits a month easy when it's all said and done. What I'm wanting to do is to put the database on it's own machine and put the sites on a different machine to reduce the cpu load. However, I'm not 100% sure this is the best option. I know there are a ton of variables to consider with this situation and I'm trying to figure out the best way to go so I don't have to redo it again. I'm thinking with the traffic these servers are going to incur if they are on one computer then I should probably have a dual CPU with a gig of ram or more and two hard drives.. Once CPU for serving up the pages and once CPU to run the db. Also, one HD for the db and one HD for the pages in trying to get the most performace out of one machine. Some of the dedicated options that people have thrown to me are in the range of a 450 CPU with 512 Ram and 30GB drive. I don't think that with so many pages being served that this system will handle it. Any suggestions? Thanks, jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Question about hosting
Well for myself I will better like to have the 2 computer design, 1 for httpd and 1 for mysql, it's alway's better that way the few nano that you lose in transit are way better then a server that do both stuff. Now the problem (that eat a lot of time is php and mysql, doh!). So you have optimise that, is mysql will be mostly for read or write data what kind of %, if you need more read or more accurate read then write I suggest you to have a lot of heap table (in memory table, put them read only and get them to regenerate at every x times), copy of the mainly used data in your application, with a lot of ram that will speed-up the main thing. Then an other thing is to take big table and put them in smaller table, way faster for writing/reading (hum, I don't quite remember if mysql is row locking or table locking during write?). Then they other best stuff is to make your dynamic page (.php) and to make them static page (.html) this way you will get way faster viewing page, you don't have they overload of neither php, nor mysql processing. khttpd anyone? Anyway, you could do a lot of stuff, load-balacing, an other server for just your image, ... If you want more, you should go at http://www.slashdot.org/ and do a little search on that subjectthey had a few good article on that on the last few month, year,... Jay Paulson wrote: Hello everyone- I need some expert advice so I turn you to all! :) I'm am currently in the process of making 7 web sites using PHP and MySQL backend. I'm porjecting that all of these sites combined will get a million plus hits a month easy when it's all said and done. What I'm wanting to do is to put the database on it's own machine and put the sites on a different machine to reduce the cpu load. However, I'm not 100% sure this is the best option. I know there are a ton of variables to consider with this situation and I'm trying to figure out the best way to go so I don't have to redo it again. I'm thinking with the traffic these servers are going to incur if they are on one computer then I should probably have a dual CPU with a gig of ram or more and two hard drives.. Once CPU for serving up the pages and once CPU to run the db. Also, one HD for the db and one HD for the pages in trying to get the most performace out of one machine. Some of the dedicated options that people have thrown to me are in the range of a 450 CPU with 512 Ram and 30GB drive. I don't think that with so many pages being served that this system will handle it. Any suggestions? Thanks, jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Francis Fillion, BAA SI Broadcasting live from his linux box. And the maintainer of http://www.windplanet.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Question about hosting
So sprach »Francis Fillion« am 2001-07-18 18.07.2001 um 17:55:41 -0400 : thing. Then an other thing is to take big table and put them in smaller table, way faster for writing/reading (hum, I don't quite remember if Good idea. Combined with MERGE tables, this might really boost performance when reading. Just let the table grow to, let's say, 500k rows and then create a new table. Alexander Skwar -- How to quote: http://learn.to/quote (german) http://quote.6x.to (english) Homepage: http://www.digitalprojects.com | http://www.iso-top.de iso-top.de - Die günstige Art an Linux Distributionen zu kommen Uptime: 1 hour 1 minute -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Question about strlen I think
Hello, On my site users can submit ftp's. Is there a way to replace the spaces between the paths? This is what I mean: /uploads//by/ /dennis/ must become /uploads/4sp/by/3spdennis/ Thnx, Dennis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Question about how to do this...
hey- so I want to have my site so that the urls are like /index.php?page=bio the way I made the index.php so far is just one gigantic switch statement...is there a better way to do it? chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Question about how to do this...
Use a database. With mysql, you can store the text into a table with primary key called 'page' or something like that, and a text field of some sort. Then, do mysql_query(SELECT pagetext FROM website WHERE page=$page;); = Dive into it. It's easier than it looks. Ben -Original Message- From: Chris Cocuzzo [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 08, 2001 1:44 PM To: PHP General List (E-mail) Subject: [PHP] Question about how to do this... hey- so I want to have my site so that the urls are like /index.php?page=bio the way I made the index.php so far is just one gigantic switch statement...is there a better way to do it? chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Question about how to do this...
what if I'm storing HTML into the database, or even PHP code itself for that matter, is this method that you mentioned still better than the switch statement method? chris -Original Message- From: Ben Bleything [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 08, 2001 4:59 PM To: [EMAIL PROTECTED]; 'PHP General List (E-mail)' Subject: RE: [PHP] Question about how to do this... Use a database. With mysql, you can store the text into a table with primary key called 'page' or something like that, and a text field of some sort. Then, do mysql_query(SELECT pagetext FROM website WHERE page=$page;); = Dive into it. It's easier than it looks. Ben -Original Message- From: Chris Cocuzzo [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 08, 2001 1:44 PM To: PHP General List (E-mail) Subject: [PHP] Question about how to do this... hey- so I want to have my site so that the urls are like /index.php?page=bio the way I made the index.php so far is just one gigantic switch statement...is there a better way to do it? chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Question about how to do this...
This is probably not a good idea if the data is mostly static. There's no real reason to use the power of a db engine for something this trivial, and static serving will be faster than a DB system. Mark C. - Original Message - From: Ben Bleything [EMAIL PROTECTED] To: [EMAIL PROTECTED]; 'PHP General List (E-mail)' [EMAIL PROTECTED] Sent: Sunday, July 08, 2001 3:59 PM Subject: RE: [PHP] Question about how to do this... Use a database. With mysql, you can store the text into a table with primary key called 'page' or something like that, and a text field of some sort. Then, do mysql_query(SELECT pagetext FROM website WHERE page=$page;); = Dive into it. It's easier than it looks. Ben -Original Message- From: Chris Cocuzzo [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 08, 2001 1:44 PM To: PHP General List (E-mail) Subject: [PHP] Question about how to do this... hey- so I want to have my site so that the urls are like /index.php?page=bio the way I made the index.php so far is just one gigantic switch statement...is there a better way to do it? chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Question about how to do this...
This is a very good valid point that I completely failed to consider = Chris, to answer your last question, yes, it _would_ work, but as Mark points out, it's probably not a very good idea. Still cool, but hey, you can tell I don't work in a production environment = The other method I sent will reduce the size (and maintenance cost) of your index.php page, while being fast (as Mark says). Ben -Original Message- From: Mark Charette [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 08, 2001 2:05 PM To: Ben Bleything; [EMAIL PROTECTED]; 'PHP General List (E-mail)' Subject: Re: [PHP] Question about how to do this... This is probably not a good idea if the data is mostly static. There's no real reason to use the power of a db engine for something this trivial, and static serving will be faster than a DB system. Mark C. - Original Message - From: Ben Bleything [EMAIL PROTECTED] To: [EMAIL PROTECTED]; 'PHP General List (E-mail)' [EMAIL PROTECTED] Sent: Sunday, July 08, 2001 3:59 PM Subject: RE: [PHP] Question about how to do this... Use a database. With mysql, you can store the text into a table with primary key called 'page' or something like that, and a text field of some sort. Then, do mysql_query(SELECT pagetext FROM website WHERE page=$page;); = Dive into it. It's easier than it looks. Ben -Original Message- From: Chris Cocuzzo [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 08, 2001 1:44 PM To: PHP General List (E-mail) Subject: [PHP] Question about how to do this... hey- so I want to have my site so that the urls are like /index.php?page=bio the way I made the index.php so far is just one gigantic switch statement...is there a better way to do it? chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Question about how to do this...
so the switch statement idea works I guess. sounds good. -Original Message- From: Mark Charette [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 08, 2001 5:05 PM To: Ben Bleything; [EMAIL PROTECTED]; 'PHP General List (E-mail)' Subject: Re: [PHP] Question about how to do this... This is probably not a good idea if the data is mostly static. There's no real reason to use the power of a db engine for something this trivial, and static serving will be faster than a DB system. Mark C. - Original Message - From: Ben Bleything [EMAIL PROTECTED] To: [EMAIL PROTECTED]; 'PHP General List (E-mail)' [EMAIL PROTECTED] Sent: Sunday, July 08, 2001 3:59 PM Subject: RE: [PHP] Question about how to do this... Use a database. With mysql, you can store the text into a table with primary key called 'page' or something like that, and a text field of some sort. Then, do mysql_query(SELECT pagetext FROM website WHERE page=$page;); = Dive into it. It's easier than it looks. Ben -Original Message- From: Chris Cocuzzo [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 08, 2001 1:44 PM To: PHP General List (E-mail) Subject: [PHP] Question about how to do this... hey- so I want to have my site so that the urls are like /index.php?page=bio the way I made the index.php so far is just one gigantic switch statement...is there a better way to do it? chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Question about how to do this...
Yup = Try splitting the pages out into separate files. I'm betting you'll find it easier to work with. Ben -Original Message- From: Chris Cocuzzo [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 08, 2001 2:02 PM To: PHP General List (E-mail) Subject: RE: [PHP] Question about how to do this... so the switch statement idea works I guess. sounds good. -Original Message- From: Mark Charette [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 08, 2001 5:05 PM To: Ben Bleything; [EMAIL PROTECTED]; 'PHP General List (E-mail)' Subject: Re: [PHP] Question about how to do this... This is probably not a good idea if the data is mostly static. There's no real reason to use the power of a db engine for something this trivial, and static serving will be faster than a DB system. Mark C. - Original Message - From: Ben Bleything [EMAIL PROTECTED] To: [EMAIL PROTECTED]; 'PHP General List (E-mail)' [EMAIL PROTECTED] Sent: Sunday, July 08, 2001 3:59 PM Subject: RE: [PHP] Question about how to do this... Use a database. With mysql, you can store the text into a table with primary key called 'page' or something like that, and a text field of some sort. Then, do mysql_query(SELECT pagetext FROM website WHERE page=$page;); = Dive into it. It's easier than it looks. Ben -Original Message- From: Chris Cocuzzo [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 08, 2001 1:44 PM To: PHP General List (E-mail) Subject: [PHP] Question about how to do this... hey- so I want to have my site so that the urls are like /index.php?page=bio the way I made the index.php so far is just one gigantic switch statement...is there a better way to do it? chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Question about how to do this...
Or even better, create a system where you can create new pages without adding to the switch statement: ? $page = /home/full/path/to/site/page_includes/.str_replace(.., , $page); if (file_exists($page)) require($page); ? Note that you _need_ to have the full path, else you're creating a security issue. /* Chris Lambert, CTO - [EMAIL PROTECTED] WhiteCrown Networks - More Than White Hats Web Application Security - www.whitecrown.net */ - Original Message - From: Ben Bleything [EMAIL PROTECTED] To: [EMAIL PROTECTED]; 'PHP General List (E-mail)' [EMAIL PROTECTED] Sent: Sunday, July 08, 2001 5:17 PM Subject: RE: [PHP] Question about how to do this... | Yup = Try splitting the pages out into separate files. I'm betting | you'll find it easier to work with. | | Ben | | | -Original Message- | From: Chris Cocuzzo [mailto:[EMAIL PROTECTED]] | Sent: Sunday, July 08, 2001 2:02 PM | To: PHP General List (E-mail) | Subject: RE: [PHP] Question about how to do this... | | so the switch statement idea works I guess. sounds good. | | -Original Message- | From: Mark Charette [mailto:[EMAIL PROTECTED]] | Sent: Sunday, July 08, 2001 5:05 PM | To: Ben Bleything; [EMAIL PROTECTED]; 'PHP General List (E-mail)' | Subject: Re: [PHP] Question about how to do this... | | | This is probably not a good idea if the data is mostly static. There's | no | real reason to use the power of a db engine for something this trivial, | and | static serving will be faster than a DB system. | | Mark C. | | - Original Message - | From: Ben Bleything [EMAIL PROTECTED] | To: [EMAIL PROTECTED]; 'PHP General List (E-mail)' | [EMAIL PROTECTED] | Sent: Sunday, July 08, 2001 3:59 PM | Subject: RE: [PHP] Question about how to do this... | | | Use a database. With mysql, you can store the text into a table with | primary key called 'page' or something like that, and a text field of | some sort. | | Then, do mysql_query(SELECT pagetext FROM website WHERE | page=$page;); | | = | | Dive into it. It's easier than it looks. | | Ben | | -Original Message- | From: Chris Cocuzzo [mailto:[EMAIL PROTECTED]] | Sent: Sunday, July 08, 2001 1:44 PM | To: PHP General List (E-mail) | Subject: [PHP] Question about how to do this... | | hey- | | so I want to have my site so that the urls are like | /index.php?page=bio | | the way I made the index.php so far is just one gigantic switch | statement...is there a better way to do it? | | | chris | | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: [EMAIL PROTECTED] | For additional commands, e-mail: [EMAIL PROTECTED] | To contact the list administrators, e-mail: | [EMAIL PROTECTED] | | | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: [EMAIL PROTECTED] | For additional commands, e-mail: [EMAIL PROTECTED] | To contact the list administrators, e-mail: | [EMAIL PROTECTED] | | | | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: [EMAIL PROTECTED] | For additional commands, e-mail: [EMAIL PROTECTED] | To contact the list administrators, e-mail: [EMAIL PROTECTED] | | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: [EMAIL PROTECTED] | For additional commands, e-mail: [EMAIL PROTECTED] | To contact the list administrators, e-mail: [EMAIL PROTECTED] | | | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: [EMAIL PROTECTED] | For additional commands, e-mail: [EMAIL PROTECTED] | To contact the list administrators, e-mail: [EMAIL PROTECTED] | | | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Question about how to do this...
ok so if I use this method below, or a hash table, etcand it has an include/require statement...in those files to be included...do I need to start it off with the ?phpor can I just write all the code and it'll be set? chris -Original Message- From: Chris Lambert - WhiteCrown Networks [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 08, 2001 5:28 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Question about how to do this... Or even better, create a system where you can create new pages without adding to the switch statement: ? $page = /home/full/path/to/site/page_includes/.str_replace(.., , $page); if (file_exists($page)) require($page); ? Note that you _need_ to have the full path, else you're creating a security issue. /* Chris Lambert, CTO - [EMAIL PROTECTED] WhiteCrown Networks - More Than White Hats Web Application Security - www.whitecrown.net */ - Original Message - From: Ben Bleything [EMAIL PROTECTED] To: [EMAIL PROTECTED]; 'PHP General List (E-mail)' [EMAIL PROTECTED] Sent: Sunday, July 08, 2001 5:17 PM Subject: RE: [PHP] Question about how to do this... | Yup = Try splitting the pages out into separate files. I'm betting | you'll find it easier to work with. | | Ben | | | -Original Message- | From: Chris Cocuzzo [mailto:[EMAIL PROTECTED]] | Sent: Sunday, July 08, 2001 2:02 PM | To: PHP General List (E-mail) | Subject: RE: [PHP] Question about how to do this... | | so the switch statement idea works I guess. sounds good. | | -Original Message- | From: Mark Charette [mailto:[EMAIL PROTECTED]] | Sent: Sunday, July 08, 2001 5:05 PM | To: Ben Bleything; [EMAIL PROTECTED]; 'PHP General List (E-mail)' | Subject: Re: [PHP] Question about how to do this... | | | This is probably not a good idea if the data is mostly static. There's | no | real reason to use the power of a db engine for something this trivial, | and | static serving will be faster than a DB system. | | Mark C. | | - Original Message - | From: Ben Bleything [EMAIL PROTECTED] | To: [EMAIL PROTECTED]; 'PHP General List (E-mail)' | [EMAIL PROTECTED] | Sent: Sunday, July 08, 2001 3:59 PM | Subject: RE: [PHP] Question about how to do this... | | | Use a database. With mysql, you can store the text into a table with | primary key called 'page' or something like that, and a text field of | some sort. | | Then, do mysql_query(SELECT pagetext FROM website WHERE | page=$page;); | | = | | Dive into it. It's easier than it looks. | | Ben | | -Original Message- | From: Chris Cocuzzo [mailto:[EMAIL PROTECTED]] | Sent: Sunday, July 08, 2001 1:44 PM | To: PHP General List (E-mail) | Subject: [PHP] Question about how to do this... | | hey- | | so I want to have my site so that the urls are like | /index.php?page=bio | | the way I made the index.php so far is just one gigantic switch | statement...is there a better way to do it? | | | chris | | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: [EMAIL PROTECTED] | For additional commands, e-mail: [EMAIL PROTECTED] | To contact the list administrators, e-mail: | [EMAIL PROTECTED] | | | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: [EMAIL PROTECTED] | For additional commands, e-mail: [EMAIL PROTECTED] | To contact the list administrators, e-mail: | [EMAIL PROTECTED] | | | | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: [EMAIL PROTECTED] | For additional commands, e-mail: [EMAIL PROTECTED] | To contact the list administrators, e-mail: [EMAIL PROTECTED] | | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: [EMAIL PROTECTED] | For additional commands, e-mail: [EMAIL PROTECTED] | To contact the list administrators, e-mail: [EMAIL PROTECTED] | | | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: [EMAIL PROTECTED] | For additional commands, e-mail: [EMAIL PROTECTED] | To contact the list administrators, e-mail: [EMAIL PROTECTED] | | | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Question about how to do this...
I believe (and I'm sure someone will correct me if I'm wrong) that whenever you 'include' or 'require' a file, it drops to regular HTML mode... so, yes, you will need to use ?php tags at the beginning and ? tags at the ends = Hope that helps = Ben -Original Message- From: Chris Cocuzzo [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 08, 2001 9:25 PM To: PHP General List (E-mail) Subject: RE: [PHP] Question about how to do this... ok so if I use this method below, or a hash table, etcand it has an include/require statement...in those files to be included...do I need to start it off with the ?phpor can I just write all the code and it'll be set? chris -Original Message- From: Chris Lambert - WhiteCrown Networks [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 08, 2001 5:28 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Question about how to do this... Or even better, create a system where you can create new pages without adding to the switch statement: ? $page = /home/full/path/to/site/page_includes/.str_replace(.., , $page); if (file_exists($page)) require($page); ? Note that you _need_ to have the full path, else you're creating a security issue. /* Chris Lambert, CTO - [EMAIL PROTECTED] WhiteCrown Networks - More Than White Hats Web Application Security - www.whitecrown.net */ - Original Message - From: Ben Bleything [EMAIL PROTECTED] To: [EMAIL PROTECTED]; 'PHP General List (E-mail)' [EMAIL PROTECTED] Sent: Sunday, July 08, 2001 5:17 PM Subject: RE: [PHP] Question about how to do this... | Yup = Try splitting the pages out into separate files. I'm betting | you'll find it easier to work with. | | Ben | | | -Original Message- | From: Chris Cocuzzo [mailto:[EMAIL PROTECTED]] | Sent: Sunday, July 08, 2001 2:02 PM | To: PHP General List (E-mail) | Subject: RE: [PHP] Question about how to do this... | | so the switch statement idea works I guess. sounds good. | | -Original Message- | From: Mark Charette [mailto:[EMAIL PROTECTED]] | Sent: Sunday, July 08, 2001 5:05 PM | To: Ben Bleything; [EMAIL PROTECTED]; 'PHP General List (E-mail)' | Subject: Re: [PHP] Question about how to do this... | | | This is probably not a good idea if the data is mostly static. There's | no | real reason to use the power of a db engine for something this trivial, | and | static serving will be faster than a DB system. | | Mark C. | | - Original Message - | From: Ben Bleything [EMAIL PROTECTED] | To: [EMAIL PROTECTED]; 'PHP General List (E-mail)' | [EMAIL PROTECTED] | Sent: Sunday, July 08, 2001 3:59 PM | Subject: RE: [PHP] Question about how to do this... | | | Use a database. With mysql, you can store the text into a table with | primary key called 'page' or something like that, and a text field of | some sort. | | Then, do mysql_query(SELECT pagetext FROM website WHERE | page=$page;); | | = | | Dive into it. It's easier than it looks. | | Ben | | -Original Message- | From: Chris Cocuzzo [mailto:[EMAIL PROTECTED]] | Sent: Sunday, July 08, 2001 1:44 PM | To: PHP General List (E-mail) | Subject: [PHP] Question about how to do this... | | hey- | | so I want to have my site so that the urls are like | /index.php?page=bio | | the way I made the index.php so far is just one gigantic switch | statement...is there a better way to do it? | | | chris | | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: [EMAIL PROTECTED] | For additional commands, e-mail: [EMAIL PROTECTED] | To contact the list administrators, e-mail: | [EMAIL PROTECTED] | | | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: [EMAIL PROTECTED] | For additional commands, e-mail: [EMAIL PROTECTED] | To contact the list administrators, e-mail: | [EMAIL PROTECTED] | | | | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: [EMAIL PROTECTED] | For additional commands, e-mail: [EMAIL PROTECTED] | To contact the list administrators, e-mail: [EMAIL PROTECTED] | | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: [EMAIL PROTECTED] | For additional commands, e-mail: [EMAIL PROTECTED] | To contact the list administrators, e-mail: [EMAIL PROTECTED] | | | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: [EMAIL PROTECTED] | For additional commands, e-mail: [EMAIL PROTECTED] | To contact the list administrators, e-mail: [EMAIL PROTECTED] | | | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net
Re: [PHP] Question about how to do this...
Ben Bleything [EMAIL PROTECTED] wrote: I believe (and I'm sure someone will correct me if I'm wrong) that whenever you 'include' or 'require' a file, it drops to regular HTML mode... so, yes, you will need to use ?php tags at the beginning and ? tags at the ends = Think of the behavior of include() as copying the exact text from your code in the include'd file and pasting it as is into the calling code...a la paper and scissors. There is no special transformation. So if the code in the include'd file would have needed PHP codes if it was directly within the calling code then it needs it in the include'd file too and if it wouldn't have in the calling code then it won't in the include'd file. -- Steve Werby President, Befriend Internet Services LLC http://www.befriend.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Question about how to do this...
on 7/8/01 10:58 PM, Steve Werby at [EMAIL PROTECTED] wrote: Ben Bleything [EMAIL PROTECTED] wrote: I believe (and I'm sure someone will correct me if I'm wrong) that whenever you 'include' or 'require' a file, it drops to regular HTML mode... so, yes, you will need to use ?php tags at the beginning and ? tags at the ends = Think of the behavior of include() as copying the exact text from your code in the include'd file and pasting it as is into the calling code...a la paper and scissors. There is no special transformation. So if the code in the include'd file would have needed PHP codes if it was directly within the calling code then it needs it in the include'd file too and if it wouldn't have in the calling code then it won't in the include'd file. from http://php.net/include An important note about how this works is that when a file is include()ed or require()ed, parsing drops out of PHP mode and into HTML mode at the beginning of the target file, and resumes again at the end. For this reason, any code inside the target file which should be executed as PHP code must be enclosed within valid PHP start and end tags. -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Question about how to do this...
Thanks, I was looking for that = Ben -Original Message- From: mike cullerton [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 08, 2001 10:01 PM To: 'PHP General List (E-mail)' Subject: Re: [PHP] Question about how to do this... on 7/8/01 10:58 PM, Steve Werby at [EMAIL PROTECTED] wrote: Ben Bleything [EMAIL PROTECTED] wrote: I believe (and I'm sure someone will correct me if I'm wrong) that whenever you 'include' or 'require' a file, it drops to regular HTML mode... so, yes, you will need to use ?php tags at the beginning and ? tags at the ends = Think of the behavior of include() as copying the exact text from your code in the include'd file and pasting it as is into the calling code...a la paper and scissors. There is no special transformation. So if the code in the include'd file would have needed PHP codes if it was directly within the calling code then it needs it in the include'd file too and if it wouldn't have in the calling code then it won't in the include'd file. from http://php.net/include An important note about how this works is that when a file is include()ed or require()ed, parsing drops out of PHP mode and into HTML mode at the beginning of the target file, and resumes again at the end. For this reason, any code inside the target file which should be executed as PHP code must be enclosed within valid PHP start and end tags. -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Question about /tmp/php* files
Hello, I noticed there are a lot of php temp files (session files) under /tmp Whats the best way to dealing with this... Thanks Andras -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Question about Sessions
Hello everyone-- I've got a general question about cookies and sessions. I was wondering if this is how php handles sessions because this is what I want. Is it possible to set up php so that the session id is the only thing that is set in the cookie and then all the session data is either pushed into a file or a database? thanks, jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Question about Sessions
Hi Jay! On Thu, 05 Jul 2001, Jay Paulson wrote: Hello everyone-- I've got a general question about cookies and sessions. I was wondering if this is how php handles sessions because this is what I want. Is it possible to set up php so that the session id is the only thing that is set in the cookie and then all the session data is either pushed into a file or a database? erm, I think that is how it actually work now. Maybe you wanted to ask something else? A link for the manual? :) http://www.php.net/manual/en/ref.session.php -- teodor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Question about Sessions
okay if i read the manual correctly (too bad i couldn't find that page or i wouldn't have had to ask this question :) ) all it stores in cookies is the session id, which is exactly what i wanted to hear! Because i have a flash navigation clip and i don't want to have to load the vars in the flash just to pass the session id.. but i will if i have too.. thanks, jay - Original Message - From: [EMAIL PROTECTED] To: PHP users [EMAIL PROTECTED] Sent: Thursday, July 05, 2001 7:36 PM Subject: Re: [PHP] Question about Sessions Hi Jay! On Thu, 05 Jul 2001, Jay Paulson wrote: Hello everyone-- I've got a general question about cookies and sessions. I was wondering if this is how php handles sessions because this is what I want. Is it possible to set up php so that the session id is the only thing that is set in the cookie and then all the session data is either pushed into a file or a database? erm, I think that is how it actually work now. Maybe you wanted to ask something else? A link for the manual? :) http://www.php.net/manual/en/ref.session.php -- teodor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] question about forms.
I have a question. I am using PHP MySQL. I am able to quary to DB and edit post delete through forms. Problem. I need to be able to also send out emails when something is posted to the databas as well as send the information that was submitted like a recipt. Any ideas? Please help. -Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] question about forms.
Don't post the question in a reply and someone will see your question - Original Message - From: Jason brashear [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Sunday, July 01, 2001 5:34 PM Subject: [PHP] question about forms. I have a question. I am using PHP MySQL. I am able to quary to DB and edit post delete through forms. Problem. I need to be able to also send out emails when something is posted to the databas as well as send the information that was submitted like a recipt. Any ideas? Please help. -Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] question about forms
I have a question. I am using PHP MySQL. I am able to quary to DB and edit post delete through forms. Problem. I need to be able to also send out emails when something is posted to the databas as well as send the information that was submitted like a recipt. Any ideas? Please help. -Jason
RE: [PHP] question about forms
check out the mail() function. Tyler -Original Message- From: Jason Brashear [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 01, 2001 11:08 PM To: [EMAIL PROTECTED] Subject: [PHP] question about forms I have a question. I am using PHP MySQL. I am able to quary to DB and edit post delete through forms. Problem. I need to be able to also send out emails when something is posted to the databas as well as send the information that was submitted like a recipt. Any ideas? Please help. -Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] question about broadcast application
My bosses came to me and asked me to spec out a broadcast mailer (spam box) that clients could: - log into - choose a pre-approved list (clients could have multiple lists) - choose a stored email - send sample - send broadcast I know that Qmail and EzMLM are the products to use, but does anyone have any tips or suggestions, or see any possible problems with this (besides the obvious UCE issue)?? Commercial/Open Source application suggestions appreciated. thanx. mike. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] question about a loop in a loop
hi, I've been driving myself bonkers trying to figure out wy this code block does not work as it is supposed to. am hoping that someone on this list can shed some light on it. Whta I am trying to do is evluate two arrays. One array is populated with a list. The other array is populated with list items that are found in the first array. Array 2 can have either all of the items found in array 1, some, or none. I want to create a marker that would tell me which items in array 2 are found in array 1 and where. My code so far: for argument sake lets say: $add[$key] ($key defined earlier) is equal to "a, b, e, g" $add[$key] is the second array $$key is the second array, and it equals "a, b, c, d, e, f, g, h, i" $$key is the first array. code block: $x = 0; do { for ($y = 0; $y = count ($add[$key]); $y++) { if ($add[$key][$y] == $$key[$x]) { $mark[$x] = $x; } } $x++; }while ($x count ($$key)); So, the idea is that every time $add[$key] at "Y" position is equal to $$key at X position, a third array is populated with the location value of X. but this is not what I am getting spti back at me. $mark is populated every iteration of the inner loop regardless if $add[$key][$y] == $$key[$x] Any suggestions? thanks! Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] question about a loop in a loop
I think array_intersect() and array_diff() is useful for you.. http://www.php.net/manual/en/function.array-intersect.php http://www.php.net/manual/en/function.array-diff.php -- Yasuo Ohgaki "Institute for Social Ecology" [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... hi, I've been driving myself bonkers trying to figure out wy this code block does not work as it is supposed to. am hoping that someone on this list can shed some light on it. Whta I am trying to do is evluate two arrays. One array is populated with a list. The other array is populated with list items that are found in the first array. Array 2 can have either all of the items found in array 1, some, or none. I want to create a marker that would tell me which items in array 2 are found in array 1 and where. My code so far: for argument sake lets say: $add[$key] ($key defined earlier) is equal to "a, b, e, g" $add[$key] is the second array $$key is the second array, and it equals "a, b, c, d, e, f, g, h, i" $$key is the first array. code block: $x = 0; do { for ($y = 0; $y = count ($add[$key]); $y++) { if ($add[$key][$y] == $$key[$x]) { $mark[$x] = $x; } } $x++; }while ($x count ($$key)); So, the idea is that every time $add[$key] at "Y" position is equal to $$key at X position, a third array is populated with the location value of X. but this is not what I am getting spti back at me. $mark is populated every iteration of the inner loop regardless if $add[$key][$y] == $$key[$x] Any suggestions? thanks! Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] question about php sessions
Hi =) Is it possible to track a user session across multiple domains? We have several related web sites and want to enable a user to login through one site and end up logged in to them all. I tested and it didn't work and I'm guessing it's a limitation of cookies. As in, a cookie created under one domain isn't available to another. Is this right or is there a way to accomplish what I'm talking about? Thanks =) -Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Question about global variables
hello!! I have a question about variables scope!! ?php $var = 10; function func1() { func2(); } function func2() { echo $var; } func1(); ? In the above segment, I know that, func2 won't echo anything, even I add "global var;" in func2. if, I modified the segment, so, that, it like the following!! ?php $var = 10; function func1() { global var; func2(); } function func2() { global var; echo $var; } func1(); ? It works!! However, I am now doing a project, using PHP, I decide to write some modules, for frequestly used. How ever, these module, have to use some variables, whose scope is originally on only the upper most level. If using these way (global all var in each function, even not the modules functions), it is very inconivent, as I need to know which variable, should 'global' it, if I use some module functions, Is there any convient way to do so??? Zenith -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Question about global variables
Hello Zenith, SNIP However, I am now doing a project, using PHP, I decide to write some modules, for frequestly used. How ever, these module, have to use some variables, whose scope is originally on only the upper most level. If using these way (global all var in each function, even not the modules functions), it is very inconivent, as I need to know which variable, should 'global' it, if I use some module functions, Is there any convient way to do so??? Globals in PHP differ from many other languages and PHP does not support name space. All global vars are not visible in function or class by default. ( Programmer must declare as global before using it) I recommed you to browse http://www.php.net/docs.php I recommend to set 'enable track vars' and 'disable register globals' in php.ini. If you done this in php.ini, programmer can only access variables from server, browser, etc as acciative arrays like $HTTP_POST_VARS, $HTTP_GET_VARS, $HTTP_SERVER_VARS, $HTTP_UPLOAD_FILES, $HTTP_SESSION_VARS,. If you want to access POST data from user's browser you can write like function foo() { global $HTTP_POST_VARS; // do something } to access all data that are posted by POST method. (Except $HTTP_UPLOAD_FILES) Using $HTTP_* variables improves code readability I think PS: You can use $GLOBALS[] to access all global vars. Regards, -- Yasuo Ohgaki Zenith -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] question about multidimension array
Consider the following code: $ary1 = array ("one","two"); $ary2 = array ("three","four"); $2d_Dimension[] = $ary1; $2d_Dimension[] = $ary2; // is $2d_Dimension a 2 dimensional array? // and the next question, how to get out content of the $2d_Dimension[] array while ( list ( $rec_no, $ary ) = each ( $2d_Dimension ) ) { echo ("Record No $rec_no:"); while ( list ( $element1, $element2 ) = each ( $ary ) ) echo "$element1, $element2"; } // I want to use the above code to print something like // Record No 0:one, two // Record No 1:three, four // But I only got the following //Record No 0: //Warning: Variable passed to each() is not an array or object in d:/project/bizvista/testinc.php on line 27 What's the problem? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] question about multidimension array
-Original Message- From: Zenith [mailto:[EMAIL PROTECTED]] Subject: [PHP] question about multidimension array Consider the following code: $ary1 = array ("one","two"); $ary2 = array ("three","four"); $2d_Dimension[] = $ary1; $2d_Dimension[] = $ary2; // is $2d_Dimension a 2 dimensional array? yes... the "dimension" of an array is basically how many brackets you put after the variable name... 1D = $this[]; 2D = $this[][]; 3D = $this[][][]; etc // and the next question, how to get out content of the $2d_Dimension[] array while ( list ( $rec_no, $ary ) = each ( $2d_Dimension ) ) { echo ("Record No $rec_no:"); while ( list ( $element1, $element2 ) = each ( $ary ) ) echo "$element1, $element2"; } with a slight modification, that code works perfectly: (see end of email for why you probably got a parse error) ?php $ary1 = array ("one","two"); $ary2 = array ("three","four"); $twod = array($ary1, $ary2); while ( list ($rec_no,$ary) = each ($twod) ) { echo ("Record No $rec_no:"); while ( list ($key,$val) = each ($ary) ) echo "$key=$val; "; echo "BR\n"; } ? // I want to use the above code to print something like // Record No 0:one, two // Record No 1:three, four my code produces: Record No 0:0=one; 1=two; Record No 1:0=three; 1=four; suppress printing $key, and you'll get the output you want. // But I only got the following //Record No 0: //Warning: Variable passed to each() is not an array or object in d:/project/bizvista/testinc.php on line 27 What's the problem? if i use your code verbatim, i get a parse error becuase of the variable name starting with a digit, but as for the error *you* describe, when i put the loop inside of a function, and fail to declare $twod as global, i get the same error: "Warning: Variable passed to each() is not an array or object ..." make sure you declare all globals as "global $varname" in your functions... PHP is basically the reverse of almost every other language (things are local by default, global by declaration)... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Question about ImageCopy and colors
Hi, I have 4 images, and I copy three of them onto one main background, these images all have fairly different colors and as you can imagine the resulting image looks splotchy and missing colors. What do i need to do to make sure the resulting image looks proper? -- David Raufeisen [EMAIL PROTECTED] Cell: (604) 818-3596 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Question about PDF functions and PDFLib 3.03
I'm running PHP4.0.4pl1-Win32, Zend Engine v1.0.4, Zend Optimizer v1.0.0, I tryed to run sample script for creating PDF document. It's PHP manual script, but I get message like this: Fatal error: Call to undefined function: pdf_new() in c:/web/pdf/pdf.php on line 2 phpinfo.php said: PDF Support enabled PDFLib Version 3.03 CJK Font Support yes In-memory PDF Creation Supportyes Can you help me with this problem? Thanks in advance, Vladmir P.S. Here is a PDF that I wanted to create. ?php $pdf = PDF_new(); PDF_open_file($pdf, "test.pdf"); PDF_set_info($pdf, "Author", "Uwe Steinmann"); PDF_set_info($pdf, "Title", "Test for PHP wrapper of PDFlib 2.0"); PDF_set_info($pdf, "Creator", "See Author"); PDF_set_info($pdf, "Subject", "Testing"); PDF_begin_page($pdf, 595, 842); PDF_add_outline($pdf, "Page 1"); PDF_set_font($pdf, "Times-Roman", 30, "host"); PDF_set_value($pdf, "textrendering", 1); PDF_show_xy($pdf, "Times Roman outlined", 50, 750); PDF_moveto($pdf, 50, 740); PDF_lineto($pdf, 330, 740); PDF_stroke($pdf); PDF_end_page($pdf); PDF_close($pdf); PDF_delete($pdf); echo "A HREF=getpdf.phpfinished/A"; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] question about PHP use
Hi, I've been looking at using PHP but am unsure if it will do what I want. What first attracted me to PHP is the claim that I can embed PHP code within my html file and have it build dynamic content. Perhaps someone on the list can confirm that ic can do as follows: I have a web page that contains various graphics and text. At the bottom of the page, I have a table of one row by two columns. Using PHP and MySQL (I already know that PHP can access MySQL databases), I want to read data from a table and dynamically grow my table (add several rows, each with two columns). So I am guessing that I will be inserting PHP code and HTML code intertwined? IS PHP my ticket for accomplishing the above? Thanks, Don -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] question about PHP use
Yeppers, it'll do that for you. Cal http://www.calevans.com -Original Message- From: Don [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 07, 2001 4:09 PM To: php list Subject: [PHP] question about PHP use Hi, I've been looking at using PHP but am unsure if it will do what I want. What first attracted me to PHP is the claim that I can embed PHP code within my html file and have it build dynamic content. Perhaps someone on the list can confirm that ic can do as follows: I have a web page that contains various graphics and text. At the bottom of the page, I have a table of one row by two columns. Using PHP and MySQL (I already know that PHP can access MySQL databases), I want to read data from a table and dynamically grow my table (add several rows, each with two columns). So I am guessing that I will be inserting PHP code and HTML code intertwined? IS PHP my ticket for accomplishing the above? Thanks, Don -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] question about PHP use
yes, that is what PHP does best (displaying dynamic content from a database). - Original Message - From: Don [EMAIL PROTECTED] To: php list [EMAIL PROTECTED] Sent: Wednesday, February 07, 2001 2:08 PM Subject: [PHP] question about PHP use Hi, I've been looking at using PHP but am unsure if it will do what I want. What first attracted me to PHP is the claim that I can embed PHP code within my html file and have it build dynamic content. Perhaps someone on the list can confirm that ic can do as follows: I have a web page that contains various graphics and text. At the bottom of the page, I have a table of one row by two columns. Using PHP and MySQL (I already know that PHP can access MySQL databases), I want to read data from a table and dynamically grow my table (add several rows, each with two columns). So I am guessing that I will be inserting PHP code and HTML code intertwined? IS PHP my ticket for accomplishing the above? Thanks, Don -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] question about PHP use
Don wrote: I have a web page that contains various graphics and text. At the bottom of the page, I have a table of one row by two columns. Using PHP and MySQL (I already know that PHP can access MySQL databases), I want to read data from a table and dynamically grow my table (add several rows, each with two columns). So I am guessing that I will be inserting PHP code and HTML code intertwined? IS PHP my ticket for accomplishing the above? It is one possible solution to your problem, yes. ASP, JSP and ColdFusion can do this as well, but being a PHP-lover I would recommend PHP. Hell, I know _why_ I love PHP... Wagner -- Three may keep a secret, if two of them are dead. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Question about flock() on Linux
Hello php-general, Script flock.php: ? $file_name = 'flock.txt'; for($i=0;$i1000;$i++){ if ($fd = fopen($file_name,'a+')){ if (flock($fd,LOCK_EX)){ fseek($fd,0,SEEK_END); fwrite($fd,$i.' : '.$i."\n"); flock($fd,LOCK_UN); }else{ die('Can not lock file'); } fclose($fd); }else{ echo 'Can not open file'; } } ? Run it: ab -n 10 -c 10 http://host/flock.php Why file have similar lines ? 432 : 431 : 431 432 433 : 433 ... 84841 : 841 2 : 842 May be flock not working or I do not understand, how it should work ? How correctly to write in a file from different threads? P.S I use Linux-2.2.17+PHP4.0.4pl1 Best regards, Andrew Sitnikov e-mail : [EMAIL PROTECTED] GSM: (+372) 56491109 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Question about flock() on Linux. Part 2
Hello php-general, This also does not work: flock.php ? $file_name = '/home/sitnikov/tmp/flock.txt'; if ($fd = fopen($file_name,'a+')){ for($i=0;$i1000;$i++){ if (flock($fd,LOCK_EX)){ fseek($fd,0,SEEK_END); fwrite($fd,$i.' : '.$i."\n"); flock($fd,LOCK_UN); usleep(5); }else{ die('Can not lock file'); } } fclose($fd); }else{ echo 'Can not open file'; } ? Best regards, Andrew Sitnikov e-mail : [EMAIL PROTECTED] GSM: (+372) 56491109 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Question about dopping zeros
I need to format decimals that are percise to the second place in the following format: 4.00 to 4 4.50 to 4.5 4.25 to 4.25 As you can see, I just want to drop the trailing zeros, and if necessary the decimal. Thanks ___ Ethan Nelson, Systems Administrator Net Solutions, LLC 840 Lawrence Street Eugene, OR 97401 [EMAIL PROTECTED] http://www.netsolutionsllc.com Voice +1 541 345-7087 Fax +1 541 485-5519 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Question about dopping zeros
Hello Ethan, $onum=4.11440; $onum =number_format($onum,2)+0; echo $onum; With this technique, you get the following: $onum output 4.166 4.12 4.135 4.11 4.000 4 4.30004.3 Is that what you wanted? To me, it's much easier to code and use than reg expressions and replaces. Best regards, Randy Thursday, January 25, 2001, 1:10:18 PM, you wrote: EN I need to format decimals that are percise to the second place in the EN following format: EN 4.00 to 4 EN 4.50 to 4.5 EN 4.25 to 4.25 EN As you can see, I just want to drop the trailing zeros, and if necessary the EN decimal. EN Thanks EN ___ EN Ethan Nelson, Systems Administrator EN Net Solutions, LLC EN 840 Lawrence Street EN Eugene, OR 97401 EN [EMAIL PROTECTED] EN http://www.netsolutionsllc.com EN Voice +1 541 345-7087 EN Fax +1 541 485-5519 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Question about dopping zeros
Oops! Copied the numbers wrong. Here's are the numbers I meant to type: R $onum output R 4.166 4.12 4.1166 4.12 R 4.135 4.11 4.1135 4.11 R 4.000 4 R 4.30004.3 R Is that what you wanted? To me, it's much easier to code and use R than reg expressions and replaces. R Best regards, R Randy R Thursday, January 25, 2001, 1:10:18 PM, you wrote: EN I need to format decimals that are percise to the second place in the EN following format: EN 4.00 to 4 EN 4.50 to 4.5 EN 4.25 to 4.25 EN As you can see, I just want to drop the trailing zeros, and if necessary the EN decimal. EN Thanks EN ___ EN Ethan Nelson, Systems Administrator EN Net Solutions, LLC EN 840 Lawrence Street EN Eugene, OR 97401 EN [EMAIL PROTECTED] EN http://www.netsolutionsllc.com EN Voice +1 541 345-7087 EN Fax +1 541 485-5519 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Question about session_register()
My question is, when the user first visit, a session created, and I register the variable. On the second, or following hits, to use the session variable, I also need "session_start", but should I still need to call session_register() for each hit? No, once you register it, it's there unless you 'unregister' it. By Day:|By Night: Don't miss the Zend Web Store's| There's not enough room here... Grand Opening on January 23, 2001! | Start here: http://www.zend.com| http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Question about session_register()
I have a question about session_register(), and the following is the background When I read a tutorial about session. I know that, once the "session_start()" is called, it will check the session id. If it's not valid, create a new one, and it will responible to retrieve the variable. I also learns about the usage of session_register(). It is a function to register a variable which will be used throughout a session. My question is, when the user first visit, a session created, and I register the variable. On the second, or following hits, to use the session variable, I also need "session_start", but should I still need to call session_register() for each hit? e.g. in script 1, I have a $foo, which should be a session variable, then ? session_start(); session_register(foo); .. ? in script 2, I still have to use that "$foo", as what I have read from the tutorial, a session_start() is already prepare that sesson variable for me, when the script is being parsed, ? session_start(); //should I still have to add such a statement? session_register(foo); ? I know my english is poor, so I use a lot of words to show my question, pls forgive!!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Question about new features of PHP4!
When I first meet PHP, it still in 3.0 version. just after I bought a book abuot PHP3, for a few weeks, PHP4 is released. for now, I have fimilar with some basic of PHP, and I try to find some useful tutorial about the PHP4, I fail. I have look about the PHP manual (pdf version), I find that, there is many many function is added to PHP4, like, session, corba, shockwave flash, XSLT, new function for OO But the manual does only provide limited information. I also heard about Zend, and the xxx engine, but just heard. not really know what's that. Can anyone tell me where can I got some article or tutorial, dicussion the new features in PHP4, online (I am a poor student!) Right, I still any another two question, it may be cross post,sorry first. 1. What is "Referer" in a HTTP header, what does it mean? 2. If I have question about mySQL, where can I raise question? Is there any newsgroup which is specially for mysql? Thanks very much!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Question about new features of PHP4!
On Sat, 20 Jan 2001, Zenith wrote: When I first meet PHP, it still in 3.0 version. just after I bought a book abuot PHP3, for a few weeks, PHP4 is released. for now, I have fimilar with some basic of PHP, and I try to find some useful tutorial about the PHP4, I fail. I have look about the PHP manual (pdf version), I find that, there is many many function is added to PHP4, like, session, corba, shockwave flash, XSLT, new function for OO But the manual does only provide limited information. I also heard about Zend, and the xxx engine, but just heard. not really know what's that. Can anyone tell me where can I got some article or tutorial, dicussion the new features in PHP4, online (I am a poor student!) Try http://www.zend.com/. Right, I still any another two question, it may be cross post,sorry first. 1. What is "Referer" in a HTTP header, what does it mean? It's the web page that the browser was just at. 2. If I have question about mySQL, where can I raise question? Is there any newsgroup which is specially for mysql? Try http://www.mysql.com/. Thanks very much!! -- Ignacio Vazquez-Abrams [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Question about phpinfo() and XML
phpinfo reports that XML is 'active' but i thought xml was a client side language? what does it have to do with the server? thanks! - Noah -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]