[PHP] Dynamic array creation and tracking
Howdy guys and girls. Been a long time since I've been in these parts. My php is rusty these days, so please bare with me. I'm trying to create a dynamic, multidimensional array, and keep track of which level I'm on, opening and closing levels as needed. Lets say that I have some data like the below: Array ( [0] => Array ( [tag] => OrderFeed [type] => open [level] => 1 [attributes] => Array ( [version] => 1.0 ) [value] => - ) [1] => Array ( [tag] => Order [type] => open [level] => 2 [value] => - ) [2] => Array ( [tag] => OrderId [type] => open [level] => 3 ) [3] => Array ( [tag] => E4XOrderId [type] => complete [level] => 4 [value] => E4X0001 ) [4] => Array ( [tag] => MerchantOrderId [type] => complete [level] => 4 [value] => Mrc001 ) [5] => Array ( [tag] => MerchantOrderRef [type] => complete [level] => 4 [value] => ABCDEFGHI01 ) [6] => Array ( [tag] => OrderId [type] => close [level] => 3 ) [7] => Array ( [tag] => Order [value] => - [type] => cdata [level] => 2 ) [8] => Array ( [tag] => OrderDate [type] => open [level] => 3 ) [9] => Array ( [tag] => CreateDate [type] => complete [level] => 4 [value] => 12-03-2007 ) [10] => Array ( [tag] => ExpiryDate [type] => complete [level] => 4 [value] => 12-15-2007 ) ) I create an empty array before I start looping through this data: $newArray = array(); Now, when looping through the data, every time I encounter a 'tag' that is of the open 'type' I need to create a new array within the base array with the value of 'tag' as the index: $newArray['OrderFeed'] $newArray['OrderFeed']['Order'] $newArray['OrderFeed']['Order']['OrderID'] So on and so forth. When I get to a 'tag' that is of the 'type' complete, I need to make that a name value pair in the current level of the array: Array ( [OrderFeed] => Array ( [Order] = Array ( [OrderID] = Array ( [CreateDate] => 12-03-2007 ) ) ) ) And when I get to 'tag' of the close 'type', I need to move up one level in the array. I have tried using another array just to keep track of what level of the array I'm currently on, but I can seem to figure out how to form the master array out of it. In the above example, I would have an array with the 'OrderFeed', 'Order' and 'OrderID' as the three elements in it. If I encounter and 'open' tag, I add that value onto the end of the 'tracking' array, and when I encounter a 'close' tag, I just pop the last element off of the tracking array. So basically, I'm trying to take the values in my 'tracking' array Array ( OrderFeed, Order, OrderID ) And somehow, use them to keep track of where I am in the dynamic $newArray. I hope this makes senseI know what I want to do in my head, but I'm not sure I'm getting it out well here. Any suggestions? Questions? -- John C. Nichel IV System Administrator KegWorks http://www.kegworks.com 716.362.9212 x16 j...@kegworks.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] OT - Leaving
Howdy ladies and gents: For the past 9 or so years, with one email account or another, I have been subscribed to the PHP General Mailing List. Well, life an work have succeeded in taking up all of my time, and the only thing I've been able to do with this list over the past year or so is select all the unread messages in my php folder, and hit the delete key. If I've posted 10 messages over the past year, I'd be surprised (probably why you n00bs are saying to yourself, "who the hell is this guy"). I'm just popping in now to let y'all know that I'm off to join people like John and Jason in the world of, "what ever happened to him". For those of you who give a damn ;) I can be reached at numerous email addresses, including: john nichel net jnichel by-tor com As well as the other in this email (which have already been harvested by a billion spam bots). Have fun, and I'll see ya on the other side. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Staff log-in
Paul Novitski wrote: At 11/10/2006 07:09 AM, tedd wrote: Lastly, I think we all know that "non-profit" simply means that at the end of the year you get to roll your profits over to the next year without incurring taxes on the excess. Nothing more. Plus, there's no limit or requirements as to the amount/percentage you pay yourself as compared to what amounts you apply to your "cause". So, mentioning "non-profit" to me is like saying you're just another scam -- and one, who's trolling for free php services. In the meantime, I suppose it is emblematic of my own innocence that it always surprises me when someone asks a naive question and is answered by insults and jeers in a listserve composed of bright and knowledgeable people who have purportedly come together for mutual education. The OP didn't ask a 'naive question' about why his register globals isn't working or something like that...he asked us to do his work for him. No 'mutual education' there. There may be no such thing as a stupid question, but the same cannot be said of the range of possible answers. It's naive to think there are no stupid questions. Had the original poster known enough about our field to ask for recommendations of open source solutions, would he have been treated so roughly? Nope. He didn't, by the way, ask for anything for free. He said, I unfortunately can't make it myself because I don't have the knowledge, can anyone of you do this for me? When no mention of remuneration has been made, why do you assume none will be forthcoming? Is this how you greet all prospective clients, non-profit or otherwise, who approach you asking for help? Are we to assume that this indicates your innate curiosity, your desire to gain clients, your ability to negotiate, your willingness to devote yourself to a good cause, or your capacity for politeness? If you followed the thread, you would have read that the OP got his panties in a knot when I posted him my rates for doing the job for him. On the surface you appear defend your right to be paid for your work (as though anyone had demanded otherwise!), but I would be very surprised if the OP considered for a moment hiring any self-proclaimed professional who replied so harshly to his query. His loss. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Staff log-in
Jochem Maas wrote: John Nichel wrote: 5) $80.00 is my *reduced* rate. ah - I was worried you might have been factoring in age-related brain depreciation ;-) If I factored that in, I'd have to pay the client. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Staff log-in
Brynjar Guðnason wrote: Why did you bother to answer me ? Please send all your replies to the list. 1) You asked if anyone could do this. 2) I gave you my rates. 3) Non-profit companies pay for services. 4) If you didn't want to pay, you should have specified that a) If you want someone on this list to do it for you out of the goodness of their heart because you *claim* it is for a non- profit organization, then you're going to need to pony up some proof to collaborate your word. b) The people on this list donate their time to the list to help answer questions. I think it is safe to say that all of us have bills to pay, and don't want to give our services away for free. So, try not to get your panties in a knot when we want to be paid for our work. 5) $80.00 is my *reduced* rate. 2006/11/9, John Nichel <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>: Brynjar Guðnason wrote: > Hi, > > I need a little php script. Staff log in by entering username and password > and then the next time they enter their username and password they log out. > The script has to take down the time they log in and log out. Then I should > be able to read old log-ins and log-outs. > > I unfortunately can't make it myself because I don't have the knowledge, > can > anyone of you do this for me? It's for a small non-profit orginisation. > $80.00 an hour. 8 hour minimum. I am a *for-profit* individual. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Staff log-in
Brynjar Guðnason wrote: Hi, I need a little php script. Staff log in by entering username and password and then the next time they enter their username and password they log out. The script has to take down the time they log in and log out. Then I should be able to read old log-ins and log-outs. I unfortunately can't make it myself because I don't have the knowledge, can anyone of you do this for me? It's for a small non-profit orginisation. $80.00 an hour. 8 hour minimum. I am a *for-profit* individual. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Delivery failed
Stut wrote: Brad Fuller wrote: Did everyone on the list get this message? Dear user php-general@lists.php.net, We have found that your e-mail account was used to send a large amount of junk email messages during the last week. Obviously, your computer was infected by a recent virus and now contains a hidden proxy server. We recommend that you follow our instruction in the attached text file in order to keep your computer safe. Sincerely yours, lists.php.net user support team. Yes, it's evil people trying to spread nastiness. The attachment (probably helpfully removed by the listserver) would have contained a virus. Well, send me the damn virus. I'll open it. I want to add it to my collection!!! -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] why so slow?
Mel wrote: Your advice is well taken and thank you. I do have a book with the help of which I made this site and I have been working on it for many many weeks. (ashamed to say exactly how many!) Remember your first ever php site? Yep, it was for a Fortune 500 company, but that's not the point. I truly do appreciate all the help I got and it did lead me to validate my html, change my links ... Which is beyond the scope of this list, and something you should have done even before coming to this list (this being one of the points: troubleshooting). I am sure there are things even you don't know or understand and that you can use help from other more experienced and generous people who are willing to share. There are, and I have, but this list, as well as others like it, are not my first stop (this being the other point: there are resources available which should be utilized before coming to the list). On Nov 1, 2006, at 12:20 PM, John Nichel wrote: Mel wrote: I have this is the page I am working on right now and it is valid html 4.01 http://www.squareinch.net/client_testing_html401.php Bzzttt. No, it isn't. The people here have been pretty accommodating of you so far, but if you continue to *not* do any research yourself, continue to *not* understand the basics of what you are trying to do, the accommodation will end quickly. Buy a book. Read some online manuals. Google. Learn how to troubleshoot. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] why so slow?
Mel wrote: I have this is the page I am working on right now and it is valid html 4.01 http://www.squareinch.net/client_testing_html401.php Bzzttt. No, it isn't. The people here have been pretty accommodating of you so far, but if you continue to *not* do any research yourself, continue to *not* understand the basics of what you are trying to do, the accommodation will end quickly. Buy a book. Read some online manuals. Google. Learn how to troubleshoot. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Run script every 30 seconds
Ahmad Al-Twaijiry wrote: Hi everyone, I have a script that I want it to run every 30 seconds, the problem is that cronjob can run every 1 minute only, do you have any solution ? Use atd. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with mail function
Ricardo Ríos wrote: Hi wizards, I 'm trying to use mail function in PHP, but this function don't send the email , I have a server with postfix. Does somebody know how to send an email with php and postfix. Thanks in advance. Does your install of postfix have a sendmail wrapper? Is it in the normal sendmail location (/usr/bin/sendmail)? Is this on the same machine as your php install? Does the user in which Apache is running as have permission to invoke the sendmail wrapper? -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Job postings?
Steve Lane wrote: Greetings all: This is a general etiquette question. I have a job posting for a junior PHP programmer. Are there any of the PHP mailing lists to which it would be appropriate to post that? If not, can anyone recommend a good place to post, especially a place that might be read by many people with specifically PHP skills? This list is fine to post that sort of thing, at least in my view. However, if you're looking for someone local, you might do better posting it to the mailing list of your local LUG. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IMAP extension causing delays
Edward Kay wrote: From this, it is clear to me there is some major delay being introduced by the loading of the IMAP extension. Any ideas on how to resolve this? use php as an apache module - thereby the startup delay is only noticed when the webserver starts - this assumes that the problem is a startup problem ... No can do. I need to run my PHP scripts as different users and to interact with the file system. You can still do this running php as a module. Just enable suexec in Apache (and configure it safely of course). -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IMAP extension causing delays
Edward Kay wrote: Hello, I need PHP's IMAP extension for my web app but it is really slowing my server up. My setup: Fedora Core 5, Apache 2.2.2, PHP 5.1.4 (run as CGI with suPHP), PHP IMAP extension - all standard FC5 RPMs. The test page is simple - just a call to phpinfo(). Without the IMAP extension, the response time is almost immediate. With the IMAP extension it takes 2-3 seconds to respond - sometimes as much as 4 secs. Watching with 'top', I can see php-cgi is called immediately when the request is received. With the IMAP extension installed, after php-cgi starts, it then drops to the end of the 'top' list, consuming 0% CPU and 2.0% memory. It remains there for the 2-3 second delay before coming into play again an running the script quickly. Without the IMAP extension, it just ends quickly having finished the request. From this, it is clear to me there is some major delay being introduced by the loading of the IMAP extension. Any ideas on how to resolve this? If you don't have to, don't run it as a cgi. A /possible/ solution, and I don't even know if it's possible, is to compile two versions of the cgi; one with and one without. While I know that part is at least possible, I don't know if you can make your webserver *choose* which version of the cgi to run depending on the need. Can the cgi in PHP5 dynamically load modules? dl() is available in PHP4, but I think they got rid of it in PHP5 -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex
Bagus Nugroho wrote: Hi All, If we have variable like : $var1 = 'abcde 12'; $var2 = 'abcdefghi 34'; $var3 = 'abc 20 def'; Then we want output like : $var1 = 'abcde'; $var2 = 'abcdefghi'; $var3 = 'abc def'; How regex can help us?. Use preg_replace to replace all numbers with nothing. $var = preg_replace ( "/\d+/", "", $var ); -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] foreach
Chris Boget wrote: $last = end ( $numbers ); reset ( $numbers ); I thought foreach() already performed a reset()? Why do it again here? Well, corn my fritters, according to TFM, it does this indeed. Maybe an old dog can learn new tricks. ;) -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] foreach
João Cândido de Souza Neto wrote: Hello. In the follow code: $numbers=array(1,2,3,4,5); foreach ($numbers as number) { ... } Inside foreach, could i know if i am in the last element of the array $numbers? $last = end ( $numbers ); reset ( $numbers ); foreach ( $numbers as $number ) { if ( $number == $last ) { // last element ... } } -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] guess documentroot
Javier Ruiz wrote: Hey all! Is it possible to get the path of a file relative to the document root of the webserver using php? For example... if we have a script like http://localhost/mydir/myseconddir/index.php is there a way to get that it's runing on /mydir/myseconddir/ ?? something like getcwd() but webserver relative, not filesystem. $array = parse_url ( "http://localhost/mydir/myseconddir/index.php"; ); $array2 = pathinfo ( $array['path'] ); $path = $array2['dirname']; -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] chown(), chgrp()
Rahul S. Johari wrote: Is there a way to find out if a file can be chown¹d or chgrp¹d ? Something like is_writeable() ... Except that you¹re trying to find out if you can change the Owner or Group of a file. Who will say it first? http://www.php.net/manual/en/function.fileowner.php -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Frustrated trying to get help from your site
Howard, Tim wrote: Your site is incredibly frustrating and difficult to navigate. My site? Hmmm, I always thought it was pretty easy to navigate. I mean, if you're looking for draft beer equipment, all you have to do is click on the draft beer equipment link. I don't know how I can make that easier, but I will give it the old college try. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Open file on a Mounted Share on Mac OS X
Rahul S. Johari wrote: Ok you may be on to something here. Everytime I was trying to chmod the permissions etcetera, the share was mounted, and that probably was the problem. What is a mount point? How do I set ownership/permission of a mount point? This is going way beyond the scope of this mailing list. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Open file on a Mounted Share on Mac OS X
Rahul S. Johari wrote: Did.. Sudo chmod 770 foresight Specified the root account password. Returned back to prompt without errors, but did absolutely nothing. Permissions remain unchanged. I don't know about Mac, but in Linux you cannot change the permissions of a mount point while the volume is mounted. You can umount the volume, set ownership/permissions on the mount point, then remount the share. Also, you can set the uid and gid in the options of the mount command (as well as rw mode). -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to skip browser's Warning?
[EMAIL PROTECTED] wrote: Hi, Could somebody explain to me what to do to skip this message I'm getting after I search for some products on my page, got the list of products, selected a detailed view of the product and click on the Back button of the browser to see again list of found products (result page): "The Page you are trying to view contains POSTDATA that has expired from cache. If you resend the data, any action the form carried out such as a search or online purchase) will be repeated. To resend the data, click OK. Otherwise, click Cancel." Don't click the back button. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Open file on a Mounted Share on Mac OS X
Rahul S. Johari wrote: I'm beginning to see it's a permissions issue... Although I don't know how to approach it, as like I said, I have every permission you can think of set to this mac os x user. Does your webserver run as the user 'rjohari'? When you say "webserver", are you talking about my Apache Web Server, or the mounted share called "foresight" ? Apache runs as a pre-specified user (usually "nobody") and group, and adheres to the permission level of that user/group. Look in your httpd.conf for what these values are. You *could* change how Apache runs, but I would leave that as is, and give Apache access to only the areas it needs access to (ie permissions on dirs and files). -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Open file on a Mounted Share on Mac OS X
Rahul S. Johari wrote: How can I set the "drwxr-xr-x" permissions on my mounted share? I've set everything I possibly could in the windows 2003 server to give the mac os x user full control! man mount -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Open file on a Mounted Share on Mac OS X
Rahul S. Johari wrote: Nope. It looks like this... drwxr-xr-x 3 root root 4096 Sep 13 10:44 . drwxr-xr-x 3 root root 4096 Sep 13 10:46 .. drwx-- 1 rjohari admin 16384 13 Sep 10:38 foresight Foresight being the mounted share. Does your webserver run as the user 'rjohari'? *permission light bulb* -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Open file on a Mounted Share on Mac OS X
Rahul S. Johari wrote: Samba. It's an SMB share. On 9/13/06 12:39 AM, "Chris" <[EMAIL PROTECTED]> wrote: Rahul S. Johari wrote: That was a good idea. I tried that... It was showing nothing for /Volumes/foresight ... But it did show the contents of /Volumes... And interestingly, 'foresight' was also listed there, but it's filetype was blank... Others had like "dir" or "link" or "file" But foresight's filetype had nothing in it!! That'll be the problem. PHP doesn't see it as a valid "type". How is it mounted, through samba, through something else? So it doesn't look like this... [EMAIL PROTECTED] staging]# ls -al total 16 drwxr-xr-x 3 root root 4096 Sep 13 10:44 . drwxr-xr-x 3 root root 4096 Sep 13 10:44 .. drwxr-xr-x 1 root root 4096 Sep 13 10:46 webserver "webserver" is a smb mount on my (Linux) machine. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Open file on a Mounted Share on Mac OS X
Rahul S. Johari wrote: Permissions have been set on the Windows Server for the Mac user... And all permissions have been given to him. This is my code.. $filename exists"; } else { echo "The file $filename does not exist"; } ?> And what does this echo out? -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Open file on a Mounted Share on Mac OS X
Rahul S. Johari wrote: Ave, I¹m getting really frustrated with this. How do I get PHP to open/read a file which is on a Share, mounted on Mac OS X. My Mac OS X is connected to a Windows 2003 Server... A Shared Folder remains mounted on my Mac OS X and I need PHP to read a file off that share. But it won¹t! I just can¹t get the path to work!! I¹ve tried ³/Volumes/Server/file.dbf² . I¹ve tried to create Aliases (shortcuts)... But nothing seems to work! What¹s the trick? How can I get this to work? Any suggestions? Permissions? -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting an argument out of a web page
Brian Dunning wrote: That did it, thanks! :) Keep in mind that if the ID is less than 5 digits, it won't match (I don't know where MySpace ID's start). You can change it to something like \d{1,} if you want it to match 1 or more digits. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting an argument out of a web page
Brian Dunning wrote: I'm trying to read a MySpace FriendID out of a web page. If you view the source, you see this is multiple places: .&friendID=12345& What's the simplest way to extract the FriendID and stick it in a variable? Is there a regex that would do this? Is it always in that format? preg_match ( "/&friendID=(\d{5,})&/", $source, $id ); The result will be in $id[1]. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OT - PHP Hosting Service in UK?
Rory Browne wrote: > > Why? If they're not hosting it in-house, why does it matter where on > the globe it is? Request latency due to distance and intermediate hops. The shorter the distance and fewer hops the faster those little images, stylesheets, and various other embedded media will load. This won't be very noticeable on the first page load due to the download times, but other requests that check timestamps against cache will appear more sluggish than necessary. It's also more fault tolerent. I don't imagine this ever happening, but if the UK was somehow cut off from all other countries internet system, then the UK customers would still be able to access sites in the UK, but not sites outside of the UK. It's one less thing that can go wrong. Seems to me to be too much worrying about a, "vary basic web site". The OP is willing to accept one or two outages a year, ya know? -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OT - PHP Hosting Service in UK?
Miles Thompson wrote: I have a Canadian client, presently living in England, who is setting up a vary basic web site. The business is located in the UK, it makes sense to have the web hosting service in the UK as well. Why? If they're not hosting it in-house, why does it matter where on the globe it is? Would anyone who is happy with a UK hosting service offering PHP (preferably 5) and MySQL please make a suggestion. (I'm willing to accept one or two outages a years, more importantly, if there is a problem with email, etc., are they responsive?) I can understand wanting the hosting service being on the same 'working' hours as the client, but many hosts have 24 hour support. I don't recommend places often, but if your client can accept a host outside of the UK, look at http://www.jtlnet.com I used them for years, and outside of great prices, their service is top notch. Note: I am not associated with JTL in any way, shape or form these days. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Free Shopping Carts
Jay Blanchard wrote: Can we do anything else for you today? I'm a php programmer and I have a valve knocking in the engine of my car. Can you fix it? -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Free Shopping Carts
Curt Zirzow wrote: On 8/30/06, Jay Blanchard <[EMAIL PROTECTED]> wrote: [snip] Are there free shopping carts that would work with PHP 5.0.X + and MySQL 4.1.X + and /or PostgresQL 8.1+ ? [/snip] Yes. Just in case: Try google: 'php mysql shopping' cart or 'php pgsql shopping cart' Freaking goody, goody. ;) -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] stupid compile problem... additional ini files not found
Jochem Maas wrote: hi people, anyone know why my additional ini files are being ignored. I've just built php5.1.1 the configure line is: './configure' '--with-interbase=shared,/opt/firebird' '--with-apxs2=/usr/sbin/apxs' '--with-gd=shared' '--with-zlib-dir' '--with-jpeg-dir' '--with-config-file-scan-dir=/etc/php.d' '--with-mm=/usr' the dir [that php is configured to look in for additional ini files] exists: # ls -lart /etc/php.d/ total 32 -rw-r--r-- 1 root root 375 Aug 21 12:42 interbase.ini -rw-r--r-- 1 root root51 Aug 21 12:42 gd.ini -rw-r--r-- 1 root root 1130 Aug 21 12:42 apc.ini drwxr-xr-x 2 root root 4096 Aug 21 12:45 . drwxr-xr-x 91 root root 12288 Aug 21 13:20 .. YET, doing a 'php -i' shows that no files were read from that dir: PHP Version => 5.1.1 System => Linux testserver.dynabyte.nl 2.6.15-1.2054_FC5 #1 Tue Mar 14 15:48:33 EST 2006 i686 Build Date => Aug 21 2006 13:43:09 Configure Command => './configure' '--with-interbase=shared,/opt/firebird' '--with-apxs2=/usr/sbin/apxs' '--with-gd=shared' '--with-zlib-dir' '--with-jpeg-dir' '--with-config-file-scan-dir=/etc/php.d' '--with-mm=/usr' Server API => Command Line Interface Virtual Directory Support => disabled Configuration File (php.ini) Path => /etc/php.ini Scan this dir for additional .ini files => /etc/php.d PHP API => 20041225 the following line should be part of the snippet just above the last line (PHP API): additional .ini files parsed => /etc/php.d/apc.ini, /etc/php.d/gd.ini, /etc/php.d/interbase.ini any takers? For shits and giggles, does 'other' have execute permission on the directory /etc/php.d? Anything in the Apache error log at start-up? -- By-Tor.com ...it's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] select colum in array.
Adam Zey wrote: I must say So you've said. Three times now. ;) -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Session issues
Dave Goodchild wrote: On 17/08/06, John Nichel <[EMAIL PROTECTED]> wrote: Dave Goodchild wrote: >> >> >> How does the user "go back one page"? If it by using the browser's >> back-button, the php script has no way of knowing it. > > > > Yes, but the session variables have already been set, and are configured to > display in the form fields. > All the session variables in the world aren't going to help when the browser loads a cached page when the back button is pressed. Granted, but that doesn't explain why the whole thing fails ie no session variables at all are entered into the database at the end. Explaining the problem is kind of difficult without seeing any code. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Session issues
Dave Goodchild wrote: How does the user "go back one page"? If it by using the browser's back-button, the php script has no way of knowing it. Yes, but the session variables have already been set, and are configured to display in the form fields. All the session variables in the world aren't going to help when the browser loads a cached page when the back button is pressed. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Max File Upload
Tom Ray [Lists] wrote: Is there anyway to overwrite the max file upload in php.ini per instant? I'd like to have users controlled on a certain website to have more then average uploads but the site runs on a shared hosting environment. http://us3.php.net/ini_set -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ftp_chmod
tedd wrote: Hi gang: Before php 5, how did you guys handle ftp_chmod? Oh, I'd probably try the code outlined in the user contributed section of the ftp_chmod manual page. Keep in mind: a) I'm working on a shared host; b) I'm trying to change permissions via php 4; c) because of (a) (I think) functions such as chmod() don't work; d) and lastly, any references/code on how to manage files (i.e., delete files and change permissions) via php 4 on a shared *nix server would be greatly appreciated. Unless your shared host has those functions disabled, they should work fine as long as you have proper permission to do things like chmod and delete (unlink). -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] List Meeting NNOT
Adam Zey wrote: It's still a bit of a drive when you live in Montreal and don't have a car. About an 18 hour drive, plus a few hours for bus stops and border crossings. Canadians are welcome to come? That's it, count me out! :-p -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Job Posting
Jay Blanchard wrote: [snip] Sure, or a link not that Jay's up for doing any work anymore - he's a director these days ;-) Ah, so that's where Microsoft cronies go to die. :-p [/snip] Yep...they make them management. Sorry to hear about your demotion. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] LAMP Developer Needed - Indianapolis
Jay Blanchard wrote: [snip] Brent Meshier wrote: Qualified candidates should e-mail their resume (Word, PDF, or Plain text preferred) to [EMAIL PROTECTED] Where should non-qualified candidates e-mail their resume? [/snip] To me. Silly me. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] LAMP Developer Needed - Indianapolis
Brent Meshier wrote: Qualified candidates should e-mail their resume (Word, PDF, or Plain text preferred) to [EMAIL PROTECTED] Where should non-qualified candidates e-mail their resume? -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Job Posting
Jochem Maas wrote: Jay Blanchard wrote: [snip] Is it appropriate to post jobs on this list? I have many PHP Developer positions available. [/snip] Sure, or a link not that Jay's up for doing any work anymore - he's a director these days ;-) Ah, so that's where Microsoft cronies go to die. :-p -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cron running 'Hello world' script dies with "Could not startup."
Ivo F.A.C. Fokkema wrote: Hi guys, I'm really stuck with this error and since my backup scripts are no longer running automatically through cron, I really need to get this fixed soon :) Suddenly my backup scripts die with the error "Could not startup.". Only through the cron, it runs fine through the console. I've tried all kinds of tests with other PHP scripts, tried a different PC, asked my distribution mailing list, tried Google and searching this list, nothing... Script: This is the crontab line: * * * * * /usr/bin/php -f /home/ifokkema/test.php - Running the exact same command from the command line works perfectly. - Cron output is nothing more than "Could not startup.". - Have not changed the PHP installation or a cron related package. - Distribution: Ubuntu Dapper, problems started July 31st. Possibly after an upgrade, can't remember. - Tried on different Ubuntu Dapper install, same result. - PHP version: 4.4.2-1build1 - Yes, I've verified that I'm using the PHP-cli executable. Thanks for any input! Ivo Does the user running the cron have permission to execute the php binary? -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php behind firewall
Jochem Maas wrote: Jim Moseby wrote: Jim Moseby wrote: I recently read an article about IP fingerprinting. The concept is that every PC-NIC-CABLE-FIREWALL combination has subtle, but measurable differences in the way they communicate. It was very in-depth, but it worked amazingly well. If I can find the article, I'll post it. Please do. I had read about this before, will read it again. but I suspect that my current server will probably have a hard time calculating the finger print for each connection. :-) Well, if you would stop using the Vic20, and upgrade! -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php behind firewall
Jochem Maas wrote: Andrew Senyshyn wrote: Hi all, I need to get local user IP, but server with apache and php is in another subnetwork. So from server environment I can get only router's IP. The only solution that I see - is getting with some magic algorithm local IP from brouser and sending it to server. My application is for intranet, so I don't see any reason to make users authorization. Any ideas for this? you can't always get the real users IP because of proxies, anonimizers, firewalls/gateways [on the user end] (and don't bother using an IP as an absolute indicator when validating a Wait, are you telling me that I can't auth my customers based on IP alone? Great, now how do I let them view their sensitive data? ;) session - you can use it as one of a number of metrics - for instance AOL users have their IP addresses changed roughly every 300 milliseconds). Gawd, AOL causes us so many headaches with that crap. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php behind firewall
tedd wrote: At 12:55 PM -0400 8/4/06, John Nichel wrote: Wait, are you telling me that I can't auth my customers based on IP alone? Great, now how do I let them view their sensitive data? ;) Okay, how do you? Retina scan, and DNA sample. Seriously though, not by IP in any way, shape or form. The only 'sensitive' data I keep for customers to view is their order history. Credit card numbers are trashed the moment I get a response back from the cc gateway. To get to that they just need their username and password. If they want the system to 'remember' their login, I use a hash of quite a few variables that I place into a cookie on their browser. The only place I use IP to help identify a user (not really a user, but a particular computer) is on our Intranet...and I can only safely (for the most part) rely on this because I control the network and the IP addresses. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The difference between ereg and preg?
Dave M G wrote: PHP List, Recently I wrote a piece of code to scrape data from an HTML page. Part of that code deleted all the unwanted text from the very top of the page, where it says "of a "" tag. That code looks like this: ereg_replace("", "", $htmlPage); It works fine. But I noticed that on almost all the tutorial pages I looked at, they just about always used preg_replace, and not ereg_replace. It seemed that the main difference was that preg_replace required forward slashes around the regular expression, like so: preg_replace("//", "", $htmlPage); But that didn't work, and returned an error. You need to comment out the '!' Since ereg was working, though, I figured I would just stick with it. Still, I thought it worth asking: Is there any reason why either ereg or preg would be more desirable over the other? Perl compatible regexs are faster* and more powerful. Course, writing a good Perl regex is an art form in itself (probably why O'Reilly released a book just on regexs), and takes some time (and headaches) to master (if one ever does master it). The difference in the people who use one or the other? Probably nothing more than their background. Those of us who worked with Perl before php are more than likely gravitate towards preg. Those who didn't, or had little Perl regex experience more than likely went to the POSIX (ereg) style as it's a bit easier to pick up. *I'm sure there are some out there who will dispute this. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What good are constants if you can't use them in an array?
Daevid Vincent wrote: *sigh* Why is PHP so lame... Because some users are too lazy to RTFM. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Documentation of PHP sourcecode
Paul Zwiers wrote: Dear all, With a growing base of previous PHP work (not to be be mistaken for a "framework" :) ) I also find myself recoding and reinventing the wheel. Something I really do not want to do. I am looking in some possibilities for automatically documenting my functions and classes. Preferably with some markup in the sourcecode and easy to implement. I am running Linux on my desktop so w* stuff won't do it for me :) Can anyone point me in the right direction? Thanks in advance! http://www.phpdoc.org/ -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cleaning bad characters from var
Paul Nowosielski wrote: Dear All, I'm trying to set up an XML feed form our news articles. My XML is validating. The issue is some of the articles have a weird encoding. I wrote a function to do this for our product descriptions when sending them in a XML doc to certain vendors. It's old, crude, but you're welcome to it. function convertString ( $string, $reverse = false ) { $find_array = array ( "/"/", "/&/", "/", "/>/", "/ /", "/¡/", "/¢/", "/£/", "/¤/", "/¥/", "/¦/", "/§/", "/¨/", "/©/", "/ª/", "/«/", "/¬/", "//", "/®/", "/¯/", "/°/", "/±/", "/²/", "/³/", "/´/", "/µ/", "/¶/", "/·/", "/¸/", "/¹/", "/º/", "/»/", "/¼/", "/½/", "/¾/", "/¿/", "/À/", "/Á/", "/Â/", "/Ã/", "/Ä/", "/Å/", "/Æ/", "/Ç/", "/È/", "/É/", "/Ê/", "/Ë/", "/Ì/", "/Í/", "/Î/", "/Ï/", "/Ð/", "/Ñ/", "/Ò/", "/Ó/", "/Ô/", "/Õ/", "/Ö/", "/×/", "/Ø/", "/Ù/", "/Ú/", "/Û/", "/Ü/", "/Ý/", "/Þ/", "/ß/", "/à/", "/á/", "/â/", "/ã/", "/ä/", "/å/", "/æ/", "/ç/", "/è/", "/é/", "/ê/", "/ë/", "/ì/", "/í/", "/î/", "/ï/", "/ð/", "/ñ/", "/ò/", "/ó/", "/ô/", "/õ/", "/ö/", "/÷/", "/ø/", "/ù/", "/ú/", "/û/", "/ü/", "/ý/", "/þ/", "/ÿ/" ); $replace_array = array ( '"', '&', '<', '>', ' ', '¡', '¢', '£', '¤', '¥', '¦', '§', '¨', '©', 'ª', '«', '¬', '', '®', '¯', '°', '±', '²', '³', '´', 'µ', '¶', '·', '¸', '¹', 'º', '»', '¼', '½', '¾', '¿', 'À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', '×', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'Þ', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ð', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', '÷', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'þ', 'ÿ' ); $string = htmlentities ( strip_tags ( preg_replace ( "/\n|\r|\r\n/", " ", $string ) ), ENT_QUOTES ); $string = pr
Re: [PHP] Re: headers and newline at end of script
Adam Zey wrote: Note that just because the fact that it works is a feature, doesn't mean it's good coding style. register globals is a feature too, but it isn't exactly a good idea to use it. Ding ding ding Give that man a cigar. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] headers and newline at end of script
Jochem Maas wrote: Martin Marques wrote: On Thu, 20 Jul 2006 11:30:14 -0400, John Nichel <[EMAIL PROTECTED]> wrote: Jochem Maas wrote: I never add the final closing '?>' in any script for this very reason. 'Cause you're a SLACKER!!! What the hell is a SLACKER??? I'm a slacker. Which is why you aren't up for the job here. The slacker position belongs to me. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] headers and newline at end of script
Jochem Maas wrote: Martin Marques wrote: I'm looking for an opinion on programming style. Basicaly, I make systems using PEAR::DB and PEAR::HTML_Template_IT. This last one puts all the HTML away from the PHP code, which has made life much easier. Now, sometimes I warning messages like this one: PHP Warning: Cannot modify header information - headers already sent in I know what it means, so I just look for newlines at the end of my PHP scripts, especially after the closing ?> and delete them. Now, my question is: Is it a bad practice to "NOT" close the script with the PHP closing "?>"? I mean, just leave the script without a closing PHP simbols, as this scripts are included? I never add the final closing '?>' in any script for this very reason. 'Cause you're a SLACKER!!! -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Basic PHP knowledge test
Finner, Doug wrote: My advice, give the candidates problems and see how they solve them. Even if they don't finish, you get an idea of how they think. tedd I like this idea! Do you expect them to be able to work with code written by others? If so, hand them some of your existing code (good examples and not so good) and ask them to figure out what it does and recommend changes. Most definitely. This position isn't going to really require the person to write their own apps. Most of the stuff he/she will be doing is maintaining code already in place. Plenty of it will be my code, but prior to me starting here three years ago, they used to just get people on a contract basis, and there's some pretty messed up code. They even contracted a job out to a couple of Russian programmers; code's pretty clean, but all the comments are in Russian. ;) I like the idea of giving them a piece of our existing code and getting them to do something with it...I'll just have to get HR to accept my word on how they did on it (they really want a question and answer sheet that they can 'grade'). I really really like the 'give them a problem and have them solve it' idea... Yeah, one of my earliest thoughts on this was to have them write something simple like connecting to a db, selecting multiple rows, parsing our the result, and displaying it in some fashion. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Basic PHP knowledge test
Please reply to the list. jekillen wrote: On Jul 19, 2006, at 8:31 AM, John Nichel wrote: We're looking to hire an entry level php programmer here, and I've been tasked with writing the test to evaluate the potential candidates. Being the lazy guy that I am, I naturally turned to Google to see if I could find some tests that I could use. After clicking thru many links, and finding mostly 'basic php tutorials', I've come here to ask you people to do my homework for me. ;) Does anyone have any links/resources for a basic php knowledge test? If not, I'll have to write one from scratch myself, and mess up the rest of my day of goofing off/sleeping. What does $_POST['x'] mean? What does $ in front of a string of chars without quotes mean? That does register globals mean? Is it possible to run php as a cgi script? When it is necessary to use 'var' in php code? If you can't answer these questions how are you going to know if someone is giving you the right answers? There are tons of basic to advance books on the commercial market about php. I've gone the distance and shelled out literally 1,000 of dollars buying books and hours learning the stuff. If you want answers to your questions spend a little time so you will know if someone has passed a test or not. I've spent the past 8+ years 'going the distance' in PHP (quite a bit longer when you count in things like Perl, PASCAL, COBOL, etc), and shelled out about $25 on one PHP book. The web is a far better, cheaper, and more up-to-date learning source. However, I'm a geek, not some college kid who writes up documents so that HR can have a pretty piece of paper saying this guy knows the difference between '==' and '==='. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Basic PHP knowledge test
Ray Hauge wrote: On Wednesday 19 July 2006 10:31, John Nichel wrote: We're looking to hire an entry level php programmer here, and I've been tasked with writing the test to evaluate the potential candidates. Being the lazy guy that I am, I naturally turned to Google to see if I could find some tests that I could use. After clicking thru many links, and finding mostly 'basic php tutorials', I've come here to ask you people to do my homework for me. ;) Does anyone have any links/resources for a basic php knowledge test? If not, I'll have to write one from scratch myself, and mess up the rest of my day of goofing off/sleeping. I just recently ran into the same problem. I got tired of trying to find one, so I made it myself. It's very specific to what we do here though. I'd definitely be interested in that info though, because we're still looking, and I'm not totally happy with mine, as I didn't have a whole lot of time to write it. Yeah, reading the writing on the wall, I think I'm just going to have to suck it up, and write it. The worst part of it is, I'm going to have to be involved in the interview process, and I'm *not* a people person. ;) I think I'll go with a few syntax questions (not really worried about that aspect, cause even after 8 years of doing php, I still hit the manual a few times a week), maybe have the people write a basic function or two to check how clean/readable their code it. Possibly also test how efficient their code would be (like to they call a function inside of a loop to get a static value that could have been set outside the loop). Basic db stuff...ugh, I don't feel like doing this. I'll post what I come up with here; maybe we (this list) can combine ideas and such, and actually put together a pretty good test or two so we can spare the next poor soul who gets put into this position by MBA wielding managers. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Basic PHP knowledge test
Jim Moseby wrote: STFW! RTFM!! STFA!! STFU!! That totally goes against my being lazy. Hell, I didn't get to where I am today by *not* exploiting the 'little people' :-p -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Basic PHP knowledge test
We're looking to hire an entry level php programmer here, and I've been tasked with writing the test to evaluate the potential candidates. Being the lazy guy that I am, I naturally turned to Google to see if I could find some tests that I could use. After clicking thru many links, and finding mostly 'basic php tutorials', I've come here to ask you people to do my homework for me. ;) Does anyone have any links/resources for a basic php knowledge test? If not, I'll have to write one from scratch myself, and mess up the rest of my day of goofing off/sleeping. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calculations
Jochem Maas wrote: tedd wrote: At 11:27 AM +0300 6/28/06, Robin Vickery wrote: On 28/06/06, tedd <[EMAIL PROTECTED]> wrote: At 2:30 PM -0400 6/27/06, Kristen G. Thorson wrote: http://www.php.net/manual/en/language.operators.bitwise.php I wonder why that's true for php when it's common to use ^ in many other languages for powers? Perl: ^ is the bitwise xor operator Python: ^ is the bitwise xor operator C: ^ is the bitwise xor operator Java: ^ is the bitwise xor operator ... -robin Oh well, that settles it then. :-) I guess the chinese-straw-hat operator has had it's meaning changed by general consensus since the days when you were programming with rocks ;-) Pffft, kids. Rocks weren't even invented in my day. We had to use dirt. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Chnage Management in PHP
Jay Blanchard wrote: [snip] Yeah, write your own you lazy sack. And get your finger out of your nose. [/snip] John obviously had a fine Fourth! LOL! Hey John, could you write it for me? It's a homework assignment. I had to stay home with the baby while my wife took the 6yo to see the fireworks. Fun stuff. First, I need you to run some test code to see what type of work your system needs. Run this from the command line, and let me know when you get a result... for ( $i=0; $i = $i; $i++ ) { } -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Chnage Management in PHP
Jay Blanchard wrote: I have been searching and digging for a PHP based change management application but have had little luck. Can anyone make a recommendation? Yeah, write your own you lazy sack. And get your finger out of your nose. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Displaying data from a MySLQ table
Don wrote: Hi Have have a varchar field in a MySQL database which contains the following 905.362.6000"l""s"'L' I am trying to display it on my web page in a field but all I see is: 905.362.6000 Because it has quotes in it. I bet if you look at the source of the page, the full value is there. If your form field looks like this... It's going to output like this -^ So when the browser sees the first double quote in your value, it assumes that you're closing off the attribute. Try running the value thru htmlentities() I am wondering why the trailing characters do not display even though they are present in the database when I check using PhpMyAdmin. Please help. Thanks in advance My code snippet is as follows: Phone The query_database() function is my own and looks as follows: // smart function for querying a MySQL database function query_database($value) { // Stripslashes if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // Quote if not a number or a numeric string if (!is_numeric($value)) { $value = mysql_real_escape_string($value); } return $value; } Why are you running mysql_real_escape_string() after selecting data? -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ONE PAGE CONNECTS MANY DATABASE
BBC wrote: Hi again.. I'm wondering is it possible to make one page which connects to many DataBase? Yes. If it's possible please tell me where can I get the references? Look at the connection functions for whatever database engine you're using. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Update site through email
Nathanael Merrill wrote: I will be on vacation from June 26th through July 17th. I will have limited access to email and will get back to you as soon as I can. Thank you. - nathanael merrill You just made the list Nathanael. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Update site through email
Jim Moseby wrote: Hy guys I'd like to know if there is a way to update a site through sending an email. Something like this, you send an email and the body of the email substitutes a text you use in your site. Igreat apreciate any help since I couldn't find anything on this topic. How much time did you spend looking? A good place to start might be: http://us2.php.net/manual/en/ref.imap.php Where there's a will, theres a way. I imagine it would be fairly easy to do. And or knowing how your mail system works (even if you don't have imap set up). Take like qmail for instance; it's trivial to trigger a script when an email arrives: .qmail-email_address (file) --- |/your/path/here/script.php And when you send an email to '[EMAIL PROTECTED]' it will inject the contents of that email into your script. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] working on a template system...
Robert Cummings wrote: On Wed, 2006-06-28 at 15:10, tedd wrote: At 2:35 PM -0400 6/28/06, Robert Cummings wrote: Not meaning to be contrary, but complex situations are supposed to be reduced to simplistic solutions. That's right, and a template engine simplifies the complexity. Cheers, Rob. Okay, whatever tools work for you. Like we used to say in my old GT&E days of running telephone cable -- "Boss, no matter how many times we cut this cable, it's still too short". In other words, Your kidding right? What you say above and what you say below are different. You must think I'm stupid. Oh well. I don't ever remember anyone using the word stupid. Other adjectives maybe, but not stupid. add as many layers of complexity you need to make things simple for you. I do, thanks. How's your cave btw? Those of us who feel adding a template system on top of something already well equipped to do the job are living in a cave? Yes, other adjectives indeed. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Single quotes verses double quotes default behavior with DW --------> (Pretty much 0T )
Ryan A wrote: Just how does one launch a "DOS" attack? c:\ fdisk c:\ format Repeat as needed ? -- Damn John, now anybody who wants to start DDOSing knows the secret. Well then, they still have some research to do for launching a DoS attack. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Single quotes verses double quotes default behavior with DW --------> (Pretty much 0T )
Ryan A wrote: Hey, Am really starting to like your emails on this list, its different to say the least! seeing as you didn't threat to DoS my server I guess I'm not trying hard enough to be different ;-) Oops, sorry about that, let me try again: You , how dare you say that, I am now going to DOS your serverafter I learn how to properly launch a DOS attack, and after I get a botnet (i have one computer so far) and after I know i can cover my tracks, and after i DOS others that really irritate me (RIAA/MPAA etc). Ok, its a horrorable threat but gimme a break, first time I ever threatened to DOS anyone. :o) Just how does one launch a "DOS" attack? c:\ fdisk c:\ format Repeat as needed ? -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Single quotes verses double quotes default behavior with DW --------> (Pretty much 0T )
Ryan A wrote: --- Prathaban Mookiah <[EMAIL PROTECTED]> wrote: Are you trying to use PHP to write the HTML onto a database. If this is the case you can simply use addslashes(). This way you can still preserve the double quotes, but write into the database without any problems. Either way some processing will be involved at some point. So I guess there is not much you can do about it. Prathap Hello, Yes, I want to write the HTML to the DB, and I know other than str_replace I have the option of addslashes, but with addslashes I have to take into account magic_quotes being on/off...and since this is going to be used on a few servers it just complicates matters a bit more, I am trying to take the guesswork So check the value of magic_quotes before you escape your data. If this is MySQL, use mysql_real_escape_string() and not addslashes() and extra coding out of the scripts and solve the problem before it comes to the scripts...by changeing the default in DW. Change the default in Dream Weaver? Can you be sure that all people now and in the future who will be entering data into your db will be using your 'modified' version of Dream Weaver? Forget Dream Weaver, and worry about the input datanever trust user input. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Ereg problem
Beauford wrote: Please turn of your mail client's request for return receipts when sending to a mailing list. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GET, POST, REQUEST
Richard Lynch wrote: On Tue, June 20, 2006 2:38 am, Satyam wrote: I come from languages where you not only have to initialize a variable but have to declare it as well so initializing comes natural, I feel wrong if I don't do it, even if the interpreter does not care. Just to be pedantic... The interpreter actually DOES care, but you have to be wise enough to enable E_NOTICE messages for the interpreter to tell you that it does care. You may want to get in the habit of using .htaccess to do that, as you will be more comfy with PHP helping you catch any typos in failing to initialize vars. :-) I do that hereour development and staging servers have all errors turned on whereas on our production server, pretty much everything is turned off. In a /perfect/ world, you would never see an error in my code, as I _try_ to write clean code, and trap all the errors before they get to the screen (no, not by the use of '@'). Since this is not a perfect world, and I don't always write clean code, it's nice to see those notices/errors pop up on the screen before the code gets live. ;) -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [MailServer Notification]Content Filtering Notification
Adam Zey wrote: [EMAIL PROTECTED] wrote: Content Filter @ AIT Batam has detect violation of the PROFANITY rule, and Quarantine entire message has been taken on 21-Jun-2006 22:49:25. Message details: Server:BTMAIL Sender: [EMAIL PROTECTED]; Recipient:[EMAIL PROTECTED];php-general@lists.php.net; Subject:Re: [PHP] helping people... OK, this is just amusing. Somebody over at "AIT Batam" is obviously an idiot. Regards, Adam. Profanity rule, eh? Let's see how good it is... Microsoft George Bush Bill Clinton SCO -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] helping people...
Rob W. wrote: No that wasnt a ddos threat you idiot, i dont play them games. So what was your threat then Robbie? Here's an idea, do your own damn homework. And if all you're going to do here is cry like a little girl*, do us a favor and STFU. *sorry to give all the little girls a bad name -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: comparing strings - again!
Jochem Maas wrote: [EMAIL PROTECTED] wrote: var_dump gives Company Director string(17) Company Director string(16) Why would they be different? probably because there is either: 1. white space in the value in your data source 2. white space being outputted along side the value when creating a form field weith that valu that and/or possible the fact that your doing a trim() in one place but not in another - personally I usually trim() incoming string data (regardless of any other validation/sanitation) to avoid stuff like this Seems like they have add some extra whitespace? exactly. btw: var_dump() should be showing exactly where the white space is e.g.: code: Without the quotes he's not going to see the extra white space though, as the browser is going to render the first space it comes too, but it will piss on any white space after that (for display purpose). Main reason I wrap my debugging data in . -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_db_query & INSERT
Jay Blanchard wrote: [snip] How do I retrieve the auto generated primary key field in the first table during the first insert operation. [/snip] http://www.php.net/mysql_insert_id You mean they have a manual for this stuff?? Holy Toledo! -- By-Tor.com ...it's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Still trying to figure this out...
Jochem Maas wrote: echo '',$port,''; 2. try to output something that resembles proper HTML (an without a closing tag sucks) P I never close my option tags that way Bar :-p -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simulating mysql_real_escape_string
Tim Traver wrote: Hi all, ok, have a relatively complicated architecture of php scripts in place, and after reading more about SQL injection, want to make sure that I clean my data completely before I enter it into a MySQL db. I tend to clean the data on the way into the app, which has many subroutines that process the data. I've written generic functions to wrap queries to the database. So, because I don't yet have an open connection to the database when the data comes in the front door, or even when I am constructing the query, I cannot use mysql_real_escape_string to clean the data. Is there a way to essentially duplicate the mysql_real_escape_string if you already know the character set that the MySQL db is using ??? When I'm constructing a query, it doesn't make sense to open the connection just to use that function. Can I just use the depricated mysql_escape_string ? or is there maybe a sequence of addcslashes parameters that can accomplish the same thing ??? mysql_escape_string() should be fine. The only difference between the two is that 'real' uses your connection to determine the current character set. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex brain-toot
Jay Blanchard wrote: [snip] Anot PCRE. Can't help you there, as I've never used the ereg functions. However... preg_match ( "/\((\d{1,}.*?)\)/", "Upper Voltage (124.1)", $regs ); [/snip] Still returns parentheses ereg("[^\(][0-9\.]*" , "Upper Voltage (124.1)", $regs ); gets rid of opening bracket, but ereg("[^\(][0-9\.]*[^\)]" , "Upper Voltage (124.1)", $regs ); doesn't Do you have to use ereg? The preg_match pattern I posted works fine. It will return an array, first element being the whole string it matched, next element will be what it matched _inside_ the parentheses (less the parentheses) (if it matches anything that is). -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex brain-toot
Jay Blanchard wrote: [snip] \(([0-9]*)\) [/snip] I had done this before and still get the parenthesis... ereg("\(([0-9]*)\)", "Upper Voltage (124.1)", $regs); Anot PCRE. Can't help you there, as I've never used the ereg functions. However... preg_match ( "/\((\d{1,}.*?)\)/", "Upper Voltage (124.1)", $regs ); -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex brain-toot
Jay Blanchard wrote: I have a field that contains a value in parenthesis', but also contains other text, for instance; (it is a legacy app that I am working with, and by legacy I am saying pre-1980) Upper voltage (124.1) I know that \([0-9]*\) will get me (124.1), but I am totally forgetting how to get 124.1 without the parenthesis without trimming ...ack. Swift kickage appreciated. \(([0-9]*)\) -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array
Rob W. wrote: $query="SELECT switchport FROM network"; $result=mysql_query($query); $sql_range=array($result['switchport']); Anybody tell me what i'm doing wrong and why this isnt going in to an array? Because you're not understanding what the function mysql_query() is doing. Look at the manual to learn about the MySQL functions. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: mysql ORDER BY problem
Rob W. wrote: It's not in general to mysql, it's how php and mysql is displaying it. That's not what you asked. You asked how to do it with your query, which has nothing, nadda, zip to do with PHP. You want MySQL to do the sorting, look at the MySQL manual under the select syntax, or ask on the MySQL list. You want PHP to do the sorting, look at PHP's array functions; however, it'd be more efficient to go the MySQL route. - Original Message - From: "Michael Rasmussen" <[EMAIL PROTECTED]> To: Sent: Sunday, June 18, 2006 4:51 PM Subject: [PHP] Re: mysql ORDER BY problem On Sun, 18 Jun 2006 15:55:14 -0500, Rob W. wrote: Is there a way with my mysql query so that I can list the numbers in correct order? In what way is this problem related to PHP? Try a MySQL group instead. -- By-Tor.com ...it's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SMS with php recommendation (a bit 0T i guess)
Ryan A wrote: Hey, Right now I am using PSWIN to send SMS messages from my php scripts, can anybody recommend a (reliable) company that i can use instead? We "fill up" on 25euros everytime on pswin, so i am not looking for a "free" provider, just a reliable and good priced one. PSwin is good, problem is they are charging us a euro .20 per day just for using the service, so even if we dont send a single sms per day we are getting charged...not good. Thanks, Ryan http://www.clickatell.com/ -- By-Tor.com ...it's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Control GET data
Steffen Mazanek wrote: Hello, I want to provide two input text fields lastname and firstname and if the user pushes the submit button the generated url should be ...?name=firstname_lastname. Is this possible and how? Yes and JavaScript Thank you for helping a php newbie. You're welcome, but it's not php. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] When is "z" != "z" ?
tedd wrote: And I thank you for your reply -- you've been much kinder than most (on and off-list). :-) True the subject line was a bit misleading, but that was intentional. Bait causes more fish to rise. I've received the answer several times over since I posted the problem, but I wasn't looking for a solution because I already had one. What I was looking for was an explanation, which I "got". I hope the answer remains with me longer than the bandages do. Asking questions in this group is like trying to feed alligators while being waist-deep in the swamp. :-) Ah, got it. You wanted one thing, but asked another to 'bait' people. Didn't like the explanation you got, thought you knew better, and dismissed it. Got 'hurt' that people got tired of your badgering, and the list is mean to you? Well, that's easily solved. One more *plonk* in my killfile, and you'll have one less person to worry about being mean to you. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] If value is odd or not
Jochem Maas wrote: Jonas Rosling wrote: Hi all, is there any easy why to check if a value is odd or not? ignore every answer that doesn't use the % operator. if ( is_int ( $value / 2 ) ) { // Even } :-p -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO purism sucks - this is a rant for anyone who is allergic to that kind of thing...
John Meyer wrote: John Nichel wrote: Do what I do, and don't do OO. ;) In other words, do what works, realizing that 99 percent of the time that you're doing indivdual sites, and ignore dogma? Hmm, what a concept! Actually, the company I work for operates multiple sites which all share code. From copying and pasting between sites, to the 'global include' directory I have set up with functions shared by all the sites. No OO. If it ain't broke, don't fix it. (sorry about the direct mail) -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO purism sucks - this is a rant for anyone who is allergic to that kind of thing...
Jochem Maas wrote: I get this sometimes, it often means I have overlooked something: Fatal error: Access to undeclared static property: AreaAgendaItem::$extraFields EVERYWHERE in php an unset var causes an E_NOTICE, but if you dare to use OO then all of a sudden the OO nuthouse runs out to put a straight jacket on you, and it's getting worse and worse. (not that this example is new) why don't the purists get that we don't need to be told at every step what is correct and what is not?? but merely to be stopped from doing things that are dangerous (as in liable to cause a segfault). eight months ago (roughly) I was told repeatedly that static interface methods were WRONG and so I wouldn't be allowed to user static interface methods anymore (fix my code was the gruff reply) - a few weeks ago static interface methods were included in php5.2(?) as a work around for some other OO deficiency (I can't remember the details but it was Derick Rethans that was suffering from whatever straight jaket had just been introduced). PHP embracing "The One and Only OO Paradigm"(tm) [a schizoid paradigm liable to change at the drop of a hat] [RANT OFF - flame away boys and girls] Do what I do, and don't do OO. ;) -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex problem
Merlin wrote: Hi there, I do work on following regex: ^(.*)_a[0-9](.*).htm$ This should be valid for "test_a9393.htm", but not for "9393.htm" as ther is no leading _a infront of the number. Unfortunatelly this also works for the 9393.htm file. Can somebody give me a hint why the regex also is true for text that does not start with _a infront of the number? Thank you for any help, Merlin Escape the period before htm. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session variables and words with spaces
Beauford wrote: Hi, I have a form in which a drop down field is populated from a MySQL database. I am also using sessions. The problem is this. After I submit the form the session variable only shows the part of the input before the space. Example: if I choose Niagra Falls from the drop down list, then I only see Niagra when I display it. I'm not sure though if it is the session or the forms variable that is causing the problem. I haven't been able to find much on this. See code below Thanks session_start( ); ..Open database and connect to server... Include("connect.inc"); !! Start of form !! -- Select Province -- $query = "select pid, location from province order by location"; $results = mysql_query($query) or $mysqlerror = mysql_error(); if ($mysqlerror) { $dberror = "Messed Up"; include("index.php"); exit; } while ($line = mysql_fetch_array($results)) { if($line['pid'] == 1) { echo ""$line['location']."\n"; } } I'm surprised you're not getting a parse error... echo "" . $line['location'] . "\n"; -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] corrupt pdfs
Ross wrote: I have pdfs saved as BLOBs I create the links dynamically but only some of the PDFs display an error message 'error opening this files...this file cannot be repaired..." Is there a file size limit in kb for Blobs and what is it? What size of file can a LONG BLOB accomodate? If it is not this any ideas? It seems to fix it though! Let's not even attempt to pretend that this question has anything remotely to do with PHP. mmmKay? -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Escaping double quotes
Pavleck, Jeremy D. wrote: So I'm writing this page (PHP Newbie here) and it checks to see if a var is set, if it isn't it spits out the form info like so: echo ""; Now is there a way to 'wrap' that so I don't have to escape quotes? Something like perls 'qq' function is what I'm looking for. I tried a few different functions from the website, magic_quotes, addslashes, htmlspecial etc etc but none did what I was looking for http://us2.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] storing single and double quote in MySQL
[EMAIL PROTECTED] wrote: ok. I just made one test and if you can then explain something to me: I entered in form (textarea) afan's "crazy" web and stored in db using mysql-real_escape_string(). in DB, it's stored with slashes: afan\'s \"crazy\" web Then I pulled that from DB on three different ways: $query = mysql_query("select test from dbtest where rec_id = 5"); $result = mysql_fetch_array($query); echo $result['gen_value']; // gives afan\'s \"crazy\" web echo stripslashes($result['gen_value']);// gives afan's "crazy" web echo htmlentities($result['gen_value']);// gives afan\'s \"crazy\" web if stripslashes() is not correcct to use - what then?!? You're missing the main issue. You shouldn't have any 'escape' slashes in your db. I'm betting your php install has magic_quotes* enabled, so what's happening is this: User inputs data magic_quotes escapes that data *you* escape the data data is inserted into the db. Either turn magic_quotes off or stripslashes() *before* you use mysql_real_escape_string() You shouldn't have to stripslashes() coming out of the db. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] storing single and double quote in MySQL
[EMAIL PROTECTED] wrote: after these very helpfull comments, I rad (again) Shiflett's (and few others) Security articles about filtering input and output. And more I read - less is clear :( Before, I used addslash() before I insert data in database and strislshe() to show them on screen. Later found it's not good and start using mysql_real_escae_string() to add to DB and stripslashe() to show on screen. If you have to stripslashes() when you pull data out of the db, you're doing something wrong (like running with magic_quotes* on, therefore double escaping your data). But, also, I thought, mysql_real_escape_string() is "filter" for everything, e.g. lets have three links (add, delete, edit) as mysql_real_escape_string() *only* escapes the data which needs to be escaped for your particular db version. Add new Edit Delete and was doing this way: #index.php it means that $action I will never store in DB, neither show on screen. I then wrong to $action = mysql_real_escape_string($_GET['action']); or I should $action = htmlentities($_GET['action']); or $action = $_GET['action']; is just fine? If you're not going to display it or insert it...if all you're doing is checking the value of it, then you don't need to modify it. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] storing single and double quote in MySQL
Brad Bonkoski wrote: Looks good to me, just make sure you use: http://www.php.net/manual/en/function.stripslashes.php if you have to dump that information back to the users. (you might want to check out: addslashes() to add the slashes before your DB insert, just to keep those things under your command) -Brad No, no, no. Bad coder. Correct way is to escape the data being put into your db with mysql_real_escape_string(), and have magic_quotes OFF. There is no need to stripslashes() when retrieving the data (and you'll end up stripping slashes that are supposed to be in the data). htmlentities() is better used for displaying data (or passing it from one page to the next), pretty useless for db entries. Always, always, always... mysql_real_escape_string() Bare minimum. [EMAIL PROTECTED] wrote: Hi to all! After the form is submitted, some fields are filled with single and/or double quote info (like: 1'2"x2'4", or sky's blue, or "cool" stuff). I validate what I got using mysql_real_escape_string() and then store the result in MySQL. And, it will be stored as:1\'2\"x2\'4\", and sky\'s blue, and \"cool\" stuff. Is this correct way or "correct" way will be to convert quotes in html entities? If yes, means have to use htmlentities($Size, ENT_QUOTES)? Thanks for any thoughts! -afan -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need Help Please
marvin hunkin wrote: Hi. doing an assignment, for my Certificate Four In Website Administration. The tutor list is down the hall. now got a couple of problems. will explain what i have to do. create a html form, which i have done. in textpad. now, when i open the form, it does not set focus to the first form field which is the user name. goes to the login button. why is this? can any one help me? Yes. Buy a book on Javascript. okay, will explain. and to create a script for a login page, on a network. and using php, and now got the user to enter their username and password, and then to display a message, saying the person logged in, and to display the date. if the user, types in the wrong user name and password, then a error message is displayed, and a link back to the form, is displayed. now got the problem of a error, when checking to see if the error happened or not, and whether to let them in or not. so will paste the html form, and the php code below. if any one can help me how to fix these problems, then let me know asap. cheers Marvin. Html Form: Code Starts Here: function SetFocus { document.forms[0].username.focus(); } User Login Form User Name: Password: Php Code: Code Starts Here: \n"; echo "Marvin Hunkin has successfully logged into the Tafe network. \n"; echo "Please Wait ... Loading Your Personal Settings ... \n"; gmdate('d-m-Y', time()+(10*60*60)); } else { echo "Not letting you login into the tafe network. \n"; echo "Error! You did not type in a correct username! Please try again... \n"; echo "Click on the link below to return back to the login form and enter your correct user name and password. \n"; echo"'Return To Login Form'"; } ?> Code Error: Code Starts Here: Parse error: parse error in c:\program files\easyphp1-8\www\userdetails.php on line 4 I am Using Easy Php 1-8, and using http://localhost in the browser, and sending my files to the www folder of easy php. Have A Great Day. Marvin. Instead of cutting and pasting, RTFM and understand what your code is (not) doing. If this is level four, Most of us here would be a Grand Poobah. -- By-Tor.com ...it's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php