Re: [PHP] Best way to deal with $_SERVER['REQUEST_URI'] on IIS?

2009-04-21 Thread Andrew Ballard
On Tue, Apr 21, 2009 at 4:21 PM, Mattias Thorslund wrote: > Andrew Ballard wrote: >> >> On Tue, Apr 21, 2009 at 4:04 PM, Mattias Thorslund >> wrote: >> >>> >>> Hi all, >>> >>> Apparently, $_SERVER['REQUEST_URI'] doesn

Re: [PHP] how to determine if a mysql query returns an empty set?

2009-04-23 Thread Andrew Ballard
exit; >                               } > > but that doesn't work, because I guess an empty set is not false, 0, or > NULL? > > > It won't be any of those because the query is successful even if it returns no records. You could use http://us2.php.net/manual/en/mysqli-stmt.num-rows.php to determine how many rows were returned. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] [php] graph with two or more input display

2009-04-24 Thread Andrew Williams
Hi All, Does anyone know of any php grahp that will enable you to show/analyse more than one inputs like price versus time? -- Best Wishes Andrew Williams willandy.co.uk

[PHP] [php] embedding excel chart/graph

2009-04-24 Thread Andrew Williams
* I have been to see how to embed excel charts and graph to php code. does any knows how* willandy.co.uk

Re: [PHP] MySQL, MD5 and SHA1

2009-04-24 Thread Andrew Ballard
r good point, too.) All I'm saying is if you hash/encrypt the value in PHP rather than passing it off to MySQL in open text, you don't have to worry about whether the connection is (or becomes) sniffable. For that matter if you're going to bring up performance, I know many DBAs who would

Re: [PHP] error with hosting

