[PHP] PHP Conference in Amsterdam
Hey, Next week I will be attending the International PHP Conference in Amsterdam and since I don't know anybody who will attend I thought it would be nice to get some contacts before I go. I'm sure there are some people on this list who will be going to the conference, so I thought this might be a good way to find some people to 'socialize' with since three days can be quite long ;) Anybody who is not coming to Amsterdam can read my weblog (http://www.filipdewaard.com), where I will post daily updates about what's going on at the conference. Cheers, Filip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions and PHP
On Mar 25, 2004, at 2:05 AM, Patrik Fomin wrote: is there anyway to get the number of people connected to the site? in asp you just use Application and session_terminate to accomplish this is there anyway to do this in PHP Hi Patrick, As far as I know this is not possible with default PHP sessions, but when you store your sessions in a database using your own session handler (http://nl.php.net/session_set_save_handler) this can be achieved easily. Regards, Filip de Waard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Example of good PHP coding
On Mar 24, 2004, at 6:43 AM, Terence wrote: Hi All, Apologies if this has been asked before, but can someone out there point out an example of good PHP coding in an open source application? I am currently looking at: PHPNuke Mambo (the most recent versions). Can these two pieces of software be considered good PHP coding practice and serve as an example on how to write PHP *in general*? No. Especially PHP Nuke is famous because of it's many (security related) bugs and Mambo isn't perfect either. It is a very bad idea to use them, let alone learn PHP out of them. You could take a look at the PEAR classes: http://pear.php.net Regards, Filip de Waard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] String Length ??
On Mar 22, 2004, at 1:46 PM, gordon stewart wrote: === foreach ($text as $color) { echo SAF '$color' - ; echo B.strlen($color)./BBR\n; } === QUESTION :- Is this the right code to use ? to find the length of each line ? ($color) - No worries - Ive just copied code from the web strlen() is the correct function to use here. Use it like: echo strlen($_POST['input_name']); Where $_POST['input_name'] should be replaced by the variable you want to check. strlen() is always right, but it counts the actual charactars of the string (which may differ from those who are shown in the browser, please look at the HTML source instead). Secondly, please use lowercase for HTML tags and use br / instead of BR... Regards, Filip de Waard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Backup of a MySQL database.
On Mar 22, 2004, at 11:34 PM, Elliot J. Balanza wrote: Can anyone post a link to a good reference material on how to do this... evidentely mysqldump is not working here... and i need to do this via php programming. I'm sure you will find prewritten scripts with Google and I know phpmyadmin does it to. Without giving it much though my first reaction to your question is pretty straigtforward: use SHOW TABLES to find out which tables are in the DB and then just do SHOW COLUMNS FROM table for each table. Then you can query the table using SELECT * FROM table and create the insert using the knowledge you have gained about the columns in that table. However, I would like to suggest looking for a prewritten solution, since it's probably not necessary to reinvent the wheel here... Regards, Filip de Waard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Backup of a MySQL database.
On Mar 23, 2004, at 1:10 AM, Chris W. Parker wrote: Elliot J. Balanza mailto:[EMAIL PROTECTED] on Monday, March 22, 2004 3:05 PM said: I was looking something more like a MySQL dump class or function... this may not be as robust a solution as you require but can you not simply backtick the mysqldump command from within php? ?php $date = date(); $output = `mysqldump --opt --quote-names -u root --password=daword database file_$date.dump`; ? or even create a shell script that does all the dumping and handling of dump files and then just execute that. I thought of that to, but I would prefer to write some PHP code to do this (like I suggested in my previous message). That is indeed a little more robust and works on windows to. I'm sure that there are pre-written functions on the net that do it using PHP code inside of mysqldump, so it's not necessary to chose this solution when you need a easy way out. Regards, Filip de Waard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP installation problem in FreeBSD OS.
On Mar 22, 2004, at 7:59 PM, Naveen Glore wrote: Hello All, I am not sure if this is the right place to post this problem. I tried with FreeBSD mailing list but could not get much help. No, it isn't. There is a specific installation list ([EMAIL PROTECTED]). I am having hard time in installing php4 using portupgrade in FreeBSD. Try installing from source. There are dozens of tutorials on the net which will help you. Regards, Filip de Waar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: ip to country
On Mar 21, 2004, at 10:38 PM, Chris Shiflett wrote: --- Filip de Waard [EMAIL PROTECTED] wrote: Using HTTP headers to identify the country where a visitor comes from is totally inaccurate. That's not really very fair to HTTP. There is no header that identifies the country, so it's not inaccurate - it doesn't exist. :-) Trying to accurately determine a country from a language isn't the fault of HTTP. I'm sure this is what you were implying, but I wanted to make sure HTTP wasn't being blamed. Chris Hey Chris, I'm not blaming HTTP, but browsers and operating systems that implement it. I posted the HTTP header that my own browser is using to identify it's language as an example to prove that Accept-Language isn't the right source to identify the visitors language or even his home country. I know there is no such thing as a 'Country' header in HTTP, but even Accept-Language is quite inaccurate. I can't back this by scientific evidence, but I'm pretty sure that using IP addresses to figure out in which country the visitor is located in combination with a table containing the main languages for that country is far more accurate then using the Accept-Language as a source to identify the users language. One of the mantra's of web development that I've encountered is: Never trust HTTP headers as a valid data source. Please don't read that as an attack on HTTP itself... Using IP addresses to identify the visitors language has three major downsides: a. it's not 100% accurate (but nothing is), b. some countries have multiple main languages (like Canada) and c. querying databases for IP addresses takes a performance toll. IP addresses are just giving a hand, but they are no heavenly cure for all our problems. Personally I'm using IP addresses nevertheless, since I'm convinced that it's the best way to initially identify the visitors language or country. I don't have any experience with GeoIP Country from Maxmind (I'm using ip-to-country), but will try it out soon. Thank you for the tip! Regards, Filip de Waard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zend Optimiser -- wide spread??
On Mar 22, 2004, at 1:16 AM, Justin French wrote: Hi all, I'm close to releasing my first widely distributed (I hope) PHP application, and I wish to protect the source with Zend Encoder. Seems easy enough. However, this is a low-cost app that was intended to work on basic installs of PHP, running on almost any server -- it uses no external libraries, and required no special compiles. Is Zend Optimiser (required to run encoded PHP files) part of a base installation, or at the very least, is it widely spread in use (available on most hosts)? Seems like there's no point encoding if only half of the servers out there can run the scripts. I know optimiser is available on *my* host, but that's not enough in this case! It's not available on every PHP aware webserver, since it's not part of PHP itself. You can give your clients two options: a. encoded file (cheaper) and b. source code (expensive). If you don't want to give them your source you can always make an reseller arrangement with a specific hosting company and forward clients who's current provider doesn't support the Zend Optimizer to that reseller account :-) Regards, Filip de Waard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CMS Templating with Standards Based HTML Delima...
On Mar 21, 2004, at 12:01 AM, Adam Reiswig wrote: Is there a good open source php based cms system out there that can do the above? I'd sure like to know about it. Thanks for any pointers! No :-( There are some options that might interest you, like Drupal. But there isn't anything like 'a perfect Open Source CMS'. Regards, Filip de Waard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: ip to country
On Mar 21, 2004, at 1:01 AM, Marek Kilimajer wrote: Manuel Lemos wrote: On 03/20/2004 06:48 PM, Enda Nagle wrote: I have a site that will have different pricing by world region / country and also offer different currencies. Presently, the user has to select their country from a select menu and submit the form, but I would like to eliminate this step if possible, and set the country according to their IP address. I had a quick look at http://www.iptocountry.com but was wondering if there was a way of doing this with PHP functions? I know its in use on the php.net and google.com sites (when I go to either I get ie.php.net or google.ie) so was wondering if its costly / easy to implement? You may also want to try this NetGeo interface class. http://www.phpclasses.org/netgeoclass You can use this class but remember that these services limit the number of requests per ip address. php.net and google certainly don't use the free service but instead bought a database. If your site is busy you should buy one too. PHP.net uses a free database: http://ip-to-country.webhosting.info/ which is actually quite good. Regards, Filip de Waard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: ip to country
On Mar 21, 2004, at 3:27 AM, Tom Reed wrote: I would think using HTTP_ACCEPT_LANGUAGE to get the users browser language/country info would be quicker and easier to implement. Using HTTP headers to identify the country where a visitor comes from is totally inaccurate. My browser identifies itself with: Accept-Language: en-us,en;q=0.5, while I live in the Netherlands where the main language is Dutch. When you need a little bit of accuracy you can't avoid using an IP to country database. Regards, Filip de Waard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML/PHP page print
On Mar 18, 2004, at 4:52 PM, Manisha Sathe wrote: Hello, I want to print a document. The values are picked up from database and then PHP displays it is on screen. But I want to print in some predefined format (Customer has printed stationary) by using Browser's print button. How can avoid other stuff on my web page ? Also when i print then title of document / page no / url / date also get displayed. How can i avoid it ? This has nothing to do with PHP, but more with presentation (client side). I would like to recommend http://www.alistapart.com/articles/goingtoprint/, which is an excellent article written by CSS guru Eric Meyer about printing from the web. Regards, Filip de Waard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Advanced PHP Programming by George Schlossnagle
Hey guys. I just recieved Advanced PHP Programming by George Schlossnagle (that's a mouth full) from an online shop. I had very high expectations of the book, since everybody starts to cheer once this book gets mentioned. I instantly started to read and I'm very happy with the quality and level of the book. Of course I haven't read the complete book yet, but from what I've read so far this was money well spent. Regards, Filip de Waard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Advanced PHP Programming by George Schlossnagle
On Mar 17, 2004, at 6:12 PM, Chris W. Parker wrote: Filip de Waard mailto:[EMAIL PROTECTED] on Wednesday, March 17, 2004 7:20 AM said: Hey guys. hi. I instantly started to read and I'm very happy with the quality and level of the book. Of course I haven't read the complete book yet, but from what I've read so far this was money well spent. where can we get more information and what online shop did you buy it from? I actually bought it from a Dutch online shop, bol,com, which isn't of much interest outside the Netherlands. At http://www.schlossnagle.org/~george/blog/ you can buy the book trough an affiliate link from Mr. Schlossnagle at Amazon and Barnes Noble. Regards, Filip de Waard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] List of all defined constants
On Mar 15, 2004, at 3:23 PM, Marco Schuler wrote: Hi How can I get a list of all constants defined with define()? Marco, Like the manual (http://nl2.php.net/constants) says: Use get_defined_constants() to get a list of all defined constants. Regards, Filip de Waard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Create table .. script
On Mar 13, 2004, at 5:24 PM, Mike Mapsnac wrote: Hello When I need to create table I have to login into mysql and run the query. Is there a way to create some sort of scipt that can create all my tables?.So If I need create a table in new database I just run the script. I know that I can do mysql_query(QUERY OF TABLE); But is there another way of doing this? $sql = CREATE TABLE `rss_cat` ( `id` int(11) NOT NULL auto_increment, `cat` varchar(50) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=1; mysql_query($sql); Just use general SQL to create tables in PHP. This isn't the correct list for these kind of questions, since we have php-db for database related stuff. Regards, Filip de Waard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Connect to MS-SQL 2000
On Mar 13, 2004, at 6:01 PM, [EMAIL PROTECTED] wrote: Can we control php direct connect to MS-SQL 2000 ( Another computer machine ) ? RTFM, http://www.php.net/ms_sql. Regards, Filip de Waard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Character Question
On Mar 12, 2004, at 11:24 PM, Pablo Gosse wrote: David Westbrooks wrote: I have articles held in a MySQL database for a law firm. When I pull the information from the DB and display it, words like that's are shown as that\'s. To take care of this problem I have done this: $newsart = eregi_replace(\\\',', $newsart); Is there a better way to handle this to catch all irregular characters? snip http://www.php.net/stripslashes stripslashes() is, like Pablo said, the solution to your question. But you should not ask how to remove the slashes, but why they are there. You should read the excellent article by Jeffrey Siegel and Michael Southwell in PHP Magazine 2.04 about 'Storing and displaying data', which explains some elementary stuff about this issue. I suppose that 'magic_quotes' (http://www.php.net/manual/en/ref.info.php#ini.magic-quotes-gpc) is switched on on your database server, which is a bad thing. Since you are using MySQL you should store your data using mysql_real_escape_string() (http://www.php.net/mysql_real_escape_string). This way you won't have to bother with slashes inside of your data. I would suggest to study the manual carefully on this issue, since it relates with security and possible SQL injection (and we don't want that, do we?). Regards, Filip de Waard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date to string (with mask)
On Sat, 2003-11-08 at 11:45, Christian Ista wrote: Hello, I have in a database a date field (this format yyy/mm/dd). I'd like when I display the value use an another format dd/mm/ (format in europ), could you tell me if there is a format DateString function ? Thanks, Christian, http://www.php.net/date Cheers, Filip de Waard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Date to string (with mask)
On Sat, 2003-11-08 at 15:21, Christian Ista wrote: ?php echo mysql_result($result_cat,0,CATC_DATE);? a string like that : 2003-11-07 and I'd like display 07/11/2003 I usually do: ? $query = SELECT UNIX_TIMESTAMP(datefield) as unixtime FROM table; $timestamp = mysql_result($result, unixtime); $date = date(d/m/Y, $timestamp); echo $date; ? Regards, Filip de Waard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dissecting an email address
RTFM http://www.php.net/explode -Filip On Sun, 2003-11-02 at 15:04, Dave Carrera wrote: Hi All, How do you split an email address sent via form post text field. I.e.: split [EMAIL PROTECTED] into me@ hotmail .com Its the domain bit I am interested in, not the username or tld. Any help is appreciated. Thank you in advance Yours Dave C --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.530 / Virus Database: 325 - Release Date: 22/10/2003 -- Met vriendelijke groet, Filip de Waard Net Collective www.netcollective.nl Tel. 06 - 48 01 22 40 Fax. 013 - 455 87 53 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Put output of mysql into an Array
On Sat, 2003-11-01 at 12:26, Frank Keessen wrote: O.K. When i do this: ? // open database connection $connection = mysql_connect($host, $user, $pass) or die (Unable to connect!); // select database mysql_select_db($db) or die (Unable to select database!); $query = SELECT markhow, COUNT(*) FROM prospects GROUP BY markhow; $result = mysql_query($query) or die (Error in query: $query. . mysql_error()); while ($row = mysql_fetch_assoc($result)) { echo $row['markhow']; } O.k. This is working.. Can someone tell me how to retrieve the COUNT function? Use 'COUNT(id) AS count_result', then you can access the value with $row['count_result']; -- Regards, Filip de Waard Net Collective www.netcollective.nl Tel. 06 - 48 01 22 40 Fax. 013 - 455 87 53 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Generating Numbers from Strings
On Sat, 2003-11-01 at 01:37, John Ryan wrote: I've a bit of a problem, I want a random keyword pulled from my database. But I dont want it random all the time. I just want it random to each page. So I have the filename variable of the page. How do I somehow generate a 'constant' random number from this string that is constant to each file??? Could you refrase your question? I understand a part of what you are trying to do, but i'm missing the whole picture. On Sat, 2003-11-01 at 03:14, John Ryan wrote: I've done that, but how do I generate a number out of that that's in a certain range? mt_rand($start, $end); generates a 'random' number between two given numbers. Filip de Waard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Apache 2
On Thu, 2003-10-30 at 14:53, Fernando Melo wrote: And when will it be considered stable? It's been a while since Apache 2 was released. PHP needs to speed up for its own good. Maybe soon, maybe never. This question is covered in a lot of FAQ's on the web. Please search google if you are interested in more specific information. Regards, Filip de Waard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tips on books and tutorials
Hi, There are many great websites, for instance: http://www.phpdeveloper.org http://www.phpbuilder.com http://www.devshed.com http://www.phpnoise.com/ One of the most vital elements in the life of a PHP programmer is the manual (http://www.php.net/manual), that answers all the questions you will be able to think of. The books part is a little more tricky, because of the fact that PHP 5 will arive in the near future. Most books that are currently available focus on PHP 4 and will be outdated soon. I'm considering to buy PHP Developers Handbook by John Coggeshall (http://www.coggeshall.org/), but you could always take a look at the currently available titles at Amazon. Good luck and happy coding, Filip de Waard On Fri, 2003-10-31 at 00:20, Tore E. Mackay wrote: Hi! I have just started to look at the exciting world og PHP and MySQL. Anyone that can inform me of good books to buy or free tutorials on the net that can guide me through building a good dynamic website. Thanx!!! TEM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Echo issue RESOLVED!
Chris, I seriously disagree with you, in my not so humble opinion OS X is really great. I currently only have Linux installed, but i've just ordered a PowerBook... However, I don't see the point in discussing this topic any longer. You won't change your opinion and Apple afficionados won't change their opinion either. I would like to suggest that you try Linux, BSD or OS X before you speak. Regards, Filip de Waard On Fri, 2003-10-31 at 00:32, Chris W. Parker wrote: - Edwin - mailto:[EMAIL PROTECTED] on Wednesday, October 29, 2003 11:26 PM said: [snip lots of nice things about mac osx] Yes, I can do those and more on my Mac. And it doesn't even crash on me even if I do many things at the same time. I could run it for months! Yeah but... it's a Mac. But seriously folks... The reason I don't like Macs is not because they don't perform well but it's because they have a retarded UI. It looks like crap and it works like crap. They do some of the most stupid things as far as user interface goes. Chris. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tips on books and tutorials
Hi, On Fri, 2003-10-31 at 00:48, Tore E. Mackay wrote: Thanx for your quick reply. No problem :) I have had a look at some of the web sites you are refering to and they are great, but I feel that they have info for the beginners and the advanced. I need the one in between. I guess that 60% of the PHP coders are between these two stages, so you are not alone. However the only way to get trough this is experience and practice, in other words: write code, drink coffee and write more code. Of course you will run into problems, but with the manual and the many other excellent resources you will gain experience. What I guess I'm looking for is a book that can guide me throug and explain in detail the entire process of building a dynamic site with different kinds of modules (publisher, forum, shopping cart, user accounts, etc etc.). There are many books that have what you need, so I suggest that you'll go to your local bookstore or Amazon.com and pick one. I can't think of an exact title, but you might want to check what Wrox are still available. Regards, Filip de Waard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php