Re: [PHP] [News] Affordable Independent Web Developer - Search Engine Optimization Services - March 19th, 2009

2009-03-20 Thread Frank Stanovcak
George Larson george.g.lar...@gmail.com wrote in message 
news:a623739c0903201141o3b430640haf91ea575f276...@mail.gmail.com...
 houses ain't gunna cleen themselfs...

 On Fri, Mar 20, 2009 at 2:39 PM, Ginkga Studio, LLC 
 webdes...@ginkga.comwrote:

 LOL.

 :0)

 Ok. You guys are fun but I have to get to work. Hope all works out for 
 you
 guys. Sorry for posting to your list. Just block me so I don't bother you
 again.

 Good luck with all your programming. You all seem like pretty good 
 people.

 Sorry for harassing you George. I'm sure you are sexy in something short
 and
 lacy.

 Sorry for offending Daniel and all of his greatness. I'm sure he's a 
 pretty
 good guy when he isn't being so defensive.


 Anyway, nice meeting you all, even it was on such terms.

 God Bless.

 XOXOXOXO




 -Original Message-
 From: George Larson [mailto:george.g.lar...@gmail.com]
 Sent: Friday, March 20, 2009 11:34 AM
 To: Thiago H. Pojda
 Cc: webdes...@ginkga.com; php-general@lists.php.net
 Subject: Re: [PHP] [News] Affordable Independent Web Developer - Search
 Engine Optimization Services - March 19th, 2009

 Oh, good; I look forward to polishing your nails... spammer.


 On Fri, Mar 20, 2009 at 2:29 PM, Thiago H. Pojda thiago.po...@gmail.com
 wrote:


On Fri, Mar 20, 2009 at 3:23 PM, Ginkga Studio, LLC
 webdes...@ginkga.comwrote:



 IF YOU WERE MY HUSBAND I WOULD SPANK YOUR ASS SO HAR YOU'D NEVER
 TALK BACK
 ANY WOMAN EVER AGAIN !!!



 Oh, gee.

Thanks for filters, Gmail.

--
Thiago Henrique Pojda
http://nerdnaweb.blogspot.com







Great...Just great!  She walks in and drops a spam ball in a tech mailling 
list, spends most of her day ranting back and forth with us, teases us with 
mildly expicit imagry, and then throws George in something lacy out there. 
My GF is going to so hate you for the next few days when all I want to do is 
cuddle and wimper.

Frank...so what's my title? 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Problems with exec() on windows

2009-03-19 Thread Frank Stanovcak

Kyohere Luke l...@beyonic.com wrote in message 
news:9bc423c50903191018k3c783213l4929cf2878e98...@mail.gmail.com...
 Eventually settled for getting rid of the spaces in the path. That worked.
 Thanks.
 Luke

 On Thu, Mar 19, 2009 at 8:06 PM, Bastien Koert phps...@gmail.com wrote:



 On Thu, Mar 19, 2009 at 12:48 PM, Kyohere Luke l...@beyonic.com wrote:

 Thanks, but I tried this. Doesn't work because the path\to\gammu.exe has
 spaces in it
 Haliphax, thanks for your comments. I tried escapeshellarg() to no end.

 I'm exploring your reply regarding proc_open, but how exactly does
 proc_open
 separate the arguments from the command?

 Unless i'm mistaken, data written to the process's stdin (for the other
 process) is not treated like an argument.

 If I add the arguments to the process name/path? I'm back to square one.

 Luke.

 On Thu, Mar 19, 2009 at 6:25 PM, Shawn McKenzie nos...@mckenzies.net
 wrote:

  Kyohere Luke wrote:
   Hi,
   I'm trying to use exec to call gammu.exe and send sms on windows XP.
  
   This works from commandline:
  
   C:\path\to\gammu.exe 1 --sendsms EMS 200 -text test1 test2
  
   But if I run it through php like this:
  
   $command = \C:\path\to\gammu.exe\ --sendsms EMS 200 -text \test1
   test2\.;
   @exec($command, $response, $retval);
  
   This always fails, returns 1 and the response is empty.
  
   If the last argument is a string with no spaces, and the double 
   quotes
  were
   omitted, it works perfectly.
  
   If the double quotes are added around the string with no spaces, it
 fails
   again, which makes me believe that the problem is with the double
 quotes.
  
   I've used procmon and it shows that when the double quotes are added
  around
   the last argument, gammu.exe is not even called at all.
  
   Problem is that the double quotes are required by gammu to send an 
   sms
  with
   spaces in it.
  
   Any ideas? :-(
  
   Luke
  
 
  Why not try:
 
  $command = 'C:\path\to\gammu.exe --sendsms EMS 200 -text test1 
  test2';
 
  --
  Thanks!
  -Shawn
  http://www.spidean.com
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 


 try double slashes for the path and wrap the pathin quotes if there are
 spaces in it. Or if possible get rid of the spaces in the folder names

 --

 Bastien

 Cat, the other other white meat



Rule of thumb.  Since PHP is for web access try to avoid spaces in any 
folder names you will be making accessable through either the site or php 
references.  It makes life much much easier.


Frank.  Back from his binge drinking, and School applications after his 
layoff. 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Stopping bad entries in PHP form

2009-03-19 Thread Frank Stanovcak

Ashley Sheridan a...@ashleysheridan.co.uk wrote in message 
news:1237498771.3562.22.ca...@localhost.localdomain...
 On Thu, 2009-03-19 at 17:33 -0400, Marc Christopher Hall wrote:
 IP lookups are like Marxism, great idea in theory, terrible in reality. 
 IP's
 can be spoofed. The best recommendation I can think of would be to add 
 some
 word filters to your (I'm assuming javascript) form validation script. 
 Even
 here caution needs to be used, i.e don't filter Moscow because there is a
 Moscow, Idaho




 -Original Message-
 From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk]
 Sent: Thursday, March 19, 2009 5:19 PM
 To: Shawn McKenzie
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Stopping bad entries in PHP form

 On Thu, 2009-03-19 at 16:04 -0500, Shawn McKenzie wrote:
  Ashley Sheridan wrote:
   On Thu, 2009-03-19 at 13:46 -0700, sono...@fannullone.us wrote:
   I have a PHP form that allows end users to request a sample of the
   products we sell.  Unfortunately, a person/people have found it and
   are sending in bad requests.  We sell only within the US, and so 
   I've
   set up the form so that they must choose one of the 50 States.  But 
   we

   keep getting requests with countries in the city field, i.e. Moscow
   Russia.
  
   Is there a way that I can scan for country names, etc. in the text
   fields and stop a request from going through if it finds one of 
   those
   banned words?  I've searched for a solution but haven't been able 
   to

   find it.
  
   If this is not enough info, please let me know.  Also, I only know
   enough PHP just to be dangerous, so please be kind. =;)
  
   Thanks,
   Frank
  
   Why make them enter the details? Let them choose from a select list
   instead, forcing them to select a state.
  
  
   Ash
   www.ashleysheridan.co.uk
  
 
  Ummm...  And what if they enter or select Texas?  You consider it a
  valid request even though they are really from Moscow and the other
  fields may be junk?
 
  -- 
  Thanks!
  -Shawn
  http://www.spidean.com
 
 Is it viable to couple it with an IP lookup to see the country they
 appear to be visiting from?


 Ash
 www.ashleysheridan.co.uk


 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 __ Information from ESET Smart Security, version of virus 
 signature
 database 3949 (20090319) __

 The message was checked by ESET Smart Security.

 http://www.eset.com




 __ Information from ESET Smart Security, version of virus 
 signature
 database 3949 (20090319) __

 The message was checked by ESET Smart Security.

 http://www.eset.com



 Filtering by Javascript is even worse than by IP, it's a matter of
 seconds to turn that off, a little bit more to change the IP ;)

 Back to the OP; what kind of form is it that should only allow US
 citizens to use it?


 Ash
 www.ashleysheridan.co.uk


Personally when I've had to provide sample code to people for a client like 
this I've found that the client prefers to have the requester to provide a 
phone number, and then have a CS rep contact them.  I then set it up so the 
CS rep could generate a 1 day valid pass code for the web site that they 
then emailed to the prospective client.  Solves several problems.

1.  They know they are talking to a perspective customer, and can add them 
as a contact while validating the location fairly acurately.

2.  It saves you a headache in validation code.

c.  It  makes you look proactive to the client, and could help you in the 
future.

Frank...yes I put c in there on purpose 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How should I ....--its a date/timestamp issue

2009-03-02 Thread Frank Stanovcak

Paul M Foster pa...@quillandmouse.com wrote in message 
news:20090219022913.gl18...@quillandmouse.com...
 On Wed, Feb 18, 2009 at 05:25:16PM -0600, Terion Miller wrote:

 snip

  What about just accepting any date in to the system, and defaulting 
 to
  the current date if any numptys/users try to set one before?

  Do something maybe like this (untested)

  $userDate = strtotime($_REQUEST['date']);
  $startDate = ($userDate  time())?time():$userDate;

  From there, you can use the timestamp how you wish.

  OOH found it:
  $startday  = mktime(0, 0, 0, date(m)  , date(d)+2, date(Y));

  Well no, guess I didn't find it because that code above gives me
  this 1235109600

  What is that??

 It's a *nix timestamp number. Give it to date() this way:

 date('Y-m-d', $startday)

 And you'll see the date it represents. (It's actually the number of
 seconds since, the Unix epoch, in 1970.)

 Paul

 -- 
 Paul M. Foster

Sorry been gone a while.
I usually double validate.  Once in javascript to make sure the date is 
valid before submit, and then again in php incase some maroon screws around 
and/or has javascript disabled on their system.  Hope that helps even if it 
is a bit late. 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Stupid is as Stupid does

2009-02-28 Thread Frank Stanovcak

Michael A. Peters mpet...@mac.com wrote in message 
news:49a79416.6060...@mac.com...
 As my web app is coming to completion, I added a means to search records 
 (different from site search).

 This involves reading post input and is many cases converting it to an 
 integer.

 Damn I feel dumb.

 The search app wasn't working, so I did what I often do when 
 troubleshooting crap - I put a die($variable) at various points to see if 
 the variable is what it is suppose to be.

 I kept getting blank returns from die after the conversion from a post 
 string to an integer. I looked in the apache logs, system logs, I even 
 tried rebooting - I couldn't figure why the smurf the variable wasn't 
 converting to integer.

 I even turned off eaccelerator in case that was causing it, though it 
 never has given me issue before (except once when I was doing something in 
 a really shoddy way - cleaned up my method and it behaved)

 After several hours contemplating if I had bad RAM, an issue with the CPU, 
 verifying my RPMs were good, wondering why I wasn't getting anything in 
 the logs, it dawned on me.

 If variable is an integer, die($var) returns nothing and is suppose to 
 return nothing, it takes a string as an argument to echo on death - 
 die($var) is what I wanted.

 I need sleep.

 I did finally find the error and fix the record search problem.

Meh...just replace the muffler bearings, and be done with it.

Frank...what's sleep? 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Garbage Collection

2009-02-06 Thread Frank Stanovcak

Boyd, Todd M. tmbo...@ccis.edu wrote in message 
news:33bde0b2c17eef46acbe00537cf2a19003cb4...@exchcluster.ccis.edu...
 -Original Message-
 From: tedd [mailto:t...@sperling.com]
 Sent: Thursday, February 05, 2009 10:07 AM
 To: php-general@lists.php.net
 Subject: [PHP] Garbage Collection

 Hi gang:

 A related question to my last Clarity needed post.

 I have a tutor table (showing all the tutors), a course table
 (showing all the courses), and a course-to-tutor table (showing all
 the instances of what tutor teaches what course).

 Okay, everything works. Whenever I want to find out what courses a
 specific tutor teaches OR what tutors teach a specific course, I
 simply search the course-to-tutor table and bingo out pops the answer.

 Now, how do you handle the situation when a tutor quits or when a
 course is no longer offered?

 If I search the course-to-tutor table for all the tutors who teach a
 course and find a tutor who is no longer there OR search the
 course-to-tutor table for all the courses a tutor teaches and find a
 course that is no longer offered, how do you handle the record?

 I realize that if either search turns up nothing, I can check for
 that situation and then handle it accordingly. But my question is
 more specifically, in the event of a tutor quilting OR removing a
 course from the curriculum, what do you do about the course-to-tutor
 orphaned record?

 As I see it, my choices are to a) ignore the orphaned record or b)
 delete the orphaned record. If I ignore the record, then the database
 grows with orphaned records and searches are slowed. If I delete the
 orphaned record, then the problem is solved, right?

 I just want to get a consensus of how you people normally handle it.
 Do any of you see in danger in deleting an orphaned record?

tedd,

I believe relational integrity can solve your problem. In MySQL (and
maybe MSSQL, but I am less versed with that product) you should be
able to put a CASCADE option on the DELETE action for your tutor table
so that when a record is deleted, its associated record in
tutors-to-courses is also deleted. I'm assuming you would want to do the
same for removing a record in tutors-to-courses when a course is removed
(but not remove the tutor, the same as you do not remove the course
itself when the tutor is deleted).

I suppose you could also do it yourself with PHP code when a failed link
is turned up, but why bother separating DB logic from the DB itself? :)

HTH,


// Todd

I agree with todd.  Set up the relationship so that when a record in one of 
the two master tables is deleted the delete cascades to the linked table. 
One to many forced update/delete I think it's called if you want to do a 
search on it.

Frank 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: preg_match question...

2009-02-06 Thread Frank Stanovcak

bruce bedoug...@earthlink.net wrote in message 
news:234801c98863$88f27260$0301a...@tmesa.com...
 hi...

 trying to figure out the best approach to using preg_match to extract the
 number from the follwing type of line...

  131646 sometext follows..

 basically, i want to extract the number, without the text, but i have to 
 be
 able to match on the text

 i've been playing with different preg_match regexs.. but i'm missing
 something obvious!

 thoughts/comments..


How about
preg_match('#(\d+)(.)+#',$haystack,$match)

if I remember right
$match[0] would be all of it
$match[1] would be the numbers
$match[2] would be the text 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: preg_match question...

2009-02-06 Thread Frank Stanovcak

Shawn McKenzie nos...@mckenzies.net wrote in message 
news:e1.67.59347.e494c...@pb1.pair.com...
 bruce wrote:
 hmmm...

 tried your preg__match/regex...

 i get:
 0 - 1145 total
 1 - 1145
 2 - l

 i would have thought that the 2nd array item should have had total...


 Probably want this: '#(\d+)(.+)#'

 -- 
 Thanks!
 -Shawn
 http://www.spidean.com

yep.  Relized it after I saw his post.

the space doesn't hurt either

'#(\d+) (.+)#'