2009-04-24 Thread Andrew Ballard
On Tue, Apr 21, 2009 at 1:20 PM, Jan G.B. wrote: > Do yourself a favour: > > * remopve that 1337 hax0r name - it makes you look like a dumbass This coming from someone whose e-mail address is ro0ot.w...@? Sounds a little ironic. ;-) Andrew -- PHP General Mailing List (http://ww

[PHP] I need ideas for things to code

2009-04-24 Thread Andrew Hucks
I've been coding PHP for about a year, and I'm running out of things to code that force me to learn new things. If you have any suggestions, I'd greatly appreciate it.

[PHP] Change color of anything in double/single quotes

2009-04-25 Thread Andrew Hucks
If I have something like $string = '"hello" there'; (the word hello is in double quotes, if you can't see it), how would I output it as something like "hello" there. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] I need ideas for things to code - webbytedd examples

2009-04-27 Thread Andrew Hucks
.php.net >> Subject: Re: [PHP] I need ideas for things to code >> >> This was a surprisingly good idea that works for me, as I >> haven't coded in >> about 3 years and need to get my hand back in.  Trying to >> make use of one >> idea led to several others.

[PHP] date time late or lagging

2009-04-28 Thread Andrew Williams
hi all, $dateNow = date('Y-m-d H:i:s'); echo "".$dateNow .""; can some see why the date time is lagging or late by 30 minutes from the server time even when server time are correct

Re: [PHP] date time late or lagging RESOLVED

2009-04-28 Thread Andrew Williams
On Tue, Apr 28, 2009 at 3:45 PM, Andrew Williams wrote: > hi all, > > $dateNow = date('Y-m-d H:i:s'); > echo "".$dateNow .""; > > can some see why the date time is lagging or late by 30 minutes from the > server time even when server time a

[PHP] Project Euler [Oh, this isn't spam mail...]

2009-04-28 Thread Andrew Hucks
This isn't a question. :-D. Anyways, there's a website that I came across which has kept me up past bedtime the past few nights. "Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Although mathemati

Re: [PHP] $_session/$_cookie trouble

2009-04-28 Thread Andrew Hucks
Take the values out of single quotes, else it sets them as strings, and not as the variable value. Also, are you meaning to set the cookie's expiration to time()-3600? Try time()+3600. On Tue, Apr 28, 2009 at 4:49 PM, Ashley Sheridan wrote: > On Tue, 2009-04-28 at 16:38 -0400, Gary wrote: >> Than

Re: [PHP] Re: $_session/$_cookie trouble

2009-04-28 Thread Andrew Hucks
$sale_value would have worked if it hadn't been in single quotes, I believe. (Assuming it was populated.). When you put it in quotes, you were making the cookie's value a string instead of a variable. So, the value would actually have literally been $sale_value, rather than the value for that varia

Re: [PHP] Getting Sub Elements with XPath

2009-04-30 Thread Andrew Ballard
to cut down your code further with something like this: query( "ResponseDetails/SearchChargeConditionsResponse/ChargeConditions/chargeconditi...@type='cancellation']/Condition", $responseElement ); foreach( $Elements as $Element ) { $condition = $Element->getAttribute('Cha

Re: [PHP] utf-8 ?

2009-04-30 Thread Andrew Hucks
It'd be a hassle to just remove a function from a language, I suppose... On Thu, Apr 30, 2009 at 6:15 PM, Reese wrote: > Tom Worster wrote: > >> why use SGML character entity references in a utf-8 file or stream? can't >> you just put the character in the file? > > Because, I thought, HTML files

Re: [PHP] Two very useful PHP functions

2009-05-01 Thread Andrew Ballard
s intentional or a botched ternary operator. I'm not sure there is a need for a function like ifset/ifsetor, but I'd MUCH rather have a clear function name that could easily be found in the manual than mangling the ternary operator. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] how to write element in textarea?

2009-05-01 Thread Andrew Ballard
after the inside element. > Any suggestions how can I fix this? > > Thanks in advance, > You need to use htmlspecialchars on whatever you place inside the textarea: Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] graphical integrated development environment recommendations?

2009-05-01 Thread Andrew Hucks
http://notepad-plus.sourceforge.net/uk/site.htm Try out N++. It's very good, supports a whole bunch of languages by default, has folding, and you can tweak the syntax highlight if you want. (You don't need to though.) Takes two minutes to install, and 45 seconds to uninstall it if you don't like

[PHP] Dynamically Rename Images

2009-05-02 Thread Andrew Hucks
Is it possible to rename images dynamically? Say that I had something like image1.png, and I don't want to rename it on the server. I'm working on an image rotater for a forum that doesn't allow anything but image files as signatures. Here's my code so far: '; ?> I used mod_rewrite, which make

Re: [PHP] Dynamically Rename Images

2009-05-03 Thread Andrew Hucks
Thanks, but I solved the problem another way. http://codepad.org/6juIkECZ. On Sun, May 3, 2009 at 3:02 PM, Michael A. Peters wrote: > Andrew Hucks wrote: >> >> Got this error: >> >> Fatal error: Cannot instantiate non-existent class: finfo in on >> line 6 >

Re: [PHP] Re: Query stopping after 2 records?

2009-05-04 Thread Andrew Hucks
When you say die, does it just stop, or do you get an error message? Depending on how long it's taking to perform the action, the script will stop just because it's taking a while. (by default, I think it's 30 seconds.) If so, use: ini_set("max_execution_time", "time in seconds"); On Mon, May 4,

Re: [PHP] SQL Injection - Solution

2009-05-06 Thread Andrew Ballard
s purpose. 2) strip_tags has absolutely nothing to do with SQL injection. Neither does trim(). There are cases where you would not want to use either of those functions on input, but you would still need to guard against injection. 3) DROP TABLE will work no matter how many white-space characters appeared between the words. For that matter, I am pretty sure that 'DROP /* some bogus SQL comment to make it past your filter */ TABLE' will work also. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Re: SQL Injection - Solution

2009-05-06 Thread Andrew Ballard
ite yet another one, it would probably be worthwhile to dissect some of those existing libraries to see how they handle work under the hood. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] [php] tcp server connection

2009-05-12 Thread Andrew Williams
Can someone help me about how to retrieve data using TCP server connection -- Best Wishes A Williams

[PHP] [PHP ADVANCE] tcp CLIENT server connection and authentication

2009-05-13 Thread Andrew Williams
Hi All, please, I need to connect to IP via a specific port en validate my user name and password to get data. Port : XXX7X Internet ip 195.19.XX.1XX please can some help with the idea of achieving it in php. please see the format below: [*Session Initialization* A session begins wit

[PHP] Re: [PHP ADVANCE] tcp CLIENT server connection and authentication

2009-05-13 Thread Andrew Williams
Hi, http://php.net/stream_socket_client does not have the option to supply authentication details and how do you supply that. On Wed, May 13, 2009 at 12:22 PM, Nathan Rixham wrote: > Andrew Williams wrote: > >> Hi All, >> >> please, I need to connect to IP via a spec

Re: [PHP] Sending SMS through website

2009-05-13 Thread Andrew Williams
http://google.com/search?q=open+source+sms+gateway On Wed, May 13, 2009 at 3:36 PM, Thodoris wrote: > > Hi All, >> >> Does anyone know how to send sms through a php website. I am completely >> new >> to the requirement and don't know even the pre-requisite of doing it. You >> can also drop in

Re: [PHP] Sending SMS through website

2009-05-13 Thread Andrew Ballard
n the US. As for payment, the sender doesn't pay anything (What are they going to do -- send a bill to the sender's e-mail address?) and the recipient pays standard rates for an incoming message. If it's within your monthly allotment, it's "free." I don't know if

Re: [PHP] Sending SMS through website

2009-05-13 Thread Andrew Ballard
On Wed, May 13, 2009 at 3:38 PM, Nathan Rixham wrote: > Andrew Ballard wrote: >> >> On Wed, May 13, 2009 at 1:55 PM, Per Jessen wrote: >>> >>> kyle.smith wrote: >>> >>>> Most carriers have email-to-sms bridges.  For example, I use AT&

Re: [PHP]Cannot output the same data from text file in PHP

2009-05-14 Thread Andrew Ballard
essage headers, other than the basic To, Subject, and Date that are usually plainly visible in mail clients? And it's not even like mail clients read the headers and add an Unsubscribe link/button to the UI when reading a message. :-) Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP]Cannot output the same data from text file in PHP

2009-05-14 Thread Andrew Ballard
On Thu, May 14, 2009 at 4:33 PM, Paul M Foster wrote: > On Thu, May 14, 2009 at 03:30:44PM -0400, Andrew Ballard wrote: > >> On Thu, May 14, 2009 at 3:29 PM, Ashley Sheridan >> wrote: >> > On Thu, 2009-05-14 at 09:29 -0400, Mike Roberts wrote: >> >> Is ther

Re: [PHP]Cannot output the same data from text file in PHP

2009-05-15 Thread Andrew Ballard
On Fri, May 15, 2009 at 10:24 AM, tedd wrote: > At 4:45 PM -0400 5/14/09, Andrew Ballard wrote: >> >> On Thu, May 14, 2009 at 4:33 PM, Paul M Foster >> wrote: >>  > My stance is, if you're going to subscribe to an email list, learn how >>> &g

Re: [PHP] Re: Parsing of forms

2009-05-19 Thread Andrew Ballard
pings=strawberries". In the grand scheme of things, these are just subtleties that can easily be handled. Since my first major experience with a web language was PHP (after a very brief dabble in PERL) before I took a turn at ASP/VBScript, I'm used to it and it isn't a "hang-up" for me. But something about it never seemed quite "right" to me either. :-) Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Re: Parsing of forms

2009-05-20 Thread Andrew Ballard
On Wed, May 20, 2009 at 6:50 AM, Ford, Mike wrote: > On 19 May 2009 17:10, Andrew Ballard advised: >>               var toppings = document.sundae.toppings; >>                 // To work with PHP, the above line would >> have to be changed: >>    

Re: [PHP] SECURITY PRECAUTION BEFORE SUBMITTING DATA IN DATABASE

2009-05-22 Thread Andrew Williams
WHY IS php-general@lists.php.net PUBLISHING USER EMAIL ON THE INTERNET: http://www.google.co.uk/search?q=sumitphp5%40gmail.com&sourceid=navclient-ff&ie=UTF-8&rlz=1B3GGGL_enGB303GB303&aq=t On Fri, May 22, 2009 at 11:28 AM, Sumit Sharma wrote: > Thanks to [0] => Ashley, [1] =>Bruce, [2] => Michae

Re: [PHP] WHY ARE lists.php.ne USER EMAIL BEING PUBLISH ON THE INTERNET

2009-05-22 Thread Andrew Williams
I have no problem with it at least user email address should be removed off the publication. - Show quoted text - On Fri, May 22, 2009 at 1:21 PM, Per Jessen wrote: > Andrew Williams wrote: > > > WHY IS php-general@lists.php.net PUBLISHING USER EMAIL ON THE > > INTERNET

Re: [PHP] SECURITY PRECAUTION BEFORE SUBMITTING DATA IN DATABASE

2009-05-22 Thread Andrew Ballard
On Fri, May 22, 2009 at 6:35 AM, Andrew Williams wrote: > WHY IS php-general@lists.php.net PUBLISHING USER EMAIL ON THE INTERNET: > > http://www.google.co.uk/search?q=sumitphp5%40gmail.com&sourceid=navclient-ff&ie=UTF-8&rlz=1B3GGGL_enGB303GB303&aq=t > > On Fri,

Re: [PHP] IE can't download, FF can: SSL ? Need special headers?

2009-05-22 Thread Andrew Ballard
s a copy in the temp folder and then directs Adobe to open that file when it spawns the reader. When you tell IE not to cache the document, it dutifully obliges, but it still tells Adobe to open the file from the temp folder. At least, that's what it looks like it tries to do. To get around the filename problems, you could also use some sort of mod_rewrite where the URL requested is the actual PDF name but let PHP handle the request if the above doesn't work for you. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Why does PHP have such a pain in the a$$ configuration file?

2009-05-26 Thread Andrew Ballard
lable to everyone, even though they are intended for those specific few who know what they're doing and who need specific functionality. :-) Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Why does PHP have such a pain in the a$$ configuration file?

2009-05-26 Thread Andrew Ballard
On Tue, May 26, 2009 at 2:18 PM, Robert Cummings wrote: > On Tue, 2009-05-26 at 14:10 -0400, Andrew Ballard wrote: >> On Tue, May 26, 2009 at 1:47 PM, Robert Cummings >> wrote: >> > [snip] Such settings are usually made >> > available to people who know what th

Re: [PHP] templating engine options

2009-05-27 Thread Andrew Ballard
to translate that structure into a valid SQL statements using that table in a specific SQL vendor dialect. Those could be anything as simple as generating CREATE TABLE statements to build a script to create a database or as complex as building stored procedures against those tables. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Confirmation email caught by spam filter

2009-05-27 Thread Andrew Ballard
? > > Also, how can I get bounced emails? > > Thanks, > > Afan > > What mail program is PHP using? Did you check out the $additional_parameters (5th parameter) for the mail() function? If you're using sendmail and the envelope from address is 'nob...@mydomain.com'

Re: [PHP] Re: mysql create table with date or timestamp

2009-05-28 Thread Andrew Ballard
r(30), >>  onfile varchar(100) >>  unique id(iddiary) >> ); > > Please advice. Thanks in advance, Grega There is a coma missing between the lines for the last column and the unique key. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Re: mysql create table with date or timestamp

