php-general Digest 24 Jan 2006 14:35:15 -0000 Issue 3924

2006-01-24 Thread php-general-digest-help

php-general Digest 24 Jan 2006 14:35:15 - Issue 3924

Topics (messages 229147 through 229166):

Re: Reference Notices -- Urgent
229147 by: Richard Correia
229149 by: Todd Brown

Re: Can't printout class variable
229148 by: Sumeet
229161 by: Scott Gunn

Help with getting PHP to see Pear.
229150 by: Payne
229151 by: Payne
229152 by: Albert
229153 by: Sumeet
229157 by: Jesús Fernández

How would u strip the path?
229154 by: Nicholas Couloute
229155 by: Paul Scott

Re: [SOLVED] How would u strip the path?
229156 by: Nicholas Couloute

Announcement: PHP-Qt
229158 by: Thomas Moenicke

Book Sample Code Help
229159 by: Poppy Alexandra
229160 by: David Grant
229162 by: Jochem Maas
229163 by: Poppy Alexandra
229164 by: Poppy Alexandra
229165 by: Jochem Maas

XML-RPC and comment spam...
229166 by: Russell Jones

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
php-general@lists.php.net


--
---BeginMessage---
Hey Todd,

You need to check the setting of error reporting in php.ini file.
http://www.weberdev.com/Manuals/PHP/ref.errorfunc.html

Thanks
Richard



On 1/24/06, Todd Brown [EMAIL PROTECTED] wrote:

 I'm getting the following notices:

 Notice: Only variables should be assigned by reference in 
 Notice: Only variable references should be returned by reference in 

 The code in question comes from PayPal (their CC processing API,) so
 modifying it to correct the reference issues is *not* an option.

 On the actual implementation server (PHP 4.4.1), I am not receiving
 these errors.  On my test server (also 4.4.1), I am.  I have run
 phpinfo() on both servers and carefully compared the output; as far as I
 can tell they are configured identically.  I really need to be able to

---End Message---
---BeginMessage---
Thanks, Richard, that solved the problem.  I knew it was something like 
that, but was just running out of time!  I appreciate your help.


Cheers,
  Todd

Richard Correia wrote:

Hey Todd,

You need to check the setting of error reporting in php.ini file.
http://www.weberdev.com/Manuals/PHP/ref.errorfunc.html

Thanks
Richard



On 1/24/06, Todd Brown [EMAIL PROTECTED] wrote:

I'm getting the following notices:

Notice: Only variables should be assigned by reference in 
Notice: Only variable references should be returned by reference in 

The code in question comes from PayPal (their CC processing API,) so
modifying it to correct the reference issues is *not* an option.

On the actual implementation server (PHP 4.4.1), I am not receiving
these errors.  On my test server (also 4.4.1), I am.  I have run
phpinfo() on both servers and carefully compared the output; as far as I
can tell they are configured identically.  I really need to be able to



---End Message---
---BeginMessage---

Scott Gunn wrote:

This should be simple.  What am I doing wrong?

Here is the code that is failing:

$user = $_SESSION['user'];
print_r($user);
echo Welcome  . $user-firstName;

The print_r command prints out:

__PHP_Incomplete_Class Object ( [__PHP_Incomplete_Class_Name] = User 
[isLoggedIn] = 1 [lastName] = Gunn [firstName] = Scott )




try
$user = (User)$_SESSION['user'];
rest remains the same.

--
Sumeet Shroff
http://www.prateeksha.com
Web Design and Ecommerce Development, Mumbai India
---End Message---
---BeginMessage---
You led me down the right path.  I wasn't including the class definition 
file before adding the object to the session.


Thanks.

Sumeet wrote:

Scott Gunn wrote:

This should be simple.  What am I doing wrong?

Here is the code that is failing:

$user = $_SESSION['user'];
print_r($user);
echo Welcome  . $user-firstName;

The print_r command prints out:

__PHP_Incomplete_Class Object ( [__PHP_Incomplete_Class_Name] = User 
[isLoggedIn] = 1 [lastName] = Gunn [firstName] = Scott )




try
$user = (User)$_SESSION['user'];
rest remains the same.

---End Message---
---BeginMessage---
Hi, I just installed SuSE 10 and I am having a problem with my phpnuke 
site and my maia site. PHPNUKE gives me this error...


*Warning*: main(db/mysql.php): failed to open stream: No such file or 
directory in */srv/www/htdocs/bse/db/db.php* on line *53*


*Warning*: main(): Failed opening 'db/mysql.php' for inclusion 
(include_path='/usr/share/php') in */srv/www/htdocs/bse/db/db.php* on 
line *53*


*Fatal error*: Cannot instantiate non-existent class: sql_db in 
*/srv/www/htdocs/bse/db/db.php* on line *86


But if I copy my old php.ini from 9.1 it works just fine.

One maia, it says that it not install, I took a look at my phpinfo and I 
did see this


*'./configure' '--prefix=/usr' 

Re: [PHP] Help with getting PHP to see Pear.

2006-01-24 Thread Sumeet

Payne wrote:
Hi, I just installed SuSE 10 and I am having a problem with my phpnuke 
site and my maia site. PHPNUKE gives me this error...


*Warning*: main(db/mysql.php): failed to open stream: No such file or 
directory in */srv/www/htdocs/bse/db/db.php* on line *53*


*Warning*: main(): Failed opening 'db/mysql.php' for inclusion 
(include_path='/usr/share/php') in */srv/www/htdocs/bse/db/db.php* on 
line *53*




i think it has to do with the 'include_path' set in php.ini

include_path = 'your_path';


--
Sumeet Shroff
http://www.prateeksha.com
Web Design and Ecommerce Development, Mumbai India

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



[PHP] How would u strip the path?

2006-01-24 Thread Nicholas Couloute

how would u strip the path off of a variable? say that:
$bob = /home/s2music/b/bob.mp3;
I want bob just to be bob.mp3!
how would I do that?
~Nick Couloute
co-owner/Web Designer
Sidekick2Music.Com

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



Re: [PHP] How would u strip the path?

2006-01-24 Thread Paul Scott
On Tue, 2006-01-24 at 04:01 -0500, Nicholas Couloute wrote:
 how would u strip the path off of a variable? say that:

http://za2.php.net/manual/en/function.basename.php

basename it!

--Paul

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



Re: [PHP][SOLVED] How would u strip the path?

2006-01-24 Thread Nicholas Couloute

Thanks that is just what I needed!

On Tue, 24 Jan 2006 4:08 am, Paul Scott wrote:

On Tue, 2006-01-24 at 04:01 -0500, Nicholas Couloute wrote:

 how would u strip the path off of a variable? say that:


http://za2.php.net/manual/en/function.basename.php

basename it!

--Paul

~Nick Couloute
co-owner/Web Designer
Sidekick2Music.Com

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



Re: [PHP] Help with getting PHP to see Pear.

2006-01-24 Thread Jesús Fernández
if you look to your phpinfo it says:

'--without-pear'

Maybe you'll need to install it with pear support or is it right just to add
pear to the include_path?


--
Esú - http://esu.proyectoanonimo.com
http://www.proyectoanonimo.com


[PHP] Announcement: PHP-Qt

2006-01-24 Thread Thomas Moenicke
Hi,

The second release of PHP-Qt is now available. PHP-Qt provides an 
object-oriented interface to the Qt4 Framework and allows to write Qt 
applications in the PHP language. 
PHP-Qt is alpha software and still in a prototype stage, but the first 6 
tutorials from Qt documentation are working. I have ported these tutorials to 
PHP-Qt, and they are available in the tarball. 
For more information, visit http://php-qt.berlios.de/ .

-- 
Thomas

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



[PHP] Book Sample Code Help