Frank...doh! 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] long echo statement performance question

2009-02-06 Thread Frank Stanovcak
I'm in the process of seperating logic from display in a section of code, 
and wanted to make sure I wasn't treading on a performance landmine here, so 
I ask you wizened masters of the dark arts this...

is there a serious performance hit, or reason not to use long, ie more than 
30 - 40 lines, comma conjoined echo statments...

echo 'blah', $var, 'blah', $var2,...ad nauseum

... to output mixed html and php var values?  If so could you refer me to a 
work around, or better way?

Frank 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] long echo statement performance question

2009-02-06 Thread Frank Stanovcak

Richard Heyes rich...@php.net wrote in message 
news:af8726440902060918v6d2f1ee1ia3f839189874...@mail.gmail.com...
 Wouldn't have thought so. But for readability, you may find this a
 little easier instead:

 Slight correction:

 ?
?=$var1? blah ?=var2?
 ?php

 -- 
 Richard Heyes

 HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
 http://www.rgraph.org (Updated January 31st)

Actually that's what I'm in the middle of undoing.  The first revision was 
jumping in and out of PHP mode upwards of 60 times per page on the shorter 
pages.  I've read a couple places that that can put a huge performace hit on 
things, so I was just trying to simplify the code a bit.  Plus I don't have 
the fast tags, ?=, enabled *blush* 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] long echo statement performance question

2009-02-06 Thread Frank Stanovcak

Bruno Fajardo bsfaja...@gmail.com wrote in message 
news:eeb6980b0902060915k2b34ec31nc6ad166e2c544...@mail.gmail.com...
In my opinion, you would achieve better results using a template
engine, like Smarty (http://www.smarty.net/). In addition, your code
would be entirely separated from presentation in a elegant way.

2009/2/6 Frank Stanovcak blindspot...@comcast.net:
 I'm in the process of seperating logic from display in a section of code,
 and wanted to make sure I wasn't treading on a performance landmine here, 
 so
 I ask you wizened masters of the dark arts this...

 is there a serious performance hit, or reason not to use long, ie more 
 than
 30 - 40 lines, comma conjoined echo statments...

 echo 'blah', $var, 'blah', $var2,...ad nauseum

 ... to output mixed html and php var values?  If so could you refer me to 
 a
 work around, or better way?

 Frank



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
Bruno Fajardo - Desenvolvimento
bruno.faja...@dinamize.com - www.dinamize.com
Dinamize RS - Porto Alegre-RS - CEP 90420-111
Fones (51) 3027 7158 / 8209 4181 - Fax (51) 3027 7150

I'm going to take a serious look at that for ver 2.0, but unfortunately live 
beta 1 rollout is monday, and I'm just cleaning house right now.  Thanks for 
the advice though!

Frank 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: going blind for looking...need eyes

2009-02-06 Thread Frank Stanovcak

Terion Miller webdev.ter...@gmail.com wrote in message 
news:37405f850902060944y74a7a5e8ndce0c3456a32d...@mail.gmail.com...
 Need eyes on this query, it is not inserting, I am going to highlight
 what/where  I thought the problem is (there is no  )but when I add the  
 it
 then changes the syntax coloring on the rest of the code  in my editor 
 which
 makes me wonder if I'm wrong... argh. and either way it's not inserting 
 ...

 -
 $sql = INSERT INTO admin (UserName, Password, Name, Email, Property,
 Department, AddWorkOrder, ;
$sql .= ViewAllWorkOrders, ViewNewOrders, ViewNewArt,
 ViewPendingWorkOrders, ViewPendingArtwork, ViewCompletedArt, ;
$sql .= ViewCompletedWorkOrders, SearchWorkOrder, EditWorkOrder,
 DelWorkOrder, ChangeStatus, AddEditAdmin;
$sql .= ) VALUES(  '$UserName', '$Password', '$Name', '$Email',
 '$Property', '$Department', '$AddWorkOrder', ;
$sql .= '$ViewAllWorkOrders', '$ViewNewOrders', '$ViewNewArt',
 '$ViewPendingWorkOrders', '$ViewPendingArtwork', ;
$sql .= '$ViewCompletedArt', '$ViewCompletedWorkOrders',
 '$SearchWorkOrder', '$EditWorkOrder', '$DelWorkOrder',  ;
$sql .= '$ChangeStatus', '$AddEditAdmin', '$ViewMyOrders');
$result = mysql_query($sql);


Try this for readability

$sql = INSERT INTO admin SET
  UserName='$UserName',
  Password='$Password',
  Name='$Name',
  Email='$Email',
  Property='$Property',
  Department='$Department',
  AddWorkOrder='$AddWorkOrder',
  ViewAllWorkOrders='$ViewAllWorkOrders',
  ViewNewOrders='$ViewNewOrders',
  ViewNewArt='$ViewNewArt',
  ViewPendingWorkOrders='$ViewPendingWorkOrders',
  ViewPendingArtwork='$ViewPendingArtwork',
  ViewCompletedArt='$ViewCompletedArt',
  ViewCompletedWorkOrders='$ViewCompletedWorkOrders',
  SearchWorkOrder='$SearchWorkOrder',
  EditWorkOrder='$EditWorkOrder',
  DelWorkOrder='$DelWorkOrder',
  ChangeStatus='$ChangeStatus',
  AddEditAdmin='$AddEditAdmin';


plus there is an extra value with no matching field in the original query. 
$ViewMyOrders has no field assigned to it.

Hope that helps some!

Frank 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Clarity needed OT

2009-02-06 Thread Frank Stanovcak

Eric Butera eric.but...@gmail.com wrote in message 
news:6a8639eb0902061020v793d22b9x1430872c2170b...@mail.gmail.com...
 On Fri, Feb 6, 2009 at 1:13 PM, tedd tedd.sperl...@gmail.com wrote:
 At 1:55 AM +0100 2/6/09, Jochem Maas wrote:

 that tedd's unlimited educational resources (tutors/courses) might
 go someway to undoing all the harm Fox News inflicts on the masses.

 Or to provide clarity to those who think that Fox News is doing harm.

 Alter all, the main-stream news doesn't like reporting unfavorable things
 about their favorites celebrities, do they? Keep in mind that not paying
 taxes by elected officials has not met the same threshold of reporting 
 not
 knowing how to speak publicly has made.

 I would rather have all politicians stammer in their speeches and pay 
 their
 taxes than the other way around.

 In fact, it would be nice if the politicians would get their facts/words
 straight. For example, the Speaker of the House just announced that 
 Last
 month over 500 million people lost their jobs in her support for the
 importance of rushing the approval of the Stimulus package (whatever 
 that
 is).

 In any event, it's interesting to realize that accordingly to her, 
 EVERYONE
 in the USA lost their job last month and two thirds of the population 
 lost
 it twice!

 It would be nice if the Speaker of the House at least realized how many
 people actually live in the country she represents. BUT -- you didn't 
 hear
 that on the main-stream news -- or -- if you did, they didn't make much 
 of
 it, right? However, if Bush had said it, that would have been something
 different -- it would be headline news and on Saturday Night Live.

 Clearly, there is a difference in news reporting today. There are no
 impartial sources -- everything has biases and spin. The days of Walter
 Cronkite reporting are over.

 Viva opposing opinions.

 Cheers,

 tedd

 --
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



 I think people should just be wise enough to understand the world they
 live in, how things work, and when people are puppets.  There are lots
 of ways to find information out there...

 -- 
 http://www.voom.me | EFnet: #voom

Ok...I'm sure that somewhere in here has to be reference to the original 
topic, and php...right?

Frank...there is isn't there? *sigh* 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] long echo statement performance question

2009-02-06 Thread Frank Stanovcak

Stuart stut...@gmail.com wrote in message 
news:a5f019de0902060932k1ccf2948ua42f3cfa33694...@mail.gmail.com...
 2009/2/6 Frank Stanovcak blindspot...@comcast.net:

 Richard Heyes rich...@php.net wrote in message
 news:af8726440902060918v6d2f1ee1ia3f839189874...@mail.gmail.com...
 Wouldn't have thought so. But for readability, you may find this a
 little easier instead:

 Slight correction:

 ?
?=$var1? blah ?=var2?
 ?php

 --
 Richard Heyes

 HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
 http://www.rgraph.org (Updated January 31st)

 Actually that's what I'm in the middle of undoing.  The first revision 
 was
 jumping in and out of PHP mode upwards of 60 times per page on the 
 shorter
 pages.  I've read a couple places that that can put a huge performace hit 
 on
 things, so I was just trying to simplify the code a bit.  Plus I don't 
 have
 the fast tags, ?=, enabled *blush*

 They're called short tags, not fast tags. There is nothing faster
 about them beyond the typing effort required.

 This question, or rather variations of it, appear on this list at
 pretty regular intervals. A little while ago I wrote a script to test
 the speed of various output methods.

http://stut.net/projects/phpspeed/?iterations=1

 As you can see, the difference is so minimal that unless you're doing
 it hundreds of thousands of times per script it makes little
 difference how you do it.

 In short it's usually not worth optimising at this level since greater
 gains are certainly to be had by looking at your interaction with
 databases or other external resources.

 -Stuart

 -- 
 http://stut.net/

Thanks Stuart!
So for clarity's sake jumping into and out of PHP parsing mode to echo a var 
isn't going to do as great a performance hit as these naysayers would have 
me believe.  Good.  I like the color coding of my html in my editor that is 
lost when I have to quote it to get it to echo/print properly!

Frank 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How can I use a function's default arguments but change one of the end ones in the list?

2009-02-06 Thread Frank Stanovcak

Boyd, Todd M. tmbo...@ccis.edu wrote in message 
news:33bde0b2c17eef46acbe00537cf2a19003d07...@exchcluster.ccis.edu...
 -Original Message-
 From: Daevid Vincent [mailto:dae...@daevid.com]
 Sent: Friday, February 06, 2009 2:26 PM
 To: php-general@lists.php.net
 Subject: Re: [PHP] How can I use a function's default arguments but
 change one of the end ones in the list?

 On Fri, 2009-02-06 at 14:10 +1300, German Geek wrote:

  I've thought about this problem before but couldn't think of a
  solution either.


 Well, I guess I *did* think of a solution, it just happens that PHP
 doesn't do the logical thing(tm)

 ;-)

 I would hope the PHP developers would implement this idea for a future
 version. The concept is simple, just specify which parameters in the
 function call you want to change and leave the others as their
default.

 I've added it here: http://bugs.php.net/bug.php?id=47331 with comments
 about similar/related bugs.

 Feel free to vote on this. I think it's a necessary addition to the
 language and often a source of frustration for me in large projects
 especially where functions get older and older and more parameters are
 needed to maintain backwards compatibility yet get new functionality
 too.

Just tell 'em that .NET already has it; that'll light a fire under them!
:D
C# can do function calls like:

FunctionName(VariableName:=Value);

I wholeheartedly prefer PHP to .NET for most things... but you've got to
admit--that's a pretty slick feature. Me likey.


// Todd

I don't remember what it was I was using, but I remember a lang that allowed 
func(,,,change,,,change) where all the empty comas just went to default. 
*shrug* 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Clarity needed OT

2009-02-06 Thread Frank Stanovcak

Daniel Brown danbr...@php.net wrote in message 
news:ab5568160902061416u10e761dal224ec7177d83e...@mail.gmail.com...
 On Fri, Feb 6, 2009 at 13:46, Frank Stanovcak blindspot...@comcast.net 
 wrote:

 Ok...I'm sure that somewhere in here has to be reference to the original
 topic, and php...right?

 Frank...there is isn't there? *sigh*

Stick around you'll see this happens frequently.  It's
 considered a Good Thing[tm].  It maintains a level of sanity among the
 community.

 -- 
 /Daniel P. Brown
 daniel.br...@parasane.net || danbr...@php.net
 http://www.parasane.net/ || http://www.pilotpig.net/
 Unadvertised dedicated server deals, too low to print - email me to find 
 out!

since when have the words 'sanity', and 'programmer' ever been used together 
outside of the setup for a joke?

Frank...still faithfully taking his pills. 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Switch statement Question

2009-02-02 Thread Frank Stanovcak

tedd tedd.sperl...@gmail.com wrote in message 
news:p06240801c5aa0ed7d...@[192.168.1.101]...
 At 4:16 PM +0100 1/30/09, Jochem Maas wrote:
tedd schreef:
  At 4:43 PM -0500 1/29/09, Frank Stanovcak wrote:
   

  yes...that is legal.  as long as the statment resolves to a boolean it
  will
  work.  It's not technically correct, but it does work.

  There you go again. What's technically correct?

hiya tedd,

you mean to ask not technically correct ... I plead
that it's his statement that is not technically correct.

1. php does a soft comparison ('==' rather than '===') so the
results of each case expression is auto-cast to a boolean
(in the case of switch'ing on TRUE), ergo there is no 'as long',
statements will always resolve to a boolean ... only they may not
do it in a way that is readily understood by everyone.

2. the php engine specifically allows for 'complex expression'
cases testing against a boolean switch value ... not best practice
according to some but very much technically correct according to
the php implementation.


 Good explanation -- I think the drum he's beating is that some of use the 
 switch without actually using the main expression within the control, such 
 as:

 switch($who_cares)
{
case $a = $b:
// do something
   break;
case $a  0:
 // do something else
   break;
case $a  0:
// do something elser
   break;
   }

 The control works.

 However to him, technically correct means:

 switch($a)
{
case 0:
// do something
   break;
case 1:
 // do something else
   break;
case 2:
// do something elser
   break;
   }

 That's what I think he's advocating.

 Cheers,

 tedd


 -- 
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com

very true since this is the way it is taught in every book.  Php, however, 
allows for other uses that weren't technically in the original plan for 
this command from other languages.  The problem is I shave my head, so I 
have no hairs to split over this one.  :)

Frank 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Blank page of hell..what to look for

2009-02-02 Thread Frank Stanovcak

Terion Miller webdev.ter...@gmail.com wrote in message 
news:37405f850902020902j624356ccp4ea869bc45161...@mail.gmail.com...
 Is there a certain thing that should be suspected and looked at first when
 getting the php blank page of hell
 I have errors on and nothing is being output anywhere to lead me in the
 right direction, I have a VariableReveal script (one of you provide and
 THANK YOU IT HAS BEEN A LIFESAVER) But it is doing nothing today, 
 yesterday
 the page worked today I get the blank page with not a clue in sight
 ARGH...
 Terion


I'm not sure what your setup is, but I get this frequently when testing on 
my windows server with IE

What I do to get the error is save a blank page over the one that is causing 
the problem.  Load it in the browser, then resave the probelem code, and 
refresh.  I almost always end up having left off a ; or } somewhere, and it 
just won't report it till I refresh like this.