2009-05-28 Thread Andrew Ballard
On Thu, May 28, 2009 at 11:15 AM, Andrew Ballard wrote: > 2009/5/28 Grega Leskovsek : >> I GOT THIS ERROR when  I tried first sample with when timestamp; >> >> >> ERROR 1064 (42000): You have an error in your SQL syntax; check the >> manual thatcorresponds to

Re: [PHP] Re: mysql create table with date or timestamp

2009-05-28 Thread Andrew Ballard
On Thu, May 28, 2009 at 11:20 AM, Daniel Brown wrote: > On Thu, May 28, 2009 at 11:15, Andrew Ballard wrote: >> >> Make that a 'comma', not the 'coma' that I seem to be in.  :-) > >    Eh, it's your birthday.  You're allowed.  ;-P > >

Re: [PHP] Re: PHP vs ASP.NET

2009-06-01 Thread Andrew Ballard
d a while back where he queried Google to count the number of pages indexed by suffix. Even so, you know what they say about statistics Will ASP.NET replace PHP? Time will tell. (I doubt it.) At any rate, I'm not losing any sleep over it. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] templating engine options

2009-06-01 Thread Andrew Ballard
t;  } >  echo ''; > } else { >  echo 'No Comments'; > } > ?> > > without php and without xml style markup (unless it's by extension of xhtml > with data attributes) > > that was a big one! > > regards & any thoughts more than welcom

Re: [PHP] Re: PHP vs ASP.NET

2009-06-01 Thread Andrew Ballard
ne. > > Isn't ".NET" the framework, and ".NET" the language? > > ASP.NET uses ASP to access the .NET framework. > VB.NET uses VB to access the .NET framework. > .NET uses to > access the .NET framework. > Not exactly. ASP isn't a language.

Re: [PHP] Re: PHP vs ASP.NET

2009-06-01 Thread Andrew Ballard
On Mon, Jun 1, 2009 at 3:18 PM, Lists wrote: > ASP (Classic) and ASP.NET = two different things. > > en.wikipedia.org/wiki/Active_Server_Pages Agreed. And neither one of them is a language. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://ww

Re: [PHP] Re: PHP vs ASP.NET

2009-06-01 Thread Andrew Ballard
ary in ASP. I'm not sure about ASP.NET. (I saw it done once without a COM library, but it was neither pretty nor fast.) Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] [php] most recent row from table

2009-06-02 Thread Andrew Ballard
top 1 from table where id = xx order by date_field desc > > What database(s) support a "TOP" clause in SELECT statements? > > Paul > > -- > Paul M. Foster Microsoft SQL Server. It's not as flexible as MySQL's LIMIT statement, though. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] [php] most recent row from table

