RE: [PHP] 2 ifs embedded?

2009-07-31 Thread Chrome
 On 7/31/09 9:53 AM, Bastien Koert phps...@gmail.com wrote:
 
 On Fri, Jul 31, 2009 at 10:28 AM, Miller,
 Teriontmil...@springfi.gannett.com wrote:
 
 
 
  On 7/31/09 8:58 AM, m0s d...@lenss.nl wrote:
 
  (!empty($row['notes'])  IsAlpha($row['notes']))
 
  I tried that and this one:
 
  If (!empty($row['notes'])  ctype_alpha($row['notes']))
 
  It didn't display the notes at all...
 
  And this one...doesn't display if the field has a 0 in it but I still
 need it to?
 
  If (!empty($row['critical'])  ctype_alnum($row['critical']))
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 Hey Teri,
 Could the return from the db have a space or something in the value?
 Perhaps
 
 If (!empty($row['critical'])  ctype_alnum((int)$row['critical']))
 
 might work
 
 
 --
 
 Bastien
 
 Cat, the other other white meat
 
 
 It's got me stumped, tried it and it still will not echo if the field
 has a 0 in it:
 
 If (!empty($row['critical'])  ctype_alnum((int)$row['critical'])){
 echo( Critical violations found: . $row['critical'] .. );
 

empty() regards 0 as an empty value... From the manual:

[quote]
The following things are considered to be empty:

*  (an empty string)
* 0 (0 as an integer)
* 0 (0 as a string)
* NULL
* FALSE
* array() (an empty array)
* var $var; (a variable declared, but without a value in a class)
[/quote]

HTH

Dan


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



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

2009-03-20 Thread Chrome
 George Larson schreef:
  Not only that but, judging from the phone number, Samantha cleans
 also
  cleans houses:
  http://betterthancleanmaidandmaintenanceservices.com/choose-
 us/contact-us-mainmenu-3/12-contacts/1-name.h
 
 what a busy girl :-)

Kudos points to the first person to find her on Craigslist?


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



RE: [PHP] Help with IF ELSE

2008-12-05 Thread Chrome


 -Original Message-
 From: Sándor Tamás (HostWare Kft.) [mailto:[EMAIL PROTECTED]
 Sent: 05 December 2008 14:58
 To: php-general@lists.php.net
 Subject: Re: [PHP] Help with IF ELSE
 
 In fact, if I have to redirect, and I am not sure about headers are
 sent or
 not, I usually do:
 
 print('SCRIPTwindow.location=somewhere.php/SCRIPT');
 
 That way I can always do the redirection.

I always use this little function for redirects

function redirect($url) { // redirect the page
   if (headers_sent()) { // perform JS redirect
  echo 'script type=text/javascript language=javascript';
  echo \n!-- \n\tdocument.location.href=' . $url . '; \n// 
--\n/script\n;
  echo 'a href=' . $url . 'Continue to your page/a';
   } else { // normal redirect
  header('location: ' . $url);
  die();
   }
}

This just outputs a JS call to a redirect if headers have already been sent and 
provides a link if the user has disabled JS (some do)

Also it should be XHTML compliant

Dan

 SanTa
 
 - Original Message -
 From: Andrew Ballard [EMAIL PROTECTED]
 To: David Stoltz [EMAIL PROTECTED]
 Cc: php-general@lists.php.net
 Sent: Friday, December 05, 2008 3:52 PM
 Subject: Re: [PHP] Help with IF ELSE
 
 
  On Fri, Dec 5, 2008 at 6:42 AM, David Stoltz [EMAIL PROTECTED] wrote:
  I turned on error reporting (ALL) as you suggested. Nothing is being
  sent to the browserstill doesn't work if the recordset isn't
 empty.
 
  I'm wondering, is there any other way to do a redirect in PHP?
 
  Thanks
 
 
  That is how you do redirects in PHP. I believe you've got several
  solutions to your actual problem by now (I like tedd's with either
 md5
  or sha1), but since you asked...
 
  There is a note in the documentation for header() that says HTTP/1.1
  requires absolute URIs instead of relative ones as those in your
  example.
 
  You can also pass the response code in the third parameter (in which
  case you can use the 303 SEE OTHER code that was intended for the
  typical redirect rather than the 302 FOUND that most sites use), but
  it isn' t necessary since PHP automatically sets a 302 on a Location:
  header when the parameter is empty.
 
  http://www.php.net/header
 
  Andrew
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


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



RE: [PHP] Politics

2008-10-21 Thread Chrome
 -Original Message-
 From: Amy [mailto:[EMAIL PROTECTED]
 Sent: 21 October 2008 11:58
 To: php-general@lists.php.net
 Subject: [PHP] Politics
 
 
 representations emphasizing leksr matching thirds painfully wakesleep
 ekswiezeezeewie accompanied

Have you tried restarting Apache? :)

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


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



RE: [PHP] Output text status on a long class

2008-10-14 Thread Chrome


 -Original Message-
 From: uaca man [mailto:[EMAIL PROTECTED]
 Sent: 14 October 2008 16:10
 To: php-general@lists.php.net
 Subject: Re: [PHP] Output text status on a long class
 
 Dan,
 
 Try
 echo some text;
 ob_flush() http://br2.php.net/manual/en/function.ob-flush.php;
 *flush()* ;
 
 also take a look at the documentation at:
 http://br2.php.net/manual/en/function.flush.php
 
 Angelo
 

Hi Angelo and Stut

Strange happenings.  Tried a few combinations of your suggestions but the
output is still just dumped at the end

Odd

Thanks for the input (and this may be something to do with the server (which
I didn't set up))

Dan



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



RE: [PHP] Output text status on a long class

2008-10-14 Thread Chrome
 Stut wrote:
  On 14 Oct 2008, at 15:56, Chrome wrote:
  I have a class that takes a while to run and am wanting to push some
  output
  to the browser while it's doing its stuff.  Is that possible?
 
  Here's what I'd like:
 
  Connecting to server... Done!
  Retrieving categories... Done!
  ...
 
  All I can get it to do is output all of the text at the end of the
 script
 
  A voice in my head says that outputting all of the text at the end
 of the
  script is the only way to do it.  Then another voice says but there
  must be
  a way! :)
 
  I did try a quick test of buffering the text then explicitly
 flushing the
  buffer but it didn't seem to work
 
  I know this seems pointless but I'm anticipating that the users will
 be
  confused (which would be a surprise /sarcasm) and attempt to
  abort/bugger
  off somewhere else
 
  Put this line at the top of your script...
 
  while (@ob_end_clean());
 
  That will remove any output buffers and your script should then
 output
  stuff as it happens.
 
  -Stut
 
 
 Or you could add
 
 flush();
 
 after your output, which will flush the output buffer and force it to
 display.

I did that as well as stut's suggestion.  And I tried ob_flush() (just in
case).  Tried a few combinations

Personally I think I sometimes have a negative effect on these things

Dan

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


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



RE: [PHP] Output text status on a long class

2008-10-14 Thread Chrome
 On 14 Oct 2008, at 16:51, Chrome wrote:
  For the record I have included a 256 char long whitespace string
  along with any prospective output but still no joy
 
  Opera 9.60 reliably informs me it's received 258 bytes but displays
  nothing
 
  I'll carry on with this for a little before blaming the browsers
  (testing also in FF3) and putting in a 'This is going to take bloody
  ages' note :)
 
 My initial response was based on it being a CLI script in which case
 my advice would have been enough. However in your case there are other
 buffers in play which could affect the output.
 
 How is your output formatted? Browsers won't necessarily display
 content until they get closing tags. This is probably the issue you're
 running into.

The output is [currently] plain text only.  Maybe it would help if I added
the standard HTML stuff too I'll have more luck

I'll try that in a little bit but food first :)

Thanks for the input

Dan

 -Stut
 
 --
 http://stut.net/


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



RE: [PHP] Output text status on a long class

2008-10-14 Thread Chrome
 On Tue, Oct 14, 2008 at 11:30 AM, Chrome [EMAIL PROTECTED] wrote:
  Stut wrote:
   On 14 Oct 2008, at 15:56, Chrome wrote:
   I have a class that takes a while to run and am wanting to push
 some
   output
   to the browser while it's doing its stuff.  Is that possible?
  
   Here's what I'd like:
  
   Connecting to server... Done!
   Retrieving categories... Done!
   ...
  
   All I can get it to do is output all of the text at the end of
 the
  script
  
   A voice in my head says that outputting all of the text at the
 end
  of the
   script is the only way to do it.  Then another voice says but
 there
   must be
   a way! :)
  
   I did try a quick test of buffering the text then explicitly
  flushing the
   buffer but it didn't seem to work
  
   I know this seems pointless but I'm anticipating that the users
 will
  be
   confused (which would be a surprise /sarcasm) and attempt to
   abort/bugger
   off somewhere else
  
   Put this line at the top of your script...
  
   while (@ob_end_clean());
  
   That will remove any output buffers and your script should then
  output
   stuff as it happens.
  
   -Stut
  
 
  Or you could add
 
  flush();
 
  after your output, which will flush the output buffer and force it
 to
  display.
 
  I did that as well as stut's suggestion.  And I tried ob_flush()
 (just in
  case).  Tried a few combinations
 
  Personally I think I sometimes have a negative effect on these things
 
  Dan
 
 
 Did you also read the notes in the description for flush()?
 
 http://www.php.net/manual/en/function.flush.php

I'm reading through them now :)

For the record I have included a 256 char long whitespace string along with any 
prospective output but still no joy

Opera 9.60 reliably informs me it's received 258 bytes but displays nothing

I'll carry on with this for a little before blaming the browsers (testing also 
in FF3) and putting in a 'This is going to take bloody ages' note :)