Hope that helps.
Frank. 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] frameworks

2009-01-30 Thread Frank Stanovcak
Ok.  I've done some reading on frameworks for PHP now, and have this 
question.

What are some good resources for learning about the various frameworks 
available, and do you recomend one over another?  If so why?

I started using PHP before frameworks came into the picture, and then had to 
take my leave for a while.  I'm sure this information will also help others 
out there who are just learning the ropes as well. 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Switch statement Question

2009-01-29 Thread Frank Stanovcak

Alice Wei aj...@alumni.iu.edu wrote in message 
news:snt101-w587cd616331fc59b84834af0...@phx.gbl...

Hi,

  I have a code snippet here as in the following:

//Switch statements between the four options
switch($string) {
case :
$string= NOT book.author='All';
break;
default:
$string= $string . AND NOT book.author='All';
break;
}
  This code does work, but I am wondering if it is possible in the switch 
 statement clauses for me to do something like case does not equal to a 
 certain author name if I don't want $string with that content to be 
 processed. or, do I always use default in this case?

Thanks in advance.

Alice
_
All-in-one security and maintenance for your PC. Get a free 90-day trial!
http://www.windowsonecare.com/purchase/trial.aspx?sc_cid=wl_wlmail

You mean as in...

switch($string){
case :
code
break;

case $string == 'some value':
code
break;

case in_array($string, $somearray):
code
break;

default:
code
};

yes...that is legal.  as long as the statment resolves to a boolean it will 
work.  It's not technically correct, but it does work. 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] validating directory and file name with preg_match

2009-01-28 Thread Frank Stanovcak
I'm limiting access to certain proceedures based on the file trying to use 
them, and the directory they are located in on my server.  Right now I am 
using two preg_match statments as you will see.  What I want to know is 
this.  Is there a way to write a single regex for this that will supply the 
file name as a match, and only return if the directory is valid?


//make sure we are calling from the propper directory, and get the file name 
that included to determine
//database access needs
preg_match('#^C:Inetpubwwwrootfolder(entry|edit)(\w*\\.(php|pdf))#i',
 
$included_files[0], $check1);
preg_match('#^C:Inetpubwwwrootfolder(\w*\\.(php|pdf))#i', 
$included_files[0], $check2);
if(isset($check1)){
 if(is_array($check1)){
  $matches[4] = $check1[2];
 };
 unset($check1);
};
if(isset($check2)){
 if(is_array($check2)){
  $matches[4] = $check2[1];
 };
 unset($check2);
};
if(isset($matches[4]){
more code here
}; 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: validating directory and file name with preg_match

2009-01-28 Thread Frank Stanovcak

Frank Stanovcak blindspot...@comcast.net wrote in message 
news:a8.d6.08436.5cf80...@pb1.pair.com...
 I'm limiting access to certain proceedures based on the file trying to use 
 them, and the directory they are located in on my server.  Right now I am 
 using two preg_match statments as you will see.  What I want to know is 
 this.  Is there a way to write a single regex for this that will supply 
 the file name as a match, and only return if the directory is valid?

 
 //make sure we are calling from the propper directory, and get the file 
 name that included to determine
 //database access needs
 preg_match('#^C:Inetpubwwwrootfolder(entry|edit)(\w*\\.(php|pdf))#i',
  
 $included_files[0], $check1);
 preg_match('#^C:Inetpubwwwrootfolder(\w*\\.(php|pdf))#i', 
 $included_files[0], $check2);
 if(isset($check1)){
 if(is_array($check1)){
  $matches[4] = $check1[2];
 };
 unset($check1);
 };
 if(isset($check2)){
 if(is_array($check2)){
  $matches[4] = $check2[1];
 };
 unset($check2);
 };
 if(isset($matches[4]){
 more code here
 };


--Then Robyn Sed--
Looks like the difference between the 2 patterns is the
'(entry|edit)' part -- couldn't you make that optional and combine
it into one expression? Ie,  '((entry|edit))*'

As for returning the filename, basename() is your friend.

R
--end--

I would use basename, but I want only the two file types specified to 
trigger a return.  They are the only two valid php types on this server.

Your suggestion worked like a charm!  Thank you very much!

Frank 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: validating directory and file name with preg_match

2009-01-28 Thread Frank Stanovcak

Boyd, Todd M. tmbo...@ccis.edu wrote in message 
news:33bde0b2c17eef46acbe00537cf2a19003bb9...@exchcluster.ccis.edu...
 -Original Message-
 From: Frank Stanovcak [mailto:blindspot...@comcast.net]
 Sent: Wednesday, January 28, 2009 1:04 PM
 To: php-general@lists.php.net
 Subject: [PHP] Re: validating directory and file name with preg_match


 Frank Stanovcak blindspot...@comcast.net wrote in message
 news:a8.d6.08436.5cf80...@pb1.pair.com...
  I'm limiting access to certain proceedures based on the file trying
 to use
  them, and the directory they are located in on my server.  Right now
 I am
  using two preg_match statments as you will see.  What I want to know
 is
  this.  Is there a way to write a single regex for this that will
 supply
  the file name as a match, and only return if the directory is valid?
 
  
  //make sure we are calling from the propper directory, and get the
 file
  name that included to determine
  //database access needs
 

preg_match('#^C:Inetpubwwwrootfolder(entry|edit)(\w
 *\\.(php|pdf))#i',
  $included_files[0], $check1);
 

preg_match('#^C:Inetpubwwwrootfolder(\w*\\.(php|pdf))#i
 ',
  $included_files[0], $check2);
  if(isset($check1)){
  if(is_array($check1)){
   $matches[4] = $check1[2];
  };
  unset($check1);
  };
  if(isset($check2)){
  if(is_array($check2)){
   $matches[4] = $check2[1];
  };
  unset($check2);
  };
  if(isset($matches[4]){
  more code here
  };
 

 --Then Robyn Sed--
 Looks like the difference between the 2 patterns is the
 '(entry|edit)' part -- couldn't you make that optional and combine
 it into one expression? Ie,  '((entry|edit))*'

 As for returning the filename, basename() is your friend.

 R
 --end--

 I would use basename, but I want only the two file types specified to
 trigger a return.  They are the only two valid php types on this
 server.

 Your suggestion worked like a charm!  Thank you very much!

Upon reading this, I realize that I over-thought my suggestion.

/^c:\\inetpub\\wwwroot\\folder\\(?:entry|edit)\\(\w+\.(?:php|pdf))$/i

That's my final answer. :)


// Todd

Thank you too Todd.  I don't know why, but for some reason if I don't double 
escape the slashes it fails everytime.  I never knew you could stop the 
return with ?:  that will help a great deal in the future!

Frank 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: New to PHP question

2009-01-28 Thread Frank Stanovcak

Don Collier dcoll...@collierclan.com wrote in message 
news:4980ac7e.2080...@collierclan.com...
I am just learning PHP from the O'Reilly Learning PHP 5 book and I have a 
question regarding the formatting of text.  Actually it is a couple of 
questions.

 First, when I use the \n and run the script from the command line it works 
 great.  When I run the same code in a browser it does not put the newline 
 in and the text runs together.  I know that I can use br/ to do the same 
 thing, but why is it this way?

 The second question is closely related to the first.  When formatting text 
 using printf the padding works great when running from the command line 
 but not at all when in a browser.
 Here is the code that I am working with:

 ?php
 $hamburger = 4.95;
 $chocmilk = 1.95;
 $cola = .85;
 $subtotal = (2 * $hamburger) + $chocmilk + $cola;
 $tax = $subtotal * .075;
 $tip = $subtotal * .16;
 $total = $subtotal + $tip + $tax;
 print Welcome to Chez Don.\n;
 print Here is your receipt:\n;
 print \n;
 printf(%1d %9s \$%.2f\n, 2, 'Hamburger', ($hamburger * 2));
 printf(%1d %9s \$%.2f\n, 1, 'Milkshake', 1.95);
 printf(%1d %9s \$%.2f\n, 1, 'Soda', .85);
 printf(%25s: \$%.2f\n,'Subtotal', $subtotal);
 printf(%25s: \$%.2f\n, 'Tax', $tax);
 printf(%25s: \$%.2f\n, 'Tip', $tip);
 printf(%25s: \$%.2f\n, 'Total', $total);
 ?

 Thanks for the help everyone.

It has specifically to do with how the browser renders the page.  part of 
the spec for rendering is that newlines are ignored, and the only way to get 
a line to break in a browser window is with the use of br.  As for the 
padding this is the same issue.  In Browswer rendering all white space 
except the first one is ignored, and you have to use nbsp; for aditionall 
spaces.

ie: 3 space would be ' nbsp; ' or 'nbsp; nbsp;'

Hope that helps!

Frank. 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] New to PHP question

2009-01-28 Thread Frank Stanovcak

Don Collier dcoll...@collierclan.com wrote in message 
news:4980c3d3.8040...@collierclan.com...


 Paul M Foster wrote:
 See? This is what I'm talking about.

 *I* understand what you're saying, Don, and I agree. But this guy is
 just learning PHP from what is arguably not one of the best books on PHP
 (IMO). And you're throwing MVC at him. Let him master the subtleties of
 the language first, then we'll give him the MVC speech.

 Yes, I know, they should learn proper programming practices from the
 beginning, blah blah blah. But think back to the first programming
 language you ever learned, when you were first learning it. If someone
 had thrown stuff like this at you, would you have had a clue? I had
 enough trouble just learning the proper syntax and library routines for
 Dartmouth BASIC and Pascal, without having to deal with a lot of
 metaprogramming stuff.

 This is the problem when you get newbies asking questions on a list
 whose membership includes hardcore gurus. The gurus look at things in
 such a lofty way that answering simple questions at the level of a
 beginner sounds like a dissertation on the subtleties of Spanish art in
 the 1500s.

 Just my opinion.

 Paul

 On that note, what would be a better book to learn from?  I have always 
 been a fan of the O'Reilly books, but I am open to differing flavors of 
 kool-aid.  One can never have too many resources.


First of all...for **insert deities name here** sake don't drink the 
kool-aid!  I started with the visual series of books just to get the hang of 
the rudimentry language, and then went right to the online php manual.  www. 
devguru. com isn't bad, but tends to be a bit sparse on explinations.  If 
you are familliar with any programming language google is your friend.  php 
is pretty close to c for ease of refference so googling for like 'switch 
php' brings up loads of examples and refs.  I still don't know anything 
about this pear, or other frameworks they speak of on here, but I'm sure I 
will learn it in time.  :)

Personally I think French art from the 1500's was better any way.

Frank 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Make New-Age Money Online with Google

2009-01-27 Thread Frank Stanovcak

Martin Zvarík mzva...@gmail.com wrote in message 
news:66.93.12464.913ee...@pb1.pair.com...
 Ashley Sheridan napsal(a):
 On Sat, 2009-01-24 at 10:14 +0200, Dora Elless wrote:
 That's why I am sending this email only to people I know and care
 about.
 And they send to a mailing list. Come again?


 Ash
 www.ashleysheridan.co.uk


 The sad thing though is that there will be always people who believe this 
 shit and pays...

 Like my dad bought a little book Take off your glasses for $10 and he 
 received 2 papers saying: sun is our best friend, look right into it and 
 it will heal your eyes.
just like that little pile of plutonium in my back yard is great for warming 
your butt on...Have a seat!

ATTENTION SHORT SITED, HUMORLESS, MORONS IN THE GOVT...that should cover 
everyone...THIS IS A JOKE.  I DO NOT OWN...
1. A YARD
2. A HOUSE FOR THE YARD I DON'T OWN
3. ANY RADIOLOGICAL MATERIALS
4. A SINGLE FRICKING THING REALLY SINCE YOU TAX MOST OF IT OUT OF ME 
ALREADY!
 NOW GO FIND SOMETHING MORE USEFULL TO DO WITH ALL MY TAX DOLLARS!

frank. 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: New PHP User with a simple question

2009-01-27 Thread Frank Stanovcak

Paul M Foster pa...@quillandmouse.com wrote in message 
news:20090126222404.gc18...@quillandmouse.com...
 On Mon, Jan 19, 2009 at 04:45:08PM -0500, Christopher W wrote:

 Dear responders,

 I was not sure which post was the best to respond to all of you so I 
 chose
 the original.

 I wanted to thank you all for taking the time to try and help answer my
 question.  I truly appreciate it.

 For the record, I have a PHP book and I understand (I think) all the
 variables, functions, conditionals, loops, constants, etc. of PHP.  My
 problem, with no computer programming to speak of, was putting those
 variables, functions, conditionals, loops, constants, etc. together to 
 make
 it do things I was hoping to accomplish.  I am hoping that with reading 
 more
 tutorials, looking at other people's php files and lots of practicing I 
 may
 one day get it.

 I am truly grateful for all the time all of you spent in trying to help.

 Glad you found a solution (from Kevin).

 Don't worry about the sniping on the list. A lot of programmer types can
 get prickly with each other about details.

 Paul
 -- 
 Paul M. Foster

Paul...leave Ash alone. 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Get Money Fast with the Government Grants

2009-01-27 Thread Frank Stanovcak

Andrew Williams andrew4willi...@gmail.com wrote in message 
news:1adf0c280901270134o2f06d0f9kaf3fce2fb4b6c...@mail.gmail.com...
 Hi,
 Beware of he spam mailer so do not let them spam your money away.

 Andrew

 On Tue, Jan 27, 2009 at 9:18 AM, clive 
 clive_li...@immigrationunit.comwrote:

 Dora Gaskins wrote:

 If you have received this email, take a time to really read it 
 carefully!

 American Gov Money

 More spam, can't we have the maillist software require people to register
 before posting?


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




 -- 

 Best Wishes
 Andrew Williams
 ---
 31 Davies Street
 W1K 4LP, London, UK
 www.NetPosten.dk


OK peeps...who's machine has a cold?

Frank
fancy sig thing here 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Dirty Button

2009-01-26 Thread Frank Stanovcak

tedd tedd.sperl...@gmail.com wrote in message 
news:p06240802c5a28dd01...@[192.168.1.101]...
 At 3:41 PM -0600 1/25/09, Micah Gersten wrote:
tedd wrote:
  At 7:02 PM + 1/25/09, Ashley Sheridan wrote:
  Tedd, what about having it reset if you then go back and select the
  original option without submitting, i.e. you originally selected and
  submitted on A, then selected B, then selected A again?

  That's a good idea.

  Now I just have to figure out how to make it all-encompassing enough
  to handle one, or more, selection-control and compare current values
  with the values that were previously selected.

  Oh, the holes we dig for ourselves.  :-)

  Cheers,

  tedd