2009-06-02 Thread Andrew Ballard
e last of these records. > > Paul > > -- > Paul M. Foster > What is wrong with this? (It's the MySQL equivalent of the query Bastien posted.) SELECT * FROM table ORDER BY date_field DESC LIMIT 1 Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Re: PHP Security

2009-06-03 Thread Andrew Ballard
one is able to access files that they should not access, remove any network interface cards and smash them to make sure malicious users cannot even connect to the machine, and fill any I/O ports with superglue to ensure that no one can plug any unauthorized devices. Oh, and be sure to remove the power sup

Re: [PHP] Best Encryption Algorithm

2009-06-03 Thread Andrew Ballard
On Wed, Jun 3, 2009 at 4:17 PM, Paul M Foster wrote: > On Wed, Jun 03, 2009 at 07:57:32PM +0100, Ashley Sheridan wrote: > > > >> A single-phase Caesar cypher is by far the best. It worked for Julias >> Caesar, and damn it, it will work for us! > > ROT13 FTW! > > Paul > > -- > Paul M. Foster > RO

Re: [PHP] forms problem

2009-06-03 Thread Andrew Ballard
eans that regardless of whether someone is able to enter a value in the field you have labeled "accès client", your PHP page will never see it because it will look at the value from the field you have labeled "mot de passe", even if it is left blank. And that is true regardless of which browser they are using. In some scripting platform other than PHP, or if you process the raw post data yourself it could be different, but in PHP the variable $_POST['title'] will only have one value in it, and it will be the last one passed by the form. (In this case, "mot de passe".) Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] html and password management

