[PHP] Exception Handling

2012-06-01 Thread James Colannino
Hey guys, Haven't posted in a long time... Happy Memorial Day! I have an issue with exception handling. I'm using a framework that throws a Database_Exception object. I was expecting catch (Exception $var) to be sufficient to catch this, but it doesn't. I have to do catch

Re: [PHP] Exception Handling

2012-06-01 Thread James Colannino
On 06/01/12 07:30, ma...@behnke.biz wrote: James Colanninocrankycycl...@gmail.com hat am 1. Juni 2012 um 16:25 geschrieben: Hey guys, Haven't posted in a long time... Happy Memorial Day! I have an issue with exception handling. I'm using a framework that throws a Database_Exception object.

Re: [PHP] Exception Handling

2012-06-01 Thread James Colannino
On 06/01/12 08:08, James Colannino wrote: On 06/01/12 07:30, ma...@behnke.biz wrote: James Colanninocrankycycl...@gmail.com hat am 1. Juni 2012 um 16:25 geschrieben: Hey guys, Haven't posted in a long time... Happy Memorial Day! I have an issue with exception handling. I'm using

Re: [PHP] Exception Handling

2012-06-01 Thread James Colannino
On 06/01/12 07:32, Mackintosh, Mike wrote: Hi James, You would have to catch Database_Exception. It is also good practice to also always catch exception afterwards. Hey Mike, Thanks for the reply! I saw this comment in the documentation

Re: [PHP] Exception Handling

2012-06-01 Thread James Colannino
On Fri, Jun 1, 2012 at 12:51 PM, Marco Behnke ma...@behnke.biz wrote: Ah, I guess that is the problem. Your application framework uses namespaces. I guess you should try catch (\Exception $e) instead of catch (Exception $e) :-) Ah, that was probably it. Will try it out tonight to

[PHP] (Kinda sorta) PHP related: recovering lost passwords

2011-08-16 Thread James Colannino
Hi everyone, I don't post all that often, so I hope my (mildly) off-topic question won't be too unwelcome... Keep in mind that I'm still pretty new when it comes to security, so what I propose may or may not sound incredibly dumb (you have been warned! :-P) I'm working on a project in PHP, a

Re: [PHP] (Kinda sorta) PHP related: recovering lost passwords

2011-08-16 Thread James Colannino
On 08/16/11 01:30, Lester Caine wrote: All the good sites simply don't have that capability ... Much safer rather than 'recovering' a password is to identify the user, and send them a temporary password which they have to change when they log in. This way nobody is allowed access existing

Re: [PHP] (Kinda sorta) PHP related: recovering lost passwords

2011-08-16 Thread James Colannino
On 08/16/11 02:08, Richard Quadling wrote: Take a look at https://code.google.com/p/loginsystem-rd/ Whilst it is just a login system, the techniques here could be adapted and probably learned from (if you are new to security). Ah, that looks interesting. Thanks for the link! James --

Re: [PHP] mysqli_query() returns NULL?

2011-06-18 Thread James Colannino
On 06/18/11 13:27, Ashley Sheridan wrote: You'll only get an error if there was an error with the query. A query that has no result is still a valid query, so won't return an error. It's quite common to check the value of mysql_num_rows() before trying to use the results of the query. But

[PHP] mysqli_query() returns NULL?

