Re: [PHP] Compare PHP settings of two different servers

2009-07-23 Thread Ben Dunlap
Thank you for replying. Just diff the HTML. Unfortunately it is not that easy. Even if the same PHP modules are present, if they are written into the page in a different place, they show up as differences. The same goes for all the HTML tags and everything else, so what I end up with is

Re: [PHP] Question on code profiling

2009-07-23 Thread Ben Dunlap
Nope. Basically it connects to a database to load an ACL (which at [...] I thought xdebug was supposed to be a pretty good profiler. If it calculating the time correctly, where are the other ~3.6 seconds going? One night I saw a script wait indefinitely for a response from a tanked database,

Re: [PHP] This is the kind of [expletives deleted] answer that is certain to prevent bugs being reported.

2009-07-24 Thread Ben Dunlap
Per Jessen wrote: Which is exactly the bug I reported. An application that deliberately ignores the locale setting passed from the environment is buggy unless it is clearly documented. Why should a developer be forced to be aware of the locale when it has already been done for him? That is

Re: [PHP] Single Quotes in Form Inputs

2009-07-27 Thread Ben Dunlap
You can use http://us.php.net/mysql_real_escape_string to escape the input. [8] You should prep your data for insertion into the data by using a tool that formats it strictly for the database. In the ops case mysql_real_escape_string() is the correct tool for the job. What about using

Re: [PHP] preg_match too greedy

2009-07-29 Thread Ben Dunlap
Jim Lucas wrote: I expected 'no match' but get 'match'. [8] cut/paste your code and it works for me. Works for me as well. I get 'no match' from PHP 5.1.2, 5.2.6, and 5.2.8. What version do you have? If I might suggest a couple of simplifications that would make it easier to

[PHP] Re: Page or URL function?

2009-07-29 Thread Ben Dunlap
I've been searching php.net for a function to do this: if page_url('browse.php') { The $_SERVER global array has this sort of information. The 'PHP_SELF' key might be what you want: http://us.php.net/manual/en/reserved.variables.server.php But where is the code that needs to know? I'm

[PHP] Re: Page or URL function?

2009-07-29 Thread Ben Dunlap
Ben Dunlap wrote [TWICE]: The $_SERVER global array has this sort of information. The 'PHP_SELF' key [8] Ben Very sorry for the double-post. Reply-all in Thunderbird News seems a little overzealous by default. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http

Re: [PHP] preg_match too greedy

2009-07-30 Thread Ben Dunlap
echo (preg_match($pattern, $test) != false) The != false here is redundant. Understood. But what you think is redundancy is, to me, clarity in programming. I happen to think that boolean tests shouldn't ride on whether or not an array returned from a function is empty or not (or a

Re: [PHP] preg_match too greedy

2009-07-30 Thread Ben Dunlap
Ben Dunlap wrote: have -- ($x != false) -- will be true whether $x is 0, NULL, an empty string, [8] But $x !== false will only be true in the last case. Sorry, replace be true with be false above. -Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http

Re: [PHP] Re: Page or URL function? (RESOLVED)

2009-07-30 Thread Ben Dunlap
Jim Lucas wrote: Miller, Terion wrote: I Figured it out using this: if ($_SERVER['SCRIPT_FILENAME'] = browse.php ) { $default = A; } else { $default = ; } $letter = isset($_GET['letter'])? $_GET['letter'] :$default ; unless you are doing more then what you are showing above.

[PHP] Re: This isn't infinitely recursive is it?

2009-07-30 Thread Ben Dunlap
I don't THINK I need to worry about circular mappings... but I'm not sure how to check for it if I did... Any suggestions? Thanks! Would the following work? It avoids recursion entirely and also checks for circular mappings. You can plug in your own code where the comments are to do whatever

[PHP] Re: This isn't infinitely recursive is it?

2009-07-30 Thread Ben Dunlap
while (isset($FieldMap[$Field]) { Oops, left out the final close-parenthesis. I always do that with isset() for some reason. Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Re: What makes _SERVER stop working

2009-08-03 Thread Ben Dunlap
Miller, Terion wrote: if ($_SERVER['SCRIPT_FILENAME'] = browse.php ) { You're using the assignment operator above ('=') instead of the comparison ('=='). If that's not simply a typo that entered the code when you composed your email, then that's the source of your problem. You might

Re: [PHP] Multiple MySQL Queries

2009-08-04 Thread Ben Dunlap
Sorry... I'm using GET. I have used the code you supplied below, but as I mentioned, it gets sent for every itemid in the table. I needs to be sent only once, and right after the action. That's where I'm stumped. Hidden form inputs should work with GET or POST -- they're only hidden

[PHP] Re: Time keeping in DB

2009-08-05 Thread Ben Dunlap
sorry man, but a good data design keeps only data in a table u can not calculate. in ur case that would be only date start and end time. refernces to user and project/tasks in other tables. ur time sheet is definately a job for a report. that type of design limits u to nothing. a user can

[PHP] Re: Time keeping in DB

2009-08-05 Thread Ben Dunlap
OK, I think I understand most points except the start and stop time. Every time sheet I have used, SAP and several other smaller ones, I enter a weeks worth of time data like: Project Sun Mon TuesWed ThurFri Sat

Re: [PHP] Displaying user data and picture

2009-08-06 Thread Ben Dunlap
I don't have any data blobs in my database - which makes incremental backups easier - I use rsync for files and do a nightly mysql dump. Except for the first of the month, the diff of that nights backup compared to first of month is saved to flat file for rsync. Binary blobs in the database

[PHP] Re: Server change affecting ability to send downloaded files???

2009-08-07 Thread Ben Dunlap
changes to the code or to the files, just one day all of a sudden any time someone purchases a DMG, EXE, PDF, etc. they get zero bytes. I've [8] Has anyone ever heard of something (besides my code and my files) that could cause this behavior? You'll be my best friend if you can help. Thanks.

Re: [PHP] Server change affecting ability to send downloaded files???

2009-08-07 Thread Ben Dunlap
Very interesting. Excellent debugging advice. It's giving me a 500 error, probably why the Rackspace techs told me to check my code: HTTP/1.0 500 Internal Server Error Did you get that 500 while running curl from a machine outside of Rackspace's network? If so, I'd be interested to see what

Re: [PHP] use preg_replace to nix and line with display: none

2009-08-09 Thread Ben Dunlap
$pattern = '|^.+?display:none.+?$|mi'; [8] I found your use of ? rather... creative...  Anyway, just add the You mean the non-greedy flag? I think that's necessary the way the regex was originally formulated -- without it, .+display would gobble up all of the list-items until the last one.

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

2009-08-09 Thread Ben Dunlap
But on another site it still works, but gives this error: Notice: Undefined index: UserWishesDateRange in /home/vs/site/phvs/bl/7solarsecrets/admin/trackingcode.html on line 79 I assume that is because the error display settings are set to a more rigorous level in this latter site. Is this

Re: [PHP] Embedding foreach loops

2009-08-10 Thread Ben Dunlap
$shows = array();  $show_01 = array();  $show_01['title'] = 'Van Cliburn Gold Medal Winner';  $show_01['date'] = 'Tues. 10/13/2009';  $show_01['time'] = '11am';  $show_01['price'] = 4.00;  $show_01['soldout'] = 0; //IF THE SHOW SELLS OUT, CHANGE 0 to 1 (without quotations).  

Re: [PHP] Embedding foreach loops

2009-08-10 Thread Ben Dunlap
I am using the print function to display my html. I cannot get the line return ( \n ) character to actually push the html onto the next line, it just gets displayed instead. Should I be using echo? In the PHP code snippet you pasted above, you're using single-quotes to delimit your literal

Re: [PHP] how to say inverse your value (to a boolean)?

2009-08-11 Thread Ben Dunlap
# before was $styles = array( 'even', 'odd' ); # after new requirements it is... $styles = array( 'white', 'white', 'gray' ); foreach($items as $item) { printf( 'li class=%s%s/li', current( $styles ), $item ); next( $styles ) or reset( $styles ); } +5000. I think is by far the most

Re: [PHP] Embedding foreach loops

2009-08-11 Thread Ben Dunlap
statements, it becomes unmaintainable very quickly, use a templating language, ether with a framework(recomended) or standalone. But he /is/ using a templating language... PHP. ;-) Ben

Re: [PHP] Single quoted strings (was: ereg_replace to preg_replace translation)

2009-08-11 Thread Ben Dunlap
Personally I try to not use double quoted. PHP parses single quoted very much faster. # for this echo Hi, $name, wellcome $home; # I use echo 'Hi, ', $name, ', wellcome ', $home; I'm not sure if this was true in older versions of PHP, but it's not so much any more, and I wonder if it

Re: [PHP] Image Headers break when image is out of bounds

2009-08-11 Thread Ben Dunlap
@Adam The headers_sent() wasa test to ensure that no other data was creeping into the headers before I wanted it to. Keeping it in does no harm, as it is basically saying, if there are no headers that have been sent, send the correct ones for the image. But if there are headers that have

Re: [PHP] Image Headers break when image is out of bounds

2009-08-11 Thread Ben Dunlap
On Tue, Aug 11, 2009 at 11:52 AM, Ben Dunlap bdun...@agentintellect.comwrote: @Adam The headers_sent() wasa test to ensure that no other data was creeping into the headers before I wanted it to. Keeping it in does no harm, as it is basically saying, if there are no headers that have been

Re: [PHP] how to say inverse your value (to a boolean)?

2009-08-11 Thread Ben Dunlap
# before was $styles = array( 'even', 'odd' ); # after new requirements it is... $styles = array( 'white', 'white', 'gray' ); foreach($items as $item) { printf( 'li class=%s%s/li', current( $styles ), $item ); next( $styles ) or reset( $styles ); } +5000. I think is by far the most

Re: [PHP] Embedding foreach loops

2009-08-11 Thread Ben Dunlap
statements, it becomes unmaintainable very quickly, use a templating language, ether with a framework(recomended) or standalone. But he /is/ using a templating language... PHP. ;-) Keep telling yourself that... and be sure to pat your own back. I'm sure there are plenty of situations

Re: [PHP] session variables - help

2009-08-13 Thread Ben Dunlap
I have the following code for order_update.php: [code] session_start(); extract($_POST); foreach ($_POST as $var = $val) { if ($val 0) { $_SESSION[$var] = $val; } else { unset($var); } header(Location: order_process.php); } [/code] This is not working, however, and it

Re: [PHP] session variables - help

2009-08-14 Thread Ben Dunlap
Thanks all for your patience! I will work on this today and write back with any further questions I can't figure out on my own. And if anyone has any advice I will be checking my email regularly. If you've already tried this with no luck, please ignore -- but you might speed up the whole

Re: [PHP] Re: ini files as config - hidden

2009-08-14 Thread Ben Dunlap
2009/8/14 João Cândido de Souza Neto j...@consultorweb.cnt.br: I think a good solution is to put the ini file out of your html folder so only your scripts can read it. I agree, and I try to do the same, but I've noticed that most open-source CMSes I've looked at (Drupal, Joomla, Textpattern,

Re: [PHP] Re: ini files as config - hidden

2009-08-14 Thread Ben Dunlap
1) Name your ini files .php so, database.ini will be database.php Actually I was assuming the configuration file to be a PHP script -- as is typical in big open-source CMSes. I took ini file earlier in the thread to be a generic description of any file, whatever the extension, that contains

Re: [PHP] Sanitizing mysql inserts of user data

2009-08-17 Thread Ben Dunlap
Note: If this function is not used to escape data, the query is vulnerable to SQL Injection Attacks. Does that necessarily imply this: If this function is used to escape data, the query is not vulnerable to SQL Injection Attacks.? Logically, it does _not_ mean the same thing. Definitely

Re: [PHP] is there a better way to know from which php file the request comes from ??

2009-08-17 Thread Ben Dunlap
This is a newbie question... Let's say there are 3 php files, page1.php, page2.php and page3.php. Form submission from page1.php or page2.php will take user to page3.php. I know that we can use parameter that is appended in the action attribute of the form (e.g FORM METHOD=POST

Re: [PHP] Sanitizing mysql inserts of user data

2009-08-17 Thread Ben Dunlap
$stmt = $db-prepare(SELECT priv FROM testUsers WHERE username=:username AND password=:password); $stmt-bindParam(':username', $user); $stmt-bindParam(':password', $pass); $stmt-execute(); [8] I haven't followed this thread, so I don't know what you mean by, I do not see how there could

Re: [PHP] Re: PHP and CGI

2009-08-19 Thread Ben Dunlap
       That's exactly the case.  I have been running my business on a Perl cart for the last 5+ years, and I can't switch to a PHP cart just yet.  I was just hoping to add some functionality with PHP.  Perl was much harder It would probably bomb your performance but you could always call a

Re: [PHP] SESSIONS lost sometimes

2009-08-19 Thread Ben Dunlap
We have a server with a site that does some XML calls. After lots of testing I have found that the server is losing session variables. [8] Also the site goes from HTTP to HTTPS at some point but this isn't the issue as it loses the sessions as soon as they are set sometimes. Therefore I

Re: [PHP] What if this code is right ? It worked perfectly for years!!

2009-08-26 Thread Ben Dunlap
?  $fName = $_REQUEST['fName'] ;  $emailid = $_REQUEST['emailid'] ;    $number = $_REQUEST['number'] ;  $message = $_REQUEST['message'] ;  mail( ch...@gmail.com, $number, $message, From: $emailid );  header( Location: http://www.thankyou.com/thankYouContact.php; ); ? This is a bit of a

Re: [PHP] Re: unset() something that doesn't exist

2009-08-27 Thread Ben Dunlap
ISTR the Royal Air Force has a Specialist Aircrew track where the really good pilots, who wanted to fly planes rather than desks, could be promoted to management ranks but avoid the management duties. They had a position like this at the first big company I worked for -- Member of the

Re: [PHP] phpmailer send() always return true even the emailaddress is invalid

2009-08-27 Thread Ben Dunlap
another change in the email admin best practices discussion. For a short while the network became clogged in bounce messages sent to both valid and invalid addresses. Some of the invalid addresses even triggered infinite loops of error messages. None of the servers I am familiar with send

Re: [PHP] phpmailer send() always return true even the emailaddress is invalid

2009-08-27 Thread Ben Dunlap
The second problem is that it still forces the originating SMTP server to pass on the 5xx error as a bounce message to the originator. Yeah, I guess this would be a problem in cases where the originating server is an open relay that's being exploited by a spammer. I wonder what proportion of

Re: [PHP] vote package

2009-08-27 Thread Ben Dunlap
You might try to use the reported IP of the submitter, again unique, but that can be forged -- so again anyone can vote more than once. Can you say more about forging the reported IP? I've always been under the impression that forging the source IP in a TCP session is a pretty sophisticated

Re: [PHP] user permissions

2009-08-27 Thread Ben Dunlap
Sort of. Create two tables a login table with user details and a specific field for a ROLE. Then create a roles table that lists the various permissions. I store this [8] This process is significantly simpler when managing users, it's easier to adjust permissions on one role than to edit a

Re: [PHP] user permissions

2009-08-27 Thread Ben Dunlap
Yes, they offer an additional layer of granularity on permissions. The apps I write use groups and role to limit acces to certain functionality. The roles determine functional access to records, ie what the user can do with them. The groups membership determines what records the user can see.

Re: [PHP] Error when execute header('location: otherpage.php') after email been sent out. Any Workaround?

2009-08-28 Thread Ben Dunlap
Which format should I used for log file? *.log or *.txt? Doesn't matter to PHP -- but you do need to provide a local path, not a URL. [http://domain.com/log/logfile.*] or No... [C:\some_path\domain.com\log\logfile.*] or just Yes! Ben -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] Re: Best way to test for form submission?

2009-08-28 Thread Ben Dunlap
I was surprised when no one recommended this: if ($_SERVER['REQUEST_METHOD'] == 'POST') So now I'm wondering if there's a pitfall to this method that I'm not aware of... Thanks, Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Re: Best way to test for form submission?

2009-08-28 Thread Ben Dunlap
Well, as far as I'm aware $_SERVER isn't reliable from server to server. That said, I've never had a problem using it. Thanks -- I just looked it up and the manual says: There is no guarantee that every web server will provide any of these; servers may omit some, or provide others not listed

Re: [PHP] I'm not crazy I swear it... IE vs Safari and Firefox - The impossible!

2009-08-31 Thread Ben Dunlap
I would set up Wireshark to capture and compare the http sequences from each browser. After you capture each stream, use the Follow TCP Stream option to look at the raw HTTP. If it is the browsers, there should be some obvious differences in the sequence of requests from them. This is a good

Re: [PHP] safe_mode and inclusion of files don't work as documented

2009-09-01 Thread Ben Dunlap
Safe mode is a bad idea. :) It's not safe; it may only have the effect of making you think you're safe. If you have a particular reason to use it then maybe it's OK, but just be aware that it will not exist in future versions of PHP and relying on it is not a good idea. Security,

Re: [PHP] CodeWorks 09

2009-09-02 Thread Ben Dunlap
What I would do for UK PHP events :-( Something like this perhaps? http://conference.phpnw.org.uk/phpnw09/ Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Generic decorators and type hinting

2009-09-02 Thread Ben Dunlap
Is there another way to cleanly wrap method calls for timing/logging purposes? I have a possibly-evil idea that gets around type-hinting by dynamically declaring decorator classes as children of the real classes that need to be timed. You end up with as many decorators as you have classes that

Re: [PHP] Generic decorators and type hinting

2009-09-02 Thread Ben Dunlap
code.  Instead, just use interfaces.  The only real downside is that all the classes you want to decorate would need to implement them and that would cause a wee bit of ugliness in the code/class declaration. Can you explain a bit more? As I understood the OP, the challenge was to take a

Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-02 Thread Ben Dunlap
       Is there is a way to search only for the alphanumeric content of field in a db?  I have an itemID field that contains item #'s that include dashes, forward slashes, etc, and I want people to be able to search for an item # even if they don't enter the punctuation exactly. Not sure if

Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-03 Thread Ben Dunlap
Excuse me? Somebody suggested a PHP loop to solve a query problem and you are saying that REGEXP should not be used? MySQL caches queries and 100 SELECT with a REGEXP will cost zero after the first one if nothing changed inside the table. Even if the REGEXP has to change with every query?

Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-03 Thread Ben Dunlap
What's wrong with using the wildcards that are built into most SQL variants? SELECT * FROM table WHERE item_id LIKE '%#abcdef' Will select all records where the item_id field ends in '#abcdef' That works if you know the user is always going to enter the last 7 characters of the product id,

Re: [PHP] Magento shows blank page.

2009-09-03 Thread Ben Dunlap
I followed this thread: http://spikomoko.wordpress.com/2009/08/19/magento-not-working-on-php-5-3/ . But then, I'm bounched on this error in my webbrowser for visitting my magento on my production server desktop: .: Fatal error: Call to a member function createDirIfNotExists() on a

Re: [PHP] Searching on AlphaNumeric Content Only

2009-09-03 Thread Ben Dunlap
stripping, stemming, spelling corrections ?  ... uhm, that's probably why they invented regular expressions, isn't it? As I said, at the end of the day, this will be a manual slow, potentially wrong implementation of what we already have and use on daily basis. If you've got a

Re: [PHP] script failing at same line

2009-09-04 Thread Ben Dunlap
$map = ms_newMapObj($mapfile); The command creates a new mapscript object. And PHP is hanging somewhere inside that constructor? Is this in a web context or a command-line context? Or both?

Re: [PHP] script failing at same line

2009-09-04 Thread Ben Dunlap
On Fri, Sep 4, 2009 at 2:38 PM, jim white jbw2...@earthlink.net wrote: It's a web app that draws maps in a browser. Sometime it will generate a seg fault. The command should not take long, so if there is some script construct that will throw an exception after a few seconds if the command has

Re: [PHP] script failing at same line

2009-09-09 Thread Ben Dunlap
My solution was to add a table to my database, and add an insert job id into the table after the line that is causing the problem. When I submit the script I use setTimeout to run an AJAX query of the table 5 seconds later. If the line has failed the job id will not be in the table and I

Re: [PHP] Re: Class variable value lost

2009-09-09 Thread Ben Dunlap
The object only exists for that instance of the script, so when the user navigates to the next page, the object is freed up from the memory. There are a couple of ways you could get round this:      * don't navigate away from the page, and use AJAX calls to update        parts of the page

Re: [PHP] Encrypt then decrypt yields extra dots at end

2009-09-09 Thread Ben Dunlap
I thought this code: $enc=mcrypt_ecb(MCRYPT_RIJNDAEL_256,salt123,encrypt_me,MCRYPT_ENCRYPT); $dec=mcrypt_ecb(MCRYPT_RIJNDAEL_256,salt123,$enc,MCRYPT_DECRYPT); echo $dec; would yield encrypt_me. The actual result is encrypt_me.. (bunch of extra dots). Why, and how do I

Re: [PHP] dns lookups only half working in chroot

2009-09-09 Thread Ben Dunlap
?php echo gethostbyname('www.google.de').\n; print_r(dns_get_record('www.google.de', DNS_A)).\n; ? [8] I don't understand why the first lookup fails, but the second one succeeds. Unfortunately thinks like fsockopen() seem to use the same technique as gethostbyname(), so they don't work

Re: [PHP] new php script and sqlite

2009-09-09 Thread Ben Dunlap
I was under the impression that sqlite2 was supported widely by PHP, but sqlite3 seems only to be enabled on php 5.3.0 by default. My concern now is actually that users may find that their hosting service providers don't provide sqlite3 out of the box. PDO seems to support both versions:

Re: [PHP] new php script and sqlite

2009-09-09 Thread Ben Dunlap
  $dbh = new PDO('sqlite:$db_file'); [8]        $dbh = new PDO('sqlite2:$db_file'); But with double-quotes, not single-quotes. ;-) Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Performance of while(true) loop

2009-09-09 Thread Ben Dunlap
I have a php cli script that listens on a UDP socket and, when data is [8] So I think the the MSG_WAITALL is causing it to block until incoming data connection is closed (it never reaches the 512 byte mark before [8] your clients are not maintaining an open connection to the socket, so it'll

Re: [PHP] Hoping for a hand with a login script

2009-09-10 Thread Ben Dunlap
So I'm trying to set up a small website that includes a store ( www.rareintaglio.com), i have all of my HTML hammed out and now I'm working on creating an admin login for the sites owner to input data from a back I would really strongly advise against building your own authentication system.

Re: [PHP] Hoping for a hand with a login script

2009-09-10 Thread Ben Dunlap
several packages available to provide it. But I believe that telling someone to adopt a complete portal system like CI just to get basic authentication is gross overkill. There has to be a better way to provide this core functionality without installing a monster package that will be 95%

Re: [PHP] Hoping for a hand with a login script

2009-09-10 Thread Ben Dunlap
I would recommend this to anyone looking to build any sort of web app. Could be that nothing out there will end up serving your purposes, but ... and, on further investigation, it looks like CI, surprisingly enough, doesn't actually have pre-built authentication and access control (although it

Re: [PHP] Creating alphanumeric id for a table

2009-09-10 Thread Ben Dunlap
I assume that I can get increment value/sequence from db  (I used harcoded increment value  in the code above (generate_id(1))), but I don't know how I can get this incremental value from db.I use mysql 5.0. If you're thinking of retrieving the newest value of an AUTO_INCREMENT column,

Re: [PHP] User Account Management

2009-09-11 Thread Ben Dunlap
Honestly, whipping up a security scheme the way I have done it is a couple of days' work (including login and management screens). I'm not sure why people seem to be averse to it. You just work up your screens, I suppose it does depend on the use case. If you're building a system for internal

Re: [PHP] Creating alphanumeric id for a table

2009-09-14 Thread Ben Dunlap
1. user A insert into table (get id = 1 from auto increment value) 2. user B insert into table (get id = 2 from auto increment value) 3. user A get value from $id = LAST_INSERT_ID() (id = 2) 4. user B get value from $id = LAST_INSERT_ID() (id =2) [8] How can we make sure that those 3

Re: [PHP] APC - Upload progress problem. apc

2009-09-16 Thread Ben Dunlap
upload keys, and any keys created via apc_add(). This listing includes a Timeout value, which is none for the apc_add keys and 3600 for the upload keys. Somewhat suspicious, I'd say, since the keys stop being working after 1 hour of use. APC lets you set a number of timeout values:

Re: [PHP] ie6 memory could not be read help!

2009-09-17 Thread Ben Dunlap
have IE 6 for whatever reason. If you block them then you are blocking possible clients. There is still a large percentage that still use it. I think that percentage depends on the target audience. There was a kerfuffle several months back (maybe a year ago now?) when 37signals announced that

Re: [PHP] APC - Upload progress problem. apc

2009-09-17 Thread Ben Dunlap
I was afraid it was a bug. I have generally just used whatever is at whatever host, until this project, and didn't really think something so glaring could be in there. WTF! I wonder if massive uploads, like the ones you're coding for, really aren't that common. I can imagine hard-coding that

Re: [PHP] ie6 memory could not be read help!

2009-09-17 Thread Ben Dunlap
I bought a Windows XP PC about three years ago with IE6 on it (I normally do all my work in Linux). I haven't upgraded it, and I can't imagine why the average user would. If it ain't broke (and most users wouldn't consider IE6 broken), don't fix it. I agree in general, but eventually

Re: [PHP] PHP Header issue

2009-09-18 Thread Ben Dunlap
if ... you have output_buffering option enabled in the php configuration. Which is probably the case on the OP's local machine, and would explain why the code doesn't fail for him there. Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Re: How to take output from an include, and embed it into a variable?

2009-09-23 Thread Ben Dunlap
$file = 'invoicetable_bottom.php'; fopen(http://yoursite.com/folder/$file,r;); http://tr.php.net/function.fopen worth trying. Easier than output buffering Easier in what sense? It would end up requiring more code than output-buffering because you'd have to read from the file after calling

Re: [PHP] Re: Does anyone here use TCPDF?

2009-09-24 Thread Ben Dunlap
I attempted to use the same functions as FPDI/FPDF, but they did not work in TCPDF. Which functions did you use in FPDF? Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Re: session.gc_maxlifetime

2009-09-24 Thread Ben Dunlap
php not but perhaps the client its not clear and commonly defined what clients do with cookies on reconnect and stuff or long idle times. Maybe not, but I'd be really surprised. An HTTP client is supposed to decide whether to send a cookie by looking at the domain name and path of the URL it's

Re: [PHP] variable

2009-09-24 Thread Ben Dunlap
Suppose I have a variable $i = 0 or 1 or 2 and I have variables $item0, $item1 and $item2 how do I print the variable $item0 using a combination of variable $item and variable $i? or with this code it gives me an error: $i = 0; $item0 = test; echo $item$i; #how do I properly use this

Re: [PHP] html email showing br instead of line breaks

2009-09-24 Thread Ben Dunlap
\r\n should be between double quotes: \r\n I think you'll still see the literal brs in your final email, though because htmlspecialchars() is converting the angle-brackets in the tag to their respective HTML entities (lt; for and gt; for ). A bit of a thorny problem because you probably do

Re: [PHP] POST without POSTing

2009-10-01 Thread Ben Dunlap
to make sure the user has properly filled out this form. So I have to validate it. That's done in the background on the server, naturally. But once the validating is done, it's time to send the user off to the secure site with a payload of POST variables. At that point, the user will enter

Re: [PHP] Parse Question Using list()

2009-10-01 Thread Ben Dunlap
$line = fgets($handle); list($col1, $col2, $col3) = $line; [8] echo c1 is $col1 and c2 is $col2 and c3 is $col3.'br'; // this shows just 1st char of each field That's odd, I would have expected $col1, $col2, and $col3 to be NULL. That's what I get when I try to assign a string to list(). It

Re: [PHP] Self-Process php forms or not?

2009-10-02 Thread Ben Dunlap
Yes. But since I don't want to display a success information + form fields, but only the success information, I believe the only way we have to do this is by either use javascript and update a div or similar, or using only php, by redirecting to another page. Is this correct? Whether or not

Re: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-02 Thread Ben Dunlap
Can someone PLEASE explain why the developers of PHP chose this seemingly whacky logic? It mimicks C. Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-02 Thread Ben Dunlap
My issue is that I see no reason to do the ASSIGNMENT FIRST and THEN INCREMENT. That's just counter intuitive. In the case of $foo = $num++, everything to the right of the = should be computed FIRST and THEN handed off to the left side. This particular expression (and I'm unaware of any

Re: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-02 Thread Ben Dunlap
On Fri, Oct 2, 2009 at 2:37 PM, Ben Dunlap bdun...@agentintellect.com wrote: My issue is that I see no reason to do the ASSIGNMENT FIRST and THEN INCREMENT. That's just counter intuitive. In the case of $foo = $num++, everything to the right of the = should be computed FIRST and THEN handed

Re: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-02 Thread Ben Dunlap
       int a = 2;        b = a++;        printf(b = [%d]\n, b); b would be 2 when printed.  However, after the second line (b = a++;) finished executing, a would then be 3. Sure, but that code is perfectly clear. It's the odd special case where you assign the variable to itself, that's

Re: [PHP] FILTER_VALIDATE_INT - newbie question

2009-10-07 Thread Ben Dunlap
If I put 0 filter_var() will return false. Actually it returns the integer 0, not the boolean FALSE. Here's an illustration of the difference: http://codepad.org/73wff2u0 The integer value 0 can masquerade as false in an if() statement, of course, as Ash pointed out above. If I put 0342352

Re: [PHP] FILTER_VALIDATE_INT - newbie question

2009-10-07 Thread Ben Dunlap
How is 0342352 being assigned to the variable that you're filtering? If PHP thinks it's a string, then the filter will fail. If PHP thinks it's a number, it seems to convert it internally to the number 115946, before you get to the filter.  Not sure what's going on there. At any Sorry, brain

Re: [PHP] FILTER_VALIDATE_INT - newbie question

2009-10-07 Thread Ben Dunlap
How is 0342352 being assigned to the variable that you're filtering? If PHP thinks it's a string, then the filter will fail. If PHP thinks Oops, potentially bad information there as well, sorry. In general, a string representation of a decimal number /will/ pass FILTER_VALIDATE_INT. But your

Re: [PHP] FILTER_VALIDATE_INT - newbie question

2009-10-07 Thread Ben Dunlap
Also, I think you're getting confused over the zero with exactly what you are asking PHP to do. filter_var() returns true if the filter matches. If the 0 match is returned as a false, then filter_var() will filter_var() actually returns the filtered data if the filter matches, and FALSE if it