2009-06-04 Thread Andrew Ballard
ltimately remain in control of the browser and that a website should not be able to assert control against the user's wishes (in this case by preventing the user from using the form manager or password manager to store the information). Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] html and password management

2009-06-04 Thread Andrew Ballard
On Thu, Jun 4, 2009 at 12:33 PM, Michael A. Peters wrote: > Andrew Ballard wrote: > >> >> >> I just thought I'd toss this out there. Do you know that there is an >> effort to remove browser support this attribute (or at least give the >> user a

Re: [PHP] formatting - design question

2009-06-04 Thread Andrew Ballard
> > It might be simpler during development, but YSlow! recommends putting them in as few pages as is practical so the browser has fewer resources to fetch and can make better use of caching. It won't affect the speed of your PHP pages, but it should speed up the overall download time of y

Re: [PHP] smallA framework, over 140 characters for twitter ;)

2009-06-08 Thread Andrew Ballard
On Mon, Jun 8, 2009 at 9:47 AM, Daniel Brown wrote: > On Sun, Jun 7, 2009 at 12:51, Rolando Santamaria > Maso wrote: >> This is a very small framework for PHP inspired by the framework of Fabien >> Potencier (http://twitto.org/). > >    Awesome.  As soon as we can throw security out the window and

Re: [PHP] Show the entire browser request

2009-06-08 Thread Andrew Ballard
On Mon, Jun 8, 2009 at 2:40 PM, Dotan Cohen wrote: >>    Roger that.  Check out getallheaders() then: >> >>        http://php.net/getallheaders >> > > Well, that seems to be partway there, but it doesn't include the GET request. > > -- > Dotan Cohen > > http://what-is-what.com > http://gibberish.co

Re: [PHP] Show the entire browser request

2009-06-08 Thread Andrew Ballard
On Mon, Jun 8, 2009 at 4:40 PM, Dotan Cohen wrote: >> This should do it, I believe: >> >> > >> echo $_SERVER['REQUEST_METHOD'], ' ', $_SERVER['REQUEST_URI'], ' ', >> $_SERVER['SERVER_PROTOCOL']; >> >&g

Re: [PHP] key for in_array()

2009-06-08 Thread Andrew Ballard
gt; --- > http://sperling.com  http://ancientstones.com  http://earthstones.com > Try this instead: http://us3.php.net/manual/en/function.array-search.php Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Preventing XSS Attacks

2009-06-10 Thread Andrew Ballard
On Wed, Jun 10, 2009 at 2:26 PM, Ashley Sheridan wrote: > On Wed, 2009-06-10 at 14:14 -0400, Eddie Drapkin wrote: >> On Wed, Jun 10, 2009 at 2:08 PM, Ashley Sheridan >> wrote: >> >> > On Wed, 2009-06-10 at 19:03 +0100, Ashley Sheridan wrote: >> > > On Wed, 2009-06-10 at 23:17 +0530, Sudheer Satyana

Re: [PHP] Preventing XSS Attacks

2009-06-10 Thread Andrew Ballard
On Wed, Jun 10, 2009 at 2:56 PM, Ashley Sheridan wrote: > On Wed, 2009-06-10 at 14:40 -0400, Andrew Ballard wrote: >> On Wed, Jun 10, 2009 at 2:26 PM, Ashley >> Sheridan wrote: >> > On Wed, 2009-06-10 at 14:14 -0400, Eddie Drapkin wrote: >> >> On Wed, Jun

Re: [PHP] Preventing XSS Attacks

2009-06-10 Thread Andrew Ballard
xception when the variable's scope is inside a function whose sole purpose is to escape the value and then do something with the escaped value.) I just often skip the extra variable and use the function return value directly unless having the extra variable makes the code more readable -- as a mat

Re: [PHP] order by what?

2009-06-11 Thread Andrew Ballard
that you are sending the correct content-type header when you serve the page. If you try to serve UTF-8 characters but your server is sending a Content-Type: ISO-8859-1; header, you will get placeholders in FF for characters that aren't recognized. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Field type for american money

2009-06-12 Thread Andrew Ballard
that are 3 for a dollar. If you enter a price of 0.33 in a decimal(10, 2) field, multiplying that by 3 will result in 0.99, whereas three items priced at 0. will come to 0., which when formatted to two digits will round to 1.00. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] opendir() Question

