[PHP] php or juvascript convert IETF format to ISO08601
Hello Evrybody, Can i convert IETF format (ex: Wed, 18 Oct 2009 13:00:00 EST) in ISO8601 format (ex: 2009-11-05T13:15:30Z) Does somebody know some php scripte or similar? Thanks... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Documentation
Hello All, I finished with coding and now I am on the part when need to write documentation. But I don't know how to write correct documentation. Does have some rules or standard for writing documentation for PHP? Or maybe have some programs for writing documentations? Best Regards, Jordan JOVANOV -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] work online
Hello Everybody, Does somebody know company for PHP programing where people can work from home? Actual I only want to know does have regular or part time job for PHP developers who work from home via internet. Thanks a lot. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Search inside file :)
Hello everybody, I create one site where user can upload .zip files, but now I have one interesting problem. I need me PHP script where can have one edit box and button, user can input same text in edit box and when press on button he need to find the document who have text from edit button. Do you same body have script or more on script who can search inside in same file (zip file with word document, presentation etc). Thanks a lot. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Install library
Hello All, I have one very funny question. A need me PDFlibrary. Can somebody tall me how can I download and install on my server this library. I use PuTTy to connect to my server. Does somebody know the command line for download in istall library in php. Thanks a lot. Best Regards, Jordan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Hi
Hi All I need me a little help. I create scripte for upload file is work very good but the problem is next: I neet to upload only .zip file i need to disable some user to shoise to upload another file Extensions. Can somebody help me. Thanks a lot. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HTTPS SSL
Hello everybody I need me a little help. I have one web page with hhtp protocol, but i need to change in https. Somebody tell me that I need to create some SSL certificate. I use some Apache server. Do you somebody know does is easy and can i do? Does need to write some php scripts or anything? Thanks a lot. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HTTPS
Hello I have one web page with hhtp protocol, but i need to change in https. Do you somebody know does is easy and can i do? Does need to write some php scripts or anything. Thanks a lot. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Text editor for Ubuntu with FTP
Hello to All, I only whant to star discussion for who is the best programm to write php and html script. I use dreamweaver, but now I change my OS to ubuntu and I want some suggestions for some Text editor for FTP for Ubuntu Thanks A lot Jordan Jovanov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Do you have some standard for defined the variable in program language?
Hello Everybody I start to write PHP script and all veritable a defined without some rules. I want to ask to you somebody know how is correct do different some variable. Like from next three variable who is correct: $firstname $FirstName $firstName $first_name etc. I know that from this variable can work all, but i want to know how is use in company. Do you have some standard for defined the variable in program language? (like ISO9001, ISO14001) Best Regard, Jordan Jovanov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Video lessons
On 24/07/2010 02:14, David Hutto wrote: On Fri, Jul 23, 2010 at 8:13 PM, David Huttosmokefl...@gmail.com wrote: On Fri, Jul 23, 2010 at 2:35 PM, Dan Josephdmjos...@gmail.com wrote: On Thu, Jul 22, 2010 at 10:04 AM, Jordan Jovanovjovanovj...@gmail.comwrote: Im thing that I'm little layse, Do you somebody know PHP VIDEO LESSONS? I'm not sure exactly what you're meaning there, but check out www.lynda.com -- -Dan Joseph http://www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month. Promo Code NEWTHINGS for 10% off initial order -- Reseller Plans also available! http://www.facebook.com/canishosting http://www.facebook.com/originalpoetry http://www.facebook.com/teaserleaguehttp://www.facebook.com/apps/application.php?id=135491833139465 Have you tried searching at youtube, or google. I'd suggest 'php video tutorials lessons' as the search term without out even trying it first myself. I you want, you can copy and paste my suggestion into the search box, that way it eliminates any excess activity on your part. Thankw for suggestions. The site www.lynda.com is very good, this is a realy I want, and of course a forgot for youtube.com Best regard Jordan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Text editor
Hello All I need me to add form for comment to one web site, but i want to use some taxt edtior. Simething similar of this editor http://www.seekcodes.com/text-editor.php , but i can not find the code. Do you somebody know some simple text editor with buttons for bold italic etc. Thanks a lot. Jordan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Text editor
On 27/07/2010 13:53, Ashley Sheridan wrote: On Tue, 2010-07-27 at 13:49 +0200, Dušan Novaković wrote: You can use TinyMCE. It's really easy to integrate in system. Check on official website. Dusan On Tue, Jul 27, 2010 at 12:10 PM, Jordan Jovanovjovanovj...@gmail.com wrote: Hello All I need me to add form for comment to one web site, but i want to use some taxt edtior. Simething similar of this editor http://www.seekcodes.com/text-editor.php , but i can not find the code. Do you somebody know some simple text editor with buttons for bold italic etc. Thanks a lot. Jordan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- mob: + 46 70 044 9432 web: http://novakovicdusan.com Please consider the environment before printing this email. I've always found CKEditor (formerly known as FCKEditor after its author) to be better than TinyMCE. It also has JQuery support should you be using that Javascript framework. They also have plenty of example documentation to integrate it with pretty much any server-side language you need to, including PHP. Thanks, Ash http://www.ashleysheridan.co.uk Thanks to all, Thanks to all for suggestions, but of course i must to choose only one, and choose TiniMCE after suggestions of Dusan. Fala Dusan :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Do you have some standard for defined the variable in program language?
On 7/27/2010 12:38 PM, Andre Polykanine wrote: Hello viraj, As for classes, it's suggested to start a class name with a capital: class MyBestClass { ... } As for functions and class methods, there are lots of people who name them like this: function the_greatest_function_in_the_world () { ... } Maybe it's readable and great, but I have a little problem: I'm using a screenreader, so the word underscore (and its Russian equivalent) is too long for me. So I prefer function TheGreatestFunctionInTheWorld () { ... } However, just discussed it with my wife. She prefers the same method as me, though she doesn't use any screenreading software for developing. Hello All First thanks for all suggestions, I find some document from 2003 year and plane to use this standard everybody who what can see on next link http://www.dagbladet.no/development/phpcodingstandard/ Best Regards Jovanov Jordan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Video lessons
Hello Im thing that I'm little layse, Do you somebody know PHP VIDEO LESSONS? Thanks a lot. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Dynamic menu
Hello All, I am new in this group and first whant to say hello to all. Need me menu who have different link if user is login or logout, something like dynamic menu. Somebody can tall me how can i use and create this menu. Thansk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Copy documents for another site.
Hello I create one site like document menage system and nide to take some date information from another site. The problem is a don't have access to date base. The site from who I need to take infomations use .htdacces but I have user and password for enter to site and i look the information. I write one php scripte but is not work. Do you somebody know how can I copy inflammations from this site to mine (from this site to my database) Thanks a lot and this is a php scirpte ?php $url = 'url site'; $username='user'; $password='pass'; $context = stream_context_create(array( 'http' = array( 'header' = Authorization: Basic . base64_encode($username:$password) ) )); $data = file_get_contents($url, false, $context); echo $data; echo file_get_contents(http://$username:$passw...@site/meetings/;); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Good PHP book?
Ashley Sheridan a écrit : On Sun, 2008-12-14 at 16:33 -0600, jeffery harris wrote: Hi guys/gals. I'm a first time user. Does anyone know of a good php book? I tend to trust O'Reilly books a lot for all things programming, although I learnt largely with 'PHP, Apache, MySQL Web Development' from WROX. Ash www.ashleysheridan.co.uk Yes, I am agree with Ashley. This book must be read. But first, you should read the whole php documentations as Tim said (available on HTML offline). There is everything in it. Good luck ! Zeuf I learned from PHP For Dummies. -- 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] advice on sql injection/XSS prevention
Actually there is a tool available for automated validation of PHP code. It's called static source code analysis which, very simply stated, acts like a spell checker for custom developed code. This tool is very accurate at finding, especially SQL injection and XSS, and can be run directly against the source code so it doesn't need the application to be up and running. This company http://www.armorize.com/services/securityasaservice?utm_source=jordanutm_medium=post is offering this kind of tool delivered as a service directly over the Web which means you can either request that those authorized people verify thier code security before posting, or you can do it after they have posted. The tool shows the vulnerability as well as the tainted origin that introduces it and provides fix suggestions, etc so everything can be fixed in a very short time with very little effort -- no installation required. From: Zoltán Németh [EMAIL PROTECTED] To: Bing Du [EMAIL PROTECTED] CC: php-general@lists.php.net Subject: Re: [PHP] advice on sql injection/XSS prevention Date: Thu, 05 Apr 2007 16:23:23 +0200 I think it is generally a Bad Idea to allow users to submit code into your system... you would be better off if you would provide some pseudo-coding possibilities which would allow them to insert certain functionalities into their content - with you providing the real code running behind and replacing the pseudo-codes with the process results greets Zoltán Németh 2007. 04. 5, csütörtök keltezéssel 09.17-kor Bing Du ezt Ãrta: Hi, I'm not an experienced PHP developer. We're hosting a content management system that allow authorized people to add PHP contents. Their PHP coding levels varies. Some are very security sensitive, but some are not. I want to know if PHP has any ready-to-use funtion to validate form input to help prevent SQL injection/XSS? So each programmer doesn't have to write their own form validation code. I'd appreciate any advice or pointers. Thanks in advance, Bing -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Message offline contacts without any fire risk! http://www.communicationevolved.com/en-za/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Security!!! www.armorize.com
Hi, I would like to introduce a new tool for verifying your PHP application's security. Our product uses the most advanced static source code analysis for identifying vulnerabilities in PHP code. Right now we are working with our version 1.17 which has improved functionality, speed and coverage. We have an under 5% false positive rate which drops to under 1% with a little configuration. Our false negatives are negligible! Our language parser and transformer creates an abstract model of the code through which it runs a series of program path, inter-procedural and data flow analyses after which it can tell you not only what line of code the vulnerability lies, but also highlights the tainted variable that introduced the bug and how it propagates throught the code to become a vulnerability. This provides an end to end illustration of the vulnerability, educates you regarding the dymanics of security problems in PHP and actually provides suggetions of how you should go abuout fixing the code. The best part is that becuase it is static analysis, the application does not need to be up and running, so you can run the scans during development. We are launching our Security-as-a-Service model which represents the hosting of our core technology at our RD center, all you need to do is log-on via your Web browser and you can verify your application's security. Today we are introducing the SaaS model and are providing it on a monthly subscription basis. Purchase for one month and fix your entire code base, when you need to modify your application again, it will only cost you that month's subscription. Our introductory price is very low for this kind of tool, because there is no tool as advanced as this. But you need not take my word for it, write to [EMAIL PROTECTED] to apply for a free 2-day trial account. Please inlcude a valid business e-mail, your name, and phone number (optional). The first 50 subscribers will recieve a full month's subscription at 50% discount. The first 25 will recieve 2 months at 50% discount. Check out our website at www.armorize.com Jordan _ Share folders without harming wildlife! http://www.communicationevolved.com/en-za/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP equivalent to Perl $0
On 1/31/07, Richard Luckhurst [EMAIL PROTECTED] wrote: Hi In Perl there is the predefined $0 which contains the name of the file containing the Perl script being executed. Is there an equivalent in PHP? I am working on converting a Listener script from Perl to PHP and at one point when the script forks it has a line $0 = Listener is accepting connections on Port $port; When this Perl script is running and I do a ps I see a process ID with the program being Listener is accepting connections on Port $port instead of the actual name of the Perl script. Is such a thing possible in PHP? If so how? I have been Google searching for a while and can not see one way or the other if it is possible. Regards, Richard Luckhurst Product Development Exodus Systems - Sydney, Australia. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __FILE__ contains the full path and filename of the file on the filesystem. There are several $_SERVER indices that give something you can get the filename/path from as well. See http://us2.php.net/manual/en/reserved.variables.php -- Kevin Jordan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fwd: [PHP] Fwd: Entries no longer appear in search
Damn, wish replyto was set, I keep doing that. -- Forwarded message -- From: Kevin Jordan [EMAIL PROTECTED] Date: Jan 30, 2007 4:07 PM Subject: Re: [PHP] Fwd: Entries no longer appear in search To: Chris [EMAIL PROTECTED] Sorry, wasn't sure it went through the first time. On 1/29/07, Chris [EMAIL PROTECTED] wrote: No need to keep posting the same question over and over again. If anyone has suggestions, they will reply. Kevin Jordan wrote: -- Forwarded message -- From: Kevin Jordan [EMAIL PROTECTED] Date: Jan 28, 2007 6:21 PM Subject: Fwd: Entries no longer appear in search To: php-general@lists.php.net, [EMAIL PROTECTED] This was originally sent to the OpenLDAP list, but it was rejected because I mentioned PHP and phpLDAPadmin and said I should send it to the appropriate lists there. -- Forwarded message -- From: Kevin Jordan [EMAIL PROTECTED] Date: Jan 27, 2007 4:24 PM Subject: Entries no longer appear in search To: openldap-software@openldap.org I'm having the random problem of an OpenLDAPperson entry just no longer showing up in the search results, causing havoc on my logins. I used phpLDAPadmin to administer LDAP and I also use PHP wrappers (they store all the information and then use the ldap functions to modify the entry) to change information on my pages. A simple move and then move back seems to work to fix it, so they aren't completely gone, but they just don't show up in the search. Has anyone else experienced this problem? -- Kevin Jordan -- Kevin Jordan -- Postgresql php tutorials http://www.designmagick.com/ -- Kevin Jordan -- Kevin Jordan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Fwd: Entries no longer appear in search
-- Forwarded message -- From: Kevin Jordan [EMAIL PROTECTED] Date: Jan 28, 2007 6:21 PM Subject: Fwd: Entries no longer appear in search To: php-general@lists.php.net, [EMAIL PROTECTED] This was originally sent to the OpenLDAP list, but it was rejected because I mentioned PHP and phpLDAPadmin and said I should send it to the appropriate lists there. -- Forwarded message -- From: Kevin Jordan [EMAIL PROTECTED] Date: Jan 27, 2007 4:24 PM Subject: Entries no longer appear in search To: openldap-software@openldap.org I'm having the random problem of an OpenLDAPperson entry just no longer showing up in the search results, causing havoc on my logins. I used phpLDAPadmin to administer LDAP and I also use PHP wrappers (they store all the information and then use the ldap functions to modify the entry) to change information on my pages. A simple move and then move back seems to work to fix it, so they aren't completely gone, but they just don't show up in the search. Has anyone else experienced this problem? -- Kevin Jordan -- Kevin Jordan -- Kevin Jordan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Fwd: Entries no longer appear in search
This was originally sent to the OpenLDAP list, but it was rejected because I mentioned PHP and phpLDAPadmin and said I should send it to the appropriate lists there. -- Forwarded message -- From: Kevin Jordan [EMAIL PROTECTED] Date: Jan 27, 2007 4:24 PM Subject: Entries no longer appear in search To: openldap-software@openldap.org I'm having the random problem of an OpenLDAPperson entry just no longer showing up in the search results, causing havoc on my logins. I used phpLDAPadmin to administer LDAP and I also use PHP wrappers (they store all the information and then use the ldap functions to modify the entry) to change information on my pages. A simple move and then move back seems to work to fix it, so they aren't completely gone, but they just don't show up in the search. Has anyone else experienced this problem? -- Kevin Jordan -- Kevin Jordan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
FW: FW: [PHP] Re: Please hack my app
Hi Ivo, Jordan forwarded me your mail to provide some technical explanation. First of all, sorry for the delay, due to recent business travels and out-of-office events, I haven't had a lot of time to go through my mailbox. The product version that you were using is a trial version, which does not support all of the most recent improvements we've added (version 1.2 will be released in January). You encountered one of the limitations, when you noticed that calling your own functions caused a vulnerability. Due to the way our algorithms analyzes and processes information flow through function calls, we can sometimes determine a user-defined function to be vulnerable, regardless of the parameters passed to it. One simple (artificial) example would be the following situation: function update_last_login($user_id) { mysql_query('insert into users (id, login_date) values (' . $user_id . ',' . $_GET['date'] . ')'); } No matter if you sanitize $user_id or not, the function will always pass an unsanitized user parameter into an SQL query, so the function call will always lead to a vulnerability - this would even happen if there were no function parameters. In that situation, the current trial version will report those calls to your user defined function vulnerable, possibly without finishing the tainted information flow trace to the actual sensitive method (the mysql_query in the case above). A complete traceback with a more fine-grained reporting level has already been implemented by not yet deployed to the trail servers. By the way, we would greatly appreciate any feedback that you could give us concerning usability and performance of the trial account. If you have any more technical questions, please don't hesitate to contact me. Best regards, Christian Hang Chief Software Architect Armorize Technologies, Inc. email: [EMAIL PROTECTED] -Original Message- From: Ivo F.A.C. Fokkema [mailto:I.F.A.C. [EMAIL PROTECTED] Sent: Saturday, December 02, 2006 12:28 AM To: php-general@lists.php.net Subject: Re: FW: [PHP] Re: Please hack my app Hi Jordan, Thank you for your offer. As you know, I've signed up a couple of days ago. I ran a scan yesterday and have gotten a big PDF file out of it. I've quickly scanned through the results and it appears there are a lot of times when I use one of my own functions (sometimes even without an argument) it finds a vulnerability. I will analyze the results more detailed later on. Would you appreciate comments on the service? Thanks again, Ivo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: FW: [PHP] Re: Please hack my app
Hi Ivo, Sorry for the late reply, I have been traveling. I am assigning someone to your case who will assist you in understanding the cause of the inclusion of the vulnerability in your own functions. To my understanding it is that it could be the result of a repetition of an instance discovered in your function. If you are then to include the function a number of times, the vulnerability will be identified in all those instances. However, I am assigning someone to this question who will give you a better answer, his name is Chris. As to your comments, I would greatly appreciate them. Thanks and all the best, Jordan Forssman Sales Manager Armorize Technologies US: Tel: +1-408-512-4052 ext. 201 Fax: +1-408-247-1570 TW: Tel. +886-2-6616-0100 ext. 201 Cell. +886-938-100-214 Fax. +886-2-6616-1100 Skype: jordan4z [EMAIL PROTECTED] -Original Message- From: Ivo F.A.C. Fokkema [mailto:I.F.A.C. [EMAIL PROTECTED] Sent: Saturday, December 02, 2006 12:26 AM To: php-general@lists.php.net Subject: Re: FW: [PHP] Re: Please hack my app Hi Jordan, Thank you for your offer. As you know, I've signed up a couple of days ago. I ran a scan yesterday and have gotten a big PDF file out of it. I've quickly scanned through the results and it appears there are a lot of times when I use one of my own functions (sometimes even without an argument) it finds a vulnerability. I will analyze the results more detailed later on. Would you appreciate comments on the service? Thanks again, Ivo On Tue, 28 Nov 2006 14:19:30 +0800, Jordan Forssman wrote: Hi, My name is Jordan Forssman, I am representing a company called Armorize Technologies. We have developed a source code analysis platform for PHP, called CodeSecure, which scans source code for SQL injection, cross site scripting, command injection, etc, vulnerability. The tool will tell you exactly which line the vulnerability is on, explain the propagation of the tainted variables, and assist you in fixing the bug. I believe this tool will help you verify the security of your application and will be able to do so very quickly. At the moment we are scanning around 20 000 lines in under 5 minutes, or 1M in about 2 minutes, depending on the application. Currently we are accepting applications for trial accounts, if you would like to use our tool to scan your code please log on to http://www.armorize.com/events/trialapplication and submit the form. We are just starting our sales and marketing effort so I hope you can use our product and give us some feedback. If you want to know more about our company and product you can find us at: www.armorize.com , download our datasheets and whitepapers at www.armorize.com/resources/download . The trial is free and can be accessed over the Web, we are using the trials as a test case for offering the product as a service and also to promote the product. Once I receive your application I will send you an e-mail with a quickstart guide and login details. If you have any questions, please feel free to contact me anytime. Best Regards, Jordan Forssman Sales Manager Armorize Technologies Tel. +886-2-6616-0100 ext. 201 Cell. +886-938-100-214 Fax. +886-2-6616-1100 Skype: jordan4z [EMAIL PROTECTED] [EMAIL PROTECTED] -Original Message- From: Ivo F.A.C. Fokkema [mailto:I.F.A.C. [EMAIL PROTECTED] Sent: Monday, November 27, 2006 6:01 PM To: php-general@lists.php.net Subject: [PHP] Re: Please hack my app On Wed, 22 Nov 2006 09:57:50 +0100, Ivo F.A.C. Fokkema wrote: Hi List, As this subject may start you wondering what the hell I'm thinking, let me clearify: I've been rewriting an GPL'ed PHP/MySQL app from scratch for the last 12 months or so. It facilitates storage of DNA mutations and the corresponding patient data. Because patient data is involved, privacy is very important. Now of course I read lots of pages on SQL injection and whatnot, and I strongly believe my application is protected from this kind of abuse. However, believing is not enough. I've had some comments in the past about security (previous version of the software) and although I didn't agree to the critic, I want to be able to say the new app went though various forms of attacks. This month, I want to release 2.0-alpha-01... *** THIS IS NOT ABOUT HACKING THE SERVER *** But about getting in the application when you're not allowed to! If you feel like helping me out, it's located at http://chromium.liacs.nl/LOVDv.2.0-dev/ 1) Please try to get in. There's one account in the system, a database administrator, capable of doing anything. If you get in, you can easily create a new user using the setup tab. This will be the prove of you breaking my security rules. 2) Can you manage to view unpublic data? Using the Variants tab, you can see there is currently one entry in the database (with two mutations). This entry has a hidden column, called 'Patient ID
FW: [PHP] Re: Please hack my app
Hi, My name is Jordan Forssman, I am representing a company called Armorize Technologies. We have developed a source code analysis platform for PHP, called CodeSecure, which scans source code for SQL injection, cross site scripting, command injection, etc, vulnerability. The tool will tell you exactly which line the vulnerability is on, explain the propagation of the tainted variables, and assist you in fixing the bug. I believe this tool will help you verify the security of your application and will be able to do so very quickly. At the moment we are scanning around 20 000 lines in under 5 minutes, or 1M in about 2 minutes, depending on the application. Currently we are accepting applications for trial accounts, if you would like to use our tool to scan your code please log on to http://www.armorize.com/events/trialapplication and submit the form. We are just starting our sales and marketing effort so I hope you can use our product and give us some feedback. If you want to know more about our company and product you can find us at: www.armorize.com , download our datasheets and whitepapers at www.armorize.com/resources/download . The trial is free and can be accessed over the Web, we are using the trials as a test case for offering the product as a service and also to promote the product. Once I receive your application I will send you an e-mail with a quickstart guide and login details. If you have any questions, please feel free to contact me anytime. Best Regards, Jordan Forssman Sales Manager Armorize Technologies Tel. +886-2-6616-0100 ext. 201 Cell. +886-938-100-214 Fax. +886-2-6616-1100 Skype: jordan4z [EMAIL PROTECTED] [EMAIL PROTECTED] -Original Message- From: Ivo F.A.C. Fokkema [mailto:I.F.A.C. [EMAIL PROTECTED] Sent: Monday, November 27, 2006 6:01 PM To: php-general@lists.php.net Subject: [PHP] Re: Please hack my app On Wed, 22 Nov 2006 09:57:50 +0100, Ivo F.A.C. Fokkema wrote: Hi List, As this subject may start you wondering what the hell I'm thinking, let me clearify: I've been rewriting an GPL'ed PHP/MySQL app from scratch for the last 12 months or so. It facilitates storage of DNA mutations and the corresponding patient data. Because patient data is involved, privacy is very important. Now of course I read lots of pages on SQL injection and whatnot, and I strongly believe my application is protected from this kind of abuse. However, believing is not enough. I've had some comments in the past about security (previous version of the software) and although I didn't agree to the critic, I want to be able to say the new app went though various forms of attacks. This month, I want to release 2.0-alpha-01... *** THIS IS NOT ABOUT HACKING THE SERVER *** But about getting in the application when you're not allowed to! If you feel like helping me out, it's located at http://chromium.liacs.nl/LOVDv.2.0-dev/ 1) Please try to get in. There's one account in the system, a database administrator, capable of doing anything. If you get in, you can easily create a new user using the setup tab. This will be the prove of you breaking my security rules. 2) Can you manage to view unpublic data? Using the Variants tab, you can see there is currently one entry in the database (with two mutations). This entry has a hidden column, called 'Patient ID'. There is a text-string in that column. If you can tell me what that string is, you win :) 3) Feel free to register as a submitter to see if that gives you any rights that you shouldn't have. A submitter is only capable of adding new data to the database (Submit tab), but that data will not be published immediately. 4) After a while, I will release login details of a curator account. This user is allowed to see non-public data and handle the specific gene, but NOT create new users or the like. If you have any questions, please ask. Thank you in advance for using your expertise for the good cause :) In case anyone is interested; I've created a low-level user ('untrusted') in the system. Password is equal to username. Feel free to try and do stuff you're not supposed to, like creating a new user or creating a gene. Ivo -- 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] Questions from a ColdFusion Developer
Robert Cummings [EMAIL PROTECTED] wrote:On Wed, 2005-12-14 at 21:34, Christopher Jordan wrote: Rob, Thanks for responding. :) I have more questions. I hope that's okay. :) *lol* No problem :) Thanks! :) You said: Share nothing refers to the PHP philosophy of not tying any data sharing system to the engine itself. In this way developers are free to create applications in such a way that if they need more power, they can just add more computers. - I guess I'm a little confused, by this and by what Jochem originally posted. I'm not sharing data between different computers within the application (if that makes sense). In other words, of course all my data (in this case inventory data) is in a MySQL table, and so multiple users could be accessing the data simultaneously. The session variable only serves to store (for display purposes, really) the results of the users last search. I also maintain a $_SESSION[LoggedIn] variable to keep track of whether the user has access in this session. Sorry, I was merely responding to your question about what share nothing meant. No worries. I'd still like to hear (from anybody, really) what specific business examples they have where this share nothing concept came into play. Also, I promise to go out and Google it to try and find out for my self, as soon as my work load dies down. I've got three projects going simultaneously and four more little ones (I hope) on the way. I'm sure most of you can relate. :) But, as long as people on this list are willing to discuss things with me and answer my questions, I'd greatly appreciate it! :) With respect to how this relates to you, your sessions and what Jochem wrote... If I read your above comment correctly it doesn't really sound like it applies to your problem only that you used ColdFusion to describe what you would have done in that environment. Sessions by nature are per user only and not application scoped. Of course. Jochem, feel free to jump in here if you've got time. :) Your comment may not have *really* applied to my specific situation, but I'm intrigued now. :) You said: This becomes a much more difficult issue when a program holds private data in memory that requires a specific way to access it. For instance if you stored some kind of application variable in memory (a la ColdFusion, Java, ASP) then this value would not be normally transparent to other computers without some kind of synchronization system to transfer it around. Perhaps I'm being dense (it wouldn't be the first time), or maybe a bit unimaginative, but I can't think of an instance where while a user is logged into an app and using it, that another computer (besides the web server, database server and the client machine), would need to have access to that data. Are you referring to state here? Or well other than passing data around between browser windows, I'm not really sure what you mean. I'd love it if you could find the time to expand on that. Imagine a configuration system loaded from a slow medium and cached in the running process for all subsequent page requests. The speed advantage is immense, but it violates the share nothing rule. Okay, I can see what you mean there. Only that *one* machine has the data cached, so if you were to want to spread the load out over several machines, they'd all have to cache the same configuration and any time it changed they'd all have to re-cache it, since none of the machines knows about the others... that kind of thing? To emulate this in PHP one would punt the cached data to a database so that it could be retrieved in a single lightweight query. In this respect PHP often differs from Java or ASP that often load configuration data and keep it resident for some time. That said, PHP merely forces the user into the share nothing philosophy, whereas Java lets the developer choose since anyone can write their code to share nothing if they want. In this regard-- protect the users from shooting themselves in the foot-- PHP often takes an arguably overzealous position. Okay, I think I'm starting to understand now. Right now, I'm working on a very large CF project for a national company and I'm trying to think of where I might apply the idea of the share nothing rule. Nothing leaps to mind, but it may when I least expect it. I'd still be interested in hearing from anyone who's applied this idea on any scale. Sometimes I've got to be beaten over the head with something before I can get my mind around it, so examples would help. Heck I'm *just now* starting to get to the Ah-ha! stage of OO programming (and I'm loving it, by the by), but it took what seems like forever to get there. You know? You Said: Using the share nothing philosophy such data doesn't generally exist, and if it does, then it is stored in a database. Databases are a better system for such data since they were designed
Re: [PHP] Questions from a ColdFusion Developer
Jochem, Thanks so much for your advice. In the end, I managed to find why that little EZSql tool wasn't working for me, and thus what I'm *really* putting into the session variable is an array. I understand also that each user would get a copy of the same session variables, but this is for a small antique dealer and there will only ever be one or two people using the admin screen which started this mess in the first place. Also, I'm using the auto_prepend_file to simulate the CF concept of an application.cfm which gets included at the start of every page. I've configured it such that if the include file doesn't exist in the application's directory, it then goes and gets an empty file of the same name to prepend from the default include path... pretty neat, actually. When you said: ...the strength and simplicity of PHP stem from the decision to make/keep PHP a 'share nothing' architecture. What did you mean, by that? I've not heard of this share nothing idea. What is the idea of share nothing and why is it a strength? I'd like to understand so if I'm doing something ass-backwards (read: inefficiently), that I can change what I'm doing. So far, things seem to be working for me, but perhaps there's an easier way to accomplish some of the stuff I'm doing, you know? I'd appreciate any time you could spend answering my questions. Thanks, Chris Jochem Maas [EMAIL PROTECTED] wrote: CF has an application scope - PHP does not. the strength and simplicity of PHP stem from the decision to make/keep PHP a share nothing architecture. with regard to shoving stuff in the SESSION superglobal: 1. it not shared between requests by different users - meaning that the SQL query you gave as an exmaple would still be run once by every visitor and each visitor would have a copy of the result set object. 2. performance-wise sticking objects in the session is possibly something to be avoided is possible - storage and retrieval of 'complex' structure (i.e. objects in this case) comes with a certain performance penalty (you might want to consider using an array to store the query results) 3. you MUST load the class definitions of ALL the objects that are in your session BEFORE you start the session. Christopher Jordan wrote: Hi folks, I'm a ColdFusion developer, but I'm branching out into PHP because alot of my smaller clients don't want to pay for CF. Anyway, a bit of background: I've got a page that does a search on one of my tables. I'm using Justin Vincent's ezSQL (http://php.justinvincent.com) to fetch the result set into an object that can be referenced nicely. Here's what his example code looks like: // Select multiple records from the database and print them out.. $users = $db-get_results(SELECT name, email FROM users); foreach ( $users as $user ){ // Access data using object syntax echo $user-name; echo $user-email; } So far so good. So I've got an iframe on the page which (I hope) will eventually display the results of the search. The user will then click on the search result for which they want to view the details, and the information from that row will be populated inside the main page (the one that houses the iframe). Hope that makes sense. Okay, so my trouble is that I don't know how to enable the page inside the iframe to have access to the result object created by Justin Vincent's nifty little class. In CF I can just say: session.oResults = queryname CF automatically returns any query as an object with the name of the query as the object name (i.e. queryname.MyIdField, or queryname.EmployeeNumber, etc.) Using a line like the one above (assigning the query object to a session variable) all of my subsequent requests would have access to that result set simply by using the object. I'm *sure* there's a way to do this in PHP. I'm just falling short of finding the answer. I've tried: $_SESSION[SearchResult] = $db-get_results($query); But it doesn't seem to work. I may have some other problem using the object. I just re-read my error and it says: Fatal error: Call to a member function get_results() on a non-object in inventorymanager.php on line 93 hmm... I sure would appreciate a little guidence here. Even if my problem is with the way I'm using the object, is the idea of assigning that object to the session scope the right way to do this or is there a better approach. To that end, I suppose I'm looking for an idea of the best practice. Thanks! Christopher Jordan Planet Access Arlington, TX - Yahoo! Shopping Find Great Deals on Holiday Gifts at Yahoo! Shopping - Yahoo! Shopping Find
Re: [PHP] Questions from a ColdFusion Developer
Rob, Thanks for responding. :) I have more questions. I hope that's okay. :) You said: Share nothing refers to the PHP philosophy of not tying any data sharing system to the engine itself. In this way developers are free to create applications in such a way that if they need more power, they can just add more computers. - I guess I'm a little confused, by this and by what Jochem originally posted. I'm not sharing data between different computers within the application (if that makes sense). In other words, of course all my data (in this case inventory data) is in a MySQL table, and so multiple users could be accessing the data simultaneously. The session variable only serves to store (for display purposes, really) the results of the users last search. I also maintain a $_SESSION[LoggedIn] variable to keep track of whether the user has access in this session. You said: This becomes a much more difficult issue when a program holds private data in memory that requires a specific way to access it. For instance if you stored some kind of application variable in memory (a la ColdFusion, Java, ASP) then this value would not be normally transparent to other computers without some kind of synchronization system to transfer it around. Perhaps I'm being dense (it wouldn't be the first time), or maybe a bit unimaginative, but I can't think of an instance where while a user is logged into an app and using it, that another computer (besides the web server, database server and the client machine), would need to have access to that data. Are you referring to state here? Or well other than passing data around between browser windows, I'm not really sure what you mean. I'd love it if you could find the time to expand on that. You Said: Using the share nothing philosophy such data doesn't generally exist, and if it does, then it is stored in a database. Databases are a better system for such data since they were designed for heterogeneous external access and quite handily solve the race condition and deadlock issues. --- Typically I think of the session variable scope as a way to preserve state. Are you suggesting that state be preserved by dumping information down to and then reading it again from a database? For example my session variable which indicates the user has successfully logged in... In speaking of *large* scale applications I suppose I might be able to see where you'd want something different than the session superglobal since the more users you have accessing the app and using that scope, the more memory it's taking up on the server. I thought cookies might be used in such cases. I don't usually use cookies, because ColdFusion has an configuration option of storing session data in the system registry (windows version obviously)... which alleviates the problem of running out of memory via the session scope. Have I completely missed your point? :) Thanks again, Chris Robert Cummings [EMAIL PROTECTED] wrote: On Wed, 2005-12-14 at 20:50, Christopher Jordan wrote: When you said: ...the strength and simplicity of PHP stem from the decision to make/keep PHP a 'share nothing' architecture. What did you mean, by that? I've not heard of this share nothing idea. What is the idea of share nothing and why is it a strength? I'd like to understand so if I'm doing something ass-backwards (read: inefficiently), that I can change what I'm doing. Share nothing refers to the PHP philosophy of not tying any data sharing system to the engine itself. In this way developers are free to create applications in such a way that if they need more power, they can just add more computers. This becomes a much more difficult issue when a program holds private data in memory that requires a specific way to access it. For instance if you stored some kind of application variable in memory (a la ColdFusion, Java, ASP) then this value would not be normally transparent to other computers without some kind of synchronization system to transfer it around. Then you run into race condition and deadlock issues. Using the share nothing philosophy such data doesn't generally exist, and if it does, then it is stored in a database. Databases are a better system for such data since they were designed for heterogeneous external access and quite handily solve the race condition and deadlock issues. That said, you can also use database replication so that multiple databases servers have an image of the same database, thus allowing even the database server to scale horizontally. So how does this relate to your mom and pop requirements... it doesn't really *lol*, but if you ever create something that becomes the next Google, it might just scale to a server farm of thousands of computers. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com
[PHP] Questions from a ColdFusion Developer
Hi folks, I'm a ColdFusion developer, but I'm branching out into PHP because alot of my smaller clients don't want to pay for CF. Anyway, a bit of background: I've got a page that does a search on one of my tables. I'm using Justin Vincent's ezSQL (http://php.justinvincent.com) to fetch the result set into an object that can be referenced nicely. Here's what his example code looks like: // Select multiple records from the database and print them out.. $users = $db-get_results(SELECT name, email FROM users); foreach ( $users as $user ){ // Access data using object syntax echo $user-name; echo $user-email; } So far so good. So I've got an iframe on the page which (I hope) will eventually display the results of the search. The user will then click on the search result for which they want to view the details, and the information from that row will be populated inside the main page (the one that houses the iframe). Hope that makes sense. Okay, so my trouble is that I don't know how to enable the page inside the iframe to have access to the result object created by Justin Vincent's nifty little class. In CF I can just say: session.oResults = queryname CF automatically returns any query as an object with the name of the query as the object name (i.e. queryname.MyIdField, or queryname.EmployeeNumber, etc.) Using a line like the one above (assigning the query object to a session variable) all of my subsequent requests would have access to that result set simply by using the object. I'm *sure* there's a way to do this in PHP. I'm just falling short of finding the answer. I've tried: $_SESSION[SearchResult] = $db-get_results($query); But it doesn't seem to work. I may have some other problem using the object. I just re-read my error and it says: Fatal error: Call to a member function get_results() on a non-object in inventorymanager.php on line 93 hmm... I sure would appreciate a little guidence here. Even if my problem is with the way I'm using the object, is the idea of assigning that object to the session scope the right way to do this or is there a better approach. To that end, I suppose I'm looking for an idea of the best practice. Thanks! Christopher Jordan Planet Access Arlington, TX - Yahoo! Shopping Find Great Deals on Holiday Gifts at Yahoo! Shopping
Re: [PHP] Why this doesn't work ?
why don't you just echo your $query to see if it is coming out correctly, before even trying to mess with mysql_query()? I think you should be able to see the problem from there. Jordan On Oct 24, 2005, at 12:44 PM, Mário Gamito wrote: Hi, Make this line instead $result = mysql_query($query) or die(mysql_error() . with the query $query; and you'll likely see the error. Here it goes: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(login) FROM formacao WHERE login = 'a'' at line 1 Regards, Mário Gamito -- 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] Declaring vars as INT ?
Hello, you could treat your variable as a string, and use the is_numeric() function (but this will include floats, too). To answer your question precisely and accurately, you may have to do regex matching since you are out of the bounds of int. However, why, *exactly*, are you trying to confirm that your string is an integer? It seems to me kind of cumbersome and unnecessary. If you provide more explicit information on what you are trying to do, your overarching goal for the script, including what are your inputs and intended outputs, along with some real code, we can probably find a solution that will do what you want without mucking about like this. Just my two cents. Jordan On Oct 21, 2005, at 2:39 PM, Chris Knipe wrote: Hi, Uhm... Let's take the below quickly: Function DoSomething($Blah) { $Blah = (int) $Blah; return $Blah } $Blah, cannot be larger than 2147483647, and sometimes, I get negative integers back from the above function. This is with PHP 4.4.0 on FreeBSD 5.4-STABLE. Can anyone else perhaps confirm this, and if it is indeed true, is this a bug, or a limitation somewhere on PHP? Any other ways to confirm that *large* numbers, are indeed integers? I'm working with numbers in the form of mmddsss (20051025001 for today for example) Thanks, 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] Declaring vars as INT ?
Also, look at this function: http://www.php.net/ctype_digit Jordan On Oct 21, 2005, at 2:39 PM, Chris Knipe wrote: Hi, Uhm... Let's take the below quickly: Function DoSomething($Blah) { $Blah = (int) $Blah; return $Blah } $Blah, cannot be larger than 2147483647, and sometimes, I get negative integers back from the above function. This is with PHP 4.4.0 on FreeBSD 5.4-STABLE. Can anyone else perhaps confirm this, and if it is indeed true, is this a bug, or a limitation somewhere on PHP? Any other ways to confirm that *large* numbers, are indeed integers? I'm working with numbers in the form of mmddsss (20051025001 for today for example) Thanks, 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] Ugh, w32 anything is making me want to drink!
I agree with John. It looks like you either need a hammer or the rooftop of a 5-story building... Jordan On Oct 21, 2005, at 3:26 PM, Jay Blanchard wrote: [snip] I just noticed that extension_dir in phpinfo is c:\php4 THAT AIN'T RIGHT! Why is PHP not loading the proper ini file? This is probably the source of my problems all along! ACK! This is what happens when you go over to the dark side. [/snip] It's not my fault! How do I fix this? -- 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] Trapping for an uploaded file that's too large?
On Oct 20, 2005, at 6:29 PM, Brian Dunning wrote: In my File Upload form, if the file is =2MB, the user just gets a blank error opening file screen, almost immediately after the upload starts. I don't know how to trap for this to give a more user-friendly experience. Can anyone point me in the right direction? are you using PHP 5? If so, maybe check out this, below. Jordan From: [EMAIL PROTECTED] Subject: Re: [PHP] Re: PHP 5 limits readfile to 1.9 MB? Date: August 17, 2005 10:26:40 AM CDT To: [EMAIL PROTECTED] Cc: php-general@lists.php.net In-Reply-To: [EMAIL PROTECTED] Ok, just checking (I am new to the fopen() function). That makes sense. Awesome, thanks! Jordan On Aug 17, 2005, at 10:19 AM, Catalin Trifu wrote: Hi, Indeed a fclose($fp) is needed (wrote it as an example :)). 1MB is more than enough as a buffer. If you have a 53MB file, what will happen then ? I have no idea if it's a bug or a feature. Either way I did lose some hair over this when I switched from PHP4 to PHP5. Catalin Jordan Miller wrote: Catalin, Wow, that worked great, thanks. I'm curious why you set a static buffer of 1024768... why not just do filesize($file), as shown at http://www.php.net/fread ? Is it better for memory usage to have a potentially smaller buffer? Also, you may want an fclose($fp) after the file has been downloaded. So is this a bug in PHP 5 or are they just purposely limiting the abilities of the readfile command? Jordan On Aug 17, 2005, at 3:36 AM, Catalin Trifu wrote: Hi, I've had a similar problem. The download always stopped at exactly 2.000.000 bytes. You have to work around that with: $fp = fopen($file, 'r'); if($fp) { while(!feof($fp)) { echo fread($fp, 1024768);//see the huge buffer to read into } } else { //whatever error handler } Catalin Jordan Miller wrote: Hello all, I am new to this list and I have searched the archives to no avail. I am having a peculiar problem when upgrading to PHP 5: My downloads are now limited to the first 1.9 MB of the file in question, with the download either terminating at 1.9 MB or seemingly continuously stuck in a downloading process at 1.9 MB. The code in the PHP script has not changed and all parameters that I could find that are relevant to this problem are given below: the minimal code needed for download: // $file_to_read is the complete path of the file to download header(Content-Type: application/pdf); header( Content-Disposition: inline; filename= \$filename \); $len = filesize($file_to_read); header(Content-Length: $len); @readfile($file_to_read); php.ini file for both php version 4 and 5 contain the following settings that may be relevant: allow_url_fopen = On max_execution_time = 300 ; Maximum execution time of each script, in seconds max_input_time = 300; Maximum amount of time each script may spend parsing request data memory_limit = 8M ; Maximum amount of memory a script may consume (8MB) post_max_size = 200M upload_max_filesize = 200M Some additional details: All files less than 1.9 MB download fine It is not a corrupted file, because all files larger than 1.9 MB fail after 1.9 MB The connection is not timing out (download of 1.9 MB takes only ~15 sec) Mac OS X 10.3.9 with Marc Liyanage's PHP 5.0.4 Fails for both Safari and Firefox Fails regardless of inline or attachment Fails regardless of pdf or ppt content-type This PHP code ALWAYS works for Marc Liyanage's PHP 4.3.4 with the same settings, above What am I doing wrong??? Any other parameter in php.ini I should have set? Any suggestions are much appreciated. thanks, Jordan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Recommended Reading?
Zandstra's PHP 5 objects patterns practice has been getting excellent reviews. i also recommend it. http://www.amazon.com/gp/product/1590593804/ On Oct 18, 2005, at 1:43 PM, Alan Lord wrote: Hi all, Forgive this long diatribe, a bit off-topic I know, but it might stimulate a good discussion... I have built a few small apps in PHP before and, whilst they work, I can't but help feeling that I go about the whole thing the WRONG way... I am not a professional software person (far from it) but I am reasonably competent in most things technical. I trained in Electronics, build my own PCs and Linux systems from scratch, have used - just for fun - Java, Delphi, Visual Basic, PHP and a little C/C++. I am now wanting to write my own application (using PHP of course) to do something really useful. And I am looking for some recommendations on reading [books or links] about how to design my application and how to think about the design in it's abstract form before I start writing code. Normally I end up writing little bits of code to solve small problems and then sort of kludging them together to do something useful. I would really like to try and go about this one the RIGHT way. Thanks in advance. Al -- 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: php-general Digest 17 Oct 2005 10:35:46 -0000 Issue 3742
if you have compiled php with pdflib support, you can do this fairly easily. see the manual: http://www.php.net/pdf Jordan On Oct 17, 2005, at 6:06 AM, Aftab Alam wrote: hi, any one can help me i want to generate Pdf file using php. how can i what tools is required for this. Regards, _ Aftab Alam -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, October 17, 2005 4:06 PM To: php-general@lists.php.net Subject: php-general Digest 17 Oct 2005 10:35:46 - Issue 3742 php-general Digest 17 Oct 2005 10:35:46 - Issue 3742 Topics (messages 224207 through 224218): Funky array question 224207 by: Brian Dunning 224209 by: Minuk Choi 224210 by: Jordan Miller 224211 by: Jordan Miller 224212 by: Jordan Miller Re: editor 224208 by: yangshiqi1089 a couple of problems with PHP form 224213 by: Bruce Gilbert 224218 by: Mark Rees Re: OPTIMIZING - The fastest way to open and show a file 224214 by: Ruben Rubio Rey 224215 by: Ruben Rubio Rey 224216 by: ac can't get IIS to run php if the script is not directly under wwwroot 224217 by: tony yau Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: php-general@lists.php.net -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Funky array question
Hello, what have you been trying for comparison so far that has not been working? if you have php 5, you would want to use stripos, which is case- INsensitive, not strpos, which is the opposite. Also, note the warning on the man page. you would want to use a triple equals sign !===false because stripos could return a zero or an empty string which is actually ==false. http://www.php.net/stripos/ if you do not have php 5, i would use regex so you can get case insensitivity. Jordan On Oct 16, 2005, at 11:18 PM, Minuk Choi wrote: Assuming that you are also accepting partial matches... (e.g. if you had a sentence with something like, Mr. LeBlue says hello, and that should be a match for blue) If $mysqlString contains 1 sentence from the mySQL database(I assume you've a loop or something that'll fetch 1 string per iteration) $resultStr = $mysqlString; $bFound=false; foreach ($myArray as $colorArray) { $firstTerm = $colorArray[0]; $secondTerm = $colorArray[1]; if (strpos($resultStr, $firstTerm)!==false) { $resultStr = $secondTerm; $bFound=true; } if ($bFound) break; } $mysqlString = $resultStr; Try that. Brian Dunning wrote: I want to create an array like this: $myArray=array( array('orange','A very bright color'), array('blue','A nice color like the ocean'), array('yellow','Very bright like the sun') ...etc... ) Sort of like a small database in memory. Then I want to compare each of the rows coming out of a MySQL call, which are sentences, against this array to see if the FIRST TERM in each array element is present in the sentence, and then display the SECOND TERM from the array for each sentence. Make sense? So for these two sentences, and the above array, here's how I want it to output: He used blue paint - A nice color like the ocean. The flower was yellow - Very bright like the sun. Can someone help me out with the code needed to search the sentence to which FIRST TERM appears in it, and retrieve the SECOND TERM? I've tried too many things and now my brain is tied in a knot. -- 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] Funky array question
sorry, I am mistaken here. I forgot that !== is the same functionality as a ===, in that the comparison is made by value *and* type. On Oct 16, 2005, at 11:26 PM, Jordan Miller wrote: Also, note the warning on the man page. you would want to use a triple equals sign !===false because stripos could return a zero or an empty string which is actually ==false. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Funky array question
one more thing... if you have php 5 and = 3.0.6, you could use stristr for case insensitive comparison without having to deal with the slower and more cumbersome regex. On Oct 16, 2005, at 11:18 PM, Minuk Choi wrote: Assuming that you are also accepting partial matches... (e.g. if you had a sentence with something like, Mr. LeBlue says hello, and that should be a match for blue) If $mysqlString contains 1 sentence from the mySQL database(I assume you've a loop or something that'll fetch 1 string per iteration) $resultStr = $mysqlString; $bFound=false; foreach ($myArray as $colorArray) { $firstTerm = $colorArray[0]; $secondTerm = $colorArray[1]; if (strpos($resultStr, $firstTerm)!==false) { $resultStr = $secondTerm; $bFound=true; } if ($bFound) break; } $mysqlString = $resultStr; Try that. Brian Dunning wrote: I want to create an array like this: $myArray=array( array('orange','A very bright color'), array('blue','A nice color like the ocean'), array('yellow','Very bright like the sun') ...etc... ) Sort of like a small database in memory. Then I want to compare each of the rows coming out of a MySQL call, which are sentences, against this array to see if the FIRST TERM in each array element is present in the sentence, and then display the SECOND TERM from the array for each sentence. Make sense? So for these two sentences, and the above array, here's how I want it to output: He used blue paint - A nice color like the ocean. The flower was yellow - Very bright like the sun. Can someone help me out with the code needed to search the sentence to which FIRST TERM appears in it, and retrieve the SECOND TERM? I've tried too many things and now my brain is tied in a knot. -- 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] why does this not work?
javascript is a client-side language, while php is a server-side language... the value you are passing to $width only exists on the client side, therefore the php server-side boolean fails. i think you will have to pass the client-side calculated variable of screen.width to the php server before you can do this properly, probably through a POST form or GET request. nice idea, though (dynamically loading css based on screen resolution). see: http://forums.devshed.com/t3846/s.html Jordan On Sep 27, 2005, at 3:20 AM, Ross wrote: This returns the correct value for $width but falls down on the boolean. I have tried intval/srtval but nothing seems to work. Maybe it is too early! $width = script document.write(screen.width); /script; //$ross= intval($width); echo $width; if ($width 1064) { echo lower; $style= style1.css; } else { $style= style2.css; } R. -- 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] Easy question - delete strings from the beginning of space...
to get rid of potential double spaces after the explode, you could do: foreach ($words as $word) { if (!empty($word)) { $first = $word; break; } } echo $first; This will always return the first word. Jordan On Sep 20, 2005, at 7:24 AM, Jochem Maas wrote: how much easier do you want it? oh and guessing kinda sucks. $str = Hello World; $words = explode( , $str); echo $words[0]; ... but what if you have double spaces, or a space at the beginning? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can I install versions of PHP/MySQL that will be compatible with my host server?
On Sep 19, 2005, at 8:31 AM, Jochem Maas wrote: e.g: $var = array_pop( explode('-', '1-2-3-4-5') ); .. is bad code (read the manual page for array_pop very carefully) and would work in older versions but the engine has been tightened up to disallow such fauxpas. Jochem, Whoa... what do you mean by this, exactly? I am running PHP 5.0.4 and $var is correctly set with the code you give above. I could not find anything like you describe in the array_pop manual (see below). Please elaborate on why this is bad code. Jordan array_pop (PHP 4, PHP 5) array_pop -- Pop the element off the end of array Description mixed array_pop ( array array ) array_pop() pops and returns the last value of the array, shortening the array by one element. If array is empty (or is not an array), NULL will be returned. Note: This function will reset() the array pointer after use. Example 1. array_pop() example ?php $stack = array(orange, banana, apple, raspberry); $fruit = array_pop($stack); print_r($stack); ? After this, $stack will have only 3 elements: Array ( [0] = orange [1] = banana [2] = apple ) and raspberry will be assigned to $fruit. See also array_push(), array_shift(), and array_unshift(). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can I install versions of PHP/MySQL that will be compatible with my host server?
That is very interesting, thank you. We cannot escape politics, eh? Jordan On Sep 19, 2005, at 9:32 AM, Jochem Maas wrote: Jordan Miller wrote: On Sep 19, 2005, at 8:31 AM, Jochem Maas wrote: e.g: $var = array_pop( explode('-', '1-2-3-4-5') ); .. is bad code (read the manual page for array_pop very carefully) and would work in older versions but the engine has been tightened up to disallow such fauxpas. Jochem, Whoa... what do you mean by this, exactly? I am running PHP 5.0.4 and what I meant an what I wrote apparently don't match up very well :-) I meant to give a valid example of when you can't pass the return value from a function to another function due to the fact that a reference is expected and in some situation the var you are passing is a reference to 'nothing' - which works in older version of php but is also the cause of a couple of weird/nasty inexplicable potential seg faults ... it was fixed, Derick opened his mouth, alot of people got angry - personally I don't give a shit because I only use 5.0.x (I'll be waiting until the shitstorm has died down before trying out 5.0.5 or 5.1 :-) maybe this helps to explain (alot) better what I was talking about ... http://phplens.com/phpeverywhere/?q=node/view/214 anyway thanks for the catch Jordan. $var is correctly set with the code you give above. I could not find anything like you describe in the array_pop manual (see below). Please elaborate on why this is bad code. Jordan array_pop (PHP 4, PHP 5) array_pop -- Pop the element off the end of array Description mixed array_pop ( array array ) array_pop() pops and returns the last value of the array, shortening the array by one element. If array is empty (or is not an array), NULL will be returned. Note: This function will reset() the array pointer after use. Example 1. array_pop() example ?php $stack = array(orange, banana, apple, raspberry); $fruit = array_pop($stack); print_r($stack); ? After this, $stack will have only 3 elements: Array ( [0] = orange [1] = banana [2] = apple ) and raspberry will be assigned to $fruit. See also array_push(), array_shift(), and array_unshift(). -- 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] Way for script to discover it's path?
Hey Ken, The variable you want is already a superglobal known as $_SERVER ['SCRIPT_FILENAME']. See: http://www.php.net/reserved.variables Do something like this to get started: echo $_SERVER['SCRIPT_FILENAME']; Good luck. Jordan On Sep 18, 2005, at 4:58 PM, Ken Tozier wrote: I'm working on an auto-include mechanism for some complex scripts and rather than have all the paths to the various components hard coded, I'd like to have the script walk up the hierarchy looking for it's specified includes. Is it possible to do this? I looked at the various file related php functions but didn't see anything resembling 'my_path()' Thanks Ken -- 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] email validation regex
What do you mean? What's wrong with top posting? ;) Jordan On Sep 16, 2005, at 11:31 AM, John Nichel wrote: bruce wrote: hi.. looking for a good/working/tested php email validation regex that conforms to the rfc2822 standard. a lot of what i've seen from google breaks, or doesn't follow the standard! any ideas/thoughts/sample code/etc... Didn't we just have this flame war about a month ago? Is it time for it to come up again? Top posting must be right around the corner; damn, I love this time of year. ;) -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- 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] Domain Info Possible?
do you have log files? the page you linked to was generated by webalizer. is there a reason you can't use that (or Awstats, or something similar)? you probably don't need to reinvent the wheel here... though you may need to tweak your webserver to put more information in the log files so you can see all the stats you desire. Jordan On Sep 15, 2005, at 11:07 AM, Chirantan Ghosh wrote: Hello, I was wondering if there was way to generate domain statistics by any PHP script? I just need some basic info like: Monthly Traffic( Sites, Kbytes, Visits, Pages, Files, Hits ) Example: http://server18.internetserver.com/stats/1800homecare/ If it is possible can I also create a Log In for that page? I would appreciate any direction. Thanks, C. Ghosh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Deny access from certain hosts
if people are allowed to post copyrighted images to your bulletin board, shouldn't you have some sort of password protection anyway? negating that, i would do it with PHP and not Apache. rather than simply serving up the file raw: img src=image.gif why not setup a php script to do URL referring blocking: img src=getFile.php?img=image.gif in the getFile.php file, you could check the referring URL, and then present the file, or not. you would need to move the images out of the web tree, though, so people couldn't bypass your script. it sounds like you need to reconsider what you really want, though. Jordan On Sep 13, 2005, at 3:00 PM, Aaron Greenspan wrote: Jordan, I have a similar problem where someone is using copyrighted images on my site in a bulletin board. It's not that one specific host is requesting the files--it's people from all over--but rather that I want to block one referring URL using Apache, rather than PHP, since the images are GIF files. Can you do that with .htaccess? Thanks, Aaron Aaron Greenspan President CEO Think Computer Corporation http://www.thinkcomputer.com -- 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] whats wrong in this program.
you need single quotes around $subnum in the sql statement. don't know why you seem to be arbitrarily leaving them off (put them around $uv and $duration, too!). also, you should never insert stuff directly from a user into a database. first escape every variable with: http://www.php.net/mysql_real_escape_string Jordan On Sep 14, 2005, at 6:36 AM, babu wrote: Hi, I tried to use the final array values in a insert statement, but the values are not inserted. the code is foreach ($final as $subnum){ $res = $db-query(INSERT INTO substrate_protocoll (substrate_type,substrate_num,operator,location,solvent,ultrasonic,dur ation,cdate,ctime,comment) VALUES('$substrate_type1', $subnum,'$operator','$location','$solvent',$uv, $duration,'$cdate','$sctime','$comment')); if(!$res){ echo insert failed; } } the values of array ($subnum)are not inserted , can you tell me where the problem is. Jordan Miller [EMAIL PROTECTED] wrote: I think I finally understand what you are trying to do. I don't see any reason why you need to use the token functions, and I would recommend using array functions instead (also, it is exceedingly easy to sort the elements of an array... see the end). I believe this will do what you are trying to do: //Tokenizer for Babu $str = '10,12,14-18'; $commas = explode(',', $str); // $commas will be an array of three items in this case // Final Values will go into the $final array $final = array(); foreach ($commas as $value) { // If one of the $commas elements contains a dash, we need to get the range between them! if (strstr($value, '-')) { // Explode based on the dash. This code assumes there will only be a single dash $rangeValues = explode('-', $value); foreach (range($rangeValues[0], $rangeValues[1]) as $number) { $final[] = $number; } } else { // If $value does not contain a dash, add it directly to the $final array $final[] = $value; } } echo All your values in the range $str are .implode(' ', $final); // Prints All your values in the range 10,12,14-18 are 10 12 14 15 16 17 18 In your last email, you had some of the values given out of order: 1. 20,21-24 2. 21-24,20 3. 10,20,21-24,25,26,30 To make sure the $final values are always ascending, just do this at the end: sort($final); Done!! Jordan On Sep 13, 2005, at 7:16 PM, babu wrote: $str=10,12,14-18; $tok = strtok($str, ','); while ($tok !== false) { $toks[] = $tok; $tok = strtok(','); } foreach ($toks as $token){ if (strpos($token,'-')){ stringtokenize($token); }else{ $finaltokens[]= $token; } } function stringtokenize($nstr){ $ntok1= strtok($nstr,'-'); $ntok2=strtok('-'); for($i=$ntok1;$i=$ntok2;$i++){ $finaltokens[]= $i; } } foreach ($finaltokens as $ftoken){ echo $ftoken; echo ; } the ouput prints only 10,12 but not 14,15,16,17,18. where is the problem. - To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - How much free photo storage do you get? Store your holiday snaps for FREE with Yahoo! Photos. Get Yahoo! Photos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] whats wrong in this program.
heh, i did it too. John, oh, good to know, thanks. $final should be composed of strings, not integers, so i guess that is his problem. i just read that it is best to quote every variable, now I know why... so you can change implementations later and not have to worry about types (and php's autotyping is so great anyway). Jordan On Sep 14, 2005, at 10:54 AM, John Nichel wrote: Jordan Miller wrote: you need single quotes around $subnum in the sql statement. don't know why you seem to be arbitrarily leaving them off (put them around $uv and $duration, too!). snip It's not needed if those fields are integers. *damnit, that's twice today I've replied to the poster and not the list. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- 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] A tricky little addition
the syntax for variable variables is: $variable= $$add; or alternatively: $variable= ${$add}; Jordan On Sep 14, 2005, at 2:25 PM, Ross wrote: $variable= $.$add; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Deny access from certain hosts
you need to do it like this: Order Allow,Deny Allow from all Deny from 85.65.154 http://httpd.apache.org/docs/1.3/mod/mod_access.html Jordan On Sep 13, 2005, at 2:30 PM, David Pollack wrote: Hello, I have a problem where someone is illegally linking to my site. There site is in another language so I'm having trouble contacting them. Is there any way that I can use PHP or Apache to stop them from linking to these files directly on there website. This is an example of a log entry that I get from their link: 85.65.154.185 - - [04/Sep/2005:06:52:40 -0700] GET /fonts/images/austrise.jpg HTTP/1.1 200 6094 http://www.tipo.co.il/zone/page.asp?zone=41611880647891pid=1044663; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) I've tried using mod_access with a simple directive in my VirtualHost like: Directory /home/da3/public_html/fonts Deny from 85.65.154 /Directory And that does not seem to work. I have mod_access installed and PHP 4. I'm sorry if this is more of an apache question but it just seems like it should be so easy and I can't find a single example of how to stop this. -- David Pollack [EMAIL PROTECTED] www.atlspecials.com www.da3.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array simple question
please provide code and an example output, and say how this is different than you would like. what you describe is unclear. Jordan On Sep 13, 2005, at 4:04 PM, matt VanDeWalle wrote: hello, I have a simple question, not really a problem this time. I know that the function print_r() will print an array but if that array has sub-arrays it prints everything and if you don't use more command or a pipe of some kind that could be useless in some cases, but I am just wondering, for an array that has several arrays in it, is there a way to print the array names that are contained in the main array but not the contents of each? thanks matt -- 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] whats wrong in this program.
I think I finally understand what you are trying to do. I don't see any reason why you need to use the token functions, and I would recommend using array functions instead (also, it is exceedingly easy to sort the elements of an array... see the end). I believe this will do what you are trying to do: //Tokenizer for Babu $str = '10,12,14-18'; $commas = explode(',', $str); // $commas will be an array of three items in this case // Final Values will go into the $final array $final = array(); foreach ($commas as $value) { // If one of the $commas elements contains a dash, we need to get the range between them! if (strstr($value, '-')) { // Explode based on the dash. This code assumes there will only be a single dash $rangeValues = explode('-', $value); foreach (range($rangeValues[0], $rangeValues[1]) as $number) { $final[] = $number; } } else { // If $value does not contain a dash, add it directly to the $final array $final[] = $value; } } echo All your values in the range $str are .implode(' ', $final); // Prints All your values in the range 10,12,14-18 are 10 12 14 15 16 17 18 In your last email, you had some of the values given out of order: 1. 20,21-24 2. 21-24,20 3. 10,20,21-24,25,26,30 To make sure the $final values are always ascending, just do this at the end: sort($final); Done!! Jordan On Sep 13, 2005, at 7:16 PM, babu wrote: $str=10,12,14-18; $tok = strtok($str, ','); while ($tok !== false) { $toks[] = $tok; $tok = strtok(','); } foreach ($toks as $token){ if (strpos($token,'-')){ stringtokenize($token); }else{ $finaltokens[]= $token; } } function stringtokenize($nstr){ $ntok1= strtok($nstr,'-'); $ntok2=strtok('-'); for($i=$ntok1;$i=$ntok2;$i++){ $finaltokens[]= $i; } } foreach ($finaltokens as $ftoken){ echo $ftoken; echo br /; } the ouput prints only 10,12 but not 14,15,16,17,18. where is the problem. - To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Round with ONE-decimal... always...
besides sprintf, number_format will also do it: number_format(6, 1, ',', '');// Outputs '6,0' Jordan On Sep 12, 2005, at 3:52 AM, Gustav Wiberg wrote: Hi there! I want to adjust the round() -function a little... If I put round(6,0) there will be an output of 6 If I put round(6,32) there will be an output of 6,3 I want it to have 6,0 instead of just 6... I guess there is an easy solution to this? Suggestions? /G http://www.varupiraten.se/ -- 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] Convert a timestamp to RFC822??
we *just* had a post similar to this. It's easy, just use the date() and strtotime() functions: $timestamp = '2004-05-14 13:24:48'; $RFC_formatted = date('r', strtotime($timestamp)); done! Jordan On Sep 10, 2005, at 11:14 AM, Brian Dunning wrote: I get my timestamp from the db in this format (I don't have control over this): 2004-05-14 13:24:48 I need to convert it to RFC822 to make it a valid RSS pubDate field like this: Wed, 02 Oct 2002 13:00:00 GMT How can I do that? I'm tearing my hair out here (what's left)... :) -- 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] Books / tutorials on Object Oriented Programming with PHP
Here is a thorough review on the Zandstra book: http://books.slashdot.org/article.pl?sid=05/08/16/0434205tid=169tid=6 Jordan On Sep 9, 2005, at 6:39 PM, Jason Coffin wrote: On 9/9/05, Vinayakam Murugan [EMAIL PROTECTED] wrote: I am learning about Object Oriented Programming with PHP. Can you suggest any good books / tutorials? Greetings, I HIGHLY recommend PHP 5 Objects, Patterns, and Practice by Matt Zandstra [http://www.apress.com/book/bookDisplay.html?bID=358]. This was one of the best PHP books I have read and I suspect it is exactly what you are looking for. Yours, Jason Coffin -- 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] Sessions , expiry times and different time zones
As I said, **rather** than relying on cookie expiration. This *necessarily* means that you will need to set the cookie expiration to sometime way in the future, like next year (or more dynamically, use the date() and mktime() functions to always set the cookie expiration to + 1 yr from today). If you do this, you will have no chance of the cookie itself expiring; therefore you can rely solely on the $_SESSION variable. The cookie will contain the session id that the webserver will be able to use to repopulate the $_SESSION variable as long as $_SESSION['expiration'] is still in the future. If $_SESSION['expiration'] is in the past (or is empty) and you issue a session_destroy() and a setcookie(), the cookie can be destroyed, too. I have written something similar to this in the past, and it behaves exactly as you would like and expect. Another benefit is that this is more secure than relying on a cookie-supplied expiration time. Jordan On Sep 6, 2005, at 8:51 PM, Dan Rossi wrote: client cookie expires hence no more session ... On 07/09/2005, at 1:57 AM, Jordan Miller wrote: Hi Dan, Couldn't you store an expiration time directly in the $_SESSION variable, rather than relying on cookie expiration (if I understand your question correctly)? Each time a page is loaded, update the expiration time in this variable to +24hr from the current time (all times relative to the server's time). Then, it shouldn't matter from which time zone the user is browsing. Jordan On Sep 6, 2005, at 10:37 AM, Dan Rossi wrote: hi there I have run into problems with sessions , cookies and expiryt times with different time zones. Ie our server is in the States however I am browsing from Koala land downunder. I have been trying to get the session to expire in a day, however for ppl in the states this is ok, but for me its already expired so i have been experiencing issues. How do i solve this ? -- 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] Better timestamp explanation to the client
methinks you should convert the datetime to a unix timestamp with strtotime(). then you can compare the difference between this timestamp and a unix timestamp of now to find if you have logged in within a min. of the previous time. Then, once you know what text to display (e.g. Less than a minute ago!), you can format the original datetime timestamp with the date() function to be however you like. You may have to read the manuals for all three of these functions several times. good luck! actually, you may be able to do simple operators (e.g. , , or -) with the datetime as is, without having to convert to a unix timestamp. NOW in datetime format can be gotten with: $now = date('Y-m-d H:i:s'); i'm not sure though. just try it! Jordan On Sep 8, 2005, at 9:41 AM, Ryan A wrote: Hi, In one of our tables we have these fields: cust_no bigint(20), cust_name varchar(30), last_online datetime, and in that members profile, if someone visits it, on the top of the page we have this: // connect to db, query for record and display it below Last seen: ?php echo $last_online; ? Any ideas on the simplest way to make it look like this: Last seen: Less than a minute ago! Last seen: 25 mins ago Last seen: 2 hours 11 mins ago Last seen: 1 (or 2 or 3) day/s ago else{ echo $last_seen; } I have seen this done on a few sites (Swedish sites actually, I can give you the URLs if you need them) I think it looks much better than: Last seen : 2005-09-07 20:59:01 Thanks! Ryan -- 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] Assign values in foreach-loop
Hello, You simply need the $key variable, then you can set a new value for $arr[$key] for each array element: ?php $arr = array(1, 2, 3, 4); foreach ($arr as $key = $value) { $arr[$key] = $value * 2; } // $arr is now array(2, 4, 6, 8) ? http://www.php.net/foreach If you have PHP 5, you can perhaps more efficiently do this: As of PHP 5, you can easily modify array's elements by preceding $value with . This will assign reference instead of copying the value. ?php $arr = array(1, 2, 3, 4); foreach ($arr as $value) { $value = $value * 2; } // $arr is now array(2, 4, 6, 8) ? Jordan On Sep 7, 2005, at 12:14 PM, Sabine wrote: Hello to all, is it possible to assign values to the array for which I do the foreach-loop? foreach ($_SESSION['arr1'] as $arr1) { foreach ($_SESSION['arr2'] as $arr2) { if ($arr1['id'] == $arr2['id']) { $arr1['selected'] = true; } } } I think $arr1 is only a temp-var, so the assignment won't reflect on $_SESSION['arr1'] . Is that right? Surely I can do it with a for-loop, but those arrays are a bit complex and a foreach would be much easier to read. Thanks in advance for your answers Sabine -- 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] Assign values in foreach-loop
sorry, i didn't fully answer the questions... if i understand your multidimensional array correctly, your code should be something like: foreach ($_SESSION['arr1'] as $key = $arr1) { foreach ($_SESSION['arr2'] as $arr2) { if ($arr1['id'] == $arr2['id']) { $_SESSION['arr1'][$key]['selected'] = true; } } } Jordan On Sep 7, 2005, at 12:22 PM, Jordan Miller wrote: foreach ($_SESSION['arr1'] as $arr1) { foreach ($_SESSION['arr2'] as $arr2) { if ($arr1['id'] == $arr2['id']) { $arr1['selected'] = true; } } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checking a date for validity
writing a parse script is okay, but it will be very difficult to always ensure they are inputting it correctly. I recommend putting a popup calendar next to the input field. If the field is automatically populated in this way you will have a much easier time parsing it correctly. I can't recommend a good one offhand, but there are several that are DHTML and JS only, so that should be a good starting point for standards compliance. See: http://www.dynarch.com/projects/calendar/ and http://www.google.com/search?q=dhtml+popup+calendar Jordan On Sep 7, 2005, at 5:39 PM, Todd Cary wrote: I need to check the input of a user to make sure the date is valid and correctly formatted. Are there any examples available? Here is one solution I created: /* Is date good */ function is_date_good($date) { if (strtotime($date) == -1) { $retval = 0; } else { if (strpos($date, /) 0) { $parts = explode(/, $date); } elseif (strpos($date, -) 0) { $parts2 = explode(-, $date); $parts[0] = $parts2[1]; $parts[1] = $parts2[2]; $parts[2] = $parts2[0]; } else { $parts = explode(., $date); } //print_r($parts); if (checkdate($parts[0], $parts[1], $parts[2]) ) return 1; else return 0; } return $retval; } Is there a simplier solution? Many thanks.. -- 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] Sessions , expiry times and different time zones
Hi Dan, Couldn't you store an expiration time directly in the $_SESSION variable, rather than relying on cookie expiration (if I understand your question correctly)? Each time a page is loaded, update the expiration time in this variable to +24hr from the current time (all times relative to the server's time). Then, it shouldn't matter from which time zone the user is browsing. Jordan On Sep 6, 2005, at 10:37 AM, Dan Rossi wrote: hi there I have run into problems with sessions , cookies and expiryt times with different time zones. Ie our server is in the States however I am browsing from Koala land downunder. I have been trying to get the session to expire in a day, however for ppl in the states this is ok, but for me its already expired so i have been experiencing issues. How do i solve this ? -- 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] how to divide string
If you are using php 5, don't forget about str_split, with 4 as the second parameter. http://us2.php.net/str_split so you could do: echo implode(br /, str_split($string, 4)); if you still have php 4 or earlier, look at that page anyway as there is a workaround function in the comments for earlier versions of php. Jordan On Sep 5, 2005, at 6:50 AM, Adi Zebic wrote: Hi, is there any magic function who can give me from: $string = abcdefghijklmnopqrstuwvxyz; somthing like this: abcd efgh ijkl mnop qrst uwvx yz (each 'x' letters go to the next line) Thanks a lot, ADI -- 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] Help: Get the value of pi up to 200+ digits?
http://us3.php.net/manual/en/ini.core.php#ini.precision precision sets the number of significant digits, *NOT* the number of digits displayed after the decimal point. If you want to get pi out to 16 decimal places you need a precision of *17* because the beginning 3 is a significant digit. Your code does exactly this, displaying pi with 15 decimal places. Jordan On Sep 1, 2005, at 8:06 AM, Wong HoWang wrote: Dear all, I'm trying to do like this but failed: ?php ini_set('precision',16); echo pi(); ? How can I get more digits after . ? Can anyone help? Thx! -- 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] running process in the background
Oh wait... you are not specifying your $_POST variable. you need to use the key for $_POST. just do a print_r($_POST) to find the key from the $_POST array that you are looking for. also, i would not pass a $_POST variable directly to your shell without escaping it somehow, first... foreach ($_POST[$key] ... Jordan Did you try also sending stderr to /dev/null rather than stdout only? I think the syntax is to add a 21: foreach ($_POST as $kid){ `php run.php param1 param2 /dev/null 21 `; } This should put each process in the background and suppress all errors and output. Does that work? Jordan On Aug 31, 2005, at 11:44 AM, Georgi Ivanov wrote: foreach ($_POST as $kid){ `php run.php param1 param2 /dev/null `; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nested IFs Problem
why not rewrite it to be more concise... i can't see a problem at the moment. are you sure you can do a comparison operator on the '12:00' and '2005-10-02' string?? Maybe if you are using 24 hr format you could just get rid of the : on both sides of the operator to have the properly evaluated... do the same for the date comparison. just try each if statement individually. then, when you find the problem, rewrite like this: if ((putFirstExpressionHere) (putSecondExpressionHere) (putThirdExpressionHere)) { // success } else { // failure } Jordan On Aug 31, 2005, at 3:05 PM, Albert Padley wrote: if ($row['date'] '2005-10-02') { if ($row['time'] '12:00') { if ($row['field'] == 'P5' ) { echo td class=\tabletextbluebg\Success; } } } else { echo td class=\tabletextred\Failed; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Browsing Into Levels
They are called breadcrumbs: http://www.google.com/search?q=php+breadcrumbs Jordan On Aug 30, 2005, at 4:57 AM, areguera wrote: Hi, I been wondering the best way to make the level browsing, I mean, those links up in page which tell you the position you are, and make you able to return sections back, keeping some kind of logic of where you are. I been used the url vars to do this but I arrive some point where there are coincidences and it loose sense, it jumps to other section, where indeed have to, but not where it logically should. any suggestions? thank :) -- 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] Browsing Into Levels
you may not need anything fancy like a class for regular breadcrumbs or these BreadcrumbsExtreme™ that you describe. i usually do simple breadcrumbs with a simple function. for the extreme version, just store an array of recently viewed pages in a session variable, and parse this array when displaying each page. Jordan On Aug 30, 2005, at 11:01 AM, Greg Schnippel wrote: Good answer, I think thats what they were looking for but just in case: Most of the breadcrumb classes out there (at least the ones that showed up in an initial google search) use either the existing directory/file structure or a hard-coded array of your site structure to create the breadcrumbs. What about on non-structured sites like Wikis? For example, on DokuWiki, it keeps track of your last 4-5 clicks in a breadcrumb trail on the top of the page. Amazon.com http://Amazon.com's recently viewed pages is another good example (though probably patented ;)) What are these kind of breadcrumbs called and which classes would you recommend using to implement them? Thx, - Greg On 8/30/05, Jordan Miller [EMAIL PROTECTED] wrote: They are called breadcrumbs: http://www.google.com/search?q=php+breadcrumbs Jordan On Aug 30, 2005, at 4:57 AM, areguera wrote: Hi, I been wondering the best way to make the level browsing, I mean, those links up in page which tell you the position you are, and make you able to return sections back, keeping some kind of logic of where you are. I been used the url vars to do this but I arrive some point where there are coincidences and it loose sense, it jumps to other section, where indeed have to, but not where it logically should. any suggestions? thank :) -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] syntax for two comparison operators
Good to know about expression evaluation. Writing the expression(s) like that (left-to-right and right-to-left) solves my dilemma... thanks! Jordan On Aug 25, 2005, at 2:44 AM, Richard Lynch wrote: I personally would use: ((2 $x) ($x = 4)) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] invert
if you are using mysql, just put the DESC (descending) directive at the end of your sql statement (default is no DESC directive, meaning ascending). most recent records will be returned first. Jordan On Aug 25, 2005, at 2:21 PM, George B wrote: I have written a shoutbox, and it works great, but I am wondering... When a user posts a shout it goes below the first shout. Like the auto_increment puts the ID up higher. I need it to go about the first shout, so like the auto_increment would invert. Someone told me this is possible through PHP. Is that true? and if so how do you do it? -- 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] invert
you need to provide more information. we cannot tell what you are doing. you should: **PASTE THE RELEVANT SECTION OF YOUR CODE IN YOUR EMAIL** On Aug 25, 2005, at 2:38 PM, George B wrote: Łukasz 'nostra' Wojciechowski wrote: W odpowiedzi na maila (21:21 - 25 sierpnia 2005): I have written a shoutbox, and it works great, but I am wondering... When a user posts a shout it goes below the first shout. Like the auto_increment puts the ID up higher. I need it to go about the first shout, so like the auto_increment would invert. Someone told me this is possible through PHP. Is that true? and if so how do you do it? mysql_query('SELECT * FROM table ORDER BY increment_field DESC'); http://dev.mysql.com/doc/mysql/en/order-by-optimization.html or get all output from DB into array and use array_reverse(); http://us2.php.net/manual/pl/function.array-reverse.php If I do that... then i get this error Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in myfile name on line 30 and on line 30 it says while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { I dont understand what is problem here... -- 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] Problem with SimpleXML
Yes, simplexml can do this easily. See: http://www.php.net/simplexml Example 7. Setting values Data in SimpleXML doesn't have to be constant. The object allows for manipulation of all of its elements. ?php include 'example.php'; $xml = simplexml_load_string($xmlstr); $xml-movie[0]-characters-character[0]-name = 'Miss Coder'; echo $xml-asXML(); ? The above code will output a new XML document, just like the original, except that the new XML will change Ms. Coder to Miss Coder. Uros, it looks like you want to change one of the attributes; you will need to use some of this code to handle the attributes: Example 4. Using attributes So far, we have only covered the work of reading element names and their values. SimpleXML can also access element attributes. Access attributes of an element just as you would elements of an array. ?php include 'example.php'; $xml = simplexml_load_string($xmlstr); /* Access the rating nodes of the first movie. * Output the rating scale, too. */ foreach ($xml-movie[0]-rating as $rating) { switch((string) $rating['type']) { // Get attributes as element indices case 'thumbs': echo $rating, ' thumbs up'; break; case 'stars': echo $rating, ' stars'; break; } } ? regards, Jordan On Aug 24, 2005, at 3:20 AM, Uroš Gruber wrote: Hi! I have XML and I would like to set some values. I almost done the whole thing but have some problems when looping through some tags foo bar id=1 name=bar1 / bar id=2 name=bar2 / ... /foo I would like to set value for tag bar in some loop and then export this back to XML. Is this even possible or it's better to use SimpleXML only for read and create new XML from it. XML is about 20 rows of data and I'm using PHP 5.0.4 with all XML included. regards Uros -- 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
[PHP] syntax for two comparison operators
General question, Is there a technical reason why PHP does not allow comparison operator expressions like the following: if (2 $x = 4) {} I prefer this concise way as it is common for mathematics expressions, and much easier to grasp physically on first glance. From what I can tell, this expression can currently only be written as: if ( $x 2 $x = 4) {} Would adding this syntax to PHP be incredibly difficult or lead to performance slowdowns? I think I remember reading that PHP always evaluates expressions from right to left, so I guess there may be a considerable codebase change required. Maybe there could be a default function workaround for this or some other way to automagically process these more concise expressions without too much of a slowdown?? Just curious. Jordan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] build sql query struture and values from form fields
I agree, you must be careful of SQL injection... use mysql_real_escape_string(). To chop off the last character of text use substr(): $sqlstruct = substr($sqlstruct, 0, -1); Jordan http://www.php.net/substr Example 3. Using a negative length ?php $rest = substr(abcdef, 0, -1); // returns abcde $rest = substr(abcdef, 2, -1); // returns cde $rest = substr(abcdef, 4, -4); // returns $rest = substr(abcdef, -3, -1); // returns de ? On Aug 20, 2005, at 4:55 PM, Greg Donald wrote: On 8/20/05, Andras Kende [EMAIL PROTECTED] wrote: I would like to create the mysql insert query for my html form fields, I have a small problem it will have an extra , at the end of $sqlstruct And extra at $sqldata.. Anyone can give a hint ? foreach ($_POST as $variable=$value){ $sqlstruct.=$variable,; $sqldata.=$value.\','\; } $query=insert into db ($sqlstruct) VALUES ($sqldata); $k = implode( ',', array_keys( $_POST ) ); $v = implode( ',', array_values( $_POST ) ); $sql = INSERT INTO db ( $k ) VALUES ( $v ); I'd never do something like this though, just begs for SQL injection. -- Greg Donald Zend Certified Engineer MySQL Core Certification http://destiney.com/ -- 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] Special HTML characters question.
Did you try html_entity_decode? http://us2.php.net/html_entity_decode You may want to combine this with mysql_real_escape_string()...? Jordan On Aug 22, 2005, at 8:29 AM, Jay Paulson wrote: I have a problem that I'm sure some of you have run into before, therefore I hope you all know of an easy solution. Some of my users are cutting and pasting text from Word into text fields that are being saved into a database then from that database being displayed on a web page. The problem occurs when some special characters are being used. Double quotes, single quotes, and other characters like accents etc have the special html code like quote; etc replacing the special characters. What methods are being used to combat this issue? Is there a solution out there to run text through some sort of filter before submitting it to the database to look for these special characters and then replacing them? Thanks for any help, Jay -- 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] Week Days
Yo, All you need is the mktime() command. do something like: $futureDate = date(Y-m-d, mktime(0, 0, 0, $month, $today+ $daysToAdd, $year)); Jordan http://www.php.net/mktime mktime() is useful for doing date arithmetic and validation, as it will automatically calculate the correct value for out-of-range input. For example, each of the following lines produces the string Jan-01-1998. ?php echo date(M-d-Y, mktime(0, 0, 0, 12, 32, 1997)); echo date(M-d-Y, mktime(0, 0, 0, 13, 1, 1997)); echo date(M-d-Y, mktime(0, 0, 0, 1, 1, 1998)); echo date(M-d-Y, mktime(0, 0, 0, 1, 1, 98)); ? On Aug 19, 2005, at 12:57 AM, [EMAIL PROTECTED] wrote: I am trying to add 3 (or a user-defined amount) week days to a certain date.. An example is today 2005-08-18 then adding 3 week days to give me a date of 2005-08-23. I have tried searching online but cannot find an easy way of doing so.
Re: [PHP] Re: sending HTML (incl. embedded images) to browser
Pardon me, but I don't think he is trying to send an HTML email. I believe he is just asking about making a simple webpage. Relative URLs should be fine and are often preferable for portability. Jordan On Aug 17, 2005, at 7:34 PM, Manuel Lemos wrote: Hello, on 08/17/2005 07:42 PM Jake Sapirstein said the following: I am a PHP newbie, pardon the elementary question - I am starting out with using print() to send HTML to the browser to be rendered. All is well with text and tables and other HTML formatting, but when trying to send IMG tags, my images aren't getting displayed. Is there a good tutorial out there (I can't seem to find it) on how to send HTML to a browser where the HTML includes IMG tags with links to image files? If I need to set up the filepaths with variables I can figure that out, but not sure what functions to use to set the paths up. You need to use absolute URLs for the images. Still, some mail programs and webmail sites disable remote image displaying by default as images may be beacons to spy on users. ALternatively you can embeded images in the actual HTML messages and they always display properly. That is done with MIME multipart/ related messages. You may want to take a look at this MIME message class that can be used to compose messages with embedded images. It comes with an example named test_html_mail_message.php that shows exactly how to do that: http://www.phpclasses.org/mimemessage -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- 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] PHP MySQL insert
besides just escaping your strings, i think you are having a quoting error: http://www.php.net/manual/en/language.types.string.php Commas should not have to be escaped, and indeed the mysql_real_escape_string() function will not escape commas. After escaping your input data with this function, I would make the $query text a bit more technically correct: Change this: $query = insert into testtable6 (indx, col1, col2) values (NULL, '$data1', '$data2'); to this: $query = insert into testtable6 (indx, col1, col2) values (NULL, '. $data1.', '.$data2.'); echo $query.br\n; to ensure proper handling of all data in the sql commands. If you echo your $query before the insert, what do you get? This is always a good practice when you're having trouble. Jordan On Aug 18, 2005, at 12:05 PM, Chris wrote: You need to escape the data, so $data1 = mysql_real_escape_string($data1,$rLink); $data2 = mysql_real_escape_string($data2,$rLink); Jon wrote: Please help with an insert problem. Sometimes $data1 could have a comma and that messes up the insert. how do I get around that? $query = insert into testtable6 (indx, col1, col2) values (NULL, '$data1', '$data2'); mysql_db_query(testdb, $query); -- 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: PHP 5 limits readfile to 1.9 MB?
Catalin, Wow, that worked great, thanks. I'm curious why you set a static buffer of 1024768... why not just do filesize($file), as shown at http://www.php.net/fread ? Is it better for memory usage to have a potentially smaller buffer? Also, you may want an fclose($fp) after the file has been downloaded. So is this a bug in PHP 5 or are they just purposely limiting the abilities of the readfile command? Jordan On Aug 17, 2005, at 3:36 AM, Catalin Trifu wrote: Hi, I've had a similar problem. The download always stopped at exactly 2.000.000 bytes. You have to work around that with: $fp = fopen($file, 'r'); if($fp) { while(!feof($fp)) { echo fread($fp, 1024768);//see the huge buffer to read into } } else { //whatever error handler } Catalin Jordan Miller wrote: Hello all, I am new to this list and I have searched the archives to no avail. I am having a peculiar problem when upgrading to PHP 5: My downloads are now limited to the first 1.9 MB of the file in question, with the download either terminating at 1.9 MB or seemingly continuously stuck in a downloading process at 1.9 MB. The code in the PHP script has not changed and all parameters that I could find that are relevant to this problem are given below: the minimal code needed for download: // $file_to_read is the complete path of the file to download header(Content-Type: application/pdf); header( Content-Disposition: inline; filename=\$filename \); $len = filesize($file_to_read); header(Content-Length: $len); @readfile($file_to_read); php.ini file for both php version 4 and 5 contain the following settings that may be relevant: allow_url_fopen = On max_execution_time = 300 ; Maximum execution time of each script, in seconds max_input_time = 300; Maximum amount of time each script may spend parsing request data memory_limit = 8M ; Maximum amount of memory a script may consume (8MB) post_max_size = 200M upload_max_filesize = 200M Some additional details: All files less than 1.9 MB download fine It is not a corrupted file, because all files larger than 1.9 MB fail after 1.9 MB The connection is not timing out (download of 1.9 MB takes only ~15 sec) Mac OS X 10.3.9 with Marc Liyanage's PHP 5.0.4 Fails for both Safari and Firefox Fails regardless of inline or attachment Fails regardless of pdf or ppt content-type This PHP code ALWAYS works for Marc Liyanage's PHP 4.3.4 with the same settings, above What am I doing wrong??? Any other parameter in php.ini I should have set? Any suggestions are much appreciated. thanks, Jordan -- 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] optional argument when creating a function
apparently the ampersand means to treat $link as a reference, not as an optional argument: http://www.softwareprojects.org/php-functions-12.htm I think the way to do it would be to set a default value in your function so that if a value is set by the calling statement that would override it: function doEmail($username, $link = false) { if ($link !=== false) { // doEmail($arg1, $arg2); gets sent here print $link $username; } else { // doEmail($arg1); gets sent here print $username; } } haven't tested this, but give it a try. Jordan On Aug 17, 2005, at 10:00 AM, D A GERM wrote: I'm throwing a warning on a function I created. I thought a in front of the argument was supposed to make it optional. Is there something else I need to do make that argument optional? CODE //I simplified the code function doEmail($username, $link) { if (isset($link)) { print $link $username; } else { print $username; } } doEmail($arg1); doEmail($arg1, $arg2); /CODE Here is the error: Warning: Missing argument 2 for doemail() in /srv/www/htdocs/test-a/staff/email_scramble.php on line 24 thanks in advance for any help. -- D. Aaron Germ Scarborough Library, Shepherd University (304) 876-5423 Well then what am I supposed to do with all my creative ideas- take a bath and wash myself with them? 'Cause that is what soap is for (Peter, Family Guy) -- 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] How Can I delete an Item of one array
you use the unset() function: unset($array[$key]); // http://www.php.net/unset you can reindex the keys if they are numeric with: $reindexedArray = array_values($array); // http://www.php.net/ array_values Jordan On Aug 17, 2005, at 1:12 PM, Tomás Rodriguez Orta wrote: Hi people. How Can I do this. I want to delete an element behind of array?, what function What Can I use? best regards TOMAS -- --- Este correo fue escaneado en busca de virus con el MDaemon Antivirus 2.27 en el dominio de correo angerona.cult.cu y no se encontro ninguna coincidencia. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP 5 limits readfile to 1.9 MB?
Ok, just checking (I am new to the fopen() function). That makes sense. Awesome, thanks! Jordan On Aug 17, 2005, at 10:19 AM, Catalin Trifu wrote: Hi, Indeed a fclose($fp) is needed (wrote it as an example :)). 1MB is more than enough as a buffer. If you have a 53MB file, what will happen then ? I have no idea if it's a bug or a feature. Either way I did lose some hair over this when I switched from PHP4 to PHP5. Catalin Jordan Miller wrote: Catalin, Wow, that worked great, thanks. I'm curious why you set a static buffer of 1024768... why not just do filesize($file), as shown at http://www.php.net/fread ? Is it better for memory usage to have a potentially smaller buffer? Also, you may want an fclose($fp) after the file has been downloaded. So is this a bug in PHP 5 or are they just purposely limiting the abilities of the readfile command? Jordan On Aug 17, 2005, at 3:36 AM, Catalin Trifu wrote: Hi, I've had a similar problem. The download always stopped at exactly 2.000.000 bytes. You have to work around that with: $fp = fopen($file, 'r'); if($fp) { while(!feof($fp)) { echo fread($fp, 1024768);//see the huge buffer to read into } } else { //whatever error handler } Catalin Jordan Miller wrote: Hello all, I am new to this list and I have searched the archives to no avail. I am having a peculiar problem when upgrading to PHP 5: My downloads are now limited to the first 1.9 MB of the file in question, with the download either terminating at 1.9 MB or seemingly continuously stuck in a downloading process at 1.9 MB. The code in the PHP script has not changed and all parameters that I could find that are relevant to this problem are given below: the minimal code needed for download: // $file_to_read is the complete path of the file to download header(Content-Type: application/pdf); header( Content-Disposition: inline; filename= \$filename \); $len = filesize($file_to_read); header(Content-Length: $len); @readfile($file_to_read); php.ini file for both php version 4 and 5 contain the following settings that may be relevant: allow_url_fopen = On max_execution_time = 300 ; Maximum execution time of each script, in seconds max_input_time = 300; Maximum amount of time each script may spend parsing request data memory_limit = 8M ; Maximum amount of memory a script may consume (8MB) post_max_size = 200M upload_max_filesize = 200M Some additional details: All files less than 1.9 MB download fine It is not a corrupted file, because all files larger than 1.9 MB fail after 1.9 MB The connection is not timing out (download of 1.9 MB takes only ~15 sec) Mac OS X 10.3.9 with Marc Liyanage's PHP 5.0.4 Fails for both Safari and Firefox Fails regardless of inline or attachment Fails regardless of pdf or ppt content-type This PHP code ALWAYS works for Marc Liyanage's PHP 4.3.4 with the same settings, above What am I doing wrong??? Any other parameter in php.ini I should have set? Any suggestions are much appreciated. thanks, Jordan -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP 5 limits readfile to 1.9 MB?
turns out it's a known bug, fixed in CVS already... haven't tried the PHP 5.1 beta release yet. http://bugs.php.net/bug.php?id=32970 On Aug 17, 2005, at 10:19 AM, Catalin Trifu wrote: Hi, Indeed a fclose($fp) is needed (wrote it as an example :)). 1MB is more than enough as a buffer. If you have a 53MB file, what will happen then ? I have no idea if it's a bug or a feature. Either way I did lose some hair over this when I switched from PHP4 to PHP5. Catalin Jordan Miller wrote: Catalin, Wow, that worked great, thanks. I'm curious why you set a static buffer of 1024768... why not just do filesize($file), as shown at http://www.php.net/fread ? Is it better for memory usage to have a potentially smaller buffer? Also, you may want an fclose($fp) after the file has been downloaded. So is this a bug in PHP 5 or are they just purposely limiting the abilities of the readfile command? Jordan On Aug 17, 2005, at 3:36 AM, Catalin Trifu wrote: Hi, I've had a similar problem. The download always stopped at exactly 2.000.000 bytes. You have to work around that with: $fp = fopen($file, 'r'); if($fp) { while(!feof($fp)) { echo fread($fp, 1024768);//see the huge buffer to read into } } else { //whatever error handler } Catalin Jordan Miller wrote: Hello all, I am new to this list and I have searched the archives to no avail. I am having a peculiar problem when upgrading to PHP 5: My downloads are now limited to the first 1.9 MB of the file in question, with the download either terminating at 1.9 MB or seemingly continuously stuck in a downloading process at 1.9 MB. The code in the PHP script has not changed and all parameters that I could find that are relevant to this problem are given below: the minimal code needed for download: // $file_to_read is the complete path of the file to download header(Content-Type: application/pdf); header( Content-Disposition: inline; filename= \$filename \); $len = filesize($file_to_read); header(Content-Length: $len); @readfile($file_to_read); php.ini file for both php version 4 and 5 contain the following settings that may be relevant: allow_url_fopen = On max_execution_time = 300 ; Maximum execution time of each script, in seconds max_input_time = 300; Maximum amount of time each script may spend parsing request data memory_limit = 8M ; Maximum amount of memory a script may consume (8MB) post_max_size = 200M upload_max_filesize = 200M Some additional details: All files less than 1.9 MB download fine It is not a corrupted file, because all files larger than 1.9 MB fail after 1.9 MB The connection is not timing out (download of 1.9 MB takes only ~15 sec) Mac OS X 10.3.9 with Marc Liyanage's PHP 5.0.4 Fails for both Safari and Firefox Fails regardless of inline or attachment Fails regardless of pdf or ppt content-type This PHP code ALWAYS works for Marc Liyanage's PHP 4.3.4 with the same settings, above What am I doing wrong??? Any other parameter in php.ini I should have set? Any suggestions are much appreciated. thanks, Jordan -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail()
Did you install sendmail? http://www.php.net/mail Requirements For the Mail functions to be available, PHP must have access to the sendmail binary on your system during compile time. If you use another mail program, such as qmail or postfix, be sure to use the appropriate sendmail wrappers that come with them. PHP will first look for sendmail in your PATH, and then in the following: /usr/bin:/ usr/sbin:/usr/etc:/etc:/usr/ucblib:/usr/lib. It's highly recommended to have sendmail available from your PATH. Also, the user that compiled PHP must have permission to access the sendmail binary. On Aug 17, 2005, at 11:48 AM, George B wrote: Warning: mail() [function.mail]: Failed to connect to mailserver at localhost port 25, verify your SMTP and smtp_port setting in php.ini or use ini_set() I checked php.ini and everything is open [mail function] ; For Win32 only. SMTP = localhost smtp_port = 25 ; For Win32 only. sendmail_from = [EMAIL PROTECTED] SO why does it not work? -- 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] Help correcting a form mailer problem...
wherever you think you are adding data to the gmev array, you are merely adding the on string. I would search your script for the string on and you will find the problem. what you need is the value in the HTML form to be the text you want inserted into the array, such as: input type=checkbox name=gmev[1] value=September 9th Jordan On Aug 17, 2005, at 3:30 PM, zedleon wrote: thanks for the reply... after using the print_r($_POST['gmev']); and selecting all the checkboxes to send to the form the return is Array ( [0] = on [1] = on [2] = on [3] = on ). So the values are missing. don't really know how to proceed at this point. any help is appreciated. Joe Wollard [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I would first start out by dumping the values of $_POST['gmev'] by using print_r($_POST['gmev']); Sounds to me like you're not getting the data that your expecting from the form for some reason. Maybe $_POST['gmev'] is an array of null values? -Good Luck On Aug 17, 2005, at 12:15 PM, zedleon wrote: I previously built a sticky form with dynamic checkbox array's. The form works beautifully thanks to help from Jochem Mass and Kathleen Ballard. I now have a slightly different problem...I have built an email form to send the form data. I copied and used the following code which works great in the sticky form. if (isset($_POST['gmev']) is_array($_POST['gmev'])) { foreach ($_POST['gmev'] as $gmev_day) { print pYou have registered for the: b$gmev_day/b Good Morning East Valley Event./p; } } else { print 'You are not registered for any events!'; } The results is this: You have registered for the: September 9th Good Morning East Valley Event. Now when I use the same code modified for the form mailer I am getting this result. if (isset($_POST['gmev']) is_array($_POST['gmev'])) { foreach ($_POST['gmev'] as $gmev_day) { $msg .= You have registered for the: $gmev_day Good Morning East Valley Event.\n; } } else { $mgs .= You are not registered for any events!; } result is - You have registered for the: on Good Morning East Valley Event. I am missing the value of the variable even though I am receiving all the instances of the variables from the checkboxes. When they are selected, they are present. I really don't know what to do about correcting the problem. Any guidance here would really be appreciatedand...go easy on me...I am new to PHP Thanks before hand... zedleon -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help correcting a form mailer problem...
Sorry, I believe you are mistaken here... you *can* specify a value for each checkbox and have it come through. I have written scripts that do this, and here is another example: http://www.tizag.com/phpT/examples/formex.php/ all zedleon needs to do is add the correct value parameter to each checkbox. Jordan On Aug 17, 2005, at 3:57 PM, [EMAIL PROTECTED] wrote: Sorry I should clarify... checkboxes don't send their values through they send their names and states... so if you have the array: Name=qmev[1]... name=qmev[2]... name=qmev[3] And your array contains [1] = on : [3] = on 1 and 3 are selected -Original Message- From: zedleon [mailto:[EMAIL PROTECTED] Sent: 17 August 2005 21:30 To: php-general@lists.php.net Subject: Re: [PHP] Help correcting a form mailer problem... thanks for the reply... after using the print_r($_POST['gmev']); and selecting all the checkboxes to send to the form the return is Array ( [0] = on [1] = on [2] = on [3] = on ). So the values are missing. don't really know how to proceed at this point. any help is appreciated. Joe Wollard [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I would first start out by dumping the values of $_POST['gmev'] by using print_r($_POST['gmev']); Sounds to me like you're not getting the data that your expecting from the form for some reason. Maybe $_POST['gmev'] is an array of null values? -Good Luck On Aug 17, 2005, at 12:15 PM, zedleon wrote: I previously built a sticky form with dynamic checkbox array's. The form works beautifully thanks to help from Jochem Mass and Kathleen Ballard. I now have a slightly different problem...I have built an email form to send the form data. I copied and used the following code which works great in the sticky form. if (isset($_POST['gmev']) is_array($_POST['gmev'])) { foreach ($_POST['gmev'] as $gmev_day) { print pYou have registered for the: b$gmev_day/b Good Morning East Valley Event./p; } } else { print 'You are not registered for any events!'; } The results is this: You have registered for the: September 9th Good Morning East Valley Event. Now when I use the same code modified for the form mailer I am getting this result. if (isset($_POST['gmev']) is_array($_POST['gmev'])) { foreach ($_POST['gmev'] as $gmev_day) { $msg .= You have registered for the: $gmev_day Good Morning East Valley Event.\n; } } else { $mgs .= You are not registered for any events!; } result is - You have registered for the: on Good Morning East Valley Event. I am missing the value of the variable even though I am receiving all the instances of the variables from the checkboxes. When they are selected, they are present. I really don't know what to do about correcting the problem. Any guidance here would really be appreciatedand...go easy on me...I am new to PHP Thanks before hand... zedleon -- 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 __ NOD32 1.1196 (20050817) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com -- 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] Help correcting a form mailer problem...
Ted, On your sticky page, your checkbox input commands no longer have their corresponding value attributes. Just add those back in, and you will be all set (you only have the value attribute set on the event_reg.php page, NOT on the event_reg_calc.php page). This is your only problem. i.e. change the code so that the output here: http://www.passeycorp.com/event_reg_calc.php will change from this: input name=gmev[] type=checkbox id=gmev checked=checked/ to this: input name=gmev[] type=checkbox id=gmev value=September 9th checked=checked/ Jordan On Aug 17, 2005, at 4:52 PM, Support wrote: Thanks for the post... The problem I am having here is that once the sticky or dynamic form is created... The checkboxes at that point don't seem to be passing the value only the state. So when it is submitted to the send mail form no value appears. I need to make the sticky pass the value... How is this done? test form is on http://www.passeycorp.com/event_reg.php check it out and I think you'll see what I mean. The suggestions and help are greatly appreciated. Ted - Original Message - From: Jordan Miller [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Wednesday, August 17, 2005 5:28 PM Subject: Re: [PHP] Help correcting a form mailer problem... Sorry, I believe you are mistaken here... you *can* specify a value for each checkbox and have it come through. I have written scripts that do this, and here is another example: http://www.tizag.com/phpT/examples/formex.php/ all zedleon needs to do is add the correct value parameter to each checkbox. Jordan On Aug 17, 2005, at 3:57 PM, [EMAIL PROTECTED] wrote: Sorry I should clarify... checkboxes don't send their values through they send their names and states... so if you have the array: Name=qmev[1]... name=qmev[2]... name=qmev[3] And your array contains [1] = on : [3] = on 1 and 3 are selected -Original Message- From: zedleon [mailto:[EMAIL PROTECTED] Sent: 17 August 2005 21:30 To: php-general@lists.php.net Subject: Re: [PHP] Help correcting a form mailer problem... thanks for the reply... after using the print_r($_POST['gmev']); and selecting all the checkboxes to send to the form the return is Array ( [0] = on [1] = on [2] = on [3] = on ). So the values are missing. don't really know how to proceed at this point. any help is appreciated. Joe Wollard [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I would first start out by dumping the values of $_POST['gmev'] by using print_r($_POST['gmev']); Sounds to me like you're not getting the data that your expecting from the form for some reason. Maybe $_POST['gmev'] is an array of null values? -Good Luck On Aug 17, 2005, at 12:15 PM, zedleon wrote: I previously built a sticky form with dynamic checkbox array's. The form works beautifully thanks to help from Jochem Mass and Kathleen Ballard. I now have a slightly different problem...I have built an email form to send the form data. I copied and used the following code which works great in the sticky form. if (isset($_POST['gmev']) is_array($_POST['gmev'])) { foreach ($_POST['gmev'] as $gmev_day) { print pYou have registered for the: b$gmev_day/b Good Morning East Valley Event./p; } } else { print 'You are not registered for any events!'; } The results is this: You have registered for the: September 9th Good Morning East Valley Event. Now when I use the same code modified for the form mailer I am getting this result. if (isset($_POST['gmev']) is_array($_POST['gmev'])) { foreach ($_POST['gmev'] as $gmev_day) { $msg .= You have registered for the: $gmev_day Good Morning East Valley Event.\n; } } else { $mgs .= You are not registered for any events!; } result is - You have registered for the: on Good Morning East Valley Event. I am missing the value of the variable even though I am receiving all the instances of the variables from the checkboxes. When they are selected, they are present. I really don't know what to do about correcting the problem. Any guidance here would really be appreciatedand...go easy on me...I am new to PHP Thanks before hand... zedleon -- 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 __ NOD32 1.1196 (20050817) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com -- 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] sending HTML (incl. embedded images) to browser
Hi Jake, You don't have to do anything special, you just have to have standards compliant HTML output. What is the HTML for the IMG tag output to the browser (i.e. go to the web browser, load the page in question, find the img tag, and send us this text). I think maybe your images are just not in the right directory or are not being referenced correctly. also, what is the actual PHP code used to print the img tag? maybe you're not escaping quotes correctly...? Jordan On Aug 17, 2005, at 5:42 PM, Jake Sapirstein wrote: Hi List, I am a PHP newbie, pardon the elementary question - I am starting out with using print() to send HTML to the browser to be rendered. All is well with text and tables and other HTML formatting, but when trying to send IMG tags, my images aren't getting displayed. Is there a good tutorial out there (I can't seem to find it) on how to send HTML to a browser where the HTML includes IMG tags with links to image files? If I need to set up the filepaths with variables I can figure that out, but not sure what functions to use to set the paths up. Thanks for any pointers! -Jake -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 5 limits readfile to 1.9 MB?
Hello all, I am new to this list and I have searched the archives to no avail. I am having a peculiar problem when upgrading to PHP 5: My downloads are now limited to the first 1.9 MB of the file in question, with the download either terminating at 1.9 MB or seemingly continuously stuck in a downloading process at 1.9 MB. The code in the PHP script has not changed and all parameters that I could find that are relevant to this problem are given below: the minimal code needed for download: // $file_to_read is the complete path of the file to download header(Content-Type: application/pdf); header( Content-Disposition: inline; filename=\$filename\); $len = filesize($file_to_read); header(Content-Length: $len); @readfile($file_to_read); php.ini file for both php version 4 and 5 contain the following settings that may be relevant: allow_url_fopen = On max_execution_time = 300 ; Maximum execution time of each script, in seconds max_input_time = 300; Maximum amount of time each script may spend parsing request data memory_limit = 8M ; Maximum amount of memory a script may consume (8MB) post_max_size = 200M upload_max_filesize = 200M Some additional details: All files less than 1.9 MB download fine It is not a corrupted file, because all files larger than 1.9 MB fail after 1.9 MB The connection is not timing out (download of 1.9 MB takes only ~15 sec) Mac OS X 10.3.9 with Marc Liyanage's PHP 5.0.4 Fails for both Safari and Firefox Fails regardless of inline or attachment Fails regardless of pdf or ppt content-type This PHP code ALWAYS works for Marc Liyanage's PHP 4.3.4 with the same settings, above What am I doing wrong??? Any other parameter in php.ini I should have set? Any suggestions are much appreciated. thanks, Jordan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] datetime formatting problem
[snip /] Hi Matt, try this: function formatDate($val) { $timestamp = strtotime($val); return date('M d, Y g:i A', $timestamp); } strtotime possibly will not work if your date is 01/01/1970. [snip /] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code Review PLEASE !!!
Wells first of all, you are going to want better form input validation. For Example: foreach ($_POST['fleet_id'] as $key = $value) { $fleetCode = $_POST['fleet_code'][$key]; $historyUrl = $_POST['history_url'][$key]; $downloadUrl = $_POST['download_url'][$key]; mysql_query(UPDATE imp_fleet SET fleet_code = '$fleetCode', history_url = '$historyUrl', download_url = '$downloadUrl' WHERE fleet_id = $value) or die (mysql_error()); } Are you sure that $_POST['fleet_id'] is valid? or even a number? What happens with $_POST['fleet_id'] == '1 = 1'?? Well, long story short, imp_fleet has no more records. Just a simple example of a huge problem. Jordan S. Jones Matthew Oatham wrote: Hi, I am a newbie PHP programmer, I have some code that works but I want some tips on how I an Improve my code, i.e. should I be doing my updates / deletes on same php page as the display page, am I using transactions correctly, am I capturing SQL errors correctly am I handling form data as efficient as possible? My code displays some information from a database and gives users the chance to delete or edit any field and is as follows: ? include (../db.php); $acton = $_POST['action']; if ($action == update) { if (isset($_POST['delete'])) { $deleteList = join(', ', $_POST['delete']); } //Enter info into the database mysql_query(begin); foreach ($_POST['fleet_id'] as $key = $value) { $fleetCode = $_POST['fleet_code'][$key]; $historyUrl = $_POST['history_url'][$key]; $downloadUrl = $_POST['download_url'][$key]; mysql_query(UPDATE imp_fleet SET fleet_code = '$fleetCode', history_url = '$historyUrl', download_url = '$downloadUrl' WHERE fleet_id = $value) or die (mysql_error()); } if ($deleteList) { mysql_query(DELETE FROM imp_fleet WHERE fleet_id IN($deleteList)) or die (mysql_error()); } if (mysql_error()) { echo (There has been an error with your edit / delete request. Please contact the webmaster); mysql_query(rollback); } else { mysql_query(commit); } } ? html head title/title /head body form name=edit method=post h1Edit / Delete Fleet/h1 table tr tdFleet Code/td tdDownload URL/td tdHistory URL/td tdDelete/td /tr ? $sql = mysql_query(SELECT fleet_id, fleet_code, download_url, history_url FROM imp_fleet); if (mysql_num_rows($sql) 0) { while ($row = mysql_fetch_array($sql)) { ? tr tdinput type=text name=fleet_code[] value=?=$row['fleet_code']?input type=hidden name=fleet_id[] value=?=$row['fleet_id']?/td tdinput type=text name=download_url[] value=?=$row['download_url']?/td tdinput type=text name=history_url[] value=?=$row['history_url']?/td tdinput type=checkbox name=delete[] value=?=$row['fleet_id']?/td /tr ? } } ? tr td colsapn=4 table tr tdinput type=hidden name=action value=updateinput type=reset value=cancel/td td colspan=2input type=submit value=submit/td /tr /table /td /tr /table /form /body /html Thanks for your time and feedback. Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code Review PLEASE !!!
If it were me I would do both Client and Server side validation. The majority of the time the client side will suffice, but, simply put, because you don't/may not look at the HTML source of a web page, doesn't mean that nobody else does. The fact of the matter is, you should not trust any data that comes from a form. Even if the ids come from the database, you still want to ensure that they really are a valid numerical value or whatever your ids happen to be based upon. Jordan S. Jones Matthew Oatham wrote: Yes I agree I need some validation, dunno whether to do server or client side validation. I don't think the fleet_id example will be a problem though as this is retrieved from the database where the field is an int. Thanks for your feedback Matt - Original Message - From: Jordan S. Jones [EMAIL PROTECTED] To: Matthew Oatham [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, April 05, 2004 11:56 PM Subject: Re: [PHP] Code Review PLEASE !!! Wells first of all, you are going to want better form input validation. For Example: foreach ($_POST['fleet_id'] as $key = $value) { $fleetCode = $_POST['fleet_code'][$key]; $historyUrl = $_POST['history_url'][$key]; $downloadUrl = $_POST['download_url'][$key]; mysql_query(UPDATE imp_fleet SET fleet_code = '$fleetCode', history_url = '$historyUrl', download_url = '$downloadUrl' WHERE fleet_id = $value) or die (mysql_error()); } Are you sure that $_POST['fleet_id'] is valid? or even a number? What happens with $_POST['fleet_id'] == '1 = 1'?? Well, long story short, imp_fleet has no more records. Just a simple example of a huge problem. Jordan S. Jones Matthew Oatham wrote: Hi, I am a newbie PHP programmer, I have some code that works but I want some tips on how I an Improve my code, i.e. should I be doing my updates / deletes on same php page as the display page, am I using transactions correctly, am I capturing SQL errors correctly am I handling form data as efficient as possible? My code displays some information from a database and gives users the chance to delete or edit any field and is as follows: ? include (../db.php); $acton = $_POST['action']; if ($action == update) { if (isset($_POST['delete'])) { $deleteList = join(', ', $_POST['delete']); } //Enter info into the database mysql_query(begin); foreach ($_POST['fleet_id'] as $key = $value) { $fleetCode = $_POST['fleet_code'][$key]; $historyUrl = $_POST['history_url'][$key]; $downloadUrl = $_POST['download_url'][$key]; mysql_query(UPDATE imp_fleet SET fleet_code = '$fleetCode', history_url = '$historyUrl', download_url = '$downloadUrl' WHERE fleet_id = $value) or die (mysql_error()); } if ($deleteList) { mysql_query(DELETE FROM imp_fleet WHERE fleet_id IN($deleteList)) or die (mysql_error()); } if (mysql_error()) { echo (There has been an error with your edit / delete request. Please contact the webmaster); mysql_query(rollback); } else { mysql_query(commit); } } ? html head title/title /head body form name=edit method=post h1Edit / Delete Fleet/h1 table tr tdFleet Code/td tdDownload URL/td tdHistory URL/td tdDelete/td /tr ? $sql = mysql_query(SELECT fleet_id, fleet_code, download_url, history_url FROM imp_fleet); if (mysql_num_rows($sql) 0) { while ($row = mysql_fetch_array($sql)) { ? tr tdinput type=text name=fleet_code[] value=?=$row['fleet_code']?input type=hidden name=fleet_id[] value=?=$row['fleet_id']?/td tdinput type=text name=download_url[] value=?=$row['download_url']?/td tdinput type=text name=history_url[] value=?=$row['history_url']?/td tdinput type=checkbox name=delete[] value=?=$row['fleet_id']?/td /tr ? } } ? tr td colsapn=4 table tr tdinput type=hidden name=action value=updateinput type=reset value=cancel/td td colspan=2input type=submit value=submit/td /tr /table /td /tr /table /form /body /html Thanks for your time and feedback. Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 4.3.4 EAPI
Hello all.. For some odd reason, I am having a very very difficult time compiling PHP with EAPI support.. Here is my configure line: CFLAGS= -DEAPI \ ./configure \ --with-apxs \ --with-config-file-path=/etc \ --disable-short-tags \ --with-zlib \ --with-bz2 \ --with-curl \ --with-mcrypt \ --with-mhash \ --with-mysql \ --enable-xslt \ --without-pear \ --with-pgsql \ --with-gd \ --enable-gd-native-ttf \ --with-xslt-sablot \ --disable-debug \ --enable-bcmath \ --enable-calendar \ --enable-inline-optimization \ --enable-memory-limit \ --enable-rule=EAPI Any help on the matter would be greatly appreciated.. Thanks, Jordan S. Jones -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie pls help
This might help as well: http://www.php.net/manual/en/installation.php Jordan S. Jones Mrs. Geeta Thanu wrote: Hi all, I want to install apache and php in a redhat box version 8 and want apache to load php. So how i shld proceed. Just downloading the rpms of both and installing will help or I have to down load the source and compile it. Pls help Thank u Geetha -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML via echo or not
Why make PHP work harder than it needs to? Jordan Robin Kopetzky wrote: Good evening. I'm probably going to stir up a hornet's nest but have a question. Does using echo for ALL html pages mean I have a sick mind? Example: echo CR, 'HTML', CR, ' BODY', CR, ' etc...'; I like the look. It's more readable, gives me a better view of variables as they are all single-quoted and stand out nicely in my editor. No messy jumping into and out of php. I have looked at a bunch of php code written by others and HEREDOC looks stupid with everything jammed against the left side of the screen, php tags within HTML breaks up the flow of properly formatted HTML, which I firmly require for all of my code, and just doesn't look right. 'print' makes you add \ to all of the HTML attributes but the 'echo' method makes everything look like php! Since all your doing is dumping text to the output subsystem, there shouldn't be any speed decrease in the code. Yes, I know, there are advocates for every kind of method to display HTML code but just wanting to get others opinions on the subject. If you wish, email me off-list @ sparkyk-AT-blackmesa-isp.net. Cheers! Robin 'Sparky' Kopetzky Black Mesa Computers/Internet Service Grants, NM 87020 -- I am nothing but a poor boy. Please Donate.. https://www.paypal.com/xclick/business=list%40racistnames.comitem_name=Jordan+S.+Jones -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help With Recursion Multi-Dimensional Arrays
Navid, So you want something like this: Category 1 Category 2 | --- Category a | Category b | Category X | Category Y | Category AC | Category BC | Category Z | Category c Category 3 in a multi-dimentional array Jordan S. Jones Navid Yar wrote: Hello Guys, I need a little bit of help with recursion. I've searched our PHP website and Google, but none helped me understand my problem. There is a code below this message in order to help you understand what I am trying to achieve. Here is an explaination: What I'm trying to do is list a typical category/subcategory system with parents and children associated with those parents. My database table (categories) lists all the parents and children together, each with a parent_id field (with root being a value of 0). What I want to do is, if a user clicked on one of the parent categories, only one level of that category will show (or only the direct children of that specific category will show). I want the depth to be endless because I want to control the depth some other way. I know that using a recursive theory would cost a lot as far as speed goes, but I'm willing to risk it for now. Here is the problem: The problem is that the recursive method yields several arrays, instead of one long array. I tried to use an array_push() function, but that doesn't seem to work well with multi-dimentional arrays. I tried the straight way, i.e. $menu_array[$count]['name'] = $name_of_category or $menu_array['name'][$count] = $name_of_category, but that yields several arrays instead of one long array or category names. The depth of the categories can be determined by the $_GET string passed, $_GET['some_path'], which is in the format: parent1_child1_grandchild1_grandchild2, etc.($some_path = 1_4_6_8), where all of these are related to each other. These, of course, are split using the underscore delimeter: $path['0'] = 1, $path['1'] = 4, and so on. And finally, here is my question: How do I get all these categories, parents and children, listed into one array and then returned. I want to be able to list them on the web page using one array. I will also include id, parent_id, and other info with each array, but first I want to get the name listings of the categories to work. Also, if anyone has any suggestions about a more speedier way to do this, please let me know. Sorry for the long explaination, I just wanted to make sure you guys understood my goals. Thanks in advance to anyone that responds, I appreciate it very much. Here is the code I promised: - function menu_tree($parent_id = '0', $cPath = '', $menu_array = '') { if (!is_array($menu_array)) { $menu_array = array(); $cPath = $this-separatePath($_GET['cPath']); // separates $_GET string into array of category ids } else { reset($cPath); array_shift($cPath); } if (sizeof($cPath) = 0) { $db = new base_db(); $query = select cid, name, parent_id from categories where parent_id = ' . $parent_id . ' order by sort_order, name;; $categories = $db-fetch_results($query); //echo sizeof($cPath).br /; //echo $query.br /; for ($i = 0, $count = 0; $i count($categories); $i++, $count++) { // The following are the methods I tied, but failed to work //$menu_array['name'][$count] = $categories[$i]['name']; //$menu_array[]['name'] = $categories[$i]['name']; //$menu_array['name'][] = $categories[$i]['name']; //array_push($menu_array, $categories[$i]['name']); // This one works, but does not yeild a multi-dimensional array, which is what I need if I were to add more information to the output of this array, like id and parent_id //array_push($menu_array[$count]['name'], $categories[$i]['name']); // This does not work, gives error saying the first parameter of array_push must be an array if (($this-get_children($categories[$i]['cid'])) in_array($categories[$i]['cid'],$cPath)) { $this-menu_tree($categories[$i]['cid'], $cPath, $menu_array); } } } print_r($menu_array); } - Here is what it returns using the print_r() function on $menu_array Array ( [name] = Array ( [0] = Cars [1] = Honda [2] = Accord [3] = 1996 [4] = 1997 [5] = 1998 [6] = 1999 [7] = 2000 [8] = 2001 [9] = 2002 ) ) Array ( [name] = Array ( [0] = Cars [1] = Honda [2] = Accord [3] = Civic ) ) Array ( [name] = Array
Re: [PHP] OT - Quick JavaScript Question
Jake McHenry wrote: I have tried this already, and it works, the JavaScript get's the server's time, but then the JavaScript clock doesn't keep counting, it's stuck at the servers time. It needs that Date() function to keep pulling the time from the local machine I guess. I was wondering if anyone knew of a way I could pass the server time into the JavaScript Date() function to make it start counting from that time, instead of the users machine time. Thanks, Jake Yes, http://devedge.netscape.com/library/manuals/2000/javascript/1.5/reference/date.html#1193137 Jordan S. Jones -- I am nothing but a poor boy. Please Donate.. https://www.paypal.com/xclick/business=list%40racistnames.comitem_name=Jordan+S.+Jonesno_note=1tax=0currency_code=USD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] database
Alain, You can pass it in the function as a variable. E.g... Function closeDB($ref_link) { mysql_close($ref_link); } closeDB($connectie); Hope this Helps, Jordan S. Jones -- I am nothing but a poor boy. Please Donate.. https://www.paypal.com/xclick/business=list%40racistnames.comitem_name=Jordan+S.+Jonesno_note=1tax=0currency_code=USD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php