What about an onChange javascript function that checks all the boxes
that need input.  Call it whenever any of the inputs change and in the
onSubmit for the form, check it again.

 I currently use onClick for the select control and that works well enough. 
 It's not the trigger that's the issue.

 If I decide to do that, then I have to loop through all the tag ID's, get 
 the current values, and check them against what was presented. This just 
 requires some thinking and I'm about all thought-out for the moment -- the 
 end of another 12 hour day.

 Thanks for your input.

 Cheers,

 tedd

 -- 
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com

Getting the previously sellected is easy.  When php renders the page have 
them inserted as javascript vars.
Why not use an on change event that checks the value selected against the 
orig, and then depending on the selection starts a timer, say 5 - 15 sec. 
If the user does nothing else on any of the controls just resubmit for them. 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] can I do this without eval?

2009-01-22 Thread Frank Stanovcak
I'm trying to build a prepared statment and dynamically bind the variables 
to it since I use this on severaly different pages I didn't want to build a 
huge bind statement hard coded on each page and then have to maintain it 
every time there was a change.

I despise having to use eval() and was hoping one of you had stumbled upon 
this and found a better workaround for it.

I've seen references to call_user_function_array, but couldn't find a 
tutorial, or description that could make me understand how to use it.
I think the big problem with all of them was they expected me to know oop, 
and that is on my plate to learn after I finnish this project.


Frank


//initialize a variable to let us know this is the first time through on
//the SET construction
 $i = true;

//step through all the FILTERED values to build the SET statment
 foreach($FILTERED as $key=$value){

//make sure we single quote the string fields
  if($i){
   $sqlstring .=  $key = ?;
   $i = false;
  }else{
   $sqlstring .= , $key = ?;
  };

//build the list of variables to bound durring the mysqli prepared staments
  $params[] = \$FILTERED[' . $key . '];

//build the list of types for use durring the mysqli perepared statments
  switch($key){
  case in_array($key, $stringfields):
   $ptype[] = 's';
   break;

  case in_array($key, $doublefields):
   $ptype[] = 'd';
   break;

  default:
   $ptype[] = 'i';
  };
 };

//make sure we only update the row we are working on
 $sqlstring .= ' WHERE BoL=' . $FILTERED['BoL'];

//connect to the db
 include('c:\inetpub\security\connection.php');

//ok...let's do this query
//use mysqli so we can use a prepared statment and avoid sql insert attacks
 $stmt = mysqli_prepare($iuserConnect, $sqlstring);
 if(!$stmt){
  die(mysqli_stmt_error($stmt));
 };

//implode the two variables to be used in the mysqli bind statment so they 
are in
//the proper formats
 $params = implode(, , $params);
 $ptype = implode('', $ptype);

---
- is there a better way to accomplish this? -
---
//run an eval to build the mysqli bind statment with the string list of 
variables
//to be bound
 eval(\$check = mysqli_stmt_bind_param(\$stmt, '$ptype', $params););
 if(!$check){
  die(mysqli_stmt_error($stmt) . 'brbr');
 };
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Military - Standard times

2009-01-22 Thread Frank Stanovcak

Richard Heyes rich...@php.net wrote in message 
news:af8726440901220050i71d99bf7m5425620f67350...@mail.gmail.com...
 PS - I think the best ever name for a Exception class is 'Tantrum':

throw new Tantrum('Ra Ra Ra Aaaargh');

 Lol.

 -- 
 Richard Heyes

 HTML5 Graphing for Firefox, Chrome, Opera and Safari:
 http://www.rgraph.org (Updated January 17th)

I got tired of an app throwing errors about one line of code that needed to 
be the way it was so I set up an error handeling routine called 
just_f*ing_die() once. 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] can I do this without eval?

2009-01-22 Thread Frank Stanovcak

Nathan Nobbe quickshif...@gmail.com wrote in message 
news:7dd2dc0b0901221048g2f089cf9s36ecb9a5b35ab...@mail.gmail.com...
 On Thu, Jan 22, 2009 at 8:35 AM, Frank Stanovcak
 blindspot...@comcast.netwrote:

 I'm trying to build a prepared statment and dynamically bind the 
 variables
 to it since I use this on severaly different pages I didn't want to build 
 a
 huge bind statement hard coded on each page and then have to maintain it
 every time there was a change.

 I despise having to use eval() and was hoping one of you had stumbled 
 upon
 this and found a better workaround for it.

 I've seen references to call_user_function_array, but couldn't find a
 tutorial, or description that could make me understand how to use it.
 I think the big problem with all of them was they expected me to know 
 oop,
 and that is on my plate to learn after I finnish this project.


 Frank

 
 //initialize a variable to let us know this is the first time through on
 //the SET construction
  $i = true;

 //step through all the FILTERED values to build the SET statment
  foreach($FILTERED as $key=$value){

 //make sure we single quote the string fields
  if($i){
   $sqlstring .=  $key = ?;
   $i = false;
  }else{
   $sqlstring .= , $key = ?;
  };

 //build the list of variables to bound durring the mysqli prepared 
 staments
  $params[] = \$FILTERED[' . $key . '];

 //build the list of types for use durring the mysqli perepared statments
  switch($key){
  case in_array($key, $stringfields):
   $ptype[] = 's';
   break;

  case in_array($key, $doublefields):
   $ptype[] = 'd';
   break;

  default:
   $ptype[] = 'i';
  };
  };

 //make sure we only update the row we are working on
  $sqlstring .= ' WHERE BoL=' . $FILTERED['BoL'];

 //connect to the db
  include('c:\inetpub\security\connection.php');

 //ok...let's do this query
 //use mysqli so we can use a prepared statment and avoid sql insert 
 attacks
  $stmt = mysqli_prepare($iuserConnect, $sqlstring);
  if(!$stmt){
  die(mysqli_stmt_error($stmt));
  };

 //implode the two variables to be used in the mysqli bind statment so 
 they
 are in
 //the proper formats
  $params = implode(, , $params);
  $ptype = implode('', $ptype);

 ---
 - is there a better way to accomplish this? -
 ---
 //run an eval to build the mysqli bind statment with the string list of
 variables
 //to be bound
  eval(\$check = mysqli_stmt_bind_param(\$stmt, '$ptype', $params););
  if(!$check){
  die(mysqli_stmt_error($stmt) . 'brbr');
  };


 yeah, id try call_user_func_array(),

 omit the line to create a string out of the $params, then merge the later
 arguments into an array w/ the first 2 args

 #$params = implode(, , $params);
 $check = call_user_func_array('mysqli_stmt_bind_param',
 array_merge(array($stmt, $ptype), $params));

 something like that i think should do the trick.

 -nathan


Thanks Nathan!
Just to make sure I understand call_user_func_array, and how it opperates.
It's first paramer is the name of the function...any function, which is part 
of what made it so confusing to me...and the second paramter is an array 
that will be used to populate the the parameters of the called function as a 
comma seperated list.

Please tell me if I got any of that wrong.  This is how I learn!

Frank 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] can I do this without eval?[RESOLVED]

2009-01-22 Thread Frank Stanovcak

Nathan Nobbe quickshif...@gmail.com wrote in message 
news:7dd2dc0b0901221048g2f089cf9s36ecb9a5b35ab...@mail.gmail.com...

 yeah, id try call_user_func_array(),

 omit the line to create a string out of the $params, then merge the later
 arguments into an array w/ the first 2 args

 #$params = implode(, , $params);
 $check = call_user_func_array('mysqli_stmt_bind_param',
 array_merge(array($stmt, $ptype), $params));

 something like that i think should do the trick.

 -nathan


Ok.  I only had to make minimal chnages to the offered 
solution...highlighted below...I would still appreciate anyone letting me 
know if my understanding of call_user_func_array() is incorrect though. :) 
Thanks everyone!

Frank


//put the string fields directly in as we will be preparing the sql statment
//and that will protect us from injection attempts
if($continue){
 foreach($stringfields as $value){
  $FILTERED[$value] = $_POST[$value];
 };
};

//ok...we've made it this far, so let's start building that update query!
$vartype = '';
if($continue){

//start building the SQL statement to update the bol table
 $sqlstring = UPDATE bol SET;

//initialize a variable to let us know this is the first time through on
//the SET construction
 $i = true;

//step through all the FILTERED values to build the SET statment
//and accompanying bind statment
 foreach($FILTERED as $key=$value){

//make sure we don't put a comma in the first time through
  if($i){
   $sqlstring .=  $key = ?;
   $i = false;
  }else{
   $sqlstring .= , $key = ?;
  };

//build the list of types for use durring the mysqli perepared statments
  switch($key){
  case in_array($key, $stringfields):
   $ptype[] = 's';
   break;

  case in_array($key, $doublefields):
   $ptype[] = 'd';
   break;

  default:
   $ptype[] = 'i';
  };
 };

//make sure we only update the row we are working on
 $sqlstring .= ' WHERE BoL=' . $FILTERED['BoL'];

//connect to the db
 include('c:\inetpub\security\connection.php');

//ok...let's do this query
//use mysqli so we can use a prepared statment and avoid sql insert attacks
 $stmt = mysqli_prepare($iuserConnect, $sqlstring);
 if(!$stmt){
  die(mysqli_stmt_error($stmt));
 };

//implode the field types so that we have a useable string for the bind
 $ptype = implode('', $ptype);


- I completely did away with the $param and inserted --
- $FILTERED directly and everything worked great! --


//bind the variables using a call to call_user_func_array to put all the
//$FILTERED variables in
 $check = call_user_func_array('mysqli_stmt_bind_param', 
array_merge(array($stmt, $ptype), $FILTERED));
 if(!$check){
  die(mysqli_stmt_error($stmt) . 'brbr');
 }; 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: developers life

2009-01-20 Thread Frank Stanovcak

Nathan Rixham nrix...@gmail.com wrote in message 
news:32.be.60519.170f4...@pb1.pair.com...
 well just for the hell of it; and because I'm feeling worn..

 anybody else find the following true when you're a developer?

 - frequent bursts of side-tracking onto more interesting subjects
 - vast amount of inhuman focus, followed by inability to remain focussed
 - general tendancy to keep taking on projects, often for no good reason
 - inability to flip out of work mode at 5pm like the rest of the world
 -- [sub] not feeling normal unless worked you've extra; while other 
 professions demand overtime as little as an extra 15 minutes
 - constant learning (positive thing)
 - unlimited skill scope, if its on a computer you'll give it a go
 - amazing ability to prioritise (the wrong things)
 - all projects suddenly become uninteresting and all motivation is lost at 
 approx 65-85 percent completion
 - the code seems more important than the app (even though its not)
 - lots more but lost interest / focus

 ps:
 expectantly installed windows 7 over the weekend, brief moment of 
 excitement coupled with the thought i wonder what it's like; anticlimax 
 + reality check, it was just a taskbar, start menu and desktop.. you'd 
 think I'd know by now.

 regards :-)

 i so have more important things to do

I have this to say re:win 7
http://xkcd.com/528/ 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] developers life

2009-01-20 Thread Frank Stanovcak

Robert Cummings rob...@interjinn.com wrote in message 
news:1232447313.30838.5.ca...@localhost...
 On Mon, 2009-01-19 at 22:06 +, Nathan Rixham wrote:
 Robert Cummings wrote:
  On Mon, 2009-01-19 at 21:53 +, Nathan Rixham wrote:
 
  Robert Cummings wrote:
 
  On Mon, 2009-01-19 at 21:28 +, Nathan Rixham wrote:
 
  well just for the hell of it; and because I'm feeling worn..
 
  anybody else find the following true when you're a developer?
 
  - frequent bursts of side-tracking onto more interesting subjects
  - vast amount of inhuman focus, followed by inability to remain 
  focussed
  - general tendancy to keep taking on projects, often for no good 
  reason
  - inability to flip out of work mode at 5pm like the rest of the 
  world
  -- [sub] not feeling normal unless worked you've extra; while other
  professions demand overtime as little as an extra 15 minutes
  - constant learning (positive thing)
  - unlimited skill scope, if its on a computer you'll give it a go
  - amazing ability to prioritise (the wrong things)
  - all projects suddenly become uninteresting and all motivation is 
  lost
  at approx 65-85 percent completion
  - the code seems more important than the app (even though its not)
  - lots more but lost interest / focus
 
  Are you an INTP?
 
  http://www.personalitytest.net/cgi-bin/q.pl
 
 
  thanks for that rob, but predicatably I've got to number 26 and 
  stopped
  - penetrating insight, lol
 
 
  Then your not INTP enough :) An INTP would want to know.
 
  Cheers,
  Rob.
 
 and finished in 3 sessions: Your personality type is INTP shock

 *lol* There ya go!

 Cheers,
 Rob.
 -- 
 http://www.interjinn.com
 Application and Templating Framework for PHP

huh...I ended up INFP

Frank --realizes he's not like the cool kids. 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Client/Server Printing

2009-01-20 Thread Frank Stanovcak
Paul M Foster pa...@quillandmouse.com wrote in message
news:20090120151606.gu18...@quillandmouse.com...
 I'd like a side check on what I'm doing to print on our internal
 network.

 We have an internal server/site which uses PHP code I've written to
 run the business-- invoicing, A/P, inventory, etc. Some things, like
 invoices and reports, need to be printed. Now remember, the code is on
 the server, and we access it from our client machines on our desks. When
 we print, we do so to our local printers, attached to the client
 machines.

 So the best way I could think of to making printing work was to generate
 PDFs of whatever needs to be printed, dump the PDF on the server, and
 provide a link to the PDF on the web page. The user clicks on the
 generated PDF, and his/her browser opens up Acrobat or xpdf, and prints
 from that application to their local machine.

 Is that a reasonable way to implement this? Any better ideas?

 Paul

 -- 
 Paul M. Foster

I'm using fpdf to generate a pdf that is
displayed in a seperate window for review prior to printing...sort of like a
print preveiw.  If you can set the webserver to process .pdf files through
php it will display in the adobe reader plug in and all the client has to do
is hit print.

www. fpdf .com

Frank








-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Security question

2009-01-15 Thread Frank Stanovcak

VamVan vamsee...@gmail.com wrote in message 
news:12eb8b030901141421u6741b943q396bc784136b7...@mail.gmail.com...
 On Wed, Jan 14, 2009 at 2:22 PM, Frank Stanovcak
 blindspot...@comcast.netwrote:

 This is mostly to make sure I understand how sessions are handled
 correctly.
 As far as sessions are concerned the variable data is stored on the 
 server
 (be it in memory or temp files), and never transmitted accross the net
 unless output to the page?  So this means I should be able to store the
 username and password for a program in session vars for quick 
 validations,
 and if I force rentry of the password for sensitive areas (every time) 
 even
 if someone mannages to spoof the sesid all they will have access to is 
 non
 sensitive areas?  This also assumes I, at least, quick validate at the
 start
 of every page immideately after starting the session.



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 Password should never be stored anywhere in clear text. You can store md5
 version in session or database. As long as password is encrypted ure fine
 and safe.

 Thanks,
 V