2009-06-12 Thread Andrew Ballard
uot;ftp://...";); > but it seems it doesn't work with FTP. Now, is there another thing I could > use for the same effect? > Thanks! > -- > --- > Contact info: > Skype: parham-d > MSN: fire_lizard16 at hotmail dot com > email: parham90 at GMail dot com RTM http:

Re: [PHP] High ID (unique, auto increment) causes slow responses on PHP (MySQL)

2009-06-14 Thread Andrew Ballard
uery what is it and what engine are your tables > using? > > -Stuart > > -- > http://stut.net/ > Right. 30k rows in most databases is nothing. Neither the number of rows nor the size of the number should cause problems at that size. Is there a chance that the table is inc

Re: [PHP] socket communication programming

2009-06-14 Thread Andrew Ballard
that isn't just a typo), you won't get the results you want. If all you are trying to do is fetch data from a remote web server, one of the packaged libraries like HTTPrequest will probably be all you need. That way the code behind the API will make sure your requests are well formed

Re: [PHP] Re: preg_replace problem

2009-06-14 Thread Andrew Ballard
e as, without the > "e" on quote. Which is an HTML entity for quote. > > But; if $value is simple a quote character ["] I get """. e.g., >  "test" => "test" > The regex that you posted won't replace an actual quote character at all. Are you sure you aren't running the value through something like htmlspecialchars() before it's getting into your regexp? Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] fopen() on a network share?

2009-06-15 Thread Andrew Ballard
or > > //servername/sharename/folder/file.xml > > -- > Thanks! > -Shawn > http://www.spidean.com > I think 'servername\sharename\folder\file.xml' will work if you're using single quotes around the string. The only slashes that would need escaped are the first two since the first slash in '\\' escapes the second. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Re: XSS Preventing.

2009-06-23 Thread Andrew Ballard
dual characters (generally 1 or 2 bytes) are inflated to entities that are often around 6-8 bytes. Additional Cons: If the content ever needed to be formatted for something other than html (either now or in the future) you'd have to remove the entities every time you read the database. So now y

Re: [PHP] resubmit form after validation error

2009-06-23 Thread Andrew Ballard
error!.  Get an editor that will show you bad syntax like the > above.  It is a freaking parse error because you don't have matched > parentheses! > > -- > Thanks! > -Shawn > http://www.spidean.com > You mean when PHP parses my code, it can't just tell what I meant and do it? I mean, web browsers aren't that picky. Geesh! :-P Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Explode-update-implode not working

2009-06-23 Thread Andrew Ballard
ue? > > Bob McConnell > See the second note at http://www.php.net/manual/en/control-structures.foreach.php Either of these should do what you want: $kvpair) { $line = explode ("|", $kvpair); if ($line[0] == "key1") { $line[1] = "value3"; $lines[$key] = implode ("|", $line); break; } } $newbuff = implode ("~", $lines); ?> Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Re: Progressbar

2009-06-25 Thread Andrew Ballard
stall. When I went looking for an IDE, I wanted a good code editor with features like syntax checking and code completion, and I wanted a debugger that I could step through code to figure out why something wasn't working as I expected. There were a couple that were close, but I chose Zend Studio at the time because it seemed to have the most complete/accurate code completion not only of the core language, but also recognizing functions and classes declared within the PHP code in the project itself (especially when you include a basic phpdoc block that describes the function @params and @return). Perhaps the new version still does all that wonderfully well, but as I said I've found it to be not worth the hassle. Perhaps, to be fair, I need to take some time to get familiar with the new paradigm, but that furthers my point: I want an editor that I can be productive with more or less out of the box. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] OT mysql pivot table problem

