Re: [PHP] Submitting as POST. Why?
On 4/7/07, Paul Novitski <[EMAIL PROTECTED]> wrote: >barophobia wrote: >>I only know of one reason to submit a form as POST and that is because >>you can submit more data in one shot. At 4/6/2007 05:44 PM, Mike Shanley wrote: >When you submit via GET, all the info shows up in the URL, so people >can tamper with it however they like. Also, people can bookmark it as well. In fact that very tamperability is one of the advantages of GET. For certain types of service it can be a boon to the user to be able to tweak the querystring. It enables even mildly technically-oriented people to roll their own queries for search engines, map engines, online resource guides, catalogs, etc. When I deliberately expose the communication channel between a form and a lookup engine like that, I try to choose querystring parameter names that are simple and easy to remember such as isbn, author, and title. Obviously you have to make sure someone can't hack your system through the querystring, but you should already be doing this anyway whether you're using POST or GET. Regards, Paul Good point, It's nice if search machine's are using GET, as you could make a script to search in their search machine by just going to an url like http://www.google.com/search?q=, instead of making a form. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP has encountered an Access Violation at 01F13157?!?!?!?
On 4/7/07, Afan Pasalic <[EMAIL PROTECTED]> wrote: hi, I just installed php 5.2.1-win32-installer on win box (XP). use IIS. created index.html file and localhost/index.html is ok. created phpinfo.php (with only phpinfo()) and was ok. then installed Zend 5.5.0 (try) and suddenly, IE is giving me blank screen. installed firefox 2 and got the error message from subject line. according google and php.net, it's bug?!? any idea? thanks for any help. -afan So, what are the error messages in your firefox? and do you have any error messages in your apache error log? Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP has encountered an Access Violation at 01F13157?!?!?!?
On 4/7/07, Tijnema ! <[EMAIL PROTECTED]> wrote: On 4/7/07, Afan Pasalic <[EMAIL PROTECTED]> wrote: > hi, > I just installed php 5.2.1-win32-installer on win box (XP). use IIS. > created index.html file and localhost/index.html is ok. > created phpinfo.php (with only phpinfo()) and was ok. > then installed Zend 5.5.0 (try) and suddenly, IE is giving me blank screen. > installed firefox 2 and got the error message from subject line. > > according google and php.net, it's bug?!? > > any idea? > > thanks for any help. > > -afan So, what are the error messages in your firefox? and do you have any error messages in your apache error log? Tijnema I'm sorry, i didn't read your title, so i didn't know what your error was, but it is a bug. Take a look here: http://bugs.php.net/bug.php?id=40662 There hasn't been a solution posted, because there were no backtraces provided. If you could provide them, it might solve the bug. Also, this bug appeared in PHP5RC3 too, there was a fix, but link is dead, and the fix they tell is "Use CVS snapshot.", and of course that would worked then, but that's not relevant anymore, as the thead is from jun 2004, anyway if you want to read it: http://bugs.php.net/bug.php?id=29127 Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Submitting as POST. Why?
On Saturday 07 April 2007 05:56, Paul Novitski wrote: > >barophobia wrote: > >>I only know of one reason to submit a form as POST and that is because > >>you can submit more data in one shot. > > At 4/6/2007 05:44 PM, Mike Shanley wrote: > >When you submit via GET, all the info shows up in the URL, so people > >can tamper with it however they like. Also, people can bookmark it as > > well. > > In fact that very tamperability is one of the advantages of GET. For > certain types of service it can be a boon to the user to be able to > tweak the querystring. It enables even mildly technically-oriented > people to roll their own queries for search engines, map engines, > online resource guides, catalogs, etc. > > When I deliberately expose the communication channel between a form > and a lookup engine like that, I try to choose querystring parameter > names that are simple and easy to remember such as isbn, author, and title. > > Obviously you have to make sure someone can't hack your system > through the querystring, but you should already be doing this anyway > whether you're using POST or GET. > GET leaves someone with an option to easily make a frontend... take ktorrent feks. This little bugger contains some khtml code and a search box, and withing this search box you can add torrent tracker sites. Imho easily downloadable and consistent when it comes to searching (well it shows the complete site inside then browserwindow, but you don't go looking for the search form box.) > Regards, > > Paul > __ > > Paul Novitski > Juniper Webcraft Ltd. > http://juniperwebcraft.com -- --- Børge http://www.arivene.net --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Submitting as POST. Why?
barophobia wrote: I only know of one reason to submit a form as POST and that is because you can submit more data in one shot. What other reasons are there? The difference between get and post is not what you *can* do, it's what you *should* do. Get, as the name implies, should be used when retrieving a page. The URL, including the query string, should contain info needed to retrieve the right page. No significant changes to either session or persistant data should be made in response to a get request. Post is used to send data to the server, and should be used when modifying something. That something could be 'the logged in user' (in the case of a login form), or 'a blog entry' (in the case of a blog entry editor form). Put more simply, get requests should not make significant changes to the data or state of your website, always use post requests for that. These implied "rules" have existed since HTTP was invented, and when you think about it they make a lot of sense. They also get emphasized by the existance of so-called web accelerators that simply pre-fetch URLs on the page the user is viewing. If you have simple links (i.e. get requests) that make changes to your websites data or state, the accelerator will seriously screw it up. As an illustration, consider a blog editing app. You log in and view a list of entries in your blog. Each one has edit and delete links next to them. These are plain URLs. The delete link uses javascript to ask the user for confirmation. The accelerator happily goes through these links, helpfully pre-fetching them for you. This is fine for the edit links, but the delete links cause the website to delete your entire blog. Oops. Hope that's made it clear. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Submitting as POST. Why?
Maybe this could help... GET http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.3 POST http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.5 URI http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.2.1 jm - Original Message - From: "barophobia" <[EMAIL PROTECTED]> To: "php-general" Sent: Saturday, April 07, 2007 2:35 AM Subject: [PHP] Submitting as POST. Why? My Peeps, I only know of one reason to submit a form as POST and that is because you can submit more data in one shot. What other reasons are there? Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Submitting as POST. Why?
On Sat, 2007-04-07 at 11:10 +0100, Stut wrote: > > These implied "rules" have existed since HTTP was invented, and when you > think about it they make a lot of sense. They also get emphasized by the > existance of so-called web accelerators that simply pre-fetch URLs on > the page the user is viewing. If you have simple links (i.e. get > requests) that make changes to your websites data or state, the > accelerator will seriously screw it up. "Accelerator" *lol*. This is a terrible waste of bandwidth. So the "accelerator" downloads 50 pages linking from the first page you hit and after spending 5 minutes reading the first page you decide not to visit any of the other links. Fast for the user maybe, but if everyone used this, it would be slower overall since the net would be plugged with 90% pointless requests. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Submitting as POST. Why?
Robert Cummings wrote: On Sat, 2007-04-07 at 11:10 +0100, Stut wrote: These implied "rules" have existed since HTTP was invented, and when you think about it they make a lot of sense. They also get emphasized by the existance of so-called web accelerators that simply pre-fetch URLs on the page the user is viewing. If you have simple links (i.e. get requests) that make changes to your websites data or state, the accelerator will seriously screw it up. "Accelerator" *lol*. This is a terrible waste of bandwidth. So the "accelerator" downloads 50 pages linking from the first page you hit and after spending 5 minutes reading the first page you decide not to visit any of the other links. Fast for the user maybe, but if everyone used this, it would be slower overall since the net would be plugged with 90% pointless requests. Indeed, I never said they were a good thing, just that we need to be aware that they exist and how they work. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Submitting as POST. Why?
On Sat, 2007-04-07 at 13:59 +0100, Stut wrote: > Robert Cummings wrote: > > On Sat, 2007-04-07 at 11:10 +0100, Stut wrote: > >> These implied "rules" have existed since HTTP was invented, and when you > >> think about it they make a lot of sense. They also get emphasized by the > >> existance of so-called web accelerators that simply pre-fetch URLs on > >> the page the user is viewing. If you have simple links (i.e. get > >> requests) that make changes to your websites data or state, the > >> accelerator will seriously screw it up. > > > > "Accelerator" *lol*. This is a terrible waste of bandwidth. So the > > "accelerator" downloads 50 pages linking from the first page you hit and > > after spending 5 minutes reading the first page you decide not to visit > > any of the other links. Fast for the user maybe, but if everyone used > > this, it would be slower overall since the net would be plugged with 90% > > pointless requests. > > Indeed, I never said they were a good thing, just that we need to be > aware that they exist and how they work. Yep, wasn't pointing any fingies at you, was just a comment following your post for the greater audience :) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP textbook suggestions?
I'd still like some actual recommendations for a good book for beginners. My "PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide" has already been mentioned by someone and gets good reviews. If you want something more basic, I wrote "PHP for the World Wide Web: Visual QuickStart Guide" for the non-programmer. It goes at a much slower pace but obviously doesn't cover as much. Although neither is technically a textbook, both are used as textbooks in high school and college classes. For a recommendation without the self-interest, the Thomson and Welling "PHP and MySQL " (Sams) is a very good book (I forget the title, but it is good and thorough). Whatever you look at, make sure you get the latest editions. I know that Amazon doesn't necessarily offer up the latest edition of a book, so you sometimes need to click on "All Editions" to see if it's been updated. Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need a working SOAP example using PHP SOAP
Daevid Vincent wrote: >> not very helpful, but an apt quote from 'the man': >> http://fplanque.net/Blog/devblog/2005/12/21/rasmus_i_don_t_like_soap > > Yeah, unfortunately, I *must* use SOAP. Not my choice, but politics and > company decree, blah blah... > >> b, you should catch exceptions > > These were the examples from the page. I didn't want to add extra > complexity. none the less your production code should include try/catch blocks to catch soapfault exceptions and deal with them accordingly. > >> c, could you be having a problem related to the >> allow_url_fopen ini setting? > > Now we're talkin! > > Okay, I made sure that allow_url_fopen and allow_url_include are both "on". > Verified via phpinfo(); > > Still no luck. :-\ > > However, this sparked an idea... > > I have been using my WinXP and IE to hit my Gentoo notebook running > apache2/php/etc. (samba mounting the /home/machine/... to edit the files) > > When I fired up KDE and hit the EXACT same pages (which are now local), they > magically worked! > > So now the question is, what setting do I have to change in my php.ini file > to get remote requests to work? I'm not following what you mean by local and remote and when your considering something to be one or the other. windows firewall springs to mind but I can't tell if it could even be involved from your current description. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP4 vs PHP5
In my opinion, it is very safe to go for PHP5 (it's been out for a long time now). Also, PHP5 has a lot of built-in functionality that you will definitely feel you're lacking in case you go for PHP4. And don't forget, PHP4 will be deprecated sooner or later (I'm sure the developers will not really like the idea of maintaining 3 PHP versions once PHP6 is released). All in all, PHP5 is a very wise choice at the moment. -- itoctopus - http://www.itoctopus.com ""Fernando Cosso"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi > I know this topic has to be discussed several times but I have a situation I > need some advices. > > I am working in a small company. The company does everything you need. > Computer service, sell computers, install servers, web page, etc. I am in > the web department. The guys from the server installation and that stuff are > using a modified debian, which for default in his stable release has php4 > and apache 1.33. > I am new at the company and I have to decide what I need and what I am going > to do. My choice is to use the CMS Mambo and make the modification that each > client would ask. > So I've seen that php5 has a lot of cool staff, like mysqli and the new (and > faster) object oriented thing. I would like to know if it is "safe" to use > this version. I know that mambo use objects so I think that php5 will do a > better job running it. I also think php5 (or php6) is the future we can use > php4 for ever. > So whats your opinion? > Thanks > > A last comment: I apologize for my English, please let me know you didn't > understand something > > -- > [EMAIL PROTECTED] > http://www.fernandocosso.com.ar > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Submitting as POST. Why?
At 9:11 PM -0400 4/6/07, Robert Cummings wrote: On Fri, 2007-04-06 at 20:44 -0400, Mike Shanley wrote: > With POST, everything stays hidden, mostly untamperable, and Bullshit. It is VERY easy to tamper with post data. Please provide an example. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: link counting
Use the function is_url (note that I haven't written it) instead to check if the link is a URL. Not only your method may count some links twice, but it will count wrong URLs also. External is not a URL that will take someone externally. Below is the function is_url function is_url($url) { return preg_match('#^http\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $url);} taken from this link: http://plurged.com/code.php?id=26 -- itoctopus - http://www.itoctopus.com "Sebe" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > i thought of an idea of counting the number of links to reduce comment spam. > > unfortunately my methods is not reliable, i haven't tested it yet > though.. anyone have maybe a better solution using some regexp? > > $links = array('http://', 'https://', 'www.'); > > $total_links = 0; > foreach($links as $link) > { > $total_links = substr_count($string, $link); > } > > if($total_links > X) > { > . > } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Submitting as POST. Why?
POST is mainly used to modify data, GET is mainly used to show data. -- itoctopus - http://www.itoctopus.com "barophobia" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > My Peeps, > > I only know of one reason to submit a form as POST and that is because > you can submit more data in one shot. > > > What other reasons are there? > > > > Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP has encountered an Access Violation at 01F13157?!?!?!?
use IIS. Tijnema ! wrote: On 4/7/07, Afan Pasalic <[EMAIL PROTECTED]> wrote: hi, I just installed php 5.2.1-win32-installer on win box (XP). use IIS. created index.html file and localhost/index.html is ok. created phpinfo.php (with only phpinfo()) and was ok. then installed Zend 5.5.0 (try) and suddenly, IE is giving me blank screen. installed firefox 2 and got the error message from subject line. according google and php.net, it's bug?!? any idea? thanks for any help. -afan So, what are the error messages in your firefox? and do you have any error messages in your apache error log? Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Submitting as POST. Why?
At 4/7/2007 03:10 AM, Stut wrote: The difference between get and post is not what you *can* do, it's what you *should* do. Get, as the name implies, should be used when retrieving a page. The URL, including the query string, should contain info needed to retrieve the right page. No significant changes to either session or persistant data should be made in response to a get request. Post is used to send data to the server, and should be used when modifying something. That something could be 'the logged in user' (in the case of a login form), or 'a blog entry' (in the case of a blog entry editor form). Put more simply, get requests should not make significant changes to the data or state of your website, always use post requests for that. These implied "rules" have existed since HTTP was invented, and when you think about it they make a lot of sense. They also get emphasized by the existance of so-called web accelerators that simply pre-fetch URLs on the page the user is viewing. If you have simple links (i.e. get requests) that make changes to your websites data or state, the accelerator will seriously screw it up. Of course, in today's web, making a page request often modifies data on the server -- consider breadcrumb managers, search engine databases, Google analytics, web stats, page counters, page-generation processes, etc. And then there are the ubiquitous spiders (both friendly and unfriendly) that walk our sites all the time, exploring all the links. And spiders don't restrict themselves to following hyperlinks -- consider the spam robots that activate contact forms and forum engines. The moral of the story is: don't put get links OR post actions on your pages that result in automatic modification of significant data without thoughtful validation of incoming data. As always. Regards, Paul __ Paul Novitski Juniper Webcraft Ltd. http://juniperwebcraft.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP has encountered an Access Violation at 01F13157?!?!?!?
already did. though, my "expertize" is telling me: install php4 instead php5 :D Tijnema ! wrote: On 4/7/07, Tijnema ! <[EMAIL PROTECTED]> wrote: On 4/7/07, Afan Pasalic <[EMAIL PROTECTED]> wrote: > hi, > I just installed php 5.2.1-win32-installer on win box (XP). use IIS. > created index.html file and localhost/index.html is ok. > created phpinfo.php (with only phpinfo()) and was ok. > then installed Zend 5.5.0 (try) and suddenly, IE is giving me blank screen. > installed firefox 2 and got the error message from subject line. > > according google and php.net, it's bug?!? > > any idea? > > thanks for any help. > > -afan So, what are the error messages in your firefox? and do you have any error messages in your apache error log? Tijnema I'm sorry, i didn't read your title, so i didn't know what your error was, but it is a bug. Take a look here: http://bugs.php.net/bug.php?id=40662 There hasn't been a solution posted, because there were no backtraces provided. If you could provide them, it might solve the bug. Also, this bug appeared in PHP5RC3 too, there was a fix, but link is dead, and the fix they tell is "Use CVS snapshot.", and of course that would worked then, but that's not relevant anymore, as the thead is from jun 2004, anyway if you want to read it: http://bugs.php.net/bug.php?id=29127 Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MD5 & bot Question
At 11:56 PM +0100 4/6/07, Tijnema ! wrote: On 4/6/07, tedd <[EMAIL PROTECTED]> wrote: At 2:55 PM +0100 4/6/07, Tijnema ! wrote: I know, but animated gifs are still quite easy to read with a bot. Really? What if I a created a box surrounded by letters, like so: A B C D E F G H I However, where "E" is located I have a gif (animated or not) pointing to a letter, which would be the key. How would a bot read that? Cheers, tedd Assuming you're using the same arrow the whole time, you could use md5 check for example. Save MD5 for all directions of the arrow and compare :) Tijnema: Okay, here's an example: http://sperling.com/a/arrows/ How would someone MD5 that? Furthermore, how would a bot decipher anything different from that? From my perspective, no matter which way the arrow is pointing, the code remains the same. The only thing that changes is the arrow and a screen reader would have to be programmed to recognize the change -- am I wrong? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with table in database and login scripts.
Team, I want to know if my table is setup correctly. I am creating a site where team owners control fantasy football teams. Imaginary teams. They can trade players, add and drop them as long as they are under the salary cap at all times. if not they are given a warning to make a different move or something along those lines. I have created a table for league_members. Can you tell me if I have this set up correctly. This will be for the register.php form Field Type Attributes Null Default Extra Action fantasyteamname varchar(30) No firstname varchar(20) No lastname varchar(30) No username varchar(10) No emailaddress varchar(50) No 0 address varchar(50) No city varchar(30) No state varchar(30) No zipcode tinyint(5) No 0 homephonenumber tinyint(4) No 0 mobilephonenumber tinyint(4) No 0 favoriteprofootballteam varchar(50) No 0 favoritecollegeteam varchar(50) No 0 Then once register they should be taken to login screen then once logged in they should be taken to their team page IE cougars.php or something like that. Can you all please give me a how to write a script on that and let me know if I did the table right? Karl James ("TheSaint") [EMAIL PROTECTED] [EMAIL PROTECTED] www.theufl.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Idea/Suggestion for PHP App
looks like I didn't get the question. I thought he's asking how to start a project. to start to learn php of course you don't need paper and pencil. books, online tutorials, php.net and time. though, for a new project (if you never did similar before and if you don't already have the code you can reuse), a sketch/outline of the application's architecture/structure with a paper and a pencil is time saving. :) -afan tedd wrote: At 9:59 PM +0200 4/5/07, [EMAIL PROTECTED] wrote: and yes, I (still) use paper and pencil because never find good app for it. if you can recommend - I'll be more than happy to use it and stop wasting paper (agree with you on "poor tree" :D) -afan Pencil and paper? What's that? I had a good friend who said -- "A program is nothing more than three steps: input; calculation; and display." I've always found that's a good start. tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Design Dilemma - Database Data Abstraction
I have a dilemma on a design where I humbly ask your help. I'm working on the model part of a web application (not to be understood in the "web2.0" way, but in a more general way, where anything mounted on HTTP is a web application) done in PHP5 following the MVC design pattern. But the strong point is that the result must be those-who-never-RTFM-proof. But that's not my dilemma, I only mention this so that no RoR concept or similar is thrown into the table, that is, NO ActiveRecord. The solution I presented is to access, and act upon, a database as if they were PHP arrays, meaning that a table is presented as an array of records. Here comes my dilemma. But first let me explain a bit about the scenario so far: * It's aceptable that some restrictions are set upon the DB structure, only if at least the following constructions are allowed: a) tables with only one field in the PK (usually an autonumeric int). b) tables with a one-to-many relationship with itself, and one field PK (a tree structure). c) tables with a one-to-one relationship, and at most two fields in the PK, and if there are two, one is a FK. d) tables with a one-to-many relationship with one of the before mentioned tables, at most two fields in the PK, and if there are two, one is a FK. e) tables that create a many-to-many relationship between two of the before mentioned tables, with possibly extra fields other than the fields of the relationship, at most three fields int the PK, and if there are two or more, two of them are FK. * The actions than will be more used to access the data will be: a) get one record using its PK, or a combination of FKs where it applies. b) get one record using a unique key. c) update or delete one record using its PK. d) insert one record e) loop on many records of one table, all or just one "page", or those related to a FK. f) order the records before the loop My dilemma is as follows: a PHP array is a construct more restricted than a DB table. In a PHP array the index is either an int or a string, in a table de index can be any combination of fields. Then, my problem is how to design coherently the indexing of the arrays that represent the DB tables. I could index by the order as they are presented by the DB: $DB['users'][0] is the first user from the query "SELECT * FROM users" $DB['users'][1] is the second user from the query "SELECT * FROM users" etc.. But this have many cons. First, without a deterministic order, the array can change its logic order on the whim of the DB, nobody assures that the order will be kept after a modification is made to the data, and this can be confusing and error prone: $name1 = $DB['users'][3]['name']; $name2 = $DB['users'][5]['name']; $DB['users'][3]['name'] = $name2; $DB['users'][5]['name'] = $name1; The last sentence may not be writing to the adequate record. But this indexation has its pros. It can be used with a traditional for loop (although it will prove inefficient in most cases). And the records after and before can be easily obtained. Another possible indexation could be by the value of the PK, but this also have some problems. First, it can be confusing if the PK is an autonumeric int, as this might be seen as a numeric indexation. Second, not all tables have only one field as PK (I can ask that all tables have at least a PK, but I can't ask that the PK is made of only one field). But I have many pros with this strategy. I solve the actions on one record using the PK (only if the PK is made of only one field): $user = $DB['users'][$userid]; // get $DB['users'][$userid] = $user; // update or insert $DB['users'][] = $userid; // insert unset($DB['users'][$userid]); // delete I think I could use other than ints and strings in the array index, but I rather stick to keeping this as seemingly equal to PHP arrays. I also could use FK relationships to solve this, for example, if tone table has an index made of two fields, one is an FK to another table, I could make one table look as an array inside the other: foreach ($DB['users'][$userid]['address_book'] as $address) { ... } In this case address_book refers to another table rather than a field (I would have to ask that there are no fields with the same name). This table has an FK to the id of the users tables and one other record working as a PK. Accesing the array this way I have one of the values of the PK (the user id), and I use the other as the array index. There is also the problem with many-to-many relationships. If there was only one table that related two tables in this way, I could do the following: $DB['users'][$userid]['groups'] <- groups where the user belongs $DB['groups'][$groupid]['users'] <- the users of a group There would be a third table other than users and groups which doesn't show up. But, what to do when there is more than one relationship table for the same two tables? And if the relationship table also had some extra fields? Also the delete action presents some problems:
Re: [PHP] PHP4 vs PHP5
Fernando Cosso wrote: > Hi > I know this topic has to be discussed several times but I have a > situation I > need some advices. > > I am working in a small company. The company does everything you need. > Computer service, sell computers, install servers, web page, etc. I am in > the web department. The guys from the server installation and that > stuff are > using a modified debian, which for default in his stable release has php4 > and apache 1.33. > I am new at the company and I have to decide what I need and what I am > going > to do. My choice is to use the CMS Mambo and make the modification > that each > client would ask. > So I've seen that php5 has a lot of cool staff, like mysqli and the > new (and > faster) object oriented thing. I would like to know if it is "safe" to > use > this version. I know that mambo use objects so I think that php5 will > do a > better job running it. I also think php5 (or php6) is the future we > can use > php4 for ever. > So whats your opinion? > Thanks > > A last comment: I apologize for my English, please let me know you didn't > understand something > What about the argument that PHP4 is dead. It's done. It's over. There is no reason anyone should be using it, less perhaps a lack of time to tweak scripts for an upgrade from 4 to 5. Even if that is the case, get to work :p "Support for PHP 4 will be dropped at the end of the year, 8 months from now. So now is the time to start upgrading all your scripts as we won't be releasing new versions after December 31st, 2007." http://derickrethans.nl/php_quebec_conference_rip_php_4.php Travis Doherty -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Submitting as POST. Why?
On Apr 7, 2007, at 9:26 AM, tedd wrote: At 9:11 PM -0400 4/6/07, Robert Cummings wrote: On Fri, 2007-04-06 at 20:44 -0400, Mike Shanley wrote: > With POST, everything stays hidden, mostly untamperable, and Bullshit. It is VERY easy to tamper with post data. Please provide an example. curl... the web developer extension to firefox... make a form on your computer that posts to another server (action=wherever_you_want_it_to_go method=post)... It's trivial to modify POST data... Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Submitting as POST. Why?
On Sat, 2007-04-07 at 10:26 -0400, tedd wrote: > At 9:11 PM -0400 4/6/07, Robert Cummings wrote: > >On Fri, 2007-04-06 at 20:44 -0400, Mike Shanley wrote: > > > With POST, everything stays hidden, mostly untamperable, and > > > >Bullshit. It is VERY easy to tamper with post data. > > Please provide an example. All those spam bots that trawl the web making advertising posts on blogs, and forums. In almost every case they make a post. CURL is your friend. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP has encountered an Access Violation at 01F13157?!?!?!?
In news: [EMAIL PROTECTED], Afan Pasalic wrote on : >> hi, >> I just installed php 5.2.1-win32-installer on win box (XP). use IIS. >> created index.html file and localhost/index.html is ok. >> created phpinfo.php (with only phpinfo()) and was ok. >> then installed Zend 5.5.0 (try) and suddenly, IE is giving me blank >> screen. installed firefox 2 and got the error message from subject >> line. >> >> according google and php.net, it's bug?!? >> >> any idea? >> >> thanks for any help. >> >> -afan I had the same thing when using installer do a manual instal. http://t56.hopto.org/out/index.htm for help Chris -- Cheap As Chips Broadband http://yeah.kick-butt.co.uk Superb hosting & domain name deals http://host.kick-butt.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: link counting
On 4/7/07, itoctopus <[EMAIL PROTECTED]> wrote: Use the function is_url (note that I haven't written it) instead to check if the link is a URL. Not only your method may count some links twice, but it will count wrong URLs also. External is not a URL that will take someone externally. Below is the function is_url function is_url($url) { return preg_match('#^http\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $url);} taken from this link: http://plurged.com/code.php?id=26 Hmm, it does only take http links, not https,ftp, etc. Tijnema -- itoctopus - http://www.itoctopus.com "Sebe" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > i thought of an idea of counting the number of links to reduce comment spam. > > unfortunately my methods is not reliable, i haven't tested it yet > though.. anyone have maybe a better solution using some regexp? > > $links = array('http://', 'https://', 'www.'); > > $total_links = 0; > foreach($links as $link) > { > $total_links = substr_count($string, $link); > } > > if($total_links > X) > { > . > } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: link counting
Tijnema ! wrote: On 4/7/07, itoctopus <[EMAIL PROTECTED]> wrote: Use the function is_url (note that I haven't written it) instead to check if the link is a URL. Not only your method may count some links twice, but it will count wrong URLs also. External is not a URL that will take someone externally. Below is the function is_url function is_url($url) { return preg_match('#^http\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $url);} taken from this link: http://plurged.com/code.php?id=26 Hmm, it does only take http links, not https,ftp, etc. Tijnema I came up with this, not sure if there is a better/faster way but it works for me. it's case insensitive so you don't have to use strtolower() preg_match_all('%http://|https://|ftp://%i', $string, $links); if(count($links[0]) > 2) { // error... } -- itoctopus - http://www.itoctopus.com "Sebe" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > i thought of an idea of counting the number of links to reduce comment spam. > > unfortunately my methods is not reliable, i haven't tested it yet > though.. anyone have maybe a better solution using some regexp? > > $links = array('http://', 'https://', 'www.'); > > $total_links = 0; > foreach($links as $link) > { > $total_links = substr_count($string, $link); > } > > if($total_links > X) > { > . > } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MD5 & bot Question
On 4/7/07, tedd <[EMAIL PROTECTED]> wrote: At 11:56 PM +0100 4/6/07, Tijnema ! wrote: >On 4/6/07, tedd <[EMAIL PROTECTED]> wrote: >>At 2:55 PM +0100 4/6/07, Tijnema ! wrote: >>>I know, but animated gifs are still quite easy to read with a bot. >> >>Really? >> >>What if I a created a box surrounded by letters, like so: >> >>A B C >>D E F >>G H I >> >>However, where "E" is located I have a gif (animated or not) pointing >>to a letter, which would be the key. How would a bot read that? >> >>Cheers, >> >>tedd > >Assuming you're using the same arrow the whole time, you could use md5 >check for example. Save MD5 for all directions of the arrow and >compare :) Tijnema: Okay, here's an example: http://sperling.com/a/arrows/ How would someone MD5 that? Furthermore, how would a bot decipher anything different from that? From my perspective, no matter which way the arrow is pointing, the code remains the same. The only thing that changes is the arrow and a screen reader would have to be programmed to recognize the change -- am I wrong? Cheers, tedd Well, I cracked it for you :) http://86.86.80.41/dev/debug/tedd.php At the bottom it shows you the MD5 code of your arrow image, and it shows you which way it points to :) If you're interested in the code: http://86.86.80.41/dev/debug/tedd.txt Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Bind IP with fsockopen
Hi is it possible to socket_bind with fsockopen? im using this with all my scripts... $fs = fsockopen('example.com', 2043, $errno, $errstr, 60); if (!$fs) { fclose($fs); and I need the remote conection to see me as one of my other IP's Ive read through socket_bind http://uk.php.net/manual/en/function.socket-bind.php but cant see how to use it with my above code Thanks
[PHP] spl DirectoryIterator
I have a problem, I need to turn an iterator into an array, but when I do, some methods I need to use stop working. Take a look at the following example: $dir = 'c:/'; $files = new DirectoryIterator($dir); //$files = iterator_to_array($files); foreach ($files as $file) { echo "{$file->getFileName()}";//works echo "{$file->getPath()}";//works } It works as expected. However, when the iterator is turned into an array: $dir = 'c:/'; $files = new DirectoryIterator($dir); $files = iterator_to_array($files); foreach ($files as $file) { echo "{$file->getFileName()}"; //does not work echo "{$file->getPath()}";//works } It stops working. Can someone please help me, as a have tried and failed to find the cause of the problem. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Bind IP with fsockopen
On 4/7/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Hi is it possible to socket_bind with fsockopen? im using this with all my scripts... $fs = fsockopen('example.com', 2043, $errno, $errstr, 60); if (!$fs) { fclose($fs); and I need the remote conection to see me as one of my other IP's Ive read through socket_bind http://uk.php.net/manual/en/function.socket-bind.php but cant see how to use it with my above code Thanks I'm not sure if it's possible, it depends on the setup of switches etc. You're remote connection is outside your LAN right? If so, then your IP address is assigned by your ISP, this is assigned for each connection. I guess you have more then one connection from your ISP, then you have more then one IP. So if you have more then one connection, you have more then one modem/router. So if you want to use the IP of another connection, you should connect through another router/modem. But this depends on your setup, and has nothing to do with PHP. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP4 vs PHP5
Travis Doherty wrote: What about the argument that PHP4 is dead. It's done. It's over. There is no reason anyone should be using it, less perhaps a lack of time to tweak scripts for an upgrade from 4 to 5. Even if that is the case, get to work :p "Support for PHP 4 will be dropped at the end of the year, 8 months from now. So now is the time to start upgrading all your scripts as we won't be releasing new versions after December 31st, 2007." http://derickrethans.nl/php_quebec_conference_rip_php_4.php Travis Doherty This is fine, as long as the newer versions are backwardly compatible. If , in particular, if the next version or version 6 does not support the PHP 4 object oriented model, it could present real problems for some software. PHP isn't used only for "scripts" but for large projects. For example, I just began to configure a DokuWicki installation, writing code for various features which are not included in the install. DokuWicki uses the PHP 4 object oriented model throughout, and user plugins, such as mine, are written to the same model. DokuWicki contains over 300 php files and more than 3 megs of code. It would be no small task to convert such a project over to the PHP 5 OO model. -- _ Myron Turner http://www.room535.org http://www.bstatzero.org http://www.mturner.org/XML_PullParser/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: spl DirectoryIterator
After some testing and reading, I think this function is still experimental. Anyone else has some thoughts on this? -- itoctopus - http://www.itoctopus.com "Matthew Dellar" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I have a problem, > > I need to turn an iterator into an array, but when I do, some methods I > need to use stop working. > > Take a look at the following example: > > $dir = 'c:/'; > $files = new DirectoryIterator($dir); > //$files = iterator_to_array($files); > foreach ($files as $file) { > echo "{$file->getFileName()}";//works > echo "{$file->getPath()}";//works > } > > It works as expected. However, when the iterator is turned into an array: > > $dir = 'c:/'; > $files = new DirectoryIterator($dir); > $files = iterator_to_array($files); > foreach ($files as $file) { > echo "{$file->getFileName()}"; //does not work > echo "{$file->getPath()}";//works > } > > It stops working. Can someone please help me, as a have tried and failed > to find the cause of the problem. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MD5 & bot Question
At 10:33 PM +0200 4/7/07, Tijnema ! wrote: On 4/7/07, tedd <[EMAIL PROTECTED]> wrote: At 11:56 PM +0100 4/6/07, Tijnema ! wrote: On 4/6/07, tedd <[EMAIL PROTECTED]> wrote: At 2:55 PM +0100 4/6/07, Tijnema ! wrote: I know, but animated gifs are still quite easy to read with a bot. Really? What if I a created a box surrounded by letters, like so: A B C D E F G H I However, where "E" is located I have a gif (animated or not) pointing to a letter, which would be the key. How would a bot read that? Cheers, tedd Assuming you're using the same arrow the whole time, you could use md5 check for example. Save MD5 for all directions of the arrow and compare :) Tijnema: Okay, here's an example: http://sperling.com/a/arrows/ How would someone MD5 that? Furthermore, how would a bot decipher anything different from that? From my perspective, no matter which way the arrow is pointing, the code remains the same. The only thing that changes is the arrow and a screen reader would have to be programmed to recognize the change -- am I wrong? Cheers, tedd Well, I cracked it for you :) http://86.86.80.41/dev/debug/tedd.php At the bottom it shows you the MD5 code of your arrow image, and it shows you which way it points to :) If you're interested in the code: http://86.86.80.41/dev/debug/tedd.txt Tijnema Tijnema: You did more than crack it for me -- you broke my brain. Now I have to figure out what the heck is going on. It's one of those love/hate things -- on one hand a love a challenge and on the other I hate the idea that I was clueless about it. So what you did was to load in each arrow image, md5() the image file, get the results and manually match them to the solution, place that in an array, and then use those results to crack it. Damn, that's sweet! I never thought about an image file producing an unique hash string. I learn something new every day, and I'm getting damned tired of it. :-) Thanks for the education. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Bind IP with fsockopen
I have a dedicated server with a number of IP addresses. When you make a connection through fsockopen it connects using the servers main IP address. What I want to do is specify which of my IP addresses fsockopen uses. Thanks - Original Message - From: "Tijnema !" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: Sent: Saturday, April 07, 2007 11:54 PM Subject: Re: [PHP] Bind IP with fsockopen On 4/7/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Hi is it possible to socket_bind with fsockopen? im using this with all my scripts... $fs = fsockopen('example.com', 2043, $errno, $errstr, 60); if (!$fs) { fclose($fs); and I need the remote conection to see me as one of my other IP's Ive read through socket_bind http://uk.php.net/manual/en/function.socket-bind.php but cant see how to use it with my above code Thanks I'm not sure if it's possible, it depends on the setup of switches etc. You're remote connection is outside your LAN right? If so, then your IP address is assigned by your ISP, this is assigned for each connection. I guess you have more then one connection from your ISP, then you have more then one IP. So if you have more then one connection, you have more then one modem/router. So if you want to use the IP of another connection, you should connect through another router/modem. But this depends on your setup, and has nothing to do with PHP. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MD5 & bot Question
Well, I cracked it for you :) http://86.86.80.41/dev/debug/tedd.php At the bottom it shows you the MD5 code of your arrow image, and it shows you which way it points to :) If you're interested in the code: http://86.86.80.41/dev/debug/tedd.txt Tijnema Tijnema: Okay, I think I figured out a fix -- try it again. :-) http://sperling.com/a/arrows/ A little knowledge is a dangerous thing. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MD5 & bot Question
tedd wrote: Okay, I think I figured out a fix -- try it again. :-) http://sperling.com/a/arrows/ A little knowledge is a dangerous thing. Give up now, while you're still sane. Think about what you're trying to do. You're trying to do something different on the client every time, but without letting that client know something is different. It really really really can't be done. Something needs to be visually different, therefore something in what the client gets needs to be different. Do you see why it's not possible now? -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MD5 & bot Question
Stut wrote: tedd wrote: Okay, I think I figured out a fix -- try it again. :-) http://sperling.com/a/arrows/ A little knowledge is a dangerous thing. Give up now, while you're still sane. Think about what you're trying to do. You're trying to do something different on the client every time, but without letting that client know something is different. It really really really can't be done. Something needs to be visually different, therefore something in what the client gets needs to be different. Do you see why it's not possible now? -Stut ah, but it is possible, if he could change the color of the background and arrow on each page refresh, then it would be pretty damn hard to cache all the possible combinations of that, plus toss in a few random degrees of difference with say 3 arrows that point to the right, but one is at 90 deg's while another is at 88 and another yet at 92. This would make things almost impossible for a computer to see, but the chances of a human screwing it up would be almost impossible. Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP4 vs PHP5
Although I rarely post here (mostly lurking)... I would think that the mere fact that support for PHP4 ends in 8 months should be in and of itself a strong argument for the server admins. In my current position, I code and am responsible for a few different servers. It's certainly a strong argument in my eyes. I'm also kind of surprised that with the amount of time that PHP5 has now been out that this is still a question for some people. (not directed at you but maybe the server admins) Once again, pretty strong argument is, if support for PHP4 is being dropped. that must mean that there is much confidence that PHP5 is mature enough... to be the only supported version in being rolled out in production environments. That's my 2 cents worth. Yves On 4/7/07, Fernando Cosso <[EMAIL PROTECTED]> wrote: I am making a new project, so if you are telling me that php5 is mature enough I will code for that version. I'm sure Mambo is ready for php5. The thing is that I have to give pretty good arguments (like some page at zend or php.net or whatever) to the guys that install the server. I also know that debian wait until the last moment to put new versions. Best regards -- [EMAIL PROTECTED] http://www.fernandocosso.com.ar -- Yves Arsenault "Love is the only force capable of transforming an enemy into a friend". --Martin Luther King, Jr.
Re: [PHP] Re: PHP4 vs PHP5
On Sat, 2007-04-07 at 21:15 -0300, Yves Arsenault wrote: > Although I rarely post here (mostly lurking)... > > I would think that the mere fact that support for PHP4 ends in 8 months > should be in and of itself a strong argument for the server admins. > > In my current position, I code and am responsible for a few different > servers. > > It's certainly a strong argument in my eyes. > > I'm also kind of surprised that with the amount of time that PHP5 has now > been out that this is still a question for some people. (not directed at you > but maybe the server admins) > > Once again, pretty strong argument is, if support for PHP4 is being > dropped. > that must mean that there is much confidence that PHP5 is > mature enough... The above line does not follow from any kind of logical reasoning. A in no way implies B as you have ascertained from thin air. > to be the only supported version in being rolled out in > production environments. Or... there's some strong arming happening to force the move. PHP4 userbase greatly outnumbers the PHP5 userbase. I think the userbase speaks louder than the support timeframe. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP4 vs PHP5
Myron Turner wrote: > Travis Doherty wrote: > >>> >> >> What about the argument that PHP4 is dead. It's done. It's over. >> There is no reason anyone should be using it, less perhaps a lack of >> time to tweak scripts for an upgrade from 4 to 5. Even if that is the >> case, get to work :p >> >> "Support for PHP 4 will be dropped at the end of the year, 8 months from >> now. So now is the time to start upgrading all your scripts as we won't >> be releasing new versions after December 31st, 2007." >> >> http://derickrethans.nl/php_quebec_conference_rip_php_4.php >> >> Travis Doherty >> >> > > This is fine, as long as the newer versions are backwardly > compatible. If , in particular, if the next version or version 6 does > not support the PHP 4 object oriented model, it could present real > problems for some software. PHP isn't used only for "scripts" but for > large projects. For example, I just began to configure a DokuWicki > installation, writing code for various features which are not included > in the install. DokuWicki uses the PHP 4 object oriented model > throughout, and user plugins, such as mine, are written to the same > model. DokuWicki contains over 300 php files and more than 3 megs of > code. It would be no small task to convert such a project over to the > PHP 5 OO model. DokuWiki should run just fine under PHP5. It may throw some E_STRICT errors warning of things that will be deprecated in a later major PHP release. I doubt DokuWiki needs register_globals, and magic_quotes shouldn't be a question. Use the strict level warnings as hints to help you find what needs to be modified in your own code. Travis Doherty -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ribs (rsync) problem
anyone here using the ribs php rsync script? i keep getting: rsync: link_stat "/home/site" failed: No such file or directory (2) does the directory structure need to match on both local/remote servers? example, i'm trying to back up /home/site to /home/backup not sure if the remote backup server has to be /home/site as well.. or if the problem is in the php script as i'm running php5. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP4 vs PHP5
Robert Cummings wrote: >Or... there's some strong arming happening to force the move. PHP4 >userbase greatly outnumbers the PHP5 userbase. I think the userbase >speaks louder than the support timeframe. > >Cheers, >Rob. > > Damien Seguy's latest stats showing the adoption rates of PHP5 show what Rob said. http://www.nexen.net/chiffres_cles/phpversion/16814-php_stats_evolution_for_march_2007.php I'm sure many of the polled domains are shared hosts, who have users, which exponentially complicates the task of migration. Travis Doherty -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] xdebug with Quanta
Does anyone use xdebug with QUanta? Could you give a tutorial to use it? Or give me a website link about this? Tnx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Bind IP with fsockopen
Hi, Sunday, April 8, 2007, 6:51:46 AM, you wrote: cac> Hi is it possible to socket_bind with fsockopen? im using this with all my scripts... cac> $fs = fsockopen('example.com', 2043, $errno, $errstr, 60); cac> if (!$fs) { cac> fclose($fs); cac> and I need the remote conection to see me as one of my other IP's cac> Ive read through socket_bind cac> http://uk.php.net/manual/en/function.socket-bind.php cac> but cant see how to use it with my above code cac> Thanks You will have to do it using the socket api something like this but with error checking: -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Design Dilemma - Database Data Abstraction
At 4/7/2007 09:49 AM, Martin Alterisio wrote: The solution I presented is to access, and act upon, a database as if they were PHP arrays, meaning that a table is presented as an array of records. This implies to me that you'll read a series of tables into arrays, modify the arrays, then update or recreate the database tables from the arrays. I can't really see how this can work for multiple users because as soon as a second user reads and starts modifying the data there will be obvious discontinuities between the two data snapshots, and updating the tables from one user will erradicate changes made by others. Is this a single-user application you're working on? I could index by the order as they are presented by the DB: $DB['users'][0] is the first user from the query "SELECT * FROM users" $DB['users'][1] is the second user from the query "SELECT * FROM users" etc.. But this have many cons. First, without a deterministic order, the array can change its logic order on the whim of the DB, nobody assures that the order will be kept after a modification is made to the data, and this can be confusing and error prone: $name1 = $DB['users'][3]['name']; $name2 = $DB['users'][5]['name']; $DB['users'][3]['name'] = $name2; $DB['users'][5]['name'] = $name1; The last sentence may not be writing to the adequate record. Hmm. I don't see why this wouldn't work -- you're not changing the keys (3 & 5) required to point to those unique records. I can see a problem if $name1 and $name2 were themselves the keys, but you're not doing that in this example. If that were the problem, though, you could simply mandate a rule that you can never change the key of an array element that represents a data record, so that the record sequence remains what it was originally. However, making your program logic depend on the record sequence as it was read from the database seems quite iffy anyway [especially in a multi-user system]; I'd just use the data table's primary key as the array key and leave it at that. Random access rocks! From what you write, it almost seems as though you're assuming that these statements: $DB['users'][3]['name'] = $name2; $DB['users'][5]['name'] = $name1; actually modify the database records they represent. If so, what system are you using? I just don't see this happening using simple PHP and MySQL. When you read a data record into a PHP array [with, for example, mysql_fetch_array()] that array is just a static copy of the data and doesn't possess any dynamic updating power over the database. Or are you using an I/O class that you're not showing in your example code that executes a modifying query each time an "array element" is changed? Another possible indexation could be by the value of the PK, but this also have some problems. First, it can be confusing if the PK is an autonumeric int, as this might be seen as a numeric indexation. You can prefix an autonumber field with alphabetic characters to force it away from numeric indexing: $sKey = str_pad($aDataRecord['recno'], $iPadLength, 'pk_00', STR_PAD_LEFT); $aArray[$sKey] = $aDataRecord; e.g., recno 12345 becomes array key 'pk_012345' Using str_pad(...LEFT) ensures that the array keys will be in the same sequence as the data records even though the autonumber values will be composed of differing numbers of digits. You just have to choose a pad length that equals the longest series of digits your database will generate for an autonumber field. Second, not all tables have only one field as PK (I can ask that all tables have at least a PK, but I can't ask that the PK is made of only one field). You can construct a single array key from multiple database fields: $aArray['pk_' . $aDataRecord['fieldA'] . '_' . $aDataRecord['fieldB']] = $aDataRecord; unset($DB['users'][$userid]); // delete Unsetting the array element, rather than retaining it with a deletion marker, implies that you're intending to recreate the database tables rather than update them atomically. Is this correct? Regards, Paul __ Paul Novitski Juniper Webcraft Ltd. http://juniperwebcraft.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Simple question on simplexml
Hello, You can use following example:) body[0]->addChild("book", "Atatürk The Rebirth Of A Nation"); ?> Republic Of Turkey - Ministry of National Education Education Technology Department Ankara / TURKEY Web: http://www.haydartuna.net "Timothy Murphy" <[EMAIL PROTECTED]>, haber iletisinde sunlari yazdi:[EMAIL PROTECTED] > > I have a catalog in XML format: > > > >... > > >... > > ... > > > Now I want to add another book, > which I have as a SimpleXMLElement: > >$book = new SimpleXMLElement($string); > > where $string reads > >... > > > Can I add this new entry to the catalog > using SimpleXML functions, > or do I have to introduce a DOMDocument? > > As may be obvious, I am very new to PHP programming; > and advice or suggestions gratefully received. > > -- > Timothy Murphy > e-mail (<80k only): tim /at/ birdsnest.maths.tcd.ie > tel: +353-86-2336090, +353-1-2842366 > s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: read only texbox to html with php
Hello, If you use read only textbox in HTML, you can use like a following HTML code.:) -- Republic Of Turkey - Ministry of National Education Education Technology Department Ankara / TURKEY Web: http://www.haydartuna.net ""Ross"" <[EMAIL PROTECTED]>, haber iletisinde þunlarý yazdý:[EMAIL PROTECTED] >I have a readonly textbox that gets mailed as a newsletter. The text is a >standard covering letter. The problem is when I try and convert it to html >it doesn't work It is inserted into a variable via a form textarea >$mail_text. > > "available on the web site href="http://www.myurl.org";>http://www.myurl.org so you can see who is > doing." > > I tried this > > htmlentities((stripslashes($mail_text))); > > > Any ideas? > > R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: form validation
Hello, You can use javascript and Ajax together. If you use the ajax, you can validate your data with PHP code. Please visit the web site below. You will find information about PHP and Ajax::) http://www.w3schools.com/php/default.asp -- Republic Of Turkey - Ministry of National Education Education Technology Department Ankara / TURKEY Web: http://www.haydartuna.net "al phillips" <[EMAIL PROTECTED]>, haber iletisinde sunlari yazdi:[EMAIL PROTECTED] > I''ve tried !preg_match and !eregi to validate my form. I get back > whatever the user inputs into the textboxes. I would like to validate each > textbox before submitting and redirect the user after submission? Here's > part of the code > > // Should accept First & Last Name email address phone city state > // Validate input from textfields > > if (!preg_match("/[^a-zA-Z\.\-\Ä\ä\Ö\ö\Ü\ü\ > ]+$/s",$firstname)); { > print 'Please enter Letters from A to Z'; > } > > > - > 8:00? 8:25? 8:40? Find a flick in no time > with theYahoo! Search movie showtime shortcut. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Bind IP with fsockopen
Hi, TR> You will have to do it using the socket api something like this but TR> with error checking: TR> $sourceip = '192.168.1.1'; // ip you want to bind to TR> $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); TR> socket_bind($sock, $sourceip); TR> socket_connect($sock, 'example.com', 2043); TR> // Write TR> $request = 'GET / HTTP/1.1'."\r\n".'Host: example.com'."\r\n\r\n"; TR> socket_write($sock, $request); TR> //Read reply TR> // Close TR> socket_close($sock); Another option using streams (php5): array( 'bindto'=>'192.168.1.1:0' //any port will do ) ); $context = stream_context_create($opts); $html = file_get_contents('http://example.com:2043', false, $context); -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php