Thanks V
So if I store the hash in the db, and in the session var then I should be 
resonably safe provided I salt the hash prior to storing it? 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Quotes in querys

2009-01-14 Thread Frank Stanovcak
Ashley Sheridan a...@ashleysheridan.co.uk wrote in message 
news:1231962521.3613.13.ca...@localhost.localdomain...
 On Wed, 2009-01-14 at 11:17 -0500, MikeP wrote:
 Hello,
 I am trying to get the following to work:
 Select Netid from Users where Netid = '$_SESSION[phpCAS][user]'
 Netid is a string type.
 No matter where of if I put the quotes, I still get array[phpCAS] not the
 value.
 If there is anything I still have trouble with after all these years its
 quoting variables.
 Help?
 Thanks
 Mike



 I always go with this:

 Select Netid from Users where Netid = '{$_SESSION[phpCAS][user]}'

 The curly braces allow PHP to use the full variable you intended. Note
 that you may need single quote marks around the text in each square
 bracket block or PHP my give you a warning about an unintended string
 literal.


 Ash
 www.ashleysheridan.co.uk


even though it might have it's drawbacks I've never had a problem with 
concat for sql statements.

$sqlstmt = Select Netid from Users where Netid = ' . 
$_SESSION['phpCAS']['user']} . ';


Frank



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Security question

2009-01-14 Thread Frank Stanovcak
This is mostly to make sure I understand how sessions are handled correctly. 
As far as sessions are concerned the variable data is stored on the server 
(be it in memory or temp files), and never transmitted accross the net 
unless output to the page?  So this means I should be able to store the 
username and password for a program in session vars for quick validations, 
and if I force rentry of the password for sensitive areas (every time) even 
if someone mannages to spoof the sesid all they will have access to is non 
sensitive areas?  This also assumes I, at least, quick validate at the start 
of every page immideately after starting the session. 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] php session GC error

2009-01-13 Thread Frank Stanovcak
I'm trying to make sure that my sessions are timed out by my server.
I'm running it on winxp, and my php.ini contains the following

session.gc_probability = 1
session.gc_divisor = 1

; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
session.gc_maxlifetime = 30

I am now getting this error

PHP Notice: session_start() [function.session-start]: ps_files_cleanup_dir: 
opendir(C:\WINDOWS\TEMP\) failed: No such file or directory (2) in 
C:\Inetpub\wwwroot\Envelope1\edit\EditMain.php on line 2

What do I have to do to make this work right?

Frank 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: php session GC error

2009-01-13 Thread Frank Stanovcak

Shawn McKenzie nos...@mckenzies.net wrote in message 
news:f8.ef.24097.e510d...@pb1.pair.com...
 Frank Stanovcak wrote:
 I'm trying to make sure that my sessions are timed out by my server.
 I'm running it on winxp, and my php.ini contains the following

 session.gc_probability = 1
 session.gc_divisor = 1

 ; After this number of seconds, stored data will be seen as 'garbage' and
 ; cleaned up by the garbage collection process.
 session.gc_maxlifetime = 30

 I am now getting this error

 PHP Notice: session_start() [function.session-start]: 
 ps_files_cleanup_dir:
 opendir(C:\WINDOWS\TEMP\) failed: No such file or directory (2) in
 C:\Inetpub\wwwroot\Envelope1\edit\EditMain.php on line 2

 What do I have to do to make this work right?

 Frank



 Does C:\WINDOWS\TEMP\ exist?

 -- 
 Thanks!
 -Shawn
 http://www.spidean.com
Yes it does, well C:\Windows\Temp does, but win isn't case sensitive...does 
it matter to PHP? 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: php session GC error

2009-01-13 Thread Frank Stanovcak

Nathan Rixham nrix...@gmail.com wrote in message 
news:496d03d3.2060...@gmail.com...
 Frank Stanovcak wrote:
 Shawn McKenzie nos...@mckenzies.net wrote in message 
 news:f8.ef.24097.e510d...@pb1.pair.com...
 Frank Stanovcak wrote:
 I'm trying to make sure that my sessions are timed out by my server.
 I'm running it on winxp, and my php.ini contains the following

 session.gc_probability = 1
 session.gc_divisor = 1

 ; After this number of seconds, stored data will be seen as 'garbage' 
 and
 ; cleaned up by the garbage collection process.
 session.gc_maxlifetime = 30

 I am now getting this error

 PHP Notice: session_start() [function.session-start]: 
 ps_files_cleanup_dir:
 opendir(C:\WINDOWS\TEMP\) failed: No such file or directory (2) in
 C:\Inetpub\wwwroot\Envelope1\edit\EditMain.php on line 2

 What do I have to do to make this work right?

 Frank


 Does C:\WINDOWS\TEMP\ exist?

 -- 
 Thanks!
 -Shawn
 http://www.spidean.com
 Yes it does, well C:\Windows\Temp does, but win isn't case 
 sensitive...does it matter to PHP?

 try changing it to the correct case then come back and tell us if case 
 matters? :)
ok...let me try it like this.

how do I explicitly tell PHP in the ini what directory to use for session 
storage and cleanup.  I've been googling for about an hour now, and am just 
getting more frustrated.  :(

The server is a single purpose server, and it will remain that way, so I 
don't want to have to code ini settings into each page.  :)

Frank 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: php session GC error

2009-01-13 Thread Frank Stanovcak

Shawn McKenzie nos...@mckenzies.net wrote in message 
news:e3.00.25553.8560d...@pb1.pair.com...
 Frank Stanovcak wrote:
 Nathan Rixham nrix...@gmail.com wrote in message
 news:496d03d3.2060...@gmail.com...
 Frank Stanovcak wrote:
 Shawn McKenzie nos...@mckenzies.net wrote in message
 news:f8.ef.24097.e510d...@pb1.pair.com...
 Frank Stanovcak wrote:
 I'm trying to make sure that my sessions are timed out by my server.
 I'm running it on winxp, and my php.ini contains the following

 session.gc_probability = 1
 session.gc_divisor = 1

 ; After this number of seconds, stored data will be seen as 'garbage'
 and
 ; cleaned up by the garbage collection process.
 session.gc_maxlifetime = 30

 I am now getting this error

 PHP Notice: session_start() [function.session-start]:
 ps_files_cleanup_dir:
 opendir(C:\WINDOWS\TEMP\) failed: No such file or directory (2) in
 C:\Inetpub\wwwroot\Envelope1\edit\EditMain.php on line 2

 What do I have to do to make this work right?

 Frank


 Does C:\WINDOWS\TEMP\ exist?

 -- 
 Thanks!
 -Shawn
 http://www.spidean.com
 Yes it does, well C:\Windows\Temp does, but win isn't case
 sensitive...does it matter to PHP?
 try changing it to the correct case then come back and tell us if case
 matters? :)
 ok...let me try it like this.

 how do I explicitly tell PHP in the ini what directory to use for session
 storage and cleanup.  I've been googling for about an hour now, and am 
 just
 getting more frustrated.  :(

 The server is a single purpose server, and it will remain that way, so I
 don't want to have to code ini settings into each page.  :)

 Frank


 Should be session.save_path, but check phpinfo() to see what it's using.
 Should be the path in the error.

 -- 
 Thanks!
 -Shawn
 http://www.spidean.com

So if my ini looks like the following I should be able to get rid of any 
session data after a preset timelimit?

session.save_path = C:\temp

; Whether to use cookies.
session.use_cookies = 1

;session.cookie_secure =

; This option enables administrators to make their users invulnerable to
; attacks which involve passing session ids in URLs; defaults to 0.
; session.use_only_cookies = 1

; Name of the session (used as cookie name).
session.name = PHPSESSID

; Initialize session on request startup.
session.auto_start = 0

; Lifetime in seconds of cookie or, if 0, until browser is restarted.
session.cookie_lifetime = 0

; The path for which the cookie is valid.
session.cookie_path = /

; The domain for which the cookie is valid.
session.cookie_domain =

; Whether or not to add the httpOnly flag to the cookie, which makes it 
inaccessible to browser scripting languages such as JavaScript.
session.cookie_httponly =

; Handler used to serialize data.  php is the standard serializer of PHP.
session.serialize_handler = php

; Define the probability that the 'garbage collection' process is started
; on every session initialization.
; The probability is calculated by using gc_probability/gc_divisor,
; e.g. 1/100 means there is a 1% chance that the GC process starts
; on each request.

session.gc_probability = 1
session.gc_divisor = 1

; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
session.gc_maxlifetime = 30 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: php session GC error

2009-01-13 Thread Frank Stanovcak
So from everything I've read there is no real way to assure a session 
timeout with out timestamping it myself and dealing with it in code by doing 
a time compare.

bummer.


Frank Stanovcak blindspot...@comcast.net wrote in message 
news:57.31.25553.de80d...@pb1.pair.com...

 Shawn McKenzie nos...@mckenzies.net wrote in message 
 news:e3.00.25553.8560d...@pb1.pair.com...
 Frank Stanovcak wrote:
 Nathan Rixham nrix...@gmail.com wrote in message
 news:496d03d3.2060...@gmail.com...
 Frank Stanovcak wrote:
 Shawn McKenzie nos...@mckenzies.net wrote in message
 news:f8.ef.24097.e510d...@pb1.pair.com...
 Frank Stanovcak wrote:
 I'm trying to make sure that my sessions are timed out by my server.
 I'm running it on winxp, and my php.ini contains the following

 session.gc_probability = 1
 session.gc_divisor = 1

 ; After this number of seconds, stored data will be seen as 
 'garbage'
 and
 ; cleaned up by the garbage collection process.
 session.gc_maxlifetime = 30

 I am now getting this error

 PHP Notice: session_start() [function.session-start]:
 ps_files_cleanup_dir:
 opendir(C:\WINDOWS\TEMP\) failed: No such file or directory (2) in
 C:\Inetpub\wwwroot\Envelope1\edit\EditMain.php on line 2

 What do I have to do to make this work right?

 Frank


 Does C:\WINDOWS\TEMP\ exist?

 -- 
 Thanks!
 -Shawn
 http://www.spidean.com
 Yes it does, well C:\Windows\Temp does, but win isn't case
 sensitive...does it matter to PHP?
 try changing it to the correct case then come back and tell us if case
 matters? :)
 ok...let me try it like this.

 how do I explicitly tell PHP in the ini what directory to use for 
 session
 storage and cleanup.  I've been googling for about an hour now, and am 
 just
 getting more frustrated.  :(

 The server is a single purpose server, and it will remain that way, so I
 don't want to have to code ini settings into each page.  :)

 Frank


 Should be session.save_path, but check phpinfo() to see what it's using.
 Should be the path in the error.

 -- 
 Thanks!
 -Shawn
 http://www.spidean.com

 So if my ini looks like the following I should be able to get rid of any 
 session data after a preset timelimit?

 session.save_path = C:\temp

 ; Whether to use cookies.
 session.use_cookies = 1

 ;session.cookie_secure =

 ; This option enables administrators to make their users invulnerable to
 ; attacks which involve passing session ids in URLs; defaults to 0.
 ; session.use_only_cookies = 1

 ; Name of the session (used as cookie name).
 session.name = PHPSESSID

 ; Initialize session on request startup.
 session.auto_start = 0

 ; Lifetime in seconds of cookie or, if 0, until browser is restarted.
 session.cookie_lifetime = 0

 ; The path for which the cookie is valid.
 session.cookie_path = /

 ; The domain for which the cookie is valid.
 session.cookie_domain =

 ; Whether or not to add the httpOnly flag to the cookie, which makes it 
 inaccessible to browser scripting languages such as JavaScript.
 session.cookie_httponly =

 ; Handler used to serialize data.  php is the standard serializer of PHP.
 session.serialize_handler = php

 ; Define the probability that the 'garbage collection' process is started
 ; on every session initialization.
 ; The probability is calculated by using gc_probability/gc_divisor,
 ; e.g. 1/100 means there is a 1% chance that the GC process starts
 ; on each request.

 session.gc_probability = 1
 session.gc_divisor = 1

 ; After this number of seconds, stored data will be seen as 'garbage' and
 ; cleaned up by the garbage collection process.
 session.gc_maxlifetime = 30
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Couple of beginner questions

2009-01-12 Thread Frank Stanovcak

Ashley Sheridan  wrote in message 
news:1231681793.3527.2.ca...@localhost.localdomain...
 On Sun, 2009-01-11 at 08:08 -0500, tedd wrote:
 At 4:16 PM -0500 1/10/09, Paul M Foster wrote:
 And let me present an alternative perspective. Never do something like:
 
 ?php echo 'Hellow world'; ?
 
 Let Apache (or whatever) interpret HTML as HTML, and don't make it
 interpret PHP code as HTML.
 
 Instead, do:
 
 h1Hello world/h1
 
 If you're going to use PHP in the middle of a bunch of HTML, then only
 use it where it's needed:
 
 h1Hello ?php echo $name; ?/h1
 
 The contents of the PHP $name variable can't be seen by the HTML, which
 is why you need to enclose it in a little PHP island. Naturally, if
 you're going to put PHP code in the middle of a HTML page, make the
 extension PHP. Otherwise, Apache will not interpret the PHP code as PHP
 (unless you do some messing with .htaccess or whatever). It's just
 simplest to call a file something.php if it has PHP in it.
 
 Paul
 --
 Paul M. Foster

 Paul:

 I agree with you. My example was not well thought out. My point was
 not to mix style elements with data. I should have said:

 I would consider the followingbad practice:

   ?php echo(h1$whatever/h1); ?

 Whereas, the following I would consider good practice.

 h1?php echo($whatever); ?/h1

 Thanks for keeping me honest.

 Cheers,

 tedd


 -- 
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com

 Unless it's something like this:

 ?php
 echo h1 class=\$headerClass\$whatever/h1;
 ?

 Which is unlikely for a header tag, but I know this sort of format gets
 used a lot by me and others, especially for setting alternate row styles
 on tables (damn browsers and not supporting alternate rows!)


 Ash
 www.ashleysheridan.co.uk


Hey Ash...Why don't you just use CSS subclassing?

style type=text/css
h1.odd {class stuff here}
h1.even {class stuff here}
/style

then

h1 class=odd?php echo $whatever; ?/h1

no escaping, and no need to php your css styles.  :)

Frank 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] switch vs elseif