2009-06-25 Thread Andrew Ballard
oups,N+1)-N-1) FROM Tally, user.table WHERE N < LENGTH(user.table.groups) AND SUBSTRING(user.table.groups,N,1) = ',' Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] OT mysql pivot table problem

2009-06-25 Thread Andrew Ballard
On Thu, Jun 25, 2009 at 4:21 PM, Andrew Ballard wrote: > On Thu, Jun 25, 2009 at 3:20 PM, Matt Giddings wrote: >> I know this is the off topic (sorry), but it is a php project that I'm >> working on!  I need some pointers on how to pivot a mysql column (containing >> com

Re: [PHP] Compare and inserting with php

2009-06-30 Thread Andrew Ballard
(mysql_num_rows($result) == 0) {    $sql = "INSERT INTO > `restaurants` (name, address, inDate, inType, notes, critical, cviolations, > noncritical)  VALUES (";    $sql .= " '$ucName', '$ucAddress', '$inDate', > '$inType', '$notes', '$critical', '$cleanViolations', '$noncritical')";       >  $result = mysql_query($sql) or die(mysql_error());    } > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > For one thing, that error message shows that you are not properly escaping the strings you are sending to mysql_query() (specifically, $ucName in this case). Even if you do get it to work, you'll be vulnerable to SQL injection. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] exasperated again

2009-06-30 Thread Andrew Ballard
> Phil Jourdan --- p...@ptahhotep.com >   http://www.ptahhotep.com >   http://www.chiccantine.com/andypantry.php > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > I see a typo in the last block where you call $result = msql_query(...) instead of $result = mysql_query(...). Is that in your actual code? Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Re: check a variable after EACH function

2009-07-01 Thread Andrew Ballard
    do_another_thing()     && >         do_yet_another_thing() && >         and_keep_doing_things()) >    ; > > > /Nisse > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > I think y

Re: [PHP] Select and compare problems still ...

2009-07-01 Thread Andrew Ballard
On Wed, Jul 1, 2009 at 10:56 AM, Miller, Terion wrote: > Why doesn't this work? > > >    $query = "SELECT * FROM `restaurants` WHERE name ='$ucName' AND > address = '$ucAddress'  " ; > > $result = mysql_query($query) or die(mysql_error()); > > >  echo $result; >     $row = mysql_fetch_array ($resul

Re: [PHP] Select and compare problems still ...

2009-07-01 Thread Andrew Ballard
On Wed, Jul 1, 2009 at 11:23 AM, Andrew Ballard wrote: > On Wed, Jul 1, 2009 at 10:56 AM, Miller, > Terion wrote: >> Why doesn't this work? >> >> >>    $query = "SELECT * FROM `restaurants` WHERE name ='$ucName' AND >> address = 

Re: [PHP] preg_replace with UTF-8

2009-07-06 Thread Andrew Ballard
t; I'm not sure if this is exactly what you want (or if it might let more things slip past than you intend), but try this: '; $data = preg_replace('~([\w\pL\.]{6})~u', '$1 < >', $data); echo 'Data After: ', $data; // UTF-8 Test $data = 'ффф'; echo 'Data before: ', $data, ''; $data = preg_replace('~([\w\pL\.]{6})~u', '$1 < >', $data); echo 'Data After: ', $data; ?> Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Simple login form with cookies

2009-07-08 Thread Andrew Ballard
encrypt/compare that you do for authentication, and if it matches you just update the username and the hash at the same time. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Simple login form with cookies

2009-07-08 Thread Andrew Ballard
to me. On my development machine, where PHP runs slow inside of the IDE, the average time to perform an md5 hash on a text string of 38 characters (much longer than most passwords) over 1 iterations is around 0.00085 seconds. I can live with that. :-) I still like handling the encryption in PH

Re: [PHP] Simple login form with cookies

2009-07-08 Thread Andrew Ballard
aned $login and $password, they looked like they > had just gone through an acid bath before being hit by katerina > (hurricane)... ;-) rather whitewashed and empty. There was nothing left > to work with. One thing to check - I'm pretty sure that mysql_real_escape_string will only work if you have an open connection to mysql, because it uses that connection to figure out what character encoding is being used so it can escape the string accordingly. (If unable to connect, it should raise an E_WARNING.) I'm not sure why you would need to use @ with trim(), but that shouldn't matter. Otherwise, nothing in there should mangle the input. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Simple login form with cookies