2006-01-24 Thread Poppy Alexandra
Hi all. I am trying to run some PHP code I got from the O'Reilly book 
Spidering Hacks and it doesn't seem to be working. Please note, the 
functions were not inculded in the code, I had to copy it from the book so I 
might have made mistake. I thought perhaps an experienced PHP programmer 
might be able to pick the error. Does the code work for anyone else?


Thank you. Poppy

The error, and code are listed below:

phpserver$ php -q book-1.php
Parse error: parse error in book-1.php on line 90
phpserver$

#!/usr/bin/php -q

?php

/* include the scraping functions script:
include( scrape_func.php );
I commented this out and included in this file for clarity
*/

function getURL( $pURL ) {
$_data = null;
if( $_http = fopen( $pURL, r ) ) {
while( !feof( $_http ) ) {
$_data .= fgets( $_http, 1024 );
}
fclose( $_http );
}
return( $_data );
}

function cleanString( $pString ) {
	$_data = str_replace( array( chr(10), chr(13), chr(9) ), chr(32), $pString 
);

while( strpos( $_data, str_repeat( chr(32), 2 ), 0 ) != false ) 
{
$_data = str_replace( str_repeat( chr(32), 2 ), 
chr(32), $_data );
}
return( trim( $_data ) );
}

function getBlock( $pStart, $pStop, $pSource, $pPrefix = true ) {
$_data = null;
$_start = strpos( strtolower( $pSource ), strtolower( $pStart ), 0 );
$_start = ( $pPrefix == false ) ? $_start + strlen( $pStart ) : $_start;
$_stop = strpos( strtolower( $pSource ), strtolower( $pStop ), $_start 
);
if( $_start  strlen( $pElement )  $_stop  $_start ) {
$_data = trim( substr( $pSource, $_start, $_stop - $_start ) );
}
return( $_data );

function getElement( $pElement, $pSource ) {
$_data = null;
$pElement = strtolower( $pElement );
$_start = strpos( strtolower( $pSource ), chr(60) . $pElement, 0 );
$_start = strpos( $pSource, chr(62), $_start ) + 1;
	$_stop = strpos( strtolower( $pSource ), / . $pElement . chr(62), 
$_start );

if( $_start  strlen( $pElement )  $_stop  $_start ) {
$_data = trim( substr( $pSource, $_start, $_stop - $_start ) );
}
return( $_data );
}



/* Next, we'll get the raw source code of
  the page using our getURL(  ) function:  */
$_rawData = getURL( http://www.techdeals.net/; );

/* And clean up the raw source for easier parsing:  */
$_rawData = cleanString( $_rawData );

/* The next step is a little more complex. Because we've already
  looked at the HTML source, we know that the items start and
  end with two particular strings. We'll use these strings to
  get the main data portion of the page:*/
$_rawData = getBlock( div class=\NewsHeader\,
 /div div id=\MenuContainer\, $_rawData );

/* We now have the particular data that we want to parse into
  an itemized list. We do that by breaking the code into an
  array so we can loop through each item: */
$_rawData = explode( div class=\NewsHeader\, $_rawData );


/* While iterating through each value, we
  parse out the individual item portions:  */

foreach( $_rawData as $_rawBlock ) {
  $_item = array(  );
  $_rawBlock = trim( $_rawBlock );
  if( strlen( $_rawBlock )  0 ) {

 /*   The title of the item can be found in h2 ... /h2 tags   */
 $_item[ title ] = strip_tags( getElement( h2, $_rawBlock ) );

 /*   The link URL can is found between
  http://www.techdeals.net/rd/go.php?id= and*/
 $_item[ link ] = getBlock( http://www.techdeals.net/rd/go.php?id=;,
  chr(34), $_rawBlock );

 /*   Posting info is in span ... /span tags   */
 $_item[ post ] = strip_tags( getElement( span, $_rawBlock ) );

 /*   The description is found between an /div and a img tag   */
 $_item[ desc ] = cleanString( strip_tags( getBlock( /div,
 img, $_rawBlock ) ) );

 /*   Some descriptions are slightly different,
  so we need to clean them up a bit   */
 if( strpos( $_item[ desc ], Click here for the techdeal, 0 )  0 ) 
{
$_marker = strpos( $_item[ desc ], Click here for the techdeal, 
0 );

$_item[ desc ] = trim( substr( $_item[ desc ], 0, $_marker ) );
 }

 /*   Print out the scraped data   */
 print( implode( chr(10), $_item ) . chr(10) . chr(10) );

 /*   Save the data as a string (used in the mail example below)   */
 $_text .= implode( chr(10), $_item ) . chr(10) . chr(10);
  }
}

?

_
Ever wanted to be a TV Stylist? Win Your Dream Job at MyCareer 
http://dreamjob.mycareer.com.au/?s_cid=213322


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



Re: [PHP] Book Sample Code Help

2006-01-24 Thread David Grant
Poppy,

Poppy Alexandra wrote:
 Parse error: parse error in book-1.php on line 90

Please provide lines 89-91 of book-1.php only please.

David
-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

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



Re: [PHP] Can't printout class variable

2006-01-24 Thread Scott Gunn
You led me down the right path.  I wasn't including the class definition 
file before adding the object to the session.


Thanks.

Sumeet wrote:

Scott Gunn wrote:

This should be simple.  What am I doing wrong?

Here is the code that is failing:

$user = $_SESSION['user'];
print_r($user);
echo Welcome  . $user-firstName;

The print_r command prints out:

__PHP_Incomplete_Class Object ( [__PHP_Incomplete_Class_Name] = User 
[isLoggedIn] = 1 [lastName] = Gunn [firstName] = Scott )




try
$user = (User)$_SESSION['user'];
rest remains the same.



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



Re: [PHP] Book Sample Code Help

2006-01-24 Thread Jochem Maas

David Grant wrote:

Poppy,

Poppy Alexandra wrote:


Parse error: parse error in book-1.php on line 90



Please provide lines 89-91 of book-1.php only please.


humbug David :-) - turns out lines 89-91 will tell the OP nothing about
the error because the its the definition of function getBlock()
that is missing a closing brace (at around line 38) that si causing the error.

once you add the missing brace the script works (at least it dumped a
load of content from http://www.techdeals.net/ onto my console).

by helping you get your sample code working are per chance hepling into
life yet another 'linkfarm' or some similarly SEO related nasty?

grds,
Jochem

PS  - 'Queen Alexandra' is a kind of poppy, apparently



David


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



Re: [PHP] Book Sample Code Help

2006-01-24 Thread Poppy Alexandra

Please provide lines 89-91 of book-1.php only please.


humbug David :-) - turns out lines 89-91 will tell the OP nothing about
the error because the its the definition of function getBlock()
that is missing a closing brace (at around line 38) that si causing the 
error.


Thanks for the reply, it had really stumped me. I knew it would be an error 
with the bit I typed in :)




once you add the missing brace the script works (at least it dumped a
load of content from http://www.techdeals.net/ onto my console).
by helping you get your sample code working are per chance hepling into
life yet another 'linkfarm' or some similarly SEO related nasty?


It's only sample code from a book. All of the examples are in Perl, except 
this particular code. I am new to PHP and wanted to try and run the code to 
see if it worked.


Thank you. Poppy

_
Buy now @ Tradingpost.com.au 
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fad%2Eau%2Edoubleclick%2Enet%2Fclk%3B24875379%3B12369854%3Ba%3Fhttp%3A%2F%2Fwww%2Etradingpost%2Ecom%2Eau%3Freferrer%3DnmsnHMetagv1_t=752643439_r=hotmailtagline_m=EXT


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



Re: [PHP] Book Sample Code Help

2006-01-24 Thread Poppy Alexandra

it' not to find in the lines 89-91

You missed a  }  at the end of func getBlock


Hello Björn,

Thank you also for your reply. I appreciate your help.



 KEEP YOUR CODE CLEAN !!