2009-01-12 Thread Frank Stanovcak
I've googled, and found some confusing answers.
I've tried searching the history of the news group, and only found info on 
switch or elseif seperately.  :(

Strictly from a performance stand point, not preference or anything else, is 
there a benefit of one over the other?


for($i=0;$i3;$i++){
switch($i){
case 0:
header pg1 code
break;
case 1:
header pg2 code
break;
case 3:
header pg3 code
break;
};
};


or would that be better served using an if...elseif structure?

Frank 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] switch vs elseif

2009-01-12 Thread Frank Stanovcak
I've googled, and found some confusing answers.
I've tried searching the history of the news group, and only found info on
switch or elseif seperately.  :(

Strictly from a performance stand point, not preference or anything else, is
there a benefit of one over the other?


for($i=0;$i3;$i++){
switch($i){
case 0:
header pg1 code
break;
case 1:
header pg2 code
break;
case 3:
header pg3 code
break;
};
};


or would that be better served using an if...elseif structure?

Frank




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] switch vs elseif

2009-01-12 Thread Frank Stanovcak

Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
news:1231793310.3558.55.ca...@localhost.localdomain...
 On Mon, 2009-01-12 at 15:15 -0500, Frank Stanovcak wrote:
 I've googled, and found some confusing answers.
 I've tried searching the history of the news group, and only found info
 on
 switch or elseif seperately.  :(

 Strictly from a performance stand point, not preference or anything else,
 is
 there a benefit of one over the other?


 for($i=0;$i3;$i++){
 switch($i){
 case 0:
 header pg1 code
 break;
 case 1:
 header pg2 code
 break;
 case 3:
 header pg3 code
 break;
 };
 };


 or would that be better served using an if...elseif structure?

 Frank



 And a switch is a lot neater for dealing with these sorts of things. I
 tend never to use if...elseif's at all, and use switches. Like Rob said,
 you can fall into further cases below, and it's very simple to add more
 at a later date. There is one place where an if...elseif would work and
 a switch could not, and that is where you were performing lots of
 different logic tests on different variables. Aside from that, I think
 any speed benefit one would have over the other would be marginal.


 Ash
 www.ashleysheridan.co.uk


Yeah, I knew about the fall through benefit.  :)  I was just worried about
speed since I have to loop through this several times and generate a pdf
from it.  Thanks folks!

Frank




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] switch vs elseif

2009-01-12 Thread Frank Stanovcak

Eric Butera eric.but...@gmail.com wrote in message 
news:6a8639eb0901121231r253eed48xe1974d8ef44ab...@mail.gmail.com...
 On Mon, Jan 12, 2009 at 3:15 PM, Frank Stanovcak
 blindspot...@comcast.net wrote:
 I've googled, and found some confusing answers.
 I've tried searching the history of the news group, and only found info 
 on
 switch or elseif seperately.  :(

 Strictly from a performance stand point, not preference or anything else, 
 is
 there a benefit of one over the other?


 for($i=0;$i3;$i++){
switch($i){
case 0:
header pg1 code
break;
case 1:
header pg2 code
break;
case 3:
header pg3 code
break;
};
 };


 or would that be better served using an if...elseif structure?

 Frank



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



 This might be of interest in answering your question:

 http://www.suspekt.org/switchtable/

Wow...so if I read that right.  the only difference in the root code of PHP 
is that the pre compiled code is easier to read.  PHP actually generates the 
If...elseif...elseif... structure any way when it compiles the script.

ewww.

Frank. 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] variable probe revision

2009-01-12 Thread Frank Stanovcak
I posted this once before, and then tried to use it multiple times in a 
script.  As you can guess I got a bunch of func already defined errors.

Here is a revision incase anyone decided to use it that will work multiple 
times in the same script for variable watching.

---Code follows---
?php
if(!function_exists(breakarray)){
 function breakarray($passed){
  echo 'table border=1trthkey/ththvalue/th/tr';
  foreach($passed as $tkey=$tvalue){
   echo 'trtd[' , $tkey , ']/tdtd';
   if(is_array($tvalue)){
if(sizeof($tvalue)  0){
 breakarray($tvalue);
 echo '/td/tr';
}else{
 echo '' , $tvalue , '/td/tr';
};
   }else{
echo 'EMPTY /td/tr';
   };
  };
  echo '/table';
 };
};

echo 'table border=1tr thvariable/th thvalue/th /tr';
foreach(get_defined_vars() as $key = $value){
 echo 'trtd$',$key ,'/tdtd';
if(is_array($value) and $key != 'GLOBALS'){
  if(sizeof($value)  0){
   breakarray($value);
   echo '/td/tr';
  }else{
   echo 'EMPTY /td/tr';
  };
 }else{
  echo '' , $value , '/td/tr';
 };
};
echo '/table';
? 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] variable probe revision

2009-01-12 Thread Frank Stanovcak

Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
news:1231796437.3558.62.ca...@localhost.localdomain...
 On Mon, 2009-01-12 at 16:11 -0500, Frank Stanovcak wrote:
 I posted this once before, and then tried to use it multiple times in a
 script.  As you can guess I got a bunch of func already defined errors.

 Here is a revision incase anyone decided to use it that will work
 multiple
 times in the same script for variable watching.

 ---Code follows---
 ?php
 if(!function_exists(breakarray)){
  function breakarray($passed){
   echo 'table border=1trthkey/ththvalue/th/tr';
   foreach($passed as $tkey=$tvalue){
echo 'trtd[' , $tkey , ']/tdtd';
if(is_array($tvalue)){
 if(sizeof($tvalue)  0){
  breakarray($tvalue);
  echo '/td/tr';
 }else{
  echo '' , $tvalue , '/td/tr';
 };
}else{
 echo 'EMPTY /td/tr';
};
   };
   echo '/table';
  };
 };

 echo 'table border=1tr thvariable/th thvalue/th /tr';
 foreach(get_defined_vars() as $key = $value){
  echo 'trtd$',$key ,'/tdtd';
 if(is_array($value) and $key != 'GLOBALS'){
   if(sizeof($value)  0){
breakarray($value);
echo '/td/tr';
   }else{
echo 'EMPTY /td/tr';
   };
  }else{
   echo '' , $value , '/td/tr';
  };
 };
 echo '/table';
 ?



 Why not put the function in a functions include and use a require_once()
 on it?


 Ash
 www.ashleysheridan.co.uk


You could do that, but I prefer to just keep one file in my root, and call
it when I need it.  It's not meant to stay there as it's only for bug
hunting purposes.

It's a preference thing I guess.

Frank.




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] variable probe revision

2009-01-12 Thread Frank Stanovcak

Chris dmag...@gmail.com wrote in message
news:496bbd52.2080...@gmail.com...
 Frank Stanovcak wrote:
 I posted this once before, and then tried to use it multiple times in a
 script.  As you can guess I got a bunch of func already defined errors.

 Here is a revision incase anyone decided to use it that will work
 multiple times in the same script for variable watching.

 ---Code follows---
 ?php
 if(!function_exists(breakarray)){

 that needs to be quoted:

 if (!function_exists('breakarray')) {

 otherwise php will generate an E_NOTICE (I think) looking for a constant
 called breakarray.

 You do have error_reporting(E_ALL); set yeh?

 -- 
 Postgresql  php tutorials
 http://www.designmagick.com/


Yep, and thanks!





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] First steps towards unix and php

2009-01-09 Thread Frank Stanovcak
*bangs head on wall*

Great...just what I need.  More acronyms.  :P


Frank
Paul Scott psc...@uwc.ac.za wrote in message 
news:1231506224.7389.7.ca...@paul-laptop...

 On Fri, 2009-01-09 at 14:53 +0200, Paul Scott wrote:
 First choice is ./configure  make  make install, second choice is
 apt


 Even better, of course, is the:

 Yo sysadmin intern! Install package for me please and don't screw it
 up

 -- Paul







 All Email originating from UWC is covered by disclaimer
 http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Couple of beginner questions

2009-01-09 Thread Frank Stanovcak

VamVan vamsee...@gmail.com wrote in message 
news:12eb8b030901091135u4e17f1f3p24698dbc8f5a2...@mail.gmail.com...

 -- Remember as you re still a beginner try to avoid using ? at the end of
 complete PHP code page. or else if you have empty lines at the end of the
 file then you wont see blank page of death in PHP.


I never knew this.  Could this be why I get 401 errors if a page throws an 
error with out a successful run first?

as in if I load up the page and there is an error I get 401, but if I upload 
a blank file with the same name, load that, then upload the errant code and 
refresh I can suddenly see an error?

Frank 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Because you guys/gals/girls/women/insert pc term hereare a smart lot

2009-01-08 Thread Frank Stanovcak
And people tell me that I'm just wrong.

Nathan Rixham nrix...@gmail.com wrote in message 
news:4965dffc.6020...@gmail.com...
 Robert Cummings wrote:
 On Thu, 2009-01-08 at 10:51 +, Richard Heyes wrote:
 until you have to dump it, zip it, ssh it over to another box and then
 import it back in
 That's what fag breaks are for... :-) Well, that and smoking.

 So... when you're forgetful... have you ever had to bum a fag?


 yup, and had my fags bummed, but never my bum fagged - thank god 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] First steps towards unix and php

2009-01-08 Thread Frank Stanovcak
I've been a microshaft punk for some time now, and am just getting ready to 
try to step over to unix on one of my own boxes.

Does anyone have any suggestions on which flavor would be a good idea to 
start with?  I'm looking mostly for compatibility with php, mysql, and other 
web based programming languages.

Thanks in advance!

Frank 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [SOLVED] Re: can a session be used in a query?

2009-01-08 Thread Frank Stanovcak
if you want to know what is happening...I just did the research...the while
statment runs untill the condition is false.  This means that, this your 
case,
$row = false.  We were getting results in the loop becuase that never
happened while it was looping, but to end the loop it proccessed $row =
false and then quit setting $row = for the rest of the program.

if you are expecting more than one row as a result set you may want to think
about outputing the result to an array like this

while ($row = mysql_fetch_array($result)){
 echo $row['AddEditAdmin']; //to print out the value of column
'var1' for each record
$rowset[] = $row;
   }
   }else{
  echo 'No records found.';
}

this will give you a zero enum array of all the returned records.
they could be accessed with $rowset[n][column name] anywhere in the code.

Hope that helps!  I know I learned from it.

Frank

tedd tedd.sperl...@gmail.com wrote in message 
news:p06240806c58be7e24...@[192.168.1.101]...
 Terion Miller wrote:

SOLVED: Thanks everyone I got it working it was the loop...took it out and
now it works like a charm!! Is there a way to mark things solved?

 Normally, when one post [SOLVED] in the subject line, the post also 
 provides the solution.

 As it is now, a person with a similar problem would have to read the 
 entire thread to figure out what you did to solve the problem you faced. 
 They would have to figure out what you meant when you said ...took it out 
 and now it works like a charm!! ?

 Would it not be easier just to post the corrected code?

 If possible, always put back more than you take.

 Cheers,

 tedd

 -- 
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: can a session be used in a query?

2009-01-07 Thread Frank Stanovcak
I'm working in the same kind of environment.

Make sure you are single quoting string data in MySQL

as in

$query = SELECT * FROM admin WHERE UserName = ' . $_SESSION['user'] . ' 
;

Thats a single quote, double quote, dot, session var, dot, double quote, 
single quote

I wrote that out because I always have a hard time seeing the two types of 
quotes so close together in code.

Frank...let us know if it works!

Terion Miller webdev.ter...@gmail.com wrote in message 
news:37405f850901071146i11d33987ga747ef2e4932f...@mail.gmail.com...
I am still struggling with getting my sessions and logins to pull just the
 allotted data that each user is allowed...
 I have the session working, and can echo it to see that .. what I'm having
 problems with is this : I want to pull the data specific to each user
 ..right... so far I either get all data regardless of user privileges or I
 get nothing.. a blank page, I have tried so many ways but never one that
 works: here are a few I have worked with

 This one pulls all data regardless of user level:
 ?php
 error_reporting(E_ALL);
 ini_set('display_errors', '1');
 session_start();
 include(inc/dbconn_open.php);


 if (empty($_SESSION['AdminLogin']) OR $_SESSION['AdminLogin']  'True' ){
header (Location: LogOut.php);
 }


$query =  SELECT * FROM admin WHERE AdminID = AdminID;
$result = mysql_query ($query);
$row = mysql_fetch_object ($result);
 ?

 From there I tried:

 ?php
 error_reporting(E_ALL);
 ini_set('display_errors', '1');
 session_start();
 include(inc/dbconn_open.php);


 if (empty($_SESSION['AdminLogin']) || $_SESSION['AdminLogin'] !=  true){
header (Location: LogOut.php);
 }


$query =
 SELECT * FROM `admin` WHERE `UserName` = `{$_SESSION['user']};
$result = mysql_query ($query);
$row = mysql_fetch_assoc($result);
 ?

 this one didn't work with the if $row - statements that are used to 
 select
 what menu items to load.

 Now I have this one which loads nothing, nil a blank page:

 $query =  SELECT * FROM  admin  WHERE  UserName  = $_SESSION['user'] ;
$result=mysql_query($query) or die('Queryproblem: ' . mysql_error() .
 'br /Executedquery: ' . $query);
 if (mysql_num_rows($result) = '1'){
while ($row = mysql_fetch_assoc($result)){
echo $row['AddEditAdmin']; //to print out the value of column
 'var1' for each record
  }
  }else{
 echo 'No records found.';
   }
 ?

 anyone have ideas for me, the session user is working, and I need to use 
 it
 in the query to pull only that users data I also on the login page where I
 set that session all set it to = $UserName but when I try and use that in
 the query UserName = $UserName I get an undefined variable error...

 Really trying but not quite getting it...
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: can a session be used in a query?

2009-01-07 Thread Frank Stanovcak

One other thought.  If you are getting a blank page with no errors or out 
put at all, I've noticed that I somtimes have to get the page to load 
successfully before the web server will dish out the error.

What I normally do is upload a blank php page with the same name as the one 
I am working on, load it up, and then upload the page with all the code and 
refresh.

I never really looked into why this was, but it's not that big of a hassle 
for me. *shrug*

Frank

Terion Miller webdev.ter...@gmail.com wrote in message 
news:37405f850901071146i11d33987ga747ef2e4932f...@mail.gmail.com...
I am still struggling with getting my sessions and logins to pull just the
 allotted data that each user is allowed...
 I have the session working, and can echo it to see that .. what I'm having
 problems with is this : I want to pull the data specific to each user
 ..right... so far I either get all data regardless of user privileges or I
 get nothing.. a blank page, I have tried so many ways but never one that
 works: here are a few I have worked with

 This one pulls all data regardless of user level:
 ?php
 error_reporting(E_ALL);
 ini_set('display_errors', '1');
 session_start();
 include(inc/dbconn_open.php);


 if (empty($_SESSION['AdminLogin']) OR $_SESSION['AdminLogin']  'True' ){
header (Location: LogOut.php);
 }


$query =  SELECT * FROM admin WHERE AdminID = AdminID;
$result = mysql_query ($query);
$row = mysql_fetch_object ($result);
 ?

 From there I tried:

 ?php
 error_reporting(E_ALL);
 ini_set('display_errors', '1');
 session_start();
 include(inc/dbconn_open.php);


 if (empty($_SESSION['AdminLogin']) || $_SESSION['AdminLogin'] !=  true){
header (Location: LogOut.php);
 }


$query =
 SELECT * FROM `admin` WHERE `UserName` = `{$_SESSION['user']};