2009-07-08 Thread Andrew Ballard
On Wed, Jul 8, 2009 at 3:06 PM, Tony Marston wrote: [snip] > I don't like this rule, so I choose to disobey it. Now that's some scary ideology. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Simple login form with cookies

2009-07-08 Thread Andrew Ballard
On Wed, Jul 8, 2009 at 4:45 PM, PJ wrote: > Andrew Ballard wrote: >> On Wed, Jul 8, 2009 at 11:53 AM, PJ wrote: >>> I have a couple of questions/comments re all this: >>> [snip] >>> 2. Cleaning is another bloody headache, for me anyway. I have found that &g

Re: [PHP] Simple login form with cookies

2009-07-08 Thread Andrew Ballard
Try again, and include the actual link this time, dummy. :-) On Wed, Jul 8, 2009 at 5:30 PM, Andrew Ballard wrote: > On Wed, Jul 8, 2009 at 4:45 PM, PJ wrote: >> Andrew Ballard wrote: >>> On Wed, Jul 8, 2009 at 11:53 AM, PJ wrote: >>>> I have a couple of

Re: [PHP] PHP script for detecting pattern sequences?

2009-07-10 Thread Andrew Ballard
This would match the repeated sequence only if the string began with a repeated sequence. $pattern = '/^(\d+?)\1+/'; // This would match the repeated sequence only if the string ended with a repeated sequence. $pattern = '/(\d+?)\1+$/'; If a string had multiple sequences, you could also use preg_match_all to find each sequence, but that looks a bit more involved than the OP. None of these require knowing the sequence in advance. How do they not satisfy the OP? Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] mysql cache query as xml

2009-07-10 Thread Andrew Ballard
te. By itself, that isn't bad performance unless this is a query that is called frequently by several concurrent users. Personally, I'd look into ways to improve the execution of the query itself in MySQL (making sure the query is sargable and improving indexes, etc.) until I thought I

Re: [PHP] Establishing PHP Session From a Different Host

2009-07-13 Thread Andrew Ballard
ehind-the-scenes web service. It can also fail in cases where the form processor on site B depends on some previous state being established with the browser (for example, a particular cookie that must already be set, or only accepting posts with a "valid" HTTP_REFERER value) before posting the credentials. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] MySql Injection advice

2009-07-13 Thread Andrew Ballard
characters long? Expand that to international phone numbers, and the zeros become even more significant since you can't easily make assumptions about the length of various segments in a phone number. Sorry, but I just don't see any advantage to storing them as integers. Andrew -- PHP G

Re: [PHP] Alphabetical pagination

2009-07-14 Thread Andrew Ballard
is little use storing separate redundant copies in session scope where it will needlessly fill up disk space and/or memory. As far as the query is concerned, you could do this: I would also consider whether you really need the keyword DISTINCT in the query. In a properly normalized table, name should probably already be distinct (and constrained by a UNIQUE index on that column). Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Alphabetical pagination

2009-07-15 Thread Andrew Ballard
On Wed, Jul 15, 2009 at 3:28 AM, Ashley Sheridan wrote: > On Wednesday 15 July 2009 06:35:04 Jim Lucas wrote: >> Andrew Ballard wrote: >> > On Tue, Jul 14, 2009 at 3:38 PM, Miller, >> > >> > Terion wrote: >> >> I am trying to make a page that dis

Re: [PHP] Alphabetical pagination

2009-07-15 Thread Andrew Ballard
nd increments/decrements to an ending value. But then he did say "from memory -- use with caution". The general idea is correct. 2) It implements numeric pagination, which is usually based on a fixed number of rows per page. The OP wanted alphabetical pagination (like an address book) with each page containing all entries that begin with the selected letter. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Alphabetical pagination (RESOLVED)

2009-07-16 Thread Andrew Ballard
nor are you escaping it before passing it off to MySQL. In this case, it should be safe to use $letter directly in the query without passing it through mysql_real_escape_string() since it should only contain a single harmless alphanumeric letter, but it wouldn't hurt (and may still be a good idea) to go ahead and escape the value in the query anyway just in case something in your code changes later that might cause some cruft to slip in. Andrew

Re: [PHP] Syntax Snag need extra eyes

2009-07-16 Thread Andrew Ballard
ual > page for this function. > > Try: > > printf( >'%s%s', >$row['name'], >$row['name'], >$row['address'] > ); > > This is the correct way to use printf() > > > I like this, just because I don't need to repeat $row['name'] (but it is the same thing): printf( '%1$s%2$s', $row['name'], $row['address'] ); Andrew

<    4   5   6   7   8   9   10   11   12   13   >