Thanks for all the input

Dan

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


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



[PHP] Output text status on a long class

2008-10-14 Thread Chrome
Hi all

I have a class that takes a while to run and am wanting to push some output
to the browser while it's doing its stuff.  Is that possible?

Here's what I'd like:

Connecting to server... Done!
Retrieving categories... Done!
...

All I can get it to do is output all of the text at the end of the script

A voice in my head says that outputting all of the text at the end of the
script is the only way to do it.  Then another voice says but there must be
a way! :)

I did try a quick test of buffering the text then explicitly flushing the
buffer but it didn't seem to work

I know this seems pointless but I'm anticipating that the users will be
confused (which would be a surprise /sarcasm) and attempt to abort/bugger
off somewhere else

Thanks in advance!

Dan


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



RE: [PHP] Graph type

2008-08-08 Thread Chrome


 -Original Message-
 From: tedd [mailto:[EMAIL PROTECTED]
 Sent: 08 August 2008 15:32
 To: php-general@lists.php.net
 Subject: Re: [PHP] Graph type
 
 Hi,
 
 Anyone know what this graph type is called?
 
 http://picasaweb.google.com/richard.heyes
 
 
 A European road sign?

Can't be.  The graph makes sense

Dan


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



[PHP] Regular expressions

2006-10-16 Thread Chrome
*edit* sorry I didn't think and just hit reply on this instead of reply
all... sorry Richard */edit*

[snip]
.*? is kinda silly -- .* mean 0 or more characters, and ? means maybe
but putting them together has no added value, so lose the ?
[/snip]

I could be wrong (and under the considerable knowledge of Richard I
certainly feel it :) ) but doesn't the ? after a quantifier signify that
preceding pattern is to be taken as ungreedy?

The Regex Coach (which I use extensively) tends to agree

Just a thought...

Dan

PS. That isn't to say that Richards assessment of the regex is incorrect;
far from it
-- 
http://chrome.me.uk

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



RE: [PHP] Regular expressions

2006-10-16 Thread Chrome
[snip]
? means maybe in some other place in PCRE.  Or maybe that's POSIX. 
Never have figured that one out.
[/snip]

? directly after an expression is equivalent to {0,1} (maybe) but after a
quantifier (*, +, {}) means ungreedy

I'm sure I'll be corrected if I'm wrong :)

Dan

-- 
http://chrome.me.uk

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



RE: [PHP] Regular expressions

2006-10-16 Thread Chrome
On 10/16/06, Chrome [EMAIL PROTECTED] wrote:
 [snip]
 ? means maybe in some other place in PCRE.  Or maybe that's POSIX.
 Never have figured that one out.
 [/snip]

 ? directly after an expression is equivalent to {0,1} (maybe) but
 after a quantifier (*, +, {}) means ungreedy

I kind of talked about this in the reply to richard the .*? is exactly
the same as doing .*(?U)

an inline modifier to the previous expression.

That makes me wonder.. according to the docs U inverts greediness, if
you have...
/foo.*?bar/U

does that make .*? a greedy .*

Curt.

Good point... I suppose it would... I'm not au fait with greediness in
honesty... I just remember the syntax

Strange really because I'm arguing with a regex at the minute lol

Dan

-- 
http://chrome.me.uk

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



RE: [PHP] Filtering (was storing single and double quote in MySQL)

2006-05-25 Thread Chrome
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: 25 May 2006 22:19
 To: tedd
 Cc: Eric Butera; php
 Subject: Re: [PHP] Filtering (was storing single and double quote in
 MySQL)
 
 As you said: Filtering. My next queston.
 
 I have small form to activate/deactivate member's account.
 
 form method=post action=members.php
 input type=hidden name=username value=?= $Usename ?
 input type=hidden name=status value=?= $Status ?
 input type=image name=action value=change src=images/status_live.gif
 border=0
 /form
 
 and once adminisrtrator clicks on button:
 
 if(isset($_POST['action']))
 {
   $Username = $_POST['Username'];
   $action = '';
   switch($action)
   {
 case 'change':
   mysql_query(UPDATE members SET status='live' WHERE Username =
 '.$Username.');
 break;
 
 case 'edit':
   //  ...
break;
   }
 }
 
 Do I have to filter $Username with mysql_real_escape_string() function
 even if $Username will not be stored in DB and I use it in WHERE part?
 If no - how to filter it?
 
 Thanks
 
 -afan


Always sanitise data provided externally; whether it's from the user
directly (e.g. a POST form or a URL query string (GET)) or from the browser
(e.g. cookie data)... always assume it can never be trusted (there are some
nasty people out there)