2011-06-17 Thread James Colannino
Hey everyone, After reading the documentation for mysqli_query(), I was lead to believe that on any error it would return false. However, through a stupid mistake, I discovered that when I specify an invalid value for the database link identifier (in my case, I accidentally passed an

[PHP] Question about logins and locking

2010-06-22 Thread James Colannino
Hey everyone, I have a question about logins. Let's say that I want to allow each user account to login only once at a time. I would then need some kind of locking mechanism to make sure that the same user can't login again somewhere else until first logging off. What's a good way to achieve

Re: [PHP] Question about logins and locking

2010-06-22 Thread James Colannino
Tommy Pham wrote: 1) Set an encrypted (to prevent hijacking and eavesdropping) cookie to expire when browser closes 2) Have a table in the DB backend to keep track if the user is logged in or not and when was the last time the validated user access your site (this gets updated when the user

Re: [PHP] var_dump( (0 == 'heading') ) == TRUE ?!

2010-05-14 Thread James Colannino
I'm pretty sure this is the right answer. If not, someone please correct me. PHP will compare the 0 against the integer represented by the string. So, for example, 0 == 0 would test true. 0 == 1 would test false. However, 'heading' doesn't represent a valid integer, so it appears on the right

[PHP] MySQL: Return Number of Matched Rows

2010-03-25 Thread James Colannino
Hey everyone, I have a question. If I do a mysql query that updates a column in a row to the same value, I get 0 rows affected. However, I also get 1 or more matched rows. Is there a way that I can return the number of matched rows, rather than the number of rows affected? I'm trying to get

Re: [PHP] MySQL: Return Number of Matched Rows

2010-03-25 Thread James Colannino
Floyd Resler wrote: As for as I know, MySQL simply just doesn't report a row as being affected if nothing has changed in it. To get the number of matched rows, try doing a SELECT query before you do the UPDATE query. I don't know if that will produce the results you're looking for, but it

Re: [PHP] database abstraction layer

2010-02-02 Thread James Colannino
Lars Nielsen wrote: Is it save to assume that I can use the same SQL, or should i make some exceptions? Standard SQL should work across all SQL servers with only a few exceptions (for example, MySQL doesn't support full outer joins.) Anything that has to do with server administration,

Re: [PHP] Happy New Year

2009-12-31 Thread James Colannino
tedd wrote: May 2010 2009. Fortunately, I think that's automatically true by definition :-D James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] utf8_decode() and mixed character sets

2009-10-10 Thread James Colannino
Hey everyone. I'd been troubled for a while by the fact that inserting cut-pasted special characters such as auml; caused truncation when passed to MySQL, then discovered that it was because I was cutting and pasting unicode values into non-unicode Latin-1 strings. Since Latin-1 also has

Re: [PHP] utf8_decode() and mixed character sets

2009-10-10 Thread James Colannino
Andrew Ballard wrote: Have you tried iconv or mb_string? Is it a option to update the database to use UTF-8? I'll look into those functions. And, I suppose I could in fact convert my database to use UTF-8 if necessary. James -- PHP General Mailing List (http://www.php.net/) To

[PHP] Converting print_r() output to an array

2009-09-30 Thread James Colannino
Hey everyone, I was pretty sure there was an easy built-in solution for what I want to do, but I've been googling around with no luck. Basically, I just want to take a string containing the output of print_r() and convert it back into an array again. That is possible, right? If so, how do I go

[PHP] Sorting an array of sub-arrays based on a sub-array's key

2009-09-06 Thread James Colannino
Hey everyone. I have an array that looks like this: $main_array[0] = array('key1' = 'vala'); $main_array[1] = array('key1' = 'valb'); etc. I want to sort the main array based on the value of key1 for each sub-array. I looked at all the array sorting functions, but unless I misunderstood

Re: [PHP] Sorting an array of sub-arrays based on a sub-array's key

2009-09-06 Thread James Colannino
Eddie Drapkin wrote: http://us3.php.net/uasort Exactly what I was looking for. Thanks. James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] PHP inserting carriage returns into POST values?

2009-09-04 Thread James Colannino
Hey everyone. I ran into a really weird issue that I was hoping I could find some clarification on. In short, I have javascript functions that operate on hidden text values. Those values may be posted, in which case PHP then prints them back to the page via what comes in on $_POST. The weird

Re: [PHP] PHP inserting carriage returns into POST values?

2009-09-04 Thread James Colannino
Andrew Ballard wrote: Javascript interpolates \n as a newline character inside both double and single quotes unlike PHP that only interpolates inside double quotes. If the client browser is running under Windows, it may even be possible that the \n is recognized by the browser as a line

Re: [PHP] accessing variable from inside a class

2009-09-04 Thread James Colannino
Lars Nielsen wrote: Hi, How do i access a variable from inside a class? Add the following statement: global $template_dir; James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Re: PHP inserting carriage returns into POST values?

2009-09-04 Thread James Colannino
Nisse Engström wrote: It may be the browser that is converting those line breaks. Ah. That's probably it then. I didn't realize that was a part of the HTML standard. Thanks! James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Using fopen on a site with popups

2009-08-14 Thread James Colannino
Hey everyone! I have a question. I know that you can use fopen to open not just local files, but also files via HTTP. My question is, assuming you're attempting to open a page that has popups, is there anyway to get at the actual content underneath the popup? Thanks! James -- PHP General

Re: [PHP] Re: Using fopen on a site with popups

2009-08-14 Thread James Colannino
Ralph Deffke wrote: have u tried? I did not, but as far as I understand u getting the stream including the html causing the browser to open an popup. so what is ur real problem then? Yeah, ummm... Sorry for the traffic. That was a really stupid question... It looks like the format of a

Re: [PHP] reason for a Notice:.. on one site but not another? (Same code.)

2009-08-09 Thread James Colannino
John Butler wrote: if($_POST['UserWishesDateRange']) { //--line 79 echo'submitted'; } else { echo'NOT submitted'; } Try this instead: if (isset('UserWishesDateRange'])) { // [...stuff goes here...] } James -- Black holes are where God

Re: [PHP] HTTP headers and include()

2009-07-12 Thread James Colannino
Zareef Ahmed wrote: You should get a headers already sent output started at kind of error if you have enabled error reporting with display_errors ON. Actually, I did. I just didn't think to mention it in my first post. The thing was that it said it was coming from one of my includes,

Re: [PHP] HTTP headers and include()

2009-07-10 Thread James Colannino
Eddie Drapkin wrote: HTTP headers are sent and finalized after the first bit of output. I had the same problem before and it turned out to be because I had a close tag ? at the end of a file followed by some whitespace. The solution was to remove the ? from the end of all the files and I

[PHP] HTTP headers and include()

2009-07-09 Thread James Colannino
Hey everyone, I've been hard at work on a new web application, and discovered something that I would never have seen coming. I was noticing that when I called session_start() after a few lines of includes, I was getting complaints because the HTTP headers had already been sent out. Then, after

Re: [PHP] PHP Manual in PDF format

2009-07-07 Thread James Colannino
Richard Quadling wrote: $ pecl install haru [...] $ phd -f pdf -t phppdf -d .manual.xml I installed haru, yet when I try the phd command, I get a class 'HaruDoc' not found error :( Has this happened to anyone else? James -- PHP General Mailing List (http://www.php.net/) To unsubscribe,

[PHP] Object type determined at runtime

2009-07-06 Thread James Colannino
Hey everyone. I have a question. Hopefully it's clear, because I'm not sure quite how to ask it. Basically, I have a variety of different objects that a variable can be instantiated as in the same block of code, its type being determined at runtime. I want to be able to do something like this:

Re: [PHP] Object type determined at runtime

2009-07-06 Thread James Colannino
Ah, thanks very much. That was very helpful! James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Persistent data between two executions

2009-06-16 Thread James Colannino
Hey everyone, Long time reader, not such a long time poster :-P (though I have posted to the list occasionally in the past...) Anyway, I have a general question for the list. Basically, I need to maintain persistent objects between page refreshes. So, for example, if while running a PHP script

Re: [PHP] Persistent data between two executions

2009-06-16 Thread James Colannino
Martin Scotta wrote: You can use $_SESSION to store the object, and serialize to convert to string and reverse I like that idea. I think I may end up going that route. I have one question. This is VERY hypothetical, and mostly just to satisfy a curiosity, but let's assume that you write an

[PHP] Help with MySQL

2009-02-13 Thread James Colannino
Hey everyone. I've been reading the list for a long time, but have only really posted to the mailing list a few times. I just had a quick question about MySQL. I'm not sure if this is exactly relevant to PHP, but it is for a PHP application I'm writing, so hopefully that makes this question

Re: [PHP] Re: 64bit vs. 32bit

2009-01-19 Thread James Colannino
Ross McKay wrote: One restriction I know (knew?) of is that you can't run DOS programs under Wine on 64-bit, but then... why? I could be wrong, but I'll bet anything that Wine made use of the now defunct vm86 component of the x86 architecture. That allowed the CPU to implement a virtual

[PHP] Replacing special characters with their HTML equivalents

2008-12-21 Thread James Colannino
Hey everyone. I have a question. I have a web scraper that grabs information from web pages that often contain characters such as vowels with umlots (I know I spelled that wrong.) The data is editable, so the characters show up unmodified in an editable text box. However, when I try to import

Re: [PHP] Replacing special characters with their HTML equivalents

2008-12-21 Thread James Colannino
Daniel Brown wrote: Welcome to the list, James. Thanks :) Check out htmlentities(): http://php.net/htmlentities I'll check that out. James -- Black holes are where God divided by zero. --Steven Wright signature.asc Description: OpenPGP digital signature

[PHP] Uploading files without saving them

2008-06-23 Thread James Colannino
Hey everyone. Here's a simple question. I'd like to be able to import information from a text file located on the client without actually saving it on the server; that is, I simply want to read the data into memory on the server, without actually saving it to a file. I've been googling

Re: [PHP] Uploading files without saving them

2008-06-23 Thread James Colannino
Boyd, Todd M. wrote: IIRC, if you never move it out of PHP's defaulted temporary storage sandbox, it will eventually be wiped. When files are uploaded via PHP, they must explicitly be moved into the active file system. Ah, I see. What would happen if two people just happened to upload files

Re: [PHP] Uploading files without saving them

2008-06-23 Thread James Colannino
Nitsan Bin-Nun wrote: PHP uses randomaly name for each of them (during the upload to the temporary directory), when its done PHP moves the file to the objective location, i dont think you will obstacle filename problems. Ah, excellent! Thanks :) James -- My blog:

Re: [PHP] strip_tags and nl2br

2008-05-21 Thread James Colannino
Chris wrote: RTM. Supply the tags you want to keep when you call strip_tags. $stripped = strip_tags($data, 'br/br'); I can do that, but my question had to do with strip_tags seeming to get rid of \n's, not br tags. This is why I was concerned. If I run strip_tags(), followed by nl2br,

Re: [PHP] strip_tags and nl2br

2008-05-21 Thread James Colannino
Chris wrote: Are you sure there are newlines before you run strip_tags? I would assume so, because everything from the textarea runs together in one line when displayed in the browser until filtered through nl2br(). That would suggest to me that there are indeed \n's that are being

Re: [PHP] strip_tags and nl2br

2008-05-21 Thread James Colannino
James Colannino wrote: Chris wrote: Are you sure there are newlines before you run strip_tags? I would assume so, because everything from the textarea runs together in one line when displayed in the browser until filtered through nl2br(). That would suggest to me that there are indeed \n's

[PHP] strip_tags and nl2br

2008-05-20 Thread James Colannino
Hey everyone, I have a little bit of a quandry. I need to strip HTML tags from user input, but I also need to convert \n's from the textarea elements to br tags so it will display properly in a browser. nl2br() works just fine, but if I use strip_tags first, then run nl2br, nl2br won't

[PHP] Persistent state applications

2008-05-17 Thread James Colannino
Hey everyone! I'm very new to PHP, and had a somewhat general question (forgive me if it's too broad in scope.) Basically, I'd like to be able to have a single PHP application that remembers its state as users click on links. When the user clicks on a link, though, the user unavoidably

Re: [PHP] Persistent state applications

2008-05-17 Thread James Colannino
tedd wrote: James: Hey tedd, thanks for the response! 1. A $_SESSION variable; After googling briefly on the subject of sessions, it looks like this is probably the way I'd want to go. I like this idea, because I can modularize the code and call different php scripts for different

Re: [PHP] PHP MS-Word plugin

2008-01-10 Thread James Colannino
Jochem Maas wrote: that said I have no idea if there are any *nix based word doc manipulators, if there are they probably won't work with all versions of word documents - the file format is closed and changes from version to version. OpenOffice.org (the website is the same as the name) is