$result = mysql_query ($query);
$row = mysql_fetch_assoc($result);
 ?

 this one didn't work with the if $row - statements that are used to 
 select
 what menu items to load.

 Now I have this one which loads nothing, nil a blank page:

 $query =  SELECT * FROM  admin  WHERE  UserName  = $_SESSION['user'] ;
$result=mysql_query($query) or die('Queryproblem: ' . mysql_error() .
 'br /Executedquery: ' . $query);
 if (mysql_num_rows($result) = '1'){
while ($row = mysql_fetch_assoc($result)){
echo $row['AddEditAdmin']; //to print out the value of column
 'var1' for each record
  }
  }else{
 echo 'No records found.';
   }
 ?

 anyone have ideas for me, the session user is working, and I need to use 
 it
 in the query to pull only that users data I also on the login page where I
 set that session all set it to = $UserName but when I try and use that in
 the query UserName = $UserName I get an undefined variable error...

 Really trying but not quite getting it...
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: can a session be used in a query?

2009-01-07 Thread Frank Stanovcak

Terion Miller webdev.ter...@gmail.com wrote in message 
news:37405f850901071354p7abd0aa8i7c96cf69c81fa...@mail.gmail.com...

 $result=mysql_query($query) or die('Queryproblem: ' . mysql_error() 
  .
  'br /Executedquery: ' . $query);
  if (mysql_num_rows($result) = '1'){
 while ($row = mysql_fetch_assoc($result)){
 echo $row['AddEditAdmin']; //to print out the value of 
  column
  'var1' for each record
   }
   }else{
  echo 'No records found.';
}
  ?
 
  anyone have ideas for me, the session user is working, and I need to 
  use
  it
  in the query to pull only that users data I also on the login page 
  where
 I
  set that session all set it to = $UserName but when I try and use that 
  in
  the query UserName = $UserName I get an undefined variable error...
 
  Really trying but not quite getting it...
 



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

 Well I am def. further along, the query is working, I can echo fields in
 the $row and get the results but when I try and use this:

?php
if ($row['AddEditAdmin'] == 'YES') {
?
 to sort out what menu items to load it just doesn't do its job.


I would say do this to see if what is in the return is what you are 
expecting

foreach($row as $key=$value){
echo $key , ': ' , $value , 'br';
};

just to make sure that the value is yes, and not 1 or true or something 
like that.

Frank 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: can a session be used in a query?

2009-01-07 Thread Frank Stanovcak
here is a handy little snippet of code I use.  Just include it where you 
want to get a snap shot of all the variables in an app.


ta ta for today boys!
- Original Message - 
From: Chris dmag...@gmail.com

To: Terion Miller webdev.ter...@gmail.com
Cc: Frank Stanovcak blindspot...@comcast.net; 
php-general@lists.php.net

Sent: Wednesday, January 07, 2009 5:29 PM
Subject: Re: [PHP] Re: can a session be used in a query?




I will try that, thanks, I did just try to echo the 
$row['AddEditAdmin']
results, as I do in the query section and in that it does return YES or 
NO
like I expect, but when I tried to echo it down in the page where I need 
to
use it guess what..no echo... am I cutting my query off somewhere? 
could

it be the while statement 

Ok tried that and got *Warning*: Invalid argument supplied for 
foreach()


var_dump($row);

what is in there?

--
Postgresql  php tutorials
http://www.designmagick.com/





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Re: can a session be used in a query?

2009-01-07 Thread Frank Stanovcak
because you so nicely didn't make fun of me...that much  :)
I keep it in it's own file and just use it as in include to probe where I need 
to.

--code follows--

?php 
function breakarray($passed){
 echo 'table border=1trthkey/ththvalue/th/tr';
 foreach($passed as $tkey=$tvalue){
  echo 'trtd[' , $tkey , ']/tdtd';
  if(is_array($tvalue)){
   breakarray($tvalue);
  }else{
   echo '' , $tvalue , '/td/tr';
  };
 };
 echo '/table';
};

echo 'table border=1tr thvariable/th thvalue/th /tr'; 
foreach(get_defined_vars() as $key = $value){ 
 echo 'trtd$',$key ,'/tdtd'; 
if(is_array($value) and $key != 'GLOBALS'){
  if(sizeof($value)  0){
   breakarray($value);
   echo '/td/tr';
  }else{
   echo 'EMPTY /td/tr';
  };
 }else{ 
  echo '' , $value , '/td/tr'; 
 };
};
echo '/table'; 
? 
  - Original Message - 
  From: Ashley Sheridan 
  To: Chris 
  Cc: Frank Stanovcak ; Terion Miller ; php-general@lists.php.net 
  Sent: Wednesday, January 07, 2009 7:23 PM
  Subject: Re: [PHP] Re: can a session be used in a query?


  On Thu, 2009-01-08 at 11:09 +1100, Chris wrote: 
Ashley Sheridan wrote:
 On Wed, 2009-01-07 at 18:50 -0500, Frank Stanovcak wrote:
 here is a handy little snippet of code I use.  Just include it where you 
 want to get a snap shot of all the variables in an app.

 ta ta for today boys!


 Is it just me, or can anybody else not see the code snippet? :p

it was an attachment..

Ah, he would have been better off posting a link, the list blocks attachments!


Ash
www.ashleysheridan.co.uk  


Re: [PHP] Because you guys/gals/girls/women/insert pc term here are a smart lot

2009-01-06 Thread Frank Stanovcak
So what I'm taking away from this is that I can index a text column, but 
that is relatively new.  Based on experience with technology I'm going to 
guess it's not a very efficient index or search function yet.  CHAR seems to 
be well entrenched, and the favorite for any column I may need to search 
against.  I just need to be warry of the size limits and account for them in 
my program and data entry.

Does that seem to be the consensus?


Nathan Rixham nrix...@gmail.com wrote in message 
news:4963388f.5080...@gmail.com...
 chris smith wrote:
 It may be worth mentioning that, IIRC, CHAR is faster due to the fixed
 length. If you can make your table use a fixed length row size (ie no
 variable length columns), it'll be faster.

 I'd be interested in seeing tests about this.. I doubt there's any 
 difference.

 quote: http://dev.mysql.com/doc/refman/5.1/en/data-size.html
 For MyISAM tables, if you do not have any variable-length columns 
 (VARCHAR, TEXT, or BLOB columns), a fixed-size row format is used. *This 
 is faster but unfortunately may waste some space.* See Section 13.4.3, 
 “MyISAM Table Storage Formats”. You can hint that you want to have fixed 
 length rows even if you have VARCHAR columns with the CREATE TABLE option 
 ROW_FORMAT=FIXED. 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Import files from directory

2009-01-06 Thread Frank Stanovcak
I may be mistaken, but it seems to me you would be better served letting it 
be file uploaded via php and process it as it arrives.  This would save the 
chron run every 5 min, and dir search headaches.  Or is there an issue that 
requires you to use an ftp transport?


Merlin Morgenstern merli...@fastmail.fm wrote in message 
news:39.7d.07052.f7f92...@pb1.pair.com...
 Hi everybody,

 I am running a real estate portal and would like to allow users to upload 
 their listing from their existing software. They do this with a XML file 
 which they will upload on a ftp server that places this xml file into a 
 seperate directory on the file system.

 My basic idea was to run a php scipt triggered by cron every 5 minutes 
 that checks if there is a new upload and then reads the file and removes 
 it. Now here is where the problem starts. Imagine if there are 1000 users, 
 I would need to go through 1000 folders to check for new content. There 
 must be a better solution to identify the directory that has a new 
 finished upload.

 Has anybody an idea on how to do this? Thank you for any hint.

 Best regards,

 Merlin 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Logic puzzle. Not a question. Just for fun

2009-01-06 Thread Frank Stanovcak
This is verbatim from the manufacturer except I replaced the code info with 
vanilia filler to keep from getting in trouble with them.

See how long it takes you to write the shortest SQL code that returns all 
State a and State f records.

If this seems simple to you remember I have no formal training in logic 
structure or DB design, and yes I know the answer.  E-mail me if you want 
it.

Frank.

the value of a status field is given in the sdk text as such...

...This number is determined by adding the following values together:

State a = 0
State b = 1
State c = 2
State d = 3
State e = 4
State f = 5
State g = 6
State h = 255
+
State i:
No = 0
Yes = 256
+
State j:
No = 0
Yes = 1024
+
State k:
No = 0
Yes = 4096
+
State l:
No = 0
Yes = 8192
+
State m:
No = 0
Yes = 16384

Example: a State a, State i, State k will have a value of
0 + 256 + 4096 = 4352



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Because you guys/gals/girls/women/insert pc term here are a smart lot

2009-01-05 Thread Frank Stanovcak
It's been a while since I've programed (VB was on version 4) I was wondering 
if any one could tell me what the diff is between char, varchar, and text in 
mysql.
I know this isn't a mysql news group, but since I am using php for the 
interaction it seemed like the place to ask.  Thanks in advance, and have a 
great day!

Frank 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Because you guys/gals/girls/women/insert pc term here are a smart lot

2009-01-05 Thread Frank Stanovcak
Thank you.  I have a stupid/nasty habit of realizing I can search after I 
post a question.  Problem was I was overwhelmed on google.  I was hoping for 
a simple this type is good for this use because, but bad for other things 
because. type answer.

My mantra around this office is I'm old not addled damnit!  :)
Stuart stut...@gmail.com wrote in message 
news:a5f019de0901051115ree20159tbbcf5b3cb2633...@mail.gmail.com...
 2009/1/5 Frank Stanovcak blindspot...@comcast.net:
 It's been a while since I've programed (VB was on version 4) I was 
 wondering
 if any one could tell me what the diff is between char, varchar, and text 
 in
 mysql.
 I know this isn't a mysql news group, but since I am using php for the
 interaction it seemed like the place to ask.  Thanks in advance, and have 
 a
 great day!

 char: the space required for the length of the field is allocated for
 each row no matter how much of it is used.

 varchar: only the space required for the content of the field is
 allocated per row but these fields are limited to 255 chars (IIRC) in
 length.

 text: for all intents and purposes these have unlimited length (4GBish 
 IIRC).

 There is a page in the MySQL manual that explains all of the data
 formats. Google for mysql data formats and you'll likely get it.

 -Stuart

 -- 
 http://stut.net/ 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Because you guys/gals/girls/women/insert pc term hereare a smart lot

2009-01-05 Thread Frank Stanovcak
This would be the winning answer.  I've been using text up till now.  I'll 
have to change that.

Thank you!

Robert Cummings rob...@interjinn.com wrote in message 
news:1231185251.4.2.ca...@localhost...
 On Mon, 2009-01-05 at 19:15 +, Stuart wrote:
 2009/1/5 Frank Stanovcak blindspot...@comcast.net:
  It's been a while since I've programed (VB was on version 4) I was 
  wondering
  if any one could tell me what the diff is between char, varchar, and 
  text in
  mysql.
  I know this isn't a mysql news group, but since I am using php for the
  interaction it seemed like the place to ask.  Thanks in advance, and 
  have a
  great day!

 char: the space required for the length of the field is allocated for
 each row no matter how much of it is used.

 varchar: only the space required for the content of the field is
 allocated per row but these fields are limited to 255 chars (IIRC) in
 length.

 text: for all intents and purposes these have unlimited length (4GBish 
 IIRC).

 There is a page in the MySQL manual that explains all of the data
 formats. Google for mysql data formats and you'll likely get it.

 It's generally worth mentioning that you can usually index char or
 varchar, but not text.

 Cheers,
 Rob.
 -- 
 http://www.interjinn.com
 Application and Templating Framework for PHP
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Question on if() priorities

2008-12-12 Thread Frank Stanovcak
I can't seem to find a reference to this in the manual, but is there an 
order of precedence for and or xor in an if statement?  Kind of like PPMDAS 
or polish notation for math (PPMDAS = Powers. Parenthacies. 
Multiplication...)

I ask because this seems to be working for me, but I want to make sure it is 
doing what I think it is.

(code follows)
if((($FILTERED['cod1'] == 0) or ($FILTERED['cod1'] == 1)) and 
(($FILTERED['cod2'] == 0) or ($FILTERED['cod2'] == 2)) and 
(($FILTERED['cod3'] == 0) or ($FILTERED['cod3'] == 4)))
(end code)

which is if either of the first set, and either of the second set, and 
either of the third set is true return true.

Thanks in advance!
Frank 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Need a brain to bounce some Mysql/DB thoughts off of!!

2008-12-12 Thread Frank Stanovcak

Robert Cummings rob...@interjinn.com wrote in message 
news:1229096146.22284.27.ca...@localhost...
 On Fri, 2008-12-12 at 06:34 -0600, Jay Blanchard wrote:
 [snip]
 It's Christmas... the season of giving and tolerance :|
 [/snip]

 We will return you to your regularly scheduled Robert Cummings Jan 2nd,
 2009

 Are you suggesting I'm not tolerant? Pfff.

 :)

 Cheers,
 Rob.
 -- 
 http://www.interjinn.com
 Application and Templating Framework for PHP

if you break it down he actually said you are very tollerant, but there is 
an explicit limiter of Jan 2nd on the degree of tollerance supplied by the 
said Cummings system. 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Question on if() priorities

2008-12-12 Thread Frank Stanovcak
Thanks. Don't know how I could have missed that.

Maciek Sokolewicz tula...@php.net wrote in message 
news:49428d51.3090...@php.net...
 Frank Stanovcak wrote:
 I can't seem to find a reference to this in the manual, but is there an 
 order of precedence for and or xor in an if statement?  Kind of like 
 PPMDAS or polish notation for math (PPMDAS = Powers. Parenthacies. 
 Multiplication...)

 I ask because this seems to be working for me, but I want to make sure it 
 is doing what I think it is.

 (code follows)
 if((($FILTERED['cod1'] == 0) or ($FILTERED['cod1'] == 1)) and 
 (($FILTERED['cod2'] == 0) or ($FILTERED['cod2'] == 2)) and 
 (($FILTERED['cod3'] == 0) or ($FILTERED['cod3'] == 4)))
 (end code)

 which is if either of the first set, and either of the second set, and 
 either of the third set is true return true.

 Thanks in advance!
 Frank
 http://nl.php.net/manual/en/language.operators.php#language.operators.precedence
  



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] MYSQL insert problems