In this case using mysql_real_escape_string() on the supplied username
should be enough for most injection attacks (
http://www.google.co.uk/search?hl=enq=sql+injectionmeta= ), but to be more
sure try this (if your username is alphanumeric only with spaces):

if(isset($_POST['action']))
{
  $Username = preg_replace('/[^a-zA-Z0-9]+/', '', $_POST['Username']);
  $action = '';
  switch($action)
  {
case 'change':
  if (!empty($Username)) mysql_query(UPDATE members SET status='live'
WHERE Username = '.$Username.');
break;
 
case 'edit':
  //  ...
   break;
  }
}

I think that's right :)

Dan
-- 
http://chrome.me.uk

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



RE: [PHP] Filtering (was storing single and double quote in MySQL)

2006-05-25 Thread Chrome
[snip]
1. Anytime you put anything into a dB then use
mysql_real_escape_string() function. If you are NOT going to put it
in a dB, then you don't need mysql_real_escape_string() function --
understand?
[/snip]

Untrue... It isn't just inserting into a DB that requires this function...
Consider:

User enters:
anything'; DROP TABLE x; SELECT 'a' = 'a

into the form for username... Now your unescaped SQL statement reads:

UPDATE members SET status='live' WHERE Username = 'anything'; DROP TABLE x;
SELECT 'a' = 'a'

Where x can be a brute-forced table name... I can't remember if MySQL allows
multiple statements but I seem to remember hearing that MySQL5 does... If
I'm wrong correct me and tell me to RTFM :)

Nice catch on the error... I didn't notice that :)

HTH (and that I'm right :) )

Dan
-- 
http://chrome.me.uk

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



RE: [PHP] Filtering (was storing single and double quote in MySQL)

2006-05-25 Thread Chrome
 -Original Message-
 From: tedd [mailto:[EMAIL PROTECTED]
 Sent: 26 May 2006 02:27
 To: Chrome; 'tedd'; [EMAIL PROTECTED]
 Cc: 'Eric Butera'; 'php'
 Subject: RE: [PHP] Filtering (was storing single and double quote in
 MySQL)
 
 At 11:51 PM +0100 5/25/06, Chrome wrote:
 [snip]
 1. Anytime you put anything into a dB then use
 mysql_real_escape_string() function. If you are NOT going to put it
 in a dB, then you don't need mysql_real_escape_string() function --
 understand?
 [/snip]
 
 Untrue... It isn't just inserting into a DB that requires this
 function...
 Consider:
 
 User enters:
 anything'; DROP TABLE x; SELECT 'a' = 'a
 
 into the form for username... Now your unescaped SQL statement reads:
 
 UPDATE members SET status='live' WHERE Username = 'anything'; DROP TABLE
 x;
 SELECT 'a' = 'a'
 
 Where x can be a brute-forced table name... I can't remember if MySQL
 allows
 multiple statements but I seem to remember hearing that MySQL5 does... If
 I'm wrong correct me and tell me to RTFM :)
 
 Nice catch on the error... I didn't notice that :)
 
 HTH (and that I'm right :) )
 
 Dan
 
 Dan:
 
 A couple of things: One, I'm not sure if afan understands multiple
 statements, so I didn't want to confuse him; Two, I don't use
 multiple statements because they confuse me. I'm much more of a
 step-by-step programmer.

I don't use them either; hence my uncertainty :)

 I find that sometimes it's best to provide something simple for
 someone to learn rather than confuse them with remote possibilities.
 I taught at college level and believe me when I say there is nothing
 dumber than a student. Baby steps are best -- and the same for me
 when I'm learning as well.

I'm still learning... very much so... which is why all my advice is subject
to correction by a higher mortal... step forward, you know who you are :)

 In the exchange I had with afan, we were talking about placing data
 into a dB without the need for escapes and I think the advice I gave
 him was correct.

Never doubted that :)... I have seen much of your advice

 I realize that there are exceptions to just about anything IF you dig
 deep enough. For example did you know that if magic_quotes are turned
 ON and you use escape_data() that function will use
 mysql_real_escape_string(). So, here's an example that proves your
 point, but if I was to inform afan of that, what good would it do?
 Knowing that hasn't done anything for me.

I only sought to provide knowledge... knowing the pitfalls regardless of how
bad the advice is set out/worded surely must be good

Security should be foremost and ignorance no excuse... That's not to say
anyone can't make a mistake :) 

 
 In any event, your point is well taken -- thanks for the clarification.
 
 tedd
 
 --
 --
 --
 http://sperling.com  http://ancientstones.com  http://earthstones.com
 
 __ NOD32 1.1559 (20060525) Information __
 
 This message was checked by NOD32 antivirus system.
 http://www.eset.com


Dan
-- 
http://chrome.me.uk

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



RE: [PHP] Regex Help for URL's

2006-05-16 Thread Chrome
 -Original Message-
 From: Robert Samuel White [mailto:[EMAIL PROTECTED]
 Sent: 16 May 2006 21:32
 To: php-general@lists.php.net
 Subject: RE: [PHP] Regex Help for URL's
 
 Don't be rude.  I've already don't all of that.  Nothing came up.  I've
 been
 programming for 20 years (since I was 11 years old) so I'm not a slacker
 when it comes to learning new things, however, I have always found regular
 expressions to be extremely difficult.  Someone here might have the answer
 I
 need, and if so, I'd appreciate a response.  If you don't know the answer,
 don't reply.  Simple enough, don't you think?
 -Original Message-
 From: Jochem Maas [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, May 16, 2006 4:28 PM
 To: Robert Samuel White
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Regex Help for URL's
 
 Robert Samuel White wrote:
  Can someone help me modify the following code?
 
  It was designed to search for all instances of [LEVEL#]...[/LEVEL#]
 
  I need a preg_match_all that will search for all of instances of an URL.
 
  It should be sophisticated enough to find something as complicated as
 this:
 
  http(s)://x.y.z.domain.com/dir/dir/file.name.ext?query=1query=2#anchor
 
  Any help would be greatly appreciated!
 
 so your looking for a regular expression that is *totally* different
 from the regular expression you have... the two have nothing in common.
 
 do you expect us to do the complete rewrite for you or do you want to
 learn abit about regexps yourself? (that probably sounds arrogant, so it
 might
 help to know even the most experienced people (a group I don't consider
 myself
 part of) here have [and do] get told to RTFM on occasion - no one is safe
 ;-)
 
 I suggest using a search engine to start with and see what that turns
 up...
 somehow I can't believe that nobody has ever written a regexp that matches
 urls,
 for instance try reading this page in the manual (hint: look at the the
 user
 notes)
 
   http://php.net/preg_match
 
 come back when/if you get stuck.
 
 
  preg_match_all('#\[LEVEL([0-9])\](.*)\[/LEVEL[0-9]]#Uim', $arcContent,
  $tmpMatches);
 
  $arcContent = preg_replace('#\[LEVEL([0-9])\](.*)\[/LEVEL[0-9]]#Uim',
  '###URL###', $arcContent);
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 __ NOD32 1.1541 (20060516) Information __
 
 This message was checked by NOD32 antivirus system.
 http://www.eset.com

Bearing in mind that none of the replies (particularly that of Jochem, one
of the posters that should be held in high regard) have been rude in any way
at all, I understand your plight with regex's

You might want to try the Regex Coach... It allows you to test your regex's
offline and can really help

http://www.weitz.de/regex-coach/

HTH

Dan

Personal note: Stop using Lookout... it sucks

-- 
http://chrome.me.uk

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



RE: [PHP] Regex Help for URL's [ANSWER]

2006-05-16 Thread Chrome

 -Original Message-
 From: Robert Samuel White [mailto:[EMAIL PROTECTED]
 Sent: 17 May 2006 01:16
 To: php-general@lists.php.net
 Subject: RE: [PHP] Regex Help for URL's [ANSWER]
 
 All pages used by my content management system must be in a valid format.
 
 Old-school style pages are never created so the solution I have come up
 with
 is perfect for my needs.
 
 Thank you.

Doesn't that make it a proprietary solution? IMHO offering the regex may
create a false situation for people... So the answer may not be for everyone

Might be wrong :)

Dan

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



RE: [PHP] Regex Help for URL's [ANSWER]

2006-05-16 Thread Chrome
 -Original Message-
 From: Robert Samuel White [mailto:[EMAIL PROTECTED]
 Sent: 17 May 2006 01:28
 To: php-general@lists.php.net
 Subject: RE: [PHP] Regex Help for URL's [ANSWER]
 
 In my opinion, it is the most reasonable solution.  I have looked all over
 the web for something else, but this works perfectly for me.  It's
 impossible to tell where an url starts and ends if you don't have it in
 quotes or single quotes.  If someone really needs to find all the urls in
 a
 page, then they'll code their pages to make use of this limitation.
 
 -Original Message-
 From: Chrome [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, May 16, 2006 8:24 PM
 To: 'Robert Samuel White'; php-general@lists.php.net
 Subject: RE: [PHP] Regex Help for URL's [ANSWER]
 
 
  -Original Message-
  From: Robert Samuel White [mailto:[EMAIL PROTECTED]
  Sent: 17 May 2006 01:16
  To: php-general@lists.php.net
  Subject: RE: [PHP] Regex Help for URL's [ANSWER]
 
  All pages used by my content management system must be in a valid
 format.
 
  Old-school style pages are never created so the solution I have come up
  with
  is perfect for my needs.
 
  Thank you.
 
 Doesn't that make it a proprietary solution? IMHO offering the regex may
 create a false situation for people... So the answer may not be for
 everyone
 
 Might be wrong :)
 
 Dan
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 __ NOD32 1.1542 (20060516) Information __
 
 This message was checked by NOD32 antivirus system.
 http://www.eset.com

If we are talking clickable links, why not focus on the a construct
itself? Otherwise URLs are just part of the page's textual content... Very
difficult to parse that

Disseminating an a tag isn't brain-meltingly difficult with a regex if you
put your mind to it... With or without quotes, be they single, double or
non-existent


If I've misunderstood please chastise me :)

HTH

Dan

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



RE: [PHP] Regex Help for URL's [ANSWER]

2006-05-16 Thread Chrome
 -Original Message-
 From: Robert Samuel White [mailto:[EMAIL PROTECTED]
 Sent: 17 May 2006 01:42
 To: php-general@lists.php.net
 Subject: RE: [PHP] Regex Help for URL's [ANSWER]
 
 
  If we are talking clickable links, why not focus on the a construct
  itself? Otherwise URLs are just part of the page's textual content...
 Very
  difficult to parse that
 
  Disseminating an a tag isn't brain-meltingly difficult with a regex if
  you put your mind to it... With or without quotes, be they single,
 double
  or non-existent
 
 If I've misunderstood please chastise me :)
 
 HTH
 
 Dan
 
 
 Dan,
 
 That's what I was doing.  I was parsing A:HREF, IMG:SRC, etc.
 
 But when I implemented a new feature on my network, where you could click
 on
 a row and have it take you to another domain, I need a better solution.
 
 Go to http://www.enetwizard.ws and it might make more sense.
 
 All the links on the left have an ONCLICK=location.href = '' attribute in
 the TR tag.
 
 This solution allowed me to make sure those links included the session
 information, just like the A:HREF links do.
 
 It also had the advantage of updating the links in my CSS.

O that breaks accessibility standards! Compliment the 'onclick's with
onkeydown at least :)

But still you get a solid onclick=... scenario

If these are visible in the source then they are fairly easy to pick out

Though you may need more than 1 regex ;)

My complaint here is, don't break accessibility :)

Dan


-- 
http://chrome.me.uk

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



RE: [PHP] 代理合作

2006-05-09 Thread Chrome
snip
It came thru with an incomplete sender envelope, and most mail servers 
will append it's own domain to that (hint: good way to configure your 
mail server to catch this; don't allow mis-formed senders)
/snip

Thanks John that clears up a lot... I'm going to put your advice into action

Cheers

Dan

-- 
http://chrome.me.uk
__ NOD32 1.1527 (20060509) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



RE: [PHP] 代理合作

2006-05-08 Thread Chrome
Strange the spam email came to me from [EMAIL PROTECTED] Virtua is my host

Anyone else?

Dan

-- 
http://chrome.me.uk
 

-Original Message-
From: Robert Cummings [mailto:[EMAIL PROTECTED] 
Sent: 09 May 2006 00:04
To: [EMAIL PROTECTED]
Cc: PHP-General
Subject: Re: [PHP] 代理合作

Is it a compliment when a spammer spoofs your domain? *heheh*

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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


__ NOD32 1.1525 (20060508) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



RE: [PHP] Re: php - js (was Javascript Navigation)

2006-04-28 Thread Chrome
snip
  Java
  ... Sucks.
 Because?

You know why!
/snip

Um I don't... Would you mind explaining for the hard of thinking please?
(that's me by the way :) )

Cheers

Dan

-- 
http://chrome.me.uk

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



RE: [PHP] how to keep spaces in parameters in URL?

2006-04-24 Thread Chrome
http://php.net/manual/en/function.urlencode.php

Should get you what you need :)

Dan

-- 
http://chrome.me.uk
 
-Original Message-
From: Bing Du [mailto:[EMAIL PROTECTED] 
Sent: 24 April 2006 22:42
To: php-general@lists.php.net
Subject: [PHP] how to keep spaces in parameters in URL?

Hello,

==
?php
$name = 'foo bar';

echo a href=/index.php?name=. $name .Foo Bar/a;
?
==

Then the URL showed up at the bottom border of the browser has 'name=foo'.

What should I do to have 'name=foo bar' in the URL?  I tried
htmlspecialchars but did not see any difference.

I'd appreciate any help.

Bing

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


__ NOD32 1.1504 (20060424) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



RE: [PHP] 2 questions: Search in array and detect JS

2006-04-15 Thread Chrome
[snip]
script language=javascript
!--
 location.href = '/url/for/ajax/page.php';
--
/script
[/snip]

My only concern with this method is that it constitutes an exit trap... For
example, if a user connects to your index page from, say, Google they will
be redirected over to your Ajax page... All good, except if they click Back
to return to the SE page they will immediately bounce back to your Ajax page

Something to consider might be:

noscript
Sorry! This page requires Javascript to function properly! Please enable it
or get a decent browser
/noscript

!-- Normal page functions --

I haven't tested it so there is a chance it's fiction :)

Of course, if web standards aren't a concern it makes no difference

HTH

Dan

 
---
http://chrome.me.uk
 
-Original Message-
From: Ryan A [mailto:[EMAIL PROTECTED] 
Sent: 15 April 2006 14:26
To: php
Cc: Stut
Subject: Re: [PHP] 2 questions: Search in array and detect JS

Hey Stut,
Thanks for replying.

---


The way I do this is to serve the 'notmal page' first, but with the
following snippet of JS in it...

script language=javascript
!--
 location.href = '/url/for/ajax/page.php';
--
/script--Makes sense and pretty easy, this was
suggested a while back, since you have supported itI think I'll start using
this method.--- You should be able to craft some combination
of array_walk and a custom
function that checks each element with stristr to do what you need.
-Actually, I solved this thanks to Richard from the list who
suggested strpos, a function I had never usedbefore ( Tedd from the list
gave me the same suggestion as you to use stristr, I didnt want to use
stristr as its a bit expensive esp with a really large array) the problem I
ran into was that strpos is a php5 functionbut reading the user
contributed articles on strpos at thephp site I got the code that does
exactly that in 2-3 linesCheers!

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


__ NOD32 1.1490 (20060415) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



RE: [PHP] 2 questions: Search in array and detect JS

2006-04-15 Thread Chrome
How about

?php $js = true; ?

noscript
?php $js = false; ?
/noscript

?php
if ($js){
// whizzy Ajax code (or file include)
} else {
// generic warning (or include non-JS base file)
}
?

I know that would work but does it give the desired effect?

Dan

 
---
http://chrome.me.uk
 

-Original Message-
From: tedd [mailto:[EMAIL PROTECTED] 
Sent: 15 April 2006 15:10
To: Chrome; 'Ryan A'; 'php'
Cc: 'Stut'
Subject: RE: [PHP] 2 questions: Search in array and detect JS

Something to consider might be:

noscript
Sorry! This page requires Javascript to function properly! Please enable it
or get a decent browser
/noscript

!-- Normal page functions --

I haven't tested it so there is a chance it's fiction :)

Of course, if web standards aren't a concern it makes no difference

Dan


It works and if you want it to validate, just enclose the paragraph 
in p/p, like so:

noscript
p
Sorry! This page requires Javascript to function properly! Please enable it
or get a decent browser.
/p
/noscript

To bad that php within those tags is read regardless or we would have 
an easy way to detect js.

tedd
-- 


http://sperling.com

__ NOD32 1.1490 (20060415) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



RE: [PHP] 2 questions: Search in array and detect JS

2006-04-15 Thread Chrome
Yep just realised my half-witted mistake (and what tedd was getting at)

Sorry about that

Dan

 
---
http://chrome.me.uk
 

-Original Message-
From: cajbecu [mailto:[EMAIL PROTECTED] 
Sent: 15 April 2006 15:40
To: Chrome
Cc: 'tedd'; 'Ryan A'; 'php'; 'Stut'
Subject: Re: [PHP] 2 questions: Search in array and detect JS

In your script, $js will be false false!

Chrome wrote:
 How about
 
 ?php $js = true; ?
 
 noscript
   ?php $js = false; ?
 /noscript
 
 ?php
 if ($js)  {
   // whizzy Ajax code (or file include)
 } else {
   // generic warning (or include non-JS base file)
 }
 ?
 
 I know that would work but does it give the desired effect?
 
 Dan
 
  
 ---
 http://chrome.me.uk
  
 
 -Original Message-
 From: tedd [mailto:[EMAIL PROTECTED] 
 Sent: 15 April 2006 15:10
 To: Chrome; 'Ryan A'; 'php'
 Cc: 'Stut'
 Subject: RE: [PHP] 2 questions: Search in array and detect JS
 
 Something to consider might be:

 noscript
 Sorry! This page requires Javascript to function properly! Please enable
it
 or get a decent browser
 /noscript

 !-- Normal page functions --

 I haven't tested it so there is a chance it's fiction :)

 Of course, if web standards aren't a concern it makes no difference

 Dan
 
 
 It works and if you want it to validate, just enclose the paragraph 
 in p/p, like so:
 
 noscript
 p
 Sorry! This page requires Javascript to function properly! Please enable
it
 or get a decent browser.
 /p
 /noscript
 
 To bad that php within those tags is read regardless or we would have 
 an easy way to detect js.
 
 tedd


__ NOD32 1.1490 (20060415) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



RE: [PHP] Include Problem

2006-04-15 Thread Chrome
Try 

include($_SERVER['DOCUMENT_ROOT'] . /cms/templates/footer.php);

maybe?

Dan
 
---
http://chrome.me.uk
 

-Original Message-
From: Shaun [mailto:[EMAIL PROTECTED] 
Sent: 15 April 2006 20:05
To: php-general@lists.php.net
Subject: [PHP] Include Problem

Hi,

I am having problems with an include statement, i am using the following
statement in an effort to include a footer file on my page:

include(/cms/templates/footer.php);

However I get the following error:

Warning: main(/cms/templates/footer.php): failed to open stream: No such
file or directory in /home/m/y/mysite/public_html/cms/news/index.php on line
38

Warning: main(/cms/templates/footer.php): failed to open stream: No such
file or directory in /home/m/y/mysite/public_html/cms/news/index.php on line
38

Warning: main(): Failed opening '/cms/templates/footer.php' for inclusion
(include_path='.:/lib/php') in
/home/m/y/mysite/public_html/cms/news/index.php on line 38

The file is definitely there, the script just doesn't seem to be picking it
up, has anyone else had this problem?

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


__ NOD32 1.1490 (20060415) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



RE: [PHP] RADICORE ramework released

2006-04-13 Thread Chrome
[snip]
Is anything better than .NET?
[/snip]

Odd... I always thought it was .NOT

 
---
http://chrome.me.uk
 
-Original Message-
From: Tony Marston [mailto:[EMAIL PROTECTED] 
Sent: 13 April 2006 17:26
To: php-general@lists.php.net
Subject: Re: [PHP] RADICORE ramework released


Jochem Maas [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Anas Mughal wrote:
 A question for the folks who have tried it out:

 Is it better than Ruby on Rails?

 is blue better than red?
 anyone care for a holy war?
 am I having a bad day?

Are brains better than brawn?
Is PHP better than Java?
Is anything better than .NET?

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org 

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


__ NOD32 1.1487 (20060413) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



RE: [PHP] interview

2006-04-13 Thread Chrome
[snip]
How would you like it if someone who didn't have a clue as to your
expertise, interviewed you and then judged you as to what you know?
[/snip]

Like upper management? ;)

Dan

 
---
http://chrome.me.uk
 
-Original Message-
From: tedd [mailto:[EMAIL PROTECTED] 
Sent: 13 April 2006 19:49
To: Mad Unix; php-general@lists.php.net
Subject: Re: [PHP] interview

At 5:21 PM +0200 4/13/06, Mad Unix wrote:
can you please send some interview questions for php
i have in few days to inteview some people.


--
madunix

no offense meant

If you know php, why are you asking us do your work for you?

else

What are you doing interviewing someone for a php position?

How would you like it if someone who didn't have a clue as to your 
expertise, interviewed you and then judged you as to what you know?

I took an interview one time where the interviewer had better things 
to do and sent in two teenagers to interview me. First, they didn't 
have a * clue as to what I was about nor what I could offer the 
company; Second, I had underwear older than them so they weren't too 
savvy in interview techniques.

A week after the interview, I received a letter from the company 
telling me that I didn't have the qualifications they were looking 
for. Less than two years later the company folded -- no surprise 
there huh? Imagine a company having an interviewer who's clueless in 
judging the qualifications of an applicant. If I worked for a company 
like that, I would be looking for another position.

/no offense meant

tedd


-- 


http://sperling.com

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


__ NOD32 1.1488 (20060413) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



RE: [PHP] php varible in Javascript alert()

2006-04-11 Thread Chrome
Does $errorMessage have any single quotes in it? Eg:

Can't connect to DB

Because if it does it will cause a Javascript error:

alert('Can't connect to DB');

Just another thing to look for :)

Dan
 
---
http://chrome.me.uk
 
-Original Message-
From: Mace Eliason [mailto:[EMAIL PROTECTED] 
Sent: 11 April 2006 19:41
To: php-general@lists.php.net
Subject: [PHP] php varible in Javascript alert()

Hi,

I am not sure why this won't work I am pretty sure I have done it before;

if($error)
{
  echo $errorMessage;  // for testing error message is displayed to screen
  echoscript language=\JavaScript\alert('$errorMessage');/script;
}

I am capturing all the errors from a form and then output them all at once

Thanks for any help

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


__ NOD32 1.1482 (20060411) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



RE: [PHP] php varible in Javascript alert()

2006-04-11 Thread Chrome
Alert isn't a native PHP command so:

?php alert('echo addslashes($errorMsg);'); ?

wouldn't work... This might though:

?php
$string = Can't connect to DB; // or 'Can\'t connect to DB';
echo 'script type=text/javascript language=javascriptalert(\'' .
addslashes($string) . '\'); /script '; ?
?

I think the line breaks may go a bit wonky :|

HTH

Dan

---
http://chrome.me.uk
 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Anthony
Ettinger
Sent: 12 April 2006 00:58
To: Chrome
Cc: Mace Eliason; php-general@lists.php.net
Subject: Re: [PHP] php varible in Javascript alert()

?php alert('echo addslashes($errorMsg);'); ?

On 4/11/06, Chrome [EMAIL PROTECTED] wrote:
 Does $errorMessage have any single quotes in it? Eg:

 Can't connect to DB

 Because if it does it will cause a Javascript error:

 alert('Can't connect to DB');

 Just another thing to look for :)

 Dan

 ---
 http://chrome.me.uk

 -Original Message-
 From: Mace Eliason [mailto:[EMAIL PROTECTED]
 Sent: 11 April 2006 19:41
 To: php-general@lists.php.net
 Subject: [PHP] php varible in Javascript alert()

 Hi,

 I am not sure why this won't work I am pretty sure I have done it before;

 if($error)
 {
   echo $errorMessage;  // for testing error message is displayed to screen
   echoscript language=\JavaScript\alert('$errorMessage');/script;
 }

 I am capturing all the errors from a form and then output them all at once

 Thanks for any help

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


 __ NOD32 1.1482 (20060411) Information __

 This message was checked by NOD32 antivirus system.
 http://www.eset.com

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





--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html

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



RE: [PHP] php varible in Javascript alert()

2006-04-11 Thread Chrome
Your example will earn you a { missing ; before statement } error from the
JS interpreter... Though it will work if you add quotes:

?php $phpError = This is a test; ?

script language=javascript

var errorMsg = '?php echo addslashes($phpError) ?';
alert('error found: ' + errorMsg);

/script

Also I removed the $ prefixing the JS vars... It's not necessary :)

HTH

Dan

PS Thinking on it why not just:

script language=javascript

alert('error found: ?php echo addslashes($phpError) ?');

/script


---
http://chrome.me.uk
 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Anthony
Ettinger
Sent: 12 April 2006 01:32
To: Chrome
Cc: Mace Eliason; php-general@lists.php.net
Subject: Re: [PHP] php varible in Javascript alert()

Yes, alert() as in the javascript:

script language=javascript

var $errorMsg = ?php echo addslashes($phpError) ?;
alert('error found: ' + $errorMsg);

/script



On 4/11/06, Chrome [EMAIL PROTECTED] wrote:
 Alert isn't a native PHP command so:

 ?php alert('echo addslashes($errorMsg);'); ?

 wouldn't work... This might though:

 ?php
 $string = Can't connect to DB; // or 'Can\'t connect to DB';
 echo 'script type=text/javascript language=javascriptalert(\'' .
 addslashes($string) . '\'); /script '; ?
 ?

 I think the line breaks may go a bit wonky :|

 HTH

 Dan

 ---
 http://chrome.me.uk


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Anthony
 Ettinger
 Sent: 12 April 2006 00:58
 To: Chrome
 Cc: Mace Eliason; php-general@lists.php.net
 Subject: Re: [PHP] php varible in Javascript alert()

 ?php alert('echo addslashes($errorMsg);'); ?

 On 4/11/06, Chrome [EMAIL PROTECTED] wrote:
  Does $errorMessage have any single quotes in it? Eg:
 
  Can't connect to DB
 
  Because if it does it will cause a Javascript error:
 
  alert('Can't connect to DB');
 
  Just another thing to look for :)
 
  Dan
 
  ---
  http://chrome.me.uk
 
  -Original Message-
  From: Mace Eliason [mailto:[EMAIL PROTECTED]
  Sent: 11 April 2006 19:41
  To: php-general@lists.php.net
  Subject: [PHP] php varible in Javascript alert()
 
  Hi,
 
  I am not sure why this won't work I am pretty sure I have done it
before;
 
  if($error)
  {
echo $errorMessage;  // for testing error message is displayed to
screen
echoscript
language=\JavaScript\alert('$errorMessage');/script;
  }
 
  I am capturing all the errors from a form and then output them all at
once
 
  Thanks for any help
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
  __ NOD32 1.1482 (20060411) Information __
 
  This message was checked by NOD32 antivirus system.
  http://www.eset.com
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 


 --
 Anthony Ettinger
 Signature: http://chovy.dyndns.org/hcard.html





--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html

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



RE: [PHP] Parsing variables within string variables

2006-04-07 Thread Chrome
Or change the quote style to double ()

Just another option

Dan

(If I'm right this time... I really can't afford 88AUD/hr... :) )
---
http://chrome.me.uk
 

-Original Message-
From: Jay Blanchard [mailto:[EMAIL PROTECTED] 
Sent: 07 April 2006 18:12
To: David Clough; php-general@lists.php.net
Subject: RE: [PHP] Parsing variables within string variables

[snip]

I have a variable containing a string that contains the names of 
variables, and want to output the variable with the variables it 
contains evaluated. E.g. 

   $foo contains 'cat'
   $bar contains 'Hello $foo'

and I want to output $bar as 

   Hello cat

The problem is that if I use

   echo $bar

I just get

   Hello $foo
[/snip]

$bar = 'Hello' . $foo;

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


__ NOD32 1.1475 (20060406) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



RE: [PHP] Parse Error on SQL Insert

2006-04-07 Thread Chrome
Backticks (`) encapsulate table or database names

I was thinking maybe if the array references were encapsulated in curly
braces {}:

$_POST['model'] to {$_POST['model']}

Of course if the field in the DB isn't numeric this would be
'{$_POST['model']}'

Dan
 
---
http://chrome.me.uk
 

-Original Message-
From: Joe Henry [mailto:[EMAIL PROTECTED] 
Sent: 07 April 2006 20:53
To: php-general@lists.php.net; [EMAIL PROTECTED]
Subject: Re: [PHP] Parse Error on SQL Insert

On Friday 07 April 2006 1:37 pm, Tom Chubb wrote:
 $insertSQL = INSERT INTO cars (model, `year`, details, price, image1,

Not sure if this is your problem, but those look like backticks around year 
instead of single quotes. Should there even be quotes there?

HTH
-- 
Joe Henry
www.celebrityaccess.com
[EMAIL PROTECTED]

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


__ NOD32 1.1475 (20060406) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



RE: [PHP] int to string

2006-04-05 Thread Chrome
Won't work

20 would become 'two zero' not 'twenty' as the for loop identifies 1
character at a time

Don't have any suggestions... Just critisms :-D... hehe sorry

Dan
 
---
http://chrome.me.uk
 

-Original Message-
From: Peter Hoskin [mailto:[EMAIL PROTECTED] 
Sent: 06 April 2006 00:47
To: Tanner Postert; php-general@lists.php.net
Subject: Re: [PHP] int to string

Tanner Postert wrote:
 I don't think it's built in, so I was wondering ya'll would recommend as
the
 best way to convert int to string, not basic type casting, but converting
to
 the english word the int represents.

 Something like this:

 5 = Five or 20 = Twenty
   
You're right - its not built in.

You could use something like this

function numerictotext($numeric) {
  for ($i;$i  strlen($numeric);$i++) {
$character = substr($numeric,$i,1);
switch ($character) {
  case 0:
$return .= 'Zero ';
break;
  case 1:
$return .= 'One ';
break;
}
  }
  return $return;
}

Regards,
Peter Hoskin
Do I get a cookie?

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


__ NOD32 1.1474 (20060405) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



RE: [PHP] int to string

2006-04-05 Thread Chrome
Please accept my apologies... I only scanned then reread and spotted the
obvious (deliberate) omissions

It is late here :)

Sorry

Dan

 
---
http://chrome.me.uk
 

-Original Message-
From: Peter Hoskin [mailto:[EMAIL PROTECTED] 
Sent: 06 April 2006 01:06
To: Chrome; php-general@lists.php.net
Subject: Re: [PHP] int to string



Chrome wrote:
 Won't work

 20 would become 'two zero' not 'twenty' as the for loop identifies 1
 character at a time

 Don't have any suggestions... Just critisms :-D... hehe sorry
   
You don't say... it won't even convert 2 to 'two' so obviously this is 
an EXAMPLE and not a COMPLETE SOLUTION.

Want a complete solution? $88 AUD/hr.

Want to criticize? look at the for loop, its infinite. $i isn't set, the 
first call to it should actually be $i = 0

Regards,
Peter Hoskin

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


__ NOD32 1.1474 (20060405) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



RE: [PHP] php, sessions and ie

2006-04-04 Thread Chrome
I let GC and cookie expiration handle ending the session... The cookie was
only set for 15 minutes

Dan

 
---
http://chrome.me.uk
 

-Original Message-
From: Dallas Cahker [mailto:[EMAIL PROTECTED] 
Sent: 04 April 2006 19:41
To: php-general@lists.php.net
Subject: Re: [PHP] php, sessions and ie

How are you destroying the sessions if they leave the site (dont logout). do
you check on activity or something else?

On 4/4/06, Dan Parry [EMAIL PROTECTED] wrote:

 I have had some issues with sessions and IE in the past and used the
 following code to start the session

 ?php
 if (isset($SessID)){ session_id($SessID); }
 session_start();
 header(Cache-control: private); // IE 6 Fix.
 setcookie(SessID, session_id(), time() + 60 * 15);
 ?

 Now, though, I always use a DB to store sessions... Much nicer

 HTH

 Dan

 -
 Dan Parry
 Senior Developer
 Virtua Webtech Ltd
 http://www.virtuawebtech.co.uk
 -Original Message-
 From: Dallas Cahker [mailto:[EMAIL PROTECTED]
 Sent: 04 April 2006 16:19
 To: php-general@lists.php.net
 Subject: [PHP] php, sessions and ie

 I've been hearing some of my friends saying there is an issue with Session
 in PHP and IE having problems with them.  Is that true?  If it is how do
 people get around this?  Session information saved to db?  Session id in
 cookie?


 __ NOD32 1.1454 (20060321) Information __

 This message was checked by NOD32 antivirus system.
 http://www.eset.com




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



RE: [PHP] Need a CRM recommendation

2006-04-04 Thread Chrome
Apparently vTiger is quite good but I've had no experience of it

http://www.vtiger.com/

Dan

 
---
http://chrome.me.uk
 

-Original Message-
From: Jay Blanchard [mailto:[EMAIL PROTECTED] 
Sent: 04 April 2006 17:50
To: php-general@lists.php.net
Subject: [PHP] Need a CRM recommendation

Howdy group!

I need recommendations for a good CRM done in PHP, thanks!

Jay

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


__ NOD32 1.1470 (20060404) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



RE: [PHP] redirect using php

2006-04-04 Thread Chrome
http://uk.php.net/manual/en/function.header.php

 
---
http://chrome.me.uk
 

-Original Message-
From: Schalk [mailto:[EMAIL PROTECTED] 
Sent: 04 April 2006 22:21
To: php-general@lists.php.net
Subject: [PHP] redirect using php

Greetings All,

In JSP I have access to a function called sendRedirect() to send a user 
from one page to another, usually after some processing completed. Is 
there a similar function in PHP?

After processing a form and sending the data via email, I need to 
redirect them to another page. I currently use a method of merely 
replacing the form with some 'thank you' text after submitting the form, 
I prefer this but, the client wants me to redirect to another page. All 
help appreciated. Thanks!

-- 
Kind Regards
Schalk Neethling
Web Developer.Designer.Programmer.President
Volume4.Business.Solution.Developers

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


__ NOD32 1.1471 (20060404) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



RE: [PHP] Re: mysql_fecth_array() and function call as parameter

2006-04-03 Thread Chrome
Maybe try NOW() or CURRENT_DATE()?

Just a guess and sorry if it's already been mentioned

Dan

 
---
http://chrome.me.uk
 

-Original Message-
From: Joe Wollard [mailto:[EMAIL PROTECTED] 
Sent: 04 April 2006 00:38
To: Paul Goepfert
Cc: Jon Drukman; php-general@lists.php.net
Subject: Re: [PHP] Re: mysql_fecth_array() and function call as parameter

Paul,

Try TO_DAYS(curdate()) instead - if not you can't say we didn't try! ;-)

If that doesn't work you may want to try a MySQL list.

- Joe



On 4/3/06, Paul Goepfert [EMAIL PROTECTED] wrote:

 I included the or die function on the end of my query statement.  When
 I tested this on my web page I got the following error

 Query2 Failed: You have an error in your SQL syntax near '(curdate())' at
 line 1

 When this code executed:

 $query2 = mysql_query(SELECT dayNum FROM Days WHERE dayNum =
 day(curdate())) ;

 I can't see where the error is.  Can anyone see the error?

 The table name is correct because I have another drop down box that
 gets all dates in the table and outputs it with no error.  I also
 tested the above SQL statement on a local copy of mysql (version
 5.0.18-nt) and it worked with out any errors.  And this code works on
 a different web server. Mysql client version 3.23.49.  However it does
 not work on mysql client version 3.23.54.  Also both php versions are
 the same.

 Thanks
 Paul

 On 4/3/06, Jon Drukman [EMAIL PROTECTED] wrote:
  Paul Goepfert wrote:
 
   function determineDay ()
 {
 $return = ;
 $query1 = mysql_query(SELECT months FROM Month WHERE
 m_id =
   month(curdate()));
 $query2 = mysql_query(SELECT dayNum FROM Days WHERE
 dayNum =
   day(curdate()));
 $query3 = mysql_query(SELECT year FROM Year WHERE year
 = year(curdate()));
 
  always Always ALWAYS check the error return!!!
 
  $query1 = mysql_query(SELECT months FROM Month WHERE m_id =
  month(curdate())) or die(query1 failed:  . mysql_error());
 
  do this religiously on every single mysql_query.  in fact, write a
  wrapper function to do it for you - that's what i do.
 
   If anyone can find my error please let me know.  I have looked at this
   for about an hour and I can't figure it out.
 
  you probably could have saved an hour by checking the error code.
 
  -jsd-
 

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



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



RE: [PHP] Div-element at same vert. position?

2006-03-28 Thread Chrome
Try drag-drop without absolute ;-)

Dan

 
---
http://chrome.me.uk
 

-Original Message-
From: Jay Blanchard [mailto:[EMAIL PROTECTED] 
Sent: 28 March 2006 21:21
To: Jochem Maas
Cc: PHP General
Subject: RE: [PHP] Div-element at same vert. position?

[snip]
what's wrong with absolute positioning?
[/snip]

Because there is only one absolute; that there are no absolutes.

IE, FF, Opera and others all treat the box model differently.

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


__ NOD32 1.1459 (20060327) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



RE: [PHP] Why does this work on one server, but not another?

2006-03-23 Thread Chrome
[snip author=Michael Crute]
I would base64encode the image string before puting it into the database
then you would probably not run in to quoting issues.
[/snip]

Have you tried this?

I realise a base64 increases the size of the target but it recognised as the
best way of storing an image in a DB

Apologies if this has already been restated :)

Another thought: What type of field are you using for this storage?

Dan

 
---
http://chrome.me.uk
 
-Original Message-
From: tedd [mailto:[EMAIL PROTECTED] 
Sent: 24 March 2006 00:42
To: php-general@lists.php.net
Subject: RE: [PHP] Why does this work on one server, but not another?

Hi gang:

Okay, another update:

I tried all sorts of combinations of assorted functions as well as 
reading every source I could find. I won't bore you with the details 
-- but, this is as far as I've gotten.

For storing an image into MySQL I simply used:

$image_large = mysql_real_escape_string($buffer);

Then for displaying the image, I use:

if (get_magic_quotes_gpc())
{
$fileContent = stripslashes($fileContent);
}

This now works for the server that didn't work before. However, the 
other server now doesn't show an image unless I comment out 
stripslashes($fileContent) statement -- and then it works. So, I have 
found solutions for both servers, just not one solution that works 
for both servers.

Remember, both servers show magic_quotes_gpc as ON. The only 
difference I see between them is that magic_quotes_runtime is ON 
for one server and is OFF for the other -- would that make a 
difference?

What say you now?

tedd
-- 


http://sperling.com

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


__ NOD32 1.1456 (20060323) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



RE: [PHP] PHP, SQL, AJAX, JS and populating a SelectBox?

2006-03-18 Thread Chrome
Ajax can be made to use POST by adding

req.open(POST, url, true); // true creates an asynchronous connection
req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');

where req is the XHR object

Also why not use the same style of formatting for the response as the
request uses... eg:

foo=My Foobar=My Barwibble=My Wibble

The first value is the option value and the second is the option text

FWIW I think that using innerHTML is a bad idea as the elements created
aren't included in the DOM tree... creating the elements using the DOM is a
much better idea... It may be more lengthy by that can be cut down some with
clever scripting :)

HTH

Dan

---
http://chrome.me.uk
 

-Original Message-
From: Daevid Vincent [mailto:[EMAIL PROTECTED] 
Sent: 18 March 2006 22:45
To: php-general@lists.php.net
Cc: 'tedd'
Subject: RE: [PHP] PHP, SQL, AJAX, JS and populating a SelectBox?

No. All of the examples I find are like the 'google' style suggest-thingy.

I want to dynamically (AJAX) populate an actual:

select
option value='1' foo 
option value='2' bar
option value='3' fee
option value='4' fum
/select 

Basically the core problem is passing back an 'array' of data from mysql
into JS to make the box.

What I've 'hacked' together so far is that I return my values like so from
PHP/mySQL to JS AJAX:

$tmp = 1|foo|2|bar|3|fee|4|fum;

And then in JS, I do this:

tokens = tmp.split('|');

Then use a for(i++2) loop and build up the options (key and value) of the
select box.

But, to me this seems like a hack.

Plus I'm a little worried that there is going to be a size limit of
characters or data or something? After all, AFAIK AJAX uses $_GET method
right? Not $_POST. So I think GET has a limit of like 1024 characters,
whereas POST doesn't have that limit.

My select box could have potentially thousands of items in it. Say for
example, IP addresses. I have supporting select boxes to filter by ranges,
or groups, or whatever, but there's nothing restricting a user from NOT
using them, and just wanting to see ALL the IP addresses...

So, I guess what I'm asking, is, is this the right way to solve this
challenge, or is there a better/more accepted way?

 -Original Message-
 From: tedd [mailto:[EMAIL PROTECTED] 
 Sent: Saturday, March 18, 2006 1:02 PM
 To: php-general@lists.php.net; Daevid Vincent
 Subject: Re: [PHP] PHP, SQL, AJAX, JS and populating a SelectBox?
 
 I need to dynamically update a select box
 with results from a SQL database using AJAX,
 but I can't find a single example of how to do this.
 
 Basically I have a text input field, and a select box.
 As someone types in the input field,
 I want the select box to fill in the results of matches.
 
 I can fill in a DIV (as per the ten million examples out there)
 and that's all fine and dandy, but way too simplistic for 
 what I need.
 
 Select Box?
 
 Do you mean a Selection List, that will change as the user types in 
 an input field like this:
 
 http://www.itsyourdomain.com/
 
 Just type domain name into the search box -- is that what 
 you're looking for?
 
 tedd
 -- 
 --
 --
 http://sperling.com
 

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


__ NOD32 1.1450 (20060318) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



RE: [PHP] Case issue with eregi_replace in text highlight function

2006-02-22 Thread Chrome
How about

function highlight_text($text, $highlight) {
   return preg_replace('/(' . $highlight . ')/i', 'span
class=highlight$1/span', $text); 
}

Case should be retained and the search is case insensitive

HTH

Dan
---
http://chrome.me.uk
 

-Original Message-
From: Nicolas Verhaeghe [mailto:[EMAIL PROTECTED] 
Sent: 23 February 2006 00:55
To: 'Chris'
Cc: php-general@lists.php.net
Subject: RE: [PHP] Case issue with eregi_replace in text highlight function

That's not where the issue is.

Eregi_replace conducts a case insensitive SEARCH but how the REPLACE
operates has nothing to do with it.

If you use ereg_replace, then it is most obviously not going to replace
MacOS with span class=highlightmacos/span or even span
class=highlightMacOS/span, because the string searched for is of a
different case.

But thanks for helping.

-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 22, 2006 5:39 PM
To: Nicolas Verhaeghe
Cc: php-general@lists.php.net
Subject: Re: [PHP] Case issue with eregi_replace in text highlight
function



 Here is the function:
 
 function highlight_text($text, $highlight) {
 return eregi_replace($highlight, span class=highlight . $highlight

 . /span, $text); }
 
 In this case, if the  text to highglight is:
 
 MacOS X Super Gizmo
 
 And a client searches for the string macos, the result will be:
 
 span class=highlightmacos/span X Super Gizmo

You're using the eregi_replace function - which does case insensitive 
replaces (read the man page).

Change it to use

ereg_replace

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

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

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


__ NOD32 1.1416 (20060222) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



RE: [PHP] Session problems

2006-02-16 Thread Chrome
Hi

I've checked the PHP ini and session.auto_start is off (0)

[snip]
Looks like your Session ID that you are trying to insert into the
database in your session_start_handler function is a duplicate of an
existing session.
[/snip]

It IS the existing session... I've verified this by being the only person
that knows where the site is :) (and matching IDs in the DB, natch)

This has stumped my hosting company as well as me

Successful conclusion rewards a night out :)

http://chrome.me.uk/snippets/  to view the issue (may need a few
refreshes)

Use admin/admin to log in on this site (it's in dev :) )

Ooo at this point I should mention I'm replying to this from my home
address, not work (yeah, I have no life...)

Thanks all

Dan
 
---
http://chrome.me.uk
 
-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED] 
Sent: 16 February 2006 21:26
To: Dan Parry
Cc: php-general@lists.php.net
Subject: Re: [PHP] Session problems

On Thu, February 16, 2006 3:50 am, Dan Parry wrote:
 I've been getting an error while using a custom session handler
 utilising a
 MySQL database

 The error I receive is:

 Duplicate entry 'PHPSESSID_REMOVED' for key 1

Looks like your Session ID that you are trying to insert into the
database in your session_start_handler function is a duplicate of an
existing session.

 Warning: Unknown(): A session is active. You cannot change the session
 module's ini settings at this time. in Unknown on line 0

This to me sounds like you have php.ini setting sessions to 'file' and
then you try to change it in, say, .htaccess but php.ini has
session.auto_start turned on, so you've already got an active 'file'
session going, and PHP ain't gonna let you change horses in mid-stream
to 'user' sessions...

Just a Wild Guess.

If you have .htaccess changing the session to 'user', try turning off
session.auto_start as well, and it may fix it.

You may also have to remove all cookies from your browser (and all
user's browsers) to clear out all old session data...

Or, perhaps, you could get away with changing the session ID name of
the Cookie, which might resolve the situation enough that the old
session data hanging around is a non-issue.

 I've contacted my hosting company regarding this but currently they
 don't
 seem to know the cause

-- 
Like Music?
http://l-i-e.com/artists.htm

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


__ NOD32 1.1412 (20060216) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



RE: [PHP] mysql/php date functions..

2005-09-26 Thread Chrome
Hi

The PHP time() function returns the number of seconds since the Unix epoch
(Jan 1 1970 midnight) whereas MySQL uses a readable datestamp

See here:

http://dev.mysql.com/doc/mysql/en/datetime.html

for the MySQL date, time and date/time types

and here

http://uk.php.net/manual/en/function.time.php

for time()... instead of using time(), use date() and format it for MySQL

http://uk.php.net/manual/en/function.date.php

That will allow you to use  and  in the SQL statements

HTH


Chrome™
http://www.chrome.me.uk


-Original Message-
From: bruce [mailto:[EMAIL PROTECTED] 
Sent: 26 September 2005 19:46
To: 'John Nichel'; php-general@lists.php.net
Subject: RE: [PHP] mysql/php date functions..

john...

that appears to be it!! although i would have assumes it would have done a
most significant bit fill with 0's...

so my question also comes down to .. do i use the php date functions for
date/time manipulation.. or do i use the mysql functions

any thoughts/suggestions...

-bruce


-Original Message-
From: John Nichel [mailto:[EMAIL PROTECTED]
Sent: Monday, September 26, 2005 11:19 AM
To: php-general@lists.php.net
Subject: Re: [PHP] mysql/php date functions..


bruce wrote:
 thanks...

 but that's not it john... i'm not worried about creating the sql_statement
 in the php...

 i'm concerned that i can't seem to craft/create a basic sql cmd within
mysql
 to get a value (other than NOW()) to work...

 if i do (from mysql)
  -- insert into foo (id, time) values (2, 33), it doesn't work...
 if i
  -- insert into foo (id, time) values (2, NOW()), it works!!...

 my question is why???

Without knowing the structure of your table, my guess is that the column
time is expecting a valid timestamp, and 33 is not a valid MySQL
timestamp.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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

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

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