This is sample code from a book. I am interested to know what you mean by 
clean code (formatting, conventions?). If you have any pointers how one 
should keep their code clean, I would like to learn. I am new to PHP. If 
this is off topic, apologies to the list.


Thank you. Pop

_
Make your dream car a reality 
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fcarpoint%2Eninemsn%2Ecom%2Eau_t=12345_r=emailtagline_m=EXT


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



Re: [PHP] Book Sample Code Help

2006-01-24 Thread Jochem Maas

Poppy Alexandra wrote:

Please provide lines 89-91 of book-1.php only please.



humbug David :-) - turns out lines 89-91 will tell the OP nothing about
the error because the its the definition of function getBlock()
that is missing a closing brace (at around line 38) that si causing 
the error.



Thanks for the reply, it had really stumped me. I knew it would be an 
error with the bit I typed in :)


it usually is ;-)





once you add the missing brace the script works (at least it dumped a
load of content from http://www.techdeals.net/ onto my console).
by helping you get your sample code working are per chance hepling into
life yet another 'linkfarm' or some similarly SEO related nasty?



It's only sample code from a book. All of the examples are in Perl, 
except this particular code. I am new to PHP and wanted to try and run 
the code to see if it worked.


which doesn;t actually answer my question :-) you see I have my suspicions
about a book named 'Spidering Hacks' - if it was meat I doubt it would be
kosher or halal.



Thank you. Poppy

_
Buy now @ Tradingpost.com.au 
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fad%2Eau%2Edoubleclick%2Enet%2Fclk%3B24875379%3B12369854%3Ba%3Fhttp%3A%2F%2Fwww%2Etradingpost%2Ecom%2Eau%3Freferrer%3DnmsnHMetagv1_t=752643439_r=hotmailtagline_m=EXT 





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



[PHP] XML-RPC and comment spam...

2006-01-24 Thread Russell Jones
I am trying to set up a personal blog of mine with the new
LinkSleeve.orgXML-RPC link spam service, but I dont know the firs
thing about PHP and
XML-RPC.

I did read that there are some problems with security, though, with the
popular PHP XML-RPC classes. Have these been fixed and which would you all
recommend?

rjones


[PHP] Re: Custom Usort Function

2006-01-24 Thread Matt Palermo
Any ideas on how to accomplish this?