2008-10-17 Thread Frank Stanovcak
I'm using the following code to try and do a simple insert query.  However 
it won't insert the data into the table, and I get no error messages.  What 
have I done wrong this time?


?php
session_start();
$connection = mysql_connect('localhost','yeah','right');
mysql_select_db('envelope1',$connection);

$filtered = $_SESSION['filtered'];
mysql_query('INSERT INTO shipped (FKOESalesOrder,FKUSUsers, DateEntered, 
DateShipped,Quantity, Cases, Pallets, Weight, FKUSShippedBy, BillofLading,) 
VALUES (' . $filtered['SalesOrder'] . ', 1, ' . date('MM/DD/', time()) . 
', ' . $filtered['ShipDate'] . ', ' . $_SESSION['quantity'] . ', ' . 
$_SESSION['cases'] . ', ' . $filtered['FullPallets'] . ', ' . 
$filtered['Weight'] . ', ' . $filtered['ShippedBy'] . ', ' . 
$filtered['BillofLading'] . ')', $connection);

$that = mysql_query('SELECT * FROM shipped',$connection);

$i = 0;
while($result_row = mysql_fetch_array($that,MYSQL_ASSOC)) {
 echo ++$i;
 foreach($result_row as $key = $value) {
  echo $key . ' : ' . $value . 'br';
 };
 echo 'br';
};
mysql_close($connection);
include('..\VariableReveal.php');
? 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: MYSQL insert problems

2008-10-17 Thread Frank Stanovcak
Just incase the problem was refrencing an array in an SQL statement I tried 
this too with the same result.

?php
session_start();
$connection = mysql_connect('localhost','FrankS','rastane');
mysql_select_db('envelope1',$connection);
$filtered = $_SESSION['filtered'];
$salesorder = $filtered['SalesOrder'];
$user = 1;
$date = date('m/d/Y', time());
$shipdate = $filtered['ShipDate'];
$quantity = $_SESSION['quantity'];
$cases = $_SESSION['cases'];
$pallets = $filtered['FullPallets'];
$weight = $filtered['Weight'];
$shippedby = $filtered['ShippedBy'];
$billoflading = $filtered['BillofLading'];
mysql_query(INSERT INTO shipped
(FKOESalesOrder,
FKUSUsers,
DateEntered,
DateShipped,
Quantity,
Cases,
Pallets,
Weight,
FKUSShippedBy,
BillofLading,)
VALUES
('$salesorder',
'$user',
'$date',
'$shipdate',
'$quantity',
'$cases',
'$pallets',
'$weight',
'$shippedby',
'$billoflading'), $connection);

$that = mysql_query('SELECT * FROM shipped',$connection);

$i = 0;
while($result_row = mysql_fetch_array($that,MYSQL_ASSOC)) {
 echo ++$i;
 foreach($result_row as $key = $value) {
  echo $key . ' : ' . $value . 'br';
 };
 echo 'br';
};
mysql_close($connection);
include('..\VariableReveal.php');
? 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP Dev Facts

2008-10-17 Thread Frank Stanovcak

Daniel Brown [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 On Fri, Oct 17, 2008 at 12:11 PM, Jay Blanchard [EMAIL PROTECTED] 
 wrote:

 It's Friday night, shouldn't you be going to the pub instead?

In another eight years he'll be glad to do that.  Little-known
 fact: Nate is the world's smartest 12-year-old.

/kidding

Shouldn't that be !kidding ?


 -- 
 /Daniel P. Brown
 More full-root dedicated server packages:
 Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
 Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
 Intel 2.4GHz/320/GB/1GB/3TB $74.99/mo.
 Dedicated servers, VPS, and hosting from $2.50/mo. 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Yeah I'm sortof a noob

2008-10-10 Thread Frank Stanovcak
TY.  That should help greatly!
Shawn McKenzie [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Frank Stanovcak wrote:
 I'm trying to follow the three precepts of accepting user entries...
 1. never trust it.
 2. never trust it.
 3. never trust it ever!

 I have one entry that may equal 0 on submission, and if it does is 
 tripping
 a bool false result, so I came up with this work around.  However when I 
 put
 this in my code the page fails to load.  What did I do wrong, and please 
 be
 specific.  I already know I'm stupid, and to answer the question.  The 
 extra
 ';' are for my clarity to know that is the end of the if or foreach
 statement.  Plus it carried over from java script and keeps me out of
 trouble as I flip between the two.

 I am looking for the instance when the key is 'ExtraCases' as that is the
 field that will possibly be zero on submission.

 //check to make sure all the entries passed
 foreach($Filtered as $ThisKey = $ThisVar) {
  if($ThisVar == FALSE) {
   if(($ThisKey == 'ExtraCases') and
 (filter_has_var(INPUT_POST,'ExtraCases'))) {
if($_POST['ExtraCases'] == 0) {
 $noProb = TRUE;
} else {
 $Continue = FALSE;
 $WrongData[$ThisKey] = TRUE;
};
   } else {
$Continue = FALSE;
$WrongData[$ThisKey] = TRUE;
   };
  };
 };



 Well, I haven't studied your code to see the problem, but I'm replying
 to your workaround.  You should be able to code this without the
 workaround if you use the correct comparison operators.

 == is untyped value comparison
 === is a strict comparison (must be same value AND same type, boolean,
 string, int, etc...)

 These are correct:
 0 == false
 '' == false
 null == false
 69 == true
 'false' == true

 These are not:
 0 === false
 '' === false
 null === false
 69 === true
 'false' === true

 -Shawn


 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Login

2008-10-09 Thread Frank Stanovcak

Wolf [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 !-- SNIP --
 Redirects make sense IMO. IIRC the Yahoo guidelines say not to
 redirect after a form POST, but unless you have a ka-jillion page
 views a second (or, a lot), then I don't think it's a concern.

 Wait, Yahell has guidelines?!?!?

 You always have to look at the User Experience.  You don't want to annoy 
 or p!ss off your users or they will find a site like yours that doesn't 
 p!ss them off.  If it makes sense to re-direct the user after a successful 
 login, then go ahead and do it.

 Of course, I don't care if I p!ss off someone who is trying to run 
 malicious code on my site or find a hidden piece.  Then a redirect to 
 ratemypoo seems like a good idea to me!

 Wolf

I'd like to take this back to the heart of this message and state that 
redirecting malicious usage to ratemypoo seems like a perfectly delightful 
means of security. 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Yeah I'm sortof a noob

2008-10-09 Thread Frank Stanovcak
I'm trying to follow the three precepts of accepting user entries...
1. never trust it.
2. never trust it.
3. never trust it ever!

I have one entry that may equal 0 on submission, and if it does is tripping 
a bool false result, so I came up with this work around.  However when I put 
this in my code the page fails to load.  What did I do wrong, and please be 
specific.  I already know I'm stupid, and to answer the question.  The extra 
';' are for my clarity to know that is the end of the if or foreach 
statement.  Plus it carried over from java script and keeps me out of 
trouble as I flip between the two.

I am looking for the instance when the key is 'ExtraCases' as that is the 
field that will possibly be zero on submission.

//check to make sure all the entries passed
foreach($Filtered as $ThisKey = $ThisVar) {
 if($ThisVar == FALSE) {
  if(($ThisKey == 'ExtraCases') and 
(filter_has_var(INPUT_POST,'ExtraCases'))) {
   if($_POST['ExtraCases'] == 0) {
$noProb = TRUE;
   } else {
$Continue = FALSE;
$WrongData[$ThisKey] = TRUE;
   };
  } else {
   $Continue = FALSE;
   $WrongData[$ThisKey] = TRUE;
  };
 };
}; 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Yeah I'm sortof a noob

2008-10-09 Thread Frank Stanovcak
Please disregard  It was a code fragment elsewhere that got put in when I 
went to save.  Thank you for looking though!

Frank
Savant at Large
Frank Stanovcak [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 I'm trying to follow the three precepts of accepting user entries...
 1. never trust it.
 2. never trust it.
 3. never trust it ever!

 I have one entry that may equal 0 on submission, and if it does is 
 tripping a bool false result, so I came up with this work around.  However 
 when I put this in my code the page fails to load.  What did I do wrong, 
 and please be specific.  I already know I'm stupid, and to answer the 
 question.  The extra ';' are for my clarity to know that is the end of the 
 if or foreach statement.  Plus it carried over from java script and keeps 
 me out of trouble as I flip between the two.

 I am looking for the instance when the key is 'ExtraCases' as that is the 
 field that will possibly be zero on submission.

 //check to make sure all the entries passed
 foreach($Filtered as $ThisKey = $ThisVar) {
 if($ThisVar == FALSE) {
  if(($ThisKey == 'ExtraCases') and 
 (filter_has_var(INPUT_POST,'ExtraCases'))) {
   if($_POST['ExtraCases'] == 0) {
$noProb = TRUE;
   } else {
$Continue = FALSE;
$WrongData[$ThisKey] = TRUE;
   };
  } else {
   $Continue = FALSE;
   $WrongData[$ThisKey] = TRUE;
  };
 };
 };
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Sterilizing regexp

2008-09-30 Thread Frank Stanovcak
A while ago I asked a question and got a few answers, so I thought I would 
toss this out there as a follow up.  I'm going to be using this to return 
filtered regexp values for a user interface.

I haven't had a chance to enter this into my code yet, so if anyone sees 
something wrong please hammer away, otherwise I hope it helps save some one 
some time.

function regexp_sanitize($string,$regexp) {
if(isarray($string)) {
foreach($string as $key = $value) {
$count = preg_match($regexp,$value,$matches) {
if($count != 1) {
$result[$key] = FALSE;
} else {
foreach($matches as $toss = $matchval) {
$result[$key] = $matchval;
};
};
};
} else {
$count = preg_match($regexp,$string,$matches);
if($count != 1) {
$result = FALSE;
} else {
$result = $matches[0];
};
};
return($result);
}; 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Sterilizing regexp

2008-09-30 Thread Frank Stanovcak
I've got to pass about 9 or 10 calls to it, some of which will be arrays, 
and I have to do it from several different places.  Felt this was a bit more 
elegant than hard coding the pregmatches unless there is an easier way.

Per Jessen [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
Frank Stanovcak wrote:

 A while ago I asked a question and got a few answers, so I thought I
 would toss this out there as a follow up.  I'm going to be using this
 to return filtered regexp values for a user interface.

 I haven't had a chance to enter this into my code yet, so if anyone
 sees something wrong please hammer away, otherwise I hope it helps
 save some one some time.

I think I'm missing the purpose - your code looks like you've wrapped a
function around preg_match() so you can pass arrays to it as well, but
I don't see much sanity anywhere :-)


/Per Jessen, Zürich



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Filters and sanitizing a regexp

2008-09-25 Thread Frank Stanovcak
Is it possible to use the php filter function to sanitize a regular 
expression such as to return just the date part of a string that may be 
passed by an nonobservant user?

#\d\d/\d\d/\d\d\d\d#

input would be something like
as02/05/2008df

I want to use the filter to give me just the date should some oaf not leave 
the date field as just digits. 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Filters and sanitizing a regexp

2008-09-25 Thread Frank Stanovcak
by the by I'm using filter_var($string, FITER_VALIDATE_REGEXP, blah blah 
blah)


Frank Stanovcak [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Is it possible to use the php filter function to sanitize a regular 
 expression such as to return just the date part of a string that may be 
 passed by an nonobservant user?

 #\d\d/\d\d/\d\d\d\d#

 input would be something like
 as02/05/2008df

 I want to use the filter to give me just the date should some oaf not 
 leave the date field as just digits.
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Function parameters and arrays

2008-09-18 Thread Frank Stanovcak
I am trying to pass a multi dimmed array as a variable parameter to a custom 
function to build a query for me.  Here is the basic code and what I am 
getting.

$WhereList[0][0] = 'OESalesOrder.OrderNo';
$WhereList[0][1] = '=';
$WhereList[0][2] = '2272';
$SQLString = SQLCall('OESalesOrder',$FieldList,$WhereList);

I then use a foreach in the function to process it.

$i = 0;
  foreach(func_get_arg(2) as $WhereArray) {
   echo $WhereArray[0][0];
   if($i == 0) {
$SQLStmt .= ' ' . $WhereArray[$i][0] . ' ' . $WhereArray[$i][1] . ' ' . 
$WhereArray[$i][2];
$i += 1;
   } else {
$SQLStmt .= ' ' . $WhereArray[$i][0] . ' ' . $WhereArray[$i][1] . ' ' . 
$WhereArray[$i][2] . ' ' . $WhereArray[$i][3];
$i += 1;
   };
  };

What I get when it processes is the first three letters of [0][0]
[0][0] = O
[0][1] = E
[0][2] = S

Did I do something wrong, or is this not possible?  I have done an array 
processing this way before, but not multidimmed.

Frank. 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Function parameters and arrays

2008-09-18 Thread Frank Stanovcak
Actually Stut pointed out that I was calling both dimmensions when my sorry 
butt should only have been referencing the second one.
I had everything over expanded so I could see where the code was breaking.
Thank you everyone for the help!  That was fantastic!

Frank
Frank Stanovcak [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
I am trying to pass a multi dimmed array as a variable parameter to a 
custom function to build a query for me.  Here is the basic code and what I 
am getting.

 $WhereList[0][0] = 'OESalesOrder.OrderNo';
 $WhereList[0][1] = '=';
 $WhereList[0][2] = '2272';
 $SQLString = SQLCall('OESalesOrder',$FieldList,$WhereList);

 I then use a foreach in the function to process it.

 $i = 0;
  foreach(func_get_arg(2) as $WhereArray) {
   echo $WhereArray[0][0];
   if($i == 0) {
$SQLStmt .= ' ' . $WhereArray[$i][0] . ' ' . $WhereArray[$i][1] . ' ' . 
 $WhereArray[$i][2];
$i += 1;
   } else {
$SQLStmt .= ' ' . $WhereArray[$i][0] . ' ' . $WhereArray[$i][1] . ' ' . 
 $WhereArray[$i][2] . ' ' . $WhereArray[$i][3];
$i += 1;
   };
  };

 What I get when it processes is the first three letters of [0][0]
 [0][0] = O
 [0][1] = E
 [0][2] = S

 Did I do something wrong, or is this not possible?  I have done an array 
 processing this way before, but not multidimmed.

 Frank.
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php