Matt Palermo [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 I'm try to sort a list of items using a usort function.  Basically, I want 
 it to sort in this order:

 Numbers (0-9)
 Letters (Aa-Zz)
 Other (anything else)

 To explain a little further, I want anything that starts with a number to 
 show up first in the sorted list, then anything that starts with a letter, 
 and finally anything that starts with some other character.  My usort 
 function I'm using now gives me results close to this, but it sorts it as 
 follows (which is wrong for what I need):

 Numbers (0-9)
 Other (anything else)
 Letters (Aa-Zz)

 They are all sorted properly alphabetically, but not in the group order 
 that I need them in.  Here is the usort function I'm using right now:


 function myUsort($x, $y)
 {
  if(strtolower($x) == strtolower($y)) return 0;
  if(strtolower($x)  strtolower($y)) return -1;
  return 1;
 }

 As I stated above, this provides me with the proper alphabetical results, 
 but I need it tweaked.  Basically this function will give a sorted list 
 like this:

 007
 90210
 __underscore
 abra-cadabra
 Zebra

 But I need the function to provide a sorted list like this:

 007
 90210
 abra-cadabra
 Zebra
 __underscore


 Anyone know what I need to do to get these results?  Please let me know.

 Thanks,

 Matt Palermo
 http://sweetphp.com 

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



[PHP] query problem.

2006-01-24 Thread Angelo Zanetti

Hi guys.

I got an entry in a field called emailfrom in my table (MySQL db).

The data in that field is: Sams Bank [EMAIL PROTECTED]

I then do the following to retrieve the info, using a DB class

$recordset=$conn-Execute(SELECT * FROM wiml_history WHERE id = $task_id);
$row=$recordset-GetArray();

$emailfrom=$row[0]['emailfrom'];

then I echo what I get out and I just get Sams Bank

It doesnt bring back the whole entry in that field,
however when I manually change the info in the field in the DB to:

Sams Bank [EMAIL PROTECTED], it retrieves it correctly.

Why does the   cause that not to be displayed? or is it retrieving it 
correctly but not showing it because of the   (which might be 
conflicting with HTML tags?


thanks in advance


--

Angelo Zanetti
Z Logic
www.zlogic.co.za
[c] +27 72 441 3355
[t] +27 21 469 1052
[f] +27 86 681 5885

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



Re: [PHP] Re: Custom Usort Function

2006-01-24 Thread David Grant
Matt,

Personally, I'd do a logic case for each combination, e.g.

if (ctype_alpha($x[0])) {
if (ctype_alpha($y[0])) {
//strcmp
} elseif (ctype_digit([$y[0])) {
//-1
} else {
// 1;
}
} elseif (ctype_digit([$x[0])) {
if (ctype_alpha($y[0])) {
// 1;
} elseif (ctype_digit([$y[0])) {
// 
} else {
// 1;
}
} else {
if (ctype_alpha($y[0])) {
// -1;
} elseif (ctype_digit([$y[0])) {
// -1
} else {
// strcmp
}
}

It's not the prettiest, but it will work.

David

Matt Palermo wrote:
 Any ideas on how to accomplish this?
 
 
 Matt Palermo [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
 I'm try to sort a list of items using a usort function.  Basically, I want 
 it to sort in this order:

 Numbers (0-9)
 Letters (Aa-Zz)
 Other (anything else)

 To explain a little further, I want anything that starts with a number to 
 show up first in the sorted list, then anything that starts with a letter, 
 and finally anything that starts with some other character.  My usort 
 function I'm using now gives me results close to this, but it sorts it as 
 follows (which is wrong for what I need):

 Numbers (0-9)
 Other (anything else)
 Letters (Aa-Zz)

 They are all sorted properly alphabetically, but not in the group order 
 that I need them in.  Here is the usort function I'm using right now:


 function myUsort($x, $y)
 {
  if(strtolower($x) == strtolower($y)) return 0;
  if(strtolower($x)  strtolower($y)) return -1;
  return 1;
 }

function myUsort($x, $y) {
if (ctype_digit($x[0])) {
} elseif (ctype_alpha($x[0]}
}

 As I stated above, this provides me with the proper alphabetical results, 
 but I need it tweaked.  Basically this function will give a sorted list 
 like this:

 007
 90210
 __underscore
 abra-cadabra
 Zebra

 But I need the function to provide a sorted list like this:

 007
 90210
 abra-cadabra
 Zebra
 __underscore


 Anyone know what I need to do to get these results?  Please let me know.

 Thanks,

 Matt Palermo
 http://sweetphp.com 
 


-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] query problem.

2006-01-24 Thread David Grant
Angelo,

Angelo Zanetti wrote:
 Why does the   cause that not to be displayed? or is it retrieving it
 correctly but not showing it because of the   (which might be
 conflicting with HTML tags?

Look at the source!

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] query problem.

2006-01-24 Thread Silvio Porcellana [tradeOver]

Angelo Zanetti wrote:

(...)
Why does the   cause that not to be displayed? or is it retrieving it 
correctly but not showing it because of the   (which might be 
conflicting with HTML tags?




When showing things in an HTML page it's always a good idea to use 
'htmlspecialchars' (or htmlentities) first


http://php.net/manual/en/function.htmlspecialchars.php
http://php.net/manual/en/function.htmlentities.php

HTH, ciao!
Silvio

--
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

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



[PHP] Re: query problem.

2006-01-24 Thread Barry

Angelo Zanetti wrote:

Hi guys.

I got an entry in a field called emailfrom in my table (MySQL db).

The data in that field is: Sams Bank [EMAIL PROTECTED]

I then do the following to retrieve the info, using a DB class

$recordset=$conn-Execute(SELECT * FROM wiml_history WHERE id = 
$task_id);

$row=$recordset-GetArray();

$emailfrom=$row[0]['emailfrom'];

then I echo what I get out and I just get Sams Bank

It doesnt bring back the whole entry in that field,
however when I manually change the info in the field in the DB to:

Sams Bank [EMAIL PROTECTED], it retrieves it correctly.

Why does the   cause that not to be displayed? or is it retrieving it 
correctly but not showing it because of the   (which might be 
conflicting with HTML tags?


thanks in advance



Have you looked into the source code?
Is there the Mail retrieved?

Probably this can help - http://de3.php.net/htmlspecialchars

Greets
Barry

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



RE: [PHP] Re: query problem.

2006-01-24 Thread Albert
Angelo Zanetti wrote:
 Why does the   cause that not to be displayed? or is it retrieving it 
 correctly but not showing it because of the   (which might be 
 conflicting with HTML tags?

Whenever you have something between   for example 

this will not show

The browser will interpret it as an HTML tag and not display it.

Have a look at htmlentities() or replace the  and  with lt; and gt;

HTH

Albert

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.22/238 - Release Date: 2006/01/23
 

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



[PHP] RE: (SCL: 5) [PHP] query problem.

2006-01-24 Thread Duffy, Scott E
Viewing in browser? If so view source.

-Original Message-
From: Angelo Zanetti [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 25, 2006 7:01 AM
To: PHP List
Subject: (SCL: 5) [PHP] query problem.

Hi guys.

I got an entry in a field called emailfrom in my table (MySQL db).

The data in that field is: Sams Bank [EMAIL PROTECTED]

I then do the following to retrieve the info, using a DB class

$recordset=$conn-Execute(SELECT * FROM wiml_history WHERE id =
$task_id);
$row=$recordset-GetArray();

$emailfrom=$row[0]['emailfrom'];

then I echo what I get out and I just get Sams Bank

It doesnt bring back the whole entry in that field,
however when I manually change the info in the field in the DB to:

Sams Bank [EMAIL PROTECTED], it retrieves it correctly.

Why does the   cause that not to be displayed? or is it retrieving it 
correctly but not showing it because of the   (which might be 
conflicting with HTML tags?

thanks in advance


-- 

Angelo Zanetti
Z Logic
www.zlogic.co.za
[c] +27 72 441 3355
[t] +27 21 469 1052
[f] +27 86 681 5885

-- 
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] Problem with Sessions

2006-01-24 Thread Barry

Hi!

I got a very funny problem.
I wonder if anyone else encountered that.

I start a Session at Shop startpage to keep some arrays and such.
Stuff you need for the Cart and so. so fine so good.

But when the customer goes through that Page some session vars just get 
NULL.

Not the whole session dies. nah just a few vars O_o

I dont understand that.
It happens not often, but at least 2 times a week.

I have no var overwriting them.

I wonder if anyone has an issue for that.

Btw its PHP 4.2-2 running on a Red Hat system under GNu linux.


really no idea what that is _

Thanks
Barry

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



[PHP] Re: Custom Usort Function

2006-01-24 Thread Al

Matt Palermo wrote:
I'm try to sort a list of items using a usort function.  Basically, I want 
it to sort in this order:


Numbers (0-9)
Letters (Aa-Zz)
Other (anything else)

To explain a little further, I want anything that starts with a number to 
show up first in the sorted list, then anything that starts with a letter, 
and finally anything that starts with some other character.  My usort 
function I'm using now gives me results close to this, but it sorts it as 
follows (which is wrong for what I need):


Numbers (0-9)
Other (anything else)
Letters (Aa-Zz)

They are all sorted properly alphabetically, but not in the group order that 
I need them in.  Here is the usort function I'm using right now:



function myUsort($x, $y)
 {
  if(strtolower($x) == strtolower($y)) return 0;
  if(strtolower($x)  strtolower($y)) return -1;
  return 1;
 }

As I stated above, this provides me with the proper alphabetical results, 
but I need it tweaked.  Basically this function will give a sorted list like 
this:


007
90210
__underscore
abra-cadabra
Zebra

But I need the function to provide a sorted list like this:

007
90210
abra-cadabra
Zebra
__underscore


Anyone know what I need to do to get these results?  Please let me know.

Thanks,

Matt Palermo
http://sweetphp.com



Did you try natcasesort()?  Seems like I recall, it's pretty close to what you 
need.

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



Re: [PHP] Problem with Sessions

2006-01-24 Thread Jochem Maas

Barry wrote:

Hi!

I got a very funny problem.
I wonder if anyone else encountered that.

I start a Session at Shop startpage to keep some arrays and such.
Stuff you need for the Cart and so. so fine so good.

But when the customer goes through that Page some session vars just get 
NULL.


are you sticking references to things in the session array sometimes?
(as opposed to sticking things in the session array and then referencing
that?)

do you have a frameset in use? (where more than one page in the frameset may
use/start the session?) - i.e. one page overwrites the values set by another
becuase either your session logic is not 'watertight' or your using a session
handler mechanism that does not do do 'locking' of the session.



Not the whole session dies. nah just a few vars O_o


wtf is 'O_o'?



I dont understand that.
It happens not often, but at least 2 times a week.

I have no var overwriting them.

I wonder if anyone has an issue for that.

Btw its PHP 4.2-2 running on a Red Hat system under GNu linux.


upgrade php to 4.4.x atleast is one thing to consider




really no idea what that is _


wtf is '_'?
I realise you may not know what it is either (and that you are asking the list) 
-
but that wasn't clear to me either. and if the last couple of sentences are 
anything
but clear as mud then I'll be darned ;-)



Thanks
Barry



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



[PHP] put method

2006-01-24 Thread sunaram patir
could anyone please tell me how to use put method to upload file to a
remote server? thanks.

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



Re: [PHP] put method

2006-01-24 Thread Jay Paulson
http://us3.php.net/features.file-upload


On 1/24/06 11:46 AM, sunaram patir [EMAIL PROTECTED] wrote:

 could anyone please tell me how to use put method to upload file to a
 remote server? thanks.
 
 --
 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] put method

2006-01-24 Thread sunaram patir
i think i would be clearer with this code i have written to do that but in vain.


?php
if(isset($_PUT['submit'])){
   $fileName=$_PUT['userfile'];
/* PUT data comes in on the stdin stream */
$putdata = fopen(php://stdin, r);

/* Open a file for writing */
$fp = fopen($fileName, w);

/* Read the data 1 KB at a time
   and write to the file */
while ($data = fread($putdata, 1024))
  fwrite($fp, $data);

/* Close the streams */
fclose($fp);
fclose($putdata);
}
else{
echo form method='put' action='putMethod.php'
enctype='multipart/form-data';
echo Send this file: input name='userfile' type='file'
echo input type='submit' name='submit' value='Send File';
echo /form;

}

?

Parse error: parse error, unexpected T_ECHO, expecting ',' or ';' in
/home/zenrays/public_html/test2/putMethod.php on line something
 something= the line number for 'echo form method='put'
action='putMethod.php' enctype='multipart/form-data';'

On 1/24/06, Jay Paulson [EMAIL PROTECTED] wrote:
 http://us3.php.net/features.file-upload


 On 1/24/06 11:46 AM, sunaram patir [EMAIL PROTECTED] wrote:

  could anyone please tell me how to use put method to upload file to a
  remote server? thanks.
 
  --
  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] put method

2006-01-24 Thread Austin Denyer

On Tue, 24 Jan 2006 23:47:46 +0530
sunaram patir [EMAIL PROTECTED] wrote:

 i think i would be clearer with this code i have written to do that
 but in vain.

snip

 echo form method='put' action='putMethod.php'
 enctype='multipart/form-data';
 echo Send this file: input name='userfile' type='file'
^
You're missing a ; here I

 echo input type='submit' name='submit' value='Send File';
 echo /form;

snip

 Parse error: parse error, unexpected T_ECHO, expecting ',' or ';' in
 ^
Just like it says here --I

 /home/zenrays/public_html/test2/putMethod.php on line something
  something= the line number for 'echo form method='put'
 action='putMethod.php' enctype='multipart/form-data';'

Regards,
Ozz.


pgp8Mbz6fyL6h.pgp
Description: PGP signature


[PHP] SOAP WSDL?

2006-01-24 Thread Jay Paulson
I'm messing around with SOAP with PHP 5 and I was wondering do I have to
create my own WSDL's or can PHP create them for me like NuSoap does?

Thanks!

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



[PHP] Re: put method

2006-01-24 Thread James Benson

change the $_PUT to $_FILES, their is no global variable in PHP called $_PUT

reading this page will give a working example you can modify:

http://php.net/features.file-upload


James





-

http://www.ciwcertified.com - Master CIW Designer
http://www.zend.com - Zend Certified Engineer


http://www.jamesbenson.co.uk

-

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



Re: [PHP] query problem.

2006-01-24 Thread Richard Lynch
On Wed, January 25, 2006 7:01 am, Angelo Zanetti wrote:
 The data in that field is: Sams Bank [EMAIL PROTECTED]
.
.
.
 Why does the   cause that not to be displayed? or is it retrieving
 it
 correctly but not showing it because of the   (which might be
 conflicting with HTML tags?

You have hit the nail on the head here.

If you use your browser's View Source menu, you'll see the full value.

NOTE: View Source is ALWAYS a good idea when what you see is not
what you expect.

If you want to display that data as HTML data, you would use:
http://php.net/htmlentities
which will translate the special characters into HTML entities, which
will render correctly in browsers.

You should use htmlentities right before you spit out the data, and be
very careful not to confuse the data that has had htmlentities applied
with the original.

So, you might do:

$email = ... /* get mysql result here, somehow */
$email_html = htmlentiites($email);
echo Email: $email_htmlbr /\n;

-- 
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



Re: [PHP] Custom Usort Function

2006-01-24 Thread Richard Lynch
On Mon, January 23, 2006 6:53 pm, Matt Palermo wrote:
 I'm try to sort a list of items using a usort function.  Basically, I
 want
 it to sort in this order:

 Numbers (0-9)
 Letters (Aa-Zz)
 Other (anything else)

 To explain a little further, I want anything that starts with a number
 to
 show up first in the sorted list, then anything that starts with a
 letter,
 and finally anything that starts with some other character.  My usort
 function I'm using now gives me results close to this, but it sorts it
 as
 follows (which is wrong for what I need):

 Numbers (0-9)
 Other (anything else)
 Letters (Aa-Zz)

 They are all sorted properly alphabetically, but not in the group
 order that
 I need them in.  Here is the usort function I'm using right now:


 function myUsort($x, $y)
  {
   if(strtolower($x) == strtolower($y)) return 0;
   if(strtolower($x)  strtolower($y)) return -1;
   return 1;
  }

The issue with previous posts is that they will only look at the first
character, unless I'm mis-reading them.

So:
__a
_a_
will not sort the way you want.

Here is my take on it:

function myUsort($x, $y){
  //ignore case (I chose upper only because I know the ASCII values)
  $x = strtoupper($x);
  $y = strtoupper($y);
  $xlen = strlen($x);
  $ylen = strlen($y);
  $len = min($xlen, $ylen);
  for ($i = 0; $i  $len; $i++){
$xi = $x[$i]; $yi = $y[$i];
$xc = ord($xi); $yc = ord($yi);
if ($xi == $yi) continue;

//handle a-z and 0-9 normally:
elseif ((65 = $xc  $xc =90 || 48 = $xc  $xc = 57)
  (65 = $yc  $yc  90 || 48 = $yc  $yc = 57)
   )
  return strcasecmp($xc, $yc);

//either $xi or $yi is out of the normal range and is big...

//$xc is the oddball character
elseif ($xc  48 || $xc  57  $xc  65 || $xc  90) return 1;

//$yc must be the oddball character
else return -1;
  }

  //The strings completely matched, up to the end of one of them:
  if ($xlen  $ylen) return -1;
  elseif ($xlen  $ylen) return 1;
  else return 0;
}

I'm not promising I got the -1 / 1 / 0 ordering correct for   == but
this should work.

Probably not the fastest, particularly for long strings, as PHP for
loops are not speedy...

-- 
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



Re: [PHP] Problem with Sessions

2006-01-24 Thread Richard Lynch
On Tue, January 24, 2006 10:30 am, Barry wrote:
 I got a very funny problem.
 I wonder if anyone else encountered that.

 I start a Session at Shop startpage to keep some arrays and such.
 Stuff you need for the Cart and so. so fine so good.

 But when the customer goes through that Page some session vars just
 get
 NULL.
 Not the whole session dies. nah just a few vars O_o

 I dont understand that.
 It happens not often, but at least 2 times a week.

 I have no var overwriting them.

 I wonder if anyone has an issue for that.

 Btw its PHP 4.2-2 running on a Red Hat system under GNu linux.


 really no idea what that is _

Something as infrequent as that is very difficult to debug, because by
the time you start looking at the data, you've already forgotten what
the data was the last time the bug ocurred.

Start logging the error to a separate file or database table.

Log all the variables you THINK should have a value that are NULL.

Look for patterns in the variables.

Also consider logging all the other variables, and their values, to
see if there is a pattern.

Hopefully, gathering the data into an ordered format will make the bug
more clear.

You should also go ahead and time-stamp it, so you can refine the 2
times per week, and possibly log successful page-hits so you have some
idea of the percentage of error.

Possibly log load as well, in some manner -- count # of active
sessions, or OS load on the box, or...

Perhaps it only happens under very heavy load?  Or does it simply
increase linearly with load, but still happens under light load?

-- 
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



[PHP] How to check if an object exists

2006-01-24 Thread Derrick Shoemake
I have sort of a silly question. I'm running SugarCRM and trying to  
track down an error.


I dug up the error from the httpd error log and then started checking  
into the code myself. The error appears to be a code issue, but since  
I don't know how to properly check to see if an object is valid, I'm  
not really sure what the correct coding should be.


The system is a FreeBSD 5.3 box with Apache 2.0.55 and PHP 5.1.2.  
Everything appears to run alright except when sending an email with  
SugarCRM then a entry in the httpd error log appears


PHP Notice: Object of class UploadFile could not be converted to int  
in sugar/modules/Emails/Save.php line 116


The code block looks like this in save.php

$upload_file = new UploadFile('email_attachment'.$i);

if ($upload_file == -1) { - Line 116
continue;
}


Does anyone know if this is the proper way to check for an Objects  
existence and where I can find more information on doing so?


Thanks,

Derrick Shoemake

[PHP] PDO: How to fetch TIMESTAMP values?

2006-01-24 Thread Michael Phillipson
I recently began evaluating the feasibility of reworking our current 
database access framework, which utilizes the PHP-native drivers for our 
database (Interbase), to one which makes use of the PDO extension. 
Unfortunately, I quickly hit a roadblock.

I have tried every permutation available in the PDO documentation, as far as 
I can see, in order to retrieve the value of a TIMESTAMP-type field from a 
given table, but so far I have been unsuccessful.

Using the PHP-native functions for Interbase, I used to be able to 
accomplish this with the following code:

?php
  $sql = SELECT TIMESTAMP_FIELD FROM MY_TABLE;
  $result = ibase_query($dbh, $sql);

  $row = ibase_fetch_row($result, IBASE_UNIXTIME);
  $field = $row[0];

  echo $field;
?

Here is one of the many [failed] methods I have attempted using a PDO:

?php
  $sql = SELECT TIMESTAMP_FIELD FROM MY_TABLE;
  $row = $dbh-query($sql);

  $field = $row['TIMESTAMP_FIELD'];

  echo $field;
?

In the first instance, a numeric (integer) value would be displayed on the 
screen.  In the PDO example, nothing is displayed.

I have also tried rewriting the PDO code above as a prepared statement, but 
i get the same result.

Has anyone else bumped up against problems with TIMESTAMP fields when using 
the Interbase PDO driver or some other?  Any suggestions would be 
appreciated.  Thanks! 

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



Re: [PHP] How to check if an object exists

2006-01-24 Thread David Grant
Derrick,

Derrick Shoemake wrote:
 Does anyone know if this is the proper way to check for an Objects
 existence and where I can find more information on doing so?

php.net/is_object
php.net/instance_of

David
-- 
David Grant
http://www.grant.org.uk/

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



[PHP] $_SESSION saves all values but Class -- works on one server but not another?! [second plead for help]

2006-01-24 Thread Daevid Vincent
Thought I'd give this another shot since I still can't figure it out after
nearly a week...

I have a gentoo server that doesn't save/restore the CLASS portion of a
session, but it does retain other $_SESSION values. This code works fine on
a debian box.

WORKING BOX:
[EMAIL PROTECTED]:/lockdown# php --version
PHP 5.0.3 (cli) (built: Jan  5 2006 13:18:18)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.3, Copyright (c) 1998-2004 Zend Technologies
with Zend Extension Manager v1.0.9, Copyright (c) 2003-2005, by Zend
Technologies
with Zend Optimizer v2.6.0, Copyright (c) 1998-2005, by Zend
Technologies

NOT WORKING BOX:
vmware apache2-php5 # php --version
PHP 5.0.5-pl3-gentoo (cli) (built: Dec 14 2005 15:44:04)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.5, Copyright (c) 1998-2004 Zend Technologies

I've compared the php.ini files and can't find anything related to sessions
that is different. In fact they're almost the same with a few minor
exceptions that should have no effect that I can think of.

Here is the code I'm executing:

?php
  [SNIP DATABASE LOAD, ETC.]
echo BUserData array = /BBR\n;
print_r($UserData);

//set the session variables:
$_SESSION['login']  = true;
$_SESSION['ie'] =
(stristr($_SERVER['HTTP_USER_AGENT'],MSIE)) ? true : false;
$_SESSION['id'] = $UserData['id'];
$_SESSION['username']   = $UserData['username'];
$_SESSION['firstname']  = $UserData['firstname'];
$_SESSION['lastname']   = $UserData['lastname'];
$_SESSION['email']  = $UserData['email'];
$_SESSION['foo']= '1234567890';

require_once('includes/classes/User.class.php');
$_SESSION['user'] = new User($UserData['id']);

echo PB_SESSION array = /BBR\n;
var_dump($_SESSION);
echo PBUSERNAME/B = .$_SESSION['user']-get_username().BR\n;
exit;
?

Which properly results in this (as it's all on the same page):

UserData array = 
Array ( [id] = 1 [firstname] = Daevid [lastname] = Vincent [email] =
[EMAIL PROTECTED] ) snip

_SESSION array = 
array(9) { [login]= bool(true) [ie]= bool(true) [id]= string(1) 1
[username]= string(6) daevid [firstname]= string(6) Daevid
[lastname]= string(7) Vincent [email]= string(17)
[EMAIL PROTECTED] [foo]= string(10) 1234567890 [user]=
object(User)#2 (24) { [username:protected]= string(6) daevid
[firstname:protected]= string(6) Daevid [lastname:protected]=
string(7) Vincent [email:protected]= string(17) [EMAIL PROTECTED] ...
snip } } 

USERNAME = daevid


Now I load a simple session loading test page with this code:

?php 
require_once('includes/classes/User.class.php');
session_start();
echo BSESSION TEST:P/B;
var_dump($_SESSION);
exit;
?

On the working box things are fine (obviously): 

SESSION TEST:
array(9) { [login]= bool(true) [ie]= bool(true) [id]= string(1) 1
[username]= string(6) daevid [firstname]= string(6) Daevid
[lastname]= string(7) Vincent [email]= string(17)
[EMAIL PROTECTED] [foo]= string(10) 1234567890 [user]=
object(User)#1 (24) { [username:protected]= string(6) daevid
[firstname:protected]= string(6) Daevid [lastname:protected]=
string(7) Vincent [email:protected]= string(17) [EMAIL PROTECTED]
[timestamp:protected]= string(19) -00-00 00:00:00 ... snip } } 

but on the broken box I see:

SESSION TEST:
array(9) { [login]= bool(true) [ie]= bool(true) [id]= string(1) 1
[username]= string(6) daevid [firstname]= string(6) Daevid
[lastname]= string(7) Vincent [email]= string(17)
[EMAIL PROTECTED] [foo]= string(10) 1234567890 [user]=
object(User)#1 (20) { [username:protected]= string(0) 
[firstname:protected]= string(0)  [lastname:protected]= string(0) 
[email:protected]= string(0)  [timestamp:protected]= NULL ... snip
} } 

Notice how the regular session info is there, but the User class is all
empty or NULL. So SOME of the $_SESSION is working, but not the User class
portion. This is completely baffling to me. Examining the /tmp/sess_* file
shows this same data.

Here is the session portion of php.ini on the broken box:

[Session]
; Handler used to store/retrieve data.
session.save_handler = files

; Argument passed to save_handler.  In the case of files, this is the path
; where data files are stored. Note: Windows users have to change this
; variable in order to use PHP's session functions.
;
; As of PHP 4.0.1, you can define the path as:
;
; session.save_path = N;/path
;
; where N is an integer.  Instead of storing all the session files in
; /path, what this will do is use subdirectories N-levels deep, and
; store the session data in those directories.  This is useful if you
; or your OS have problems with lots of files in one directory, and is
; a more efficient layout for servers that handle lots of sessions.
;
; NOTE 1: PHP will not create this directory structure automatically.
; You can use the script in the ext/session dir for that purpose.
; NOTE 2: See the section on garbage collection below if 

[PHP] Quickform Date element time range.

2006-01-24 Thread Gary Smith
Aloha All,

I was wondering how I could set a time range using the date element. What I
need is a way to limit the time fields to reflect the times available. So if
the range is 7 am to 4 pm I would like the hours menu to only contain
7,8,9,10,11,12,1,2,3,4. Any time selected before 12 would be am and after 12
would be pm, it would be great if the am and pm could be set via javascript.


Here's my time element:
$contact-addElement ( 'date' , 'Times1' , 'Tee Time First Choice' ,
array('format' = 'g i A','optionIncrement' = array('i' = 10)));



Any suggestions?
Thanks,
Gary


Re: [PHP] How to check if an object exists

2006-01-24 Thread Derrick Shoemake

Thanks David,

I changed some code and it apparently didn't give the error anymore  
but didn't really solve my problem.


It appears that the error I was getting wasn't really related to my  
problem. I'm getting a error in httpd-error.log


httpd in free(): error: junk pointer, too high to make sense
[Tue Jan 24 17:11:32 2006] [notice] child pid 22665 exit signal Abort  
trap (6)


Is there any way to track down where the code is failing? It's not  
creating any dump file that I can see. I don't mind digging into this  
to either report a bug to php.net,  apache.org or even just fix the  
code myself and submit a patch to someone, but I'm a little new to  
the php and apache working together.


Thanks,

-Derrick



On Jan 24, 2006, at 4:40 PM, David Grant wrote:


Derrick,

Derrick Shoemake wrote:

Does anyone know if this is the proper way to check for an Objects
existence and where I can find more information on doing so?


php.net/is_object
php.net/instance_of

David
--
David Grant
http://www.grant.org.uk/

--
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] Re: $_SESSION saves all values but Class -- works on one server but not another?! [second plead for help]

2006-01-24 Thread James Benson

Take a look at the following functions:-


http://php.net/serialize
http://php.net/unserialize



James




-

http://www.ciwcertified.com - Master CIW Designer
http://www.zend.com - Zend Certified Engineer


http://www.jamesbenson.co.uk

-

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



Re: [PHP] query problem.

2006-01-24 Thread Brian V Bonini
On Wed, 2006-01-25 at 08:01, Angelo Zanetti wrote:
 Hi guys.
 
 I got an entry in a field called emailfrom in my table (MySQL db).
 
 The data in that field is: Sams Bank [EMAIL PROTECTED]
 
 I then do the following to retrieve the info, using a DB class
 
 $recordset=$conn-Execute(SELECT * FROM wiml_history WHERE id = $task_id);
 $row=$recordset-GetArray();
 
 $emailfrom=$row[0]['emailfrom'];
 
 then I echo what I get out and I just get Sams Bank
 
 It doesnt bring back the whole entry in that field,
 however when I manually change the info in the field in the DB to:
 
 Sams Bank [EMAIL PROTECTED], it retrieves it correctly.
 
 Why does the   cause that not to be displayed? or is it retrieving it 
 correctly but not showing it because of the   (which might be 
 conflicting with HTML tags?
 
 thanks in advance


$emailfrom = htmlspecialchars($row[0]['emailfrom']);



-- 

s/:-[(/]/:-)/g


BrianGnuPG - KeyID: 0x04A4F0DC | Key Server: pgp.mit.edu
==
gpg --keyserver pgp.mit.edu --recv-keys 04A4F0DC
Key Info: http://gfx-design.com/keys
Linux Registered User #339825 at http://counter.li.org

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



Re: [PHP] PHP not seeing MySQL functions

2006-01-24 Thread PHP Superman
ah sorry, i assumed windows box

On 1/22/06, John Nichel [EMAIL PROTECTED] wrote:

 PHP Superman wrote:
  did you uncomment the line that adds the proper php
  module(mysqli_blahblahblah.dll)?

 How would loading the mysqli modules help the poster with the mysql
 functions?

 How would loading Windoze dll's help the poster on a Linux box?

  On 1/16/06, Jonathan Duncan [EMAIL PROTECTED] wrote:
 
 I just got a new web server with RedHat Enterprise Linux 4 on it.  It
 came
 -^
 with MySQL 4.1.x and PHP 4.3.9 on it.  I uninstalled the MySQL 4 and put
 MySQL 5 on it.  When I run a PHP script that has a DB connection in it I
 get:
 
 Fatal error: Call to undefined function: mysql_connect() in
 ---^

 OP, chance are, your RHEL box has the improved mysql (mysqli) libriaries
 set-up.  Try mysqli_connect.  If this isn't the case, then your
 libraries are not being loaded when you start Apache.  Check your error
 logs.

 http://us2.php.net/mysqli

 --
 By-Tor.com
 ...it's all about the Rush
 http://www.by-tor.com

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




--
Hi Everyone, I am running PHP 5 on Windosws XP SP2 with MySQL5, Bye Now!


[PHP] Variable variables

2006-01-24 Thread Mark Steudel
I was wondering if you could create variable variables for objects, please
see examples below, Im having problems getting it to work.

$data['fieldname'] = foo;
 
// without variable variables
$res = $db-query( SELECT foo FROM table );
 
while( $res-fetchInto( $db_data ) )
{
echo $db_data-foo; // pretend this echos bar
}
 
 
 // with variable variables
$varVar = '$db_data-'.$data['fieldname']; // should be $db_data-foo
 
$res = $db-query( SELECT foo FROM table );
 
   while( $res-fetchInto( $db_data ) )
{
echo ${$varVar}; // would like this to echo bar
}
 
 
Thanks, Mark


Re: [PHP] $_SESSION saves all values but Class -- works on one server but not another?! [second plead for help]

2006-01-24 Thread tg-php
You say it's working on one box and not on the other?  Maybe I'm wrong (and 
sounds like I am) but I thought that you couldn't pass objects between scripts 
even with serialize()?

Certainly sounds like it was working for you...   can anyone clarify what 
objects/variables/data types can be passed from script to script and what can't?

I know things like database connections can't be shared (that is, you can't 
assign a MySQL connect link to a variable then pass that variable/connect to 
the next script, it needs to reconnect the next time around.. or am I wrong 
about that too? hah)

-TG
God I'm tired

= = = Original message = = =

Thought I'd give this another shot since I still can't figure it out after
nearly a week...

I have a gentoo server that doesn't save/restore the CLASS portion of a
session, but it does retain other $_SESSION values. This code works fine on
a debian box.

WORKING BOX:
[snip]

___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



[PHP] Re: Variable variables

2006-01-24 Thread James Benson



Mark Steudel wrote:

I was wondering if you could create variable variables for objects, please
see examples below, Im having problems getting it to work.

$data['fieldname'] = foo;
 
// without variable variables

$res = $db-query( SELECT foo FROM table );
 
while( $res-fetchInto( $db_data ) )

{
echo $db_data-foo; // pretend this echos bar
}
 
 
 // with variable variables

$varVar = '$db_data-'.$data['fieldname']; // should be $db_data-foo
 



Try using double quotes, ie.

$varVar = $db_data-.$data['fieldname'];




James

-

http://www.ciwcertified.com - Master CIW Designer
http://www.zend.com - Zend Certified Engineer


http://www.jamesbenson.co.uk

-

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



[PHP] Google using PHP @ http://www.google-store.com

2006-01-24 Thread James Benson
Looks like google are using PHP and oscommerce for their web store: 
http://www.google-store.com


Nice to see :)






James


-

http://www.ciwcertified.com - Master CIW Designer
http://www.zend.com - Zend Certified Engineer


http://www.jamesbenson.co.uk

-

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



[PHP] XML-RPC questions...

2006-01-24 Thread Russell Jones
I have read recently that there are some issues with XML-RPC and security in
PHP classes. Have these been fixed? What would you recommend? I am looking
to create a LinkSleeve filter for my blog and it requires XML-RPC.


rjonesx


RE: [PHP] $_SESSION saves all values but Class -- works on one server but not another?! [second plead for help]

2006-01-24 Thread Daevid Vincent
No no no. I'm NOT passing data between servers. It's just two pages on the
same server. One that sets up the session/class and the other page just
re-loads the session. 

When I talk about two different servers, I copy the entire source/db schema
from one server to the other so they are clones for all intents and
purposes.

One server works the way I'd expect.
The other doesn't.
SAME code on both. Same schema. Nearly identical LAMP versions.
This is why I'm saying, it's not my PHP code or database or anything like
that.
It must be some kind of server configuration, but I can't figure out what it
would be. I've compared the php.ini files and don't see anything that seems
relevant. 


 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, January 24, 2006 4:54 PM
 To: php-general@lists.php.net
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] $_SESSION saves all values but Class -- 
 works on one server but not another?! [second plead for help]
 
 You say it's working on one box and not on the other?  Maybe 
 I'm wrong (and sounds like I am) but I thought that you 
 couldn't pass objects between scripts even with serialize()?
 
 Certainly sounds like it was working for you...   can anyone 
 clarify what objects/variables/data types can be passed from 
 script to script and what can't?
 
 I know things like database connections can't be shared (that 
 is, you can't assign a MySQL connect link to a variable then 
 pass that variable/connect to the next script, it needs to 
 reconnect the next time around.. or am I wrong about that too? hah)
 
 -TG
 God I'm tired
 
 = = = Original message = = =
 
 Thought I'd give this another shot since I still can't figure 
 it out after
 nearly a week...
 
 I have a gentoo server that doesn't save/restore the CLASS 
 portion of a
 session, but it does retain other $_SESSION values. This code 
 works fine on
 a debian box.
 
 WORKING BOX:
 [snip]

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



Re: [PHP] Google using PHP @ spam

2006-01-24 Thread Peter Hoskin
Its hosted from 85.13.206.209.reverse.coreix.net - somehow I don't think 
this is a google owned site.


Yahoo use PHP and sponsor PHP - yet nobody talks about that :-/

James Benson wrote:
Looks like google are using PHP and oscommerce for their web store: 
http://www.google-store.com


Nice to see :)


James


-

http://www.ciwcertified.com - Master CIW Designer
http://www.zend.com - Zend Certified Engineer


http://www.jamesbenson.co.uk

-



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



RE: [PHP] Re: $_SESSION saves all values but Class -- works on one server butnot another?! [second plead for help]

2006-01-24 Thread Daevid Vincent
Thank you, but again, not the problem.

The same code is on both servers. I'm not transfering from one server to
another. Only from page to page ON THE SAME SERVER. 

This has to be a configuration problem IMHO.

 -Original Message-
 From: James Benson [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, January 24, 2006 3:45 PM
 To: php-general@lists.php.net
 Subject: [PHP] Re: $_SESSION saves all values but Class -- 
 works on one server butnot another?! [second plead for help]
 
 Take a look at the following functions:-
 
 http://php.net/serialize
 http://php.net/unserialize

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



Re: [PHP] imagettftext, text values. How to add a new line? is it \n?

2006-01-24 Thread Richard Correia
hey,

Check the properties at
http://www.weberdev.com/Manuals/PHP/function.imagettftext.html

You can try second imagettftext with new X and Y co-ordinates.

Thanks
Richard

On 1/25/06, Louie Miranda [EMAIL PROTECTED] wrote:

 imagettftext($im, $size, 0, 2, 13, $text_color,
 includes/resources/SHELAS.TTF, $text);

 I have generated this image text width=300 x height=300. The value of the
 $text is

 Hello World

 I want to get the second word which is World into the second line. I have
 tried \n but it has no effect.

 Would that be possible? Please help.

 --
 Louie Miranda
 http://www.axishift.com -- under development



Re: [PHP] Problem with Sessions

2006-01-24 Thread Richard Correia
upgrade to 4.4.X

4.2 has known problems in session handling.

Thanks,
Richard

On 1/24/06, Barry [EMAIL PROTECTED] wrote:

 Hi!

 I got a very funny problem.
 I wonder if anyone else encountered that.

 I start a Session at Shop startpage to keep some arrays and such.
 Stuff you need for the Cart and so. so fine so good.

 But when the customer goes through that Page some session vars just get
 NULL.
 Not the whole session dies. nah just a few vars O_o

 I dont understand that.
 It happens not often, but at least 2 times a week.

 I have no var overwriting them.

 I wonder if anyone has an issue for that.

 Btw its PHP 4.2-2 running on a Red Hat system under GNu linux.


 really no idea what that is _

 Thanks
 Barry

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




Re: [PHP] RE: (SCL: 5) [PHP] query problem.

2006-01-24 Thread Richard Correia
Remove those brackets  and .

Or

print htmlentities($email_address);

Thanks
Richard

On 1/24/06, Duffy, Scott E [EMAIL PROTECTED] wrote:

 Viewing in browser? If so view source.

 -Original Message-
 From: Angelo Zanetti [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, January 25, 2006 7:01 AM
 To: PHP List
 Subject: (SCL: 5) [PHP] query problem.

 Hi guys.

 I got an entry in a field called emailfrom in my table (MySQL db).

 The data in that field is: Sams Bank [EMAIL PROTECTED]

 I then do the following to retrieve the info, using a DB class

 $recordset=$conn-Execute(SELECT * FROM wiml_history WHERE id =
 $task_id);
 $row=$recordset-GetArray();

 $emailfrom=$row[0]['emailfrom'];

 then I echo what I get out and I just get Sams Bank

 It doesnt bring back the whole entry in that field,
 however when I manually change the info in the field in the DB to:

 Sams Bank [EMAIL PROTECTED], it retrieves it correctly.

 Why does the   cause that not to be displayed? or is it retrieving it
 correctly but not showing it because of the   (which might be
 conflicting with HTML tags?

 thanks in advance


 --




Re: [PHP] Google using PHP @ spam

2006-01-24 Thread Robert Cummings
On Tue, 2006-01-24 at 21:41, Peter Hoskin wrote:
 Its hosted from 85.13.206.209.reverse.coreix.net - somehow I don't think 
 this is a google owned site.
 
 Yahoo use PHP and sponsor PHP - yet nobody talks about that :-/

Sure they do. Rasmus works for Yahoo and every once in a while one of
his posts will happen to contain a reference (and no, not as a
gratuitous plug :)

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



Re: [PHP] Book Sample Code Help

2006-01-24 Thread Poppy Alexandra

which doesn;t actually answer my question :-) you see I have my suspicions
about a book named 'Spidering Hacks' - if it was meat I doubt it would be
kosher or halal.




Hello Jochem

It's actually an interesting text with an evil name. I agree the title might 
sounds suspicious so to answer your question : no. No link farms or 
spambots, very much kosher and halal :)



I maintain several web sites so I battle spam and spambots on a daily basis, 
so I understand you being suspicious.


Thanks again for your help getting the code working.



Pop

_
Make your dream car a reality 
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fcarpoint%2Eninemsn%2Ecom%2Eau_t=12345_r=emailtagline_m=EXT


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



[PHP] upload_max_filesize

2006-01-24 Thread Daniel Lahey
A client has started experiencing problems with uploading files  
larger than the default 2M set in php.ini.  The problem only started  
occurring a few weeks or so ago, and I cannot figure out how to get  
around it.  I have a php.ini file in the /public_html folder that reads:


post_max_size 8388608
upload_max_filesize 8388608

I've also tried peppering the code with calls to ini_set 
('upload_max_filesize', '8388608');   In desparation, I've also tried  
a .htaccess file that reads:


IfModule mod_php5.c
php_value upload_max_filesize 8388608
/IfModule
IfModule mod_php4.c
php_value upload_max_filesize 8388608
/IfModule

Nothing seems to work.  This didn't used to be a problem.  I can  
upload files smaller than 2M just fine.  Any ideas?


TIA

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



[PHP] Re: upload_max_filesize

2006-01-24 Thread David Robley
Daniel Lahey wrote:

 A client has started experiencing problems with uploading files
 larger than the default 2M set in php.ini.  The problem only started
 occurring a few weeks or so ago, and I cannot figure out how to get
 around it.  I have a php.ini file in the /public_html folder that reads:
 
 post_max_size 8388608
 upload_max_filesize 8388608
 
 I've also tried peppering the code with calls to ini_set
 ('upload_max_filesize', '8388608');   In desparation, I've also tried
 a .htaccess file that reads:
 
 IfModule mod_php5.c
  php_value upload_max_filesize 8388608
 /IfModule
 IfModule mod_php4.c
  php_value upload_max_filesize 8388608
 /IfModule
 
 Nothing seems to work.  This didn't used to be a problem.  I can
 upload files smaller than 2M just fine.  Any ideas?
 
 TIA

Have you checked the value for MAX_FILE_SIZE in the upload form?


Cheers
-- 
David Robley

Someone threw a beer at Clinton. He dodged it. No doubt a draft.

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



[PHP] QUARANTINED: Delivery reports about your e-mail

2006-01-24 Thread WorkgroupMail Content Filter
The message Delivery reports about your e-mail from Bounced mail, sent on 
1/25/2006 08:21 was quarantined because it contained either an executable file, 
a batch file or a screen saver file. All of these types of attachments are 
considered security risks. Please consult your mail administrator who can 
release the message.

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