Re: [PHP] Using array_search I get error

2007-03-12 Thread Tijnema !

On 3/12/07, Richard Kurth <[EMAIL PROTECTED]> wrote:




Richard Kurth wrote:
>
>
> -Original Message-
> From: Stut [mailto:[EMAIL PROTECTED]
> Sent: Sunday, March 11, 2007 2:53 PM
> To: Richard Kurth
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] Using array_search I get error
>
> Richard Kurth wrote:
>> This array comes from  $_REQUEST of all data submitted
>>
>> $array='Array ( [id] => 17 [takeaction] => saveCustomFields [notes]
>> =>
>> -- Feb 4, 2007 @ 9:16 PM --fdsfdsfsdfdsfsfsfds -- Feb 4, 2007 @ 9:21
>> PM --fdfdsfsdffsd -- February 11, 2007, @ 9:31 PM -- This is a tes --
>> February 14, 2007, @ 10:10 PM -- jhafjhfa afjahfajfhda
>> kasjdaksdhADSKJL [firstname] => NANCY [lastname] => ADKINS  [phone2]
>> =>
> [address1] => 25 ALWARD CT.
>> [address2] => [city] => MARTINSVILLE [State] => AK [other] => [zip]
>> =>
>> 24112 [country] => US [date18] => 03-13-2007 [text19] => test1
>> [text20] => [rating] => 0 [status] => Active )';  when I use
>> array_search to find date18
>>
>> $key = array_search('date18', $array);  // $key = 1;
>>
>> I get Wrong datatype for second argument How come the array is wrong
>> datatype isn't a array an array or am I using this wrong
>
> $array is a string, and array_search is expecting an array, so it's
correct.
> Where did you get that "array"?
>
> -Stut
>
> This array comes from  $_REQUEST of all data submitted from a form

Yeah, you said that in your first post. What I meant was where did it come
from?

What you have there is the output from print_r($_REQUEST). How exactly are
you getting that string? Why are you creating it as a literal array rather
than using $_REQUEST directly?

What you have there is the output from print_r($_REQUEST). How exactly are
you getting that string? Why are you creating it as a literal array rather
than using $_REQUEST directly?

-Stut

This is for saving data from custom fields created by the user I don't
know
what they are named so I can't use $_REQUEST[name] to pull them from the
array.
I am submitting a form to a script that will search thru the array and
find
the fields that are in there date18 text19 text20 these are user custom
fields that I do not know what they are named. I what to compare what is
in
the array  with a database table and if they match then save the
information
in the array for that item to the database.



Somehow you managed to get an array become a string..., if your are using
$_REQUEST directly, or a copy of it, then you should have an array.
I also don't really understand what you are trying to do, as 'date18' is a
key, not a value, and array_search searches vor values, in this case it
searches for the value 'date18' and then try's to get the key of that value,
but date18 is a key, so it would probably return false.

Tijnema

--

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




[PHP] Re: php 4 and 5

2007-03-12 Thread Haydar Tuna
Hello,
Most important change is Object Oriented Features. PHP 5 support 
Object Oriented programming features. PHP 5 also supports more library than 
PHP 4.:)


-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net


<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> Dear All,
>
> What different between 4 and 5 ?
>
> Edward. 

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



[PHP] Re: Why won't this query go through?

2007-03-12 Thread Haydar Tuna
Hello,
   Did you control your user privileges? May be, your database user 
don't have enough privileges for INSERT. If your database user have enough 
database privileges for INSERT, you must control your SQL. Firstly you 
should write your SQL to the screen with echo ($q) and then paste this in 
the mysql command line. If you get an errors, there is a problem on your 
SQL. :)


-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net


"Mike Shanley" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi,
>
> I am just not understanding what I could have possibly done wrong with 
> this query. All of the variables are good, without special characters in 
> any sense of the word... So why isn't it importing anything?
>
> Thanks!
>
> $q = "INSERT INTO 
> `visitors`(`username`,`password`,`email`,`firstname`,`lastname`,`birthdate`,`verifythis`)
>VALUES ('".$username."',
>'".md5($password1)."',
>'".$email."',
>'".$firstname."',
>'".$lastname."',
>'".$birthdate."',
>'".$verifythis."');";
> mysql_query($q);
>
> -- 
> Mike Shanley
>
> ~you are almost there~ 

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



[PHP] Re: Data Types Problem

2007-03-12 Thread Haydar Tuna
Hello,
   Becuase PHP don't convert "01" string to integer 1. In the PHP 
help file :

PHP Help for type casting

When a string is evaluated as a numeric value, the resulting value and type 
are determined as follows.

The string will evaluate as a float if it contains any of the characters 
'.', 'e', or 'E'. Otherwise, it will evaluate as an integer.

The value is given by the initial portion of the string. If the string 
starts with valid numeric data, this will be the value used. Otherwise, the 
value will be 0 (zero). Valid numeric data is an optional sign, followed by 
one or more digits (optionally containing a decimal point), followed by an 
optional exponent. The exponent is an 'e' or 'E' followed by one or more 
digits.



You can use = = =  comparision operator for check your variable type 
and variable value at the same time:) $a = = = $b Identical TRUE if $a is 
equal to $b, and they are of the same type. (introduced in PHP 4)







-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net


"Arno Coetzee" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi Guys
>
> I seem to have a problem with data types in php
>
> when executing the following script , i do not get the desired output.
>
> i a pass url parameter (message) to the script.
>
> if i pass a numeric value (1) , the script accepts it as '01' and vice 
> versa.
> the same with 0 and '00'
>
> here is the script:
>
> $theMessage = $_REQUEST['message'];
>   echo "theMessage : '" . $theMessage . "'\n";
>   if ($theMessage == "01")
>{
>echo "message : '01'";
>}else if ($theMessage == "00")
>{
>echo "message : '00'";
>}else if (is_numeric($theMessage))
>{
> echo "Numeric Input : " . $theMessage;
>}else
>{
>echo "Invalid Input";
>}
> ?>
>
> i presume that i am not interpreting the data types it should be 
> interpreted.
>
> can anyone please help
>
> -- 
> Arno Coetzee
> Flash Media Group
> Developer
> Mobile : 27 82 693 6180
> Office : 27 12 430 7597 

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



Re: [PHP] PHP 5.2 + IE 7 = HTTP 304 in login procedure [SOLVED]

2007-03-12 Thread Yannick Warnier
The problem wasn't quite there. The 304 response was correct and didn't
really cause a problem in IE7.

In fact, the problem was somewhere else. As mentioned by someone in the
PHP doc comments (http://be.php.net/manual/en/ref.session.php#64125 ),
IE is the only one to reject urls of the likes of
http://example_demo.littleweb.com/ because of the "_" character.

This means that basically IE will display the site without a problem,
but will not register any cookie, and of course will not mention it, so
it makes it all much easier to detect. The fact that FF and Opera get a
session each does not help at all in finding the problem.

Changing the URL to http://exampledemo.littleweb.com/ will work perfectly.

Yannick


Le dimanche 11 mars 2007 à 23:01 +, Yannick Warnier a écrit :
> Hello,
> 
> One of my clients is currently having a problem when logging into one of
> my site.
> Investigating further (because it works with Firefox with his login/pass
> from my machine), it appears the problem is caused for an obscure reason
> when IE7 requests the page and obviously does a "conditional GET", which
> only loads what's necessary for this login to proceed when the page has
> been updated since last time. The returned HTTP header is 304: Not
> modified, which is not returned with other browsers (others get a 200
> header).
> This is true for PHP pages as well as included CSS files, which triggers
> the question of having any link to PHP at all...
> 
> I've looked on Google quite a bit, and if I have found people having the
> same kind of problems, they generally report it along with the fact that
> they use incorrectly the header('HTTP/1.1 ...'); or
> header('Status: ...'); function, so the fix is generally a change of
> these.
> 
> However, my application doesn't set any of these headers from inside the
> PHP code.
> 
> Before I start getting into the whole Apache2 config (which I'm not to
> good at) and try a lot of funny things in a bid to discover one element
> that would cause this, I'd like to know...
> 
> Does anybody know the problem and have already found a fix?
> 
> Thanks,
> 
> Yannick
> 

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



Re: [PHP] FW: looking for two remote functions

2007-03-12 Thread Tijnema !

Just a little note, getting content-length and a lot of other stuff from
remote files is also possbiel with curl_getinfo()

www.php.net/curl_getinfo

Tijnema


On 3/11/07, Tijnema ! <[EMAIL PROTECTED]> wrote:


Not everyone checks his email 1000 times a day, last time he replied was
yesterday... so give him some time to read his email

Tijnema


On 3/11/07, Myron Turner <[EMAIL PROTECTED]> wrote:
>
> I think we've been talking to ourselves.  The guy with the original
> question seems to have folded his hand and gone home.
>
> > This is exactly what my script also did, get the content-length from
> the
> > header.
> > But i don't see what the actual problem is, there have been a lot of
> > solutions around here but they are all wrong?
> >
> > Tijnema
> >
> --
>
> _
> Myron Turner
> http://www.room535.org
> http://www.bstatzero.org
> http://www.mturner.org/XML_PullParser/
>
>



[PHP] Limiting speed when using CURL functions

2007-03-12 Thread Tijnema !

Hi,

Is there any way i can limit the transfer speed when using CURL?

I'm uploading a file to a server, and i don't want the script to f*** up all
bandwidth.

TIA

Tijnema


Re: [PHP] __autoload() no workie on my 5.2 install...

2007-03-12 Thread Jochem Maas
Nathan Hawks wrote:
> Hey all.  This is my first post, 'coz it's the first time I've ever had
> such a confusing problem with PHP.
> 
> I recently got a VPS and compiled PHP 5.2.1 with the following options:
> 
> --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs
> --with-config-file-path=/etc/php5 --with-curl
> --with-curl-dir=/usr/local/lib --with-gd --with-gd-dir=/usr/local
> --with-gettext --with-jpeg-dir=/usr/local/lib --with-kerberos
> --with-mcrypt --with-mhash --with-mysql=/usr --with-pear
> --with-png-dir=/usr/local/lib --with-xml --with-zlib
> --with-zlib-dir=/usr/local/lib --with-zip --with-openssl --enable-bcmath
> --enable-calendar --enable-ftp --enable-magic-quotes --enable-sockets
> --enable-track-vars --enable-mbstring --enable-memory-limit
> --with-freetype-dir=/usr/include/freetype2 --enable-soap
> --with-mysql-sock=/tmp/mysql.sock
> 
> Apache is 2.2.4 and was also hand-compiled.
> 
> Meanwhile, at home, I have PHP 5.1.6 and Apache 2.2.3.
> 
> At home, __autoload() works great.

so you have 2 different version of php - try running 5.2.1 at home and see if 
that breaks
too.

sometime/somewhere __autoload functionaltiy became a chained affair - this has 
to do
with SPL - I have no idea whether the functionality was meant to change so that
you now have explicitly register your autoloader if you only
define __autload() ... that seems backassed but it may be the case, wouldn't be 
the first
time an arbitrary change to php5's OO functionality had it's BC broken.

try this page and do what it says on the tin - it may help:

http://php.net/manual/en/function.spl-autoload-functions.php

> 
> On the VPS, it doesn't work at all.
> 

I very much doubt this has to do with the fact that it's a VPS.

...

> No clues whatsoever in my Apache error_log.  When I try throwing:
> echo("Got here!\n");
> ..into my __autoload() function, it reveals that __autoload() is never
> being fired.

not sure if echo can output inside of __autoload().

> 
> Please help.
> 
> Nathan
> 

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



Re: [PHP] Limiting speed when using CURL functions

2007-03-12 Thread Martin Marques

Tijnema ! wrote:


Hi,

Is there any way i can limit the transfer speed when using CURL?

I'm uploading a file to a server, and i don't want the script to f*** 
up all

bandwidth.



man renice

P.D.: This is not a PHP question.


--
21:50:04 up 2 days,  9:07,  0 users,  load average: 0.92, 0.37, 0.18
-
Lic. Martín Marqués |   SELECT 'mmarques' || 
Centro de Telemática|   '@' || 'unl.edu.ar';
Universidad Nacional|   DBA, Programador, 
   del Litoral |   Administrador

-

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



[PHP] Caching options - trunkcache?

2007-03-12 Thread Merlin

Hi there,

I am looking for a replacement of php trunkcache. As far as I can see, 
there is no further development and I had to take it offline due a 
system update and compatibility issues.


What would you guys recommend for a free caching system on a LAMP 
environment running php 4.x apache 1.x and mysql 3.x


Thank you for any advice.

Merlin

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



Re: [PHP] Limiting speed when using CURL functions

2007-03-12 Thread Tijnema !

On 3/12/07, Martin Marques  wrote:


Tijnema ! wrote:

> Hi,
>
> Is there any way i can limit the transfer speed when using CURL?
>
> I'm uploading a file to a server, and i don't want the script to f***
> up all
> bandwidth.


man renice

P.D.: This is not a PHP question.



I'm talking about the PHP functions, i know how to do it with the command
line version of CURL, but which settings to use in curl_setopt ??

Tijnema

--

21:50:04 up 2 days,  9:07,  0 users,  load average: 0.92, 0.37, 0.18
-
Lic. Martín Marqués |   SELECT 'mmarques' ||
Centro de Telemática|   '@' || 'unl.edu.ar';
Universidad Nacional|   DBA, Programador,
   del Litoral |   Administrador
-




Re: [PHP] Caching options - trunkcache?

2007-03-12 Thread Jochem Maas
Merlin wrote:
> Hi there,
> 
> I am looking for a replacement of php trunkcache. As far as I can see,
> there is no further development and I had to take it offline due a
> system update and compatibility issues.
> 
> What would you guys recommend for a free caching system on a LAMP
> environment running php 4.x apache 1.x and mysql 3.x

caching what exactly? opcodes? query results? abitrary data structures?
'pre-compiled' templates? html output? elephants?

try here: http://php.net/apc
or here?: http://www.google.nl/search?q=php4+caching

ps - there are currently no projects that support elephant caching, I'm fairly 
sure.

> 
> Thank you for any advice.
> 
> Merlin
> 

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



Re: [PHP] Caching options - trunkcache?

2007-03-12 Thread clive

Merlin wrote:

I am looking for a replacement of php trunkcache. 

I think you meant turck mmcache?

have a look at these:

http://eaccelerator.net (derivative of mmcache last release: 2006/02/15)
http://www.php-accelerator.co.uk/


--
Regards,

Clive.

Real Time Travel Connections


{No electrons were harmed in the creation, transmission or reading of 
this email. However, many were excited and some may well have enjoyed 
the experience.}


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



Re: [PHP] Re: php 4 and 5

2007-03-12 Thread Robert Cummings
On Mon, 2007-03-12 at 10:21 +0200, Haydar Tuna wrote:
> Hello,
> Most important change is Object Oriented Features. PHP 5 support 
> Object Oriented programming features.

I think you mean supports "more" OOP features. PHP4 had plenty of OOP
support also.

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



[PHP] PHP URL issues

2007-03-12 Thread Don Don
I've got the following url rewriting problem.
   
  on page 1 i've got this
   
See 
   
  and on page 2 i've got this
   
  $messageID = $_REQUEST["messageId"];
$userID = $_REQUEST["userId"];
   
  
when i check to see the values of these variables its says its empty, but when 
i place my cursor on the link in
page 1 i can see both variables being show with their values in the browser.  
But on page 2 i cant get the values
Something seems wrong perharps ?
   
  Cheers

 
-
Now that's room service! Choose from over 150,000 hotels 
in 45,000 destinations on Yahoo! Travel to find your fit.

Re: [PHP] PHP URL issues

2007-03-12 Thread Tijnema !

On 3/12/07, Don Don <[EMAIL PROTECTED]> wrote:


I've got the following url rewriting problem.

on page 1 i've got this

  See 

and on page 2 i've got this

$messageID = $_REQUEST["messageId"];
$userID = $_REQUEST["userId"];


when i check to see the values of these variables its says its empty, but
when i place my cursor on the link in
page 1 i can see both variables being show with their values in the
browser.  But on page 2 i cant get the values
Something seems wrong perharps ?

Cheers



I don't know if it matters, but if the variables are coming from the url,
you could also retrieve them with $_GET
$messageID = $_GET["messageId"];
$userID = $_GET["userId"];

And in your link, i see it is pointing to page1.php, i don't know if that is
just a typo in the example

Tijnema

-

Now that's room service! Choose from over 150,000 hotels
in 45,000 destinations on Yahoo! Travel to find your fit.


Re: [PHP] PHP URL issues

2007-03-12 Thread Németh Zoltán
2007. 03. 12, hétfő keltezéssel 05.50-kor Don Don ezt írta:
> I've got the following url rewriting problem.
>
>   on page 1 i've got this
>
> See 

is this all within something like an echo statement with " marks?
otherwise the values might not display correctly

>
>   and on page 2 i've got this
>
>   $messageID = $_REQUEST["messageId"];
> $userID = $_REQUEST["userId"];

why use $_REQUEST? for this $_GET should be okay, and less confusing

hope that helps
Zoltán Németh

>
>   
> when i check to see the values of these variables its says its empty, but 
> when i place my cursor on the link in
> page 1 i can see both variables being show with their values in the browser.  
> But on page 2 i cant get the values
> Something seems wrong perharps ?
>
>   Cheers
> 
>  
> -
> Now that's room service! Choose from over 150,000 hotels 
> in 45,000 destinations on Yahoo! Travel to find your fit.

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



Re: [PHP] Re: php 4 and 5

2007-03-12 Thread Haydar Tuna
Hello,
  Yes, you are right I mean supports more OOP features. PHP 5 support 
more OOP features than PHP 4. :)

-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

"Robert Cummings" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> On Mon, 2007-03-12 at 10:21 +0200, Haydar Tuna wrote:
>> Hello,
>> Most important change is Object Oriented Features. PHP 5 support
>> Object Oriented programming features.
>
> I think you mean supports "more" OOP features. PHP4 had plenty of OOP
> support also.
>
> 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] Caching options - trunkcache?

2007-03-12 Thread Merlin

clive schrieb:

Merlin wrote:

I am looking for a replacement of php trunkcache. 

I think you meant turck mmcache?

have a look at these:

http://eaccelerator.net (derivative of mmcache last release: 2006/02/15)
http://www.php-accelerator.co.uk/




thanx I tried php-accelerator. Lets see if this will bring some extra 
performance.


Merlin

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



Re: [PHP] Caching options - trunkcache?

2007-03-12 Thread Robert Cummings
On Mon, 2007-03-12 at 14:17 +0100, Merlin wrote:
> clive schrieb:
> > Merlin wrote:
> > 
> >> I am looking for a replacement of php trunkcache. 
> > I think you meant turck mmcache?
> > 
> > have a look at these:
> > 
> > http://eaccelerator.net (derivative of mmcache last release: 2006/02/15)

*COUGH COUGH* Last release 2006/10/11. Eaccelerator is actively
maintained and works great :)

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] php 4 and 5

2007-03-12 Thread tedd

At 8:14 AM +0800 3/12/07, [EMAIL PROTECTED] wrote:

Dear All,

What different between 4 and 5 ?

Edward.


1

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

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



[PHP] dst and strtotime

2007-03-12 Thread Jake McHenry

Hi everyone,

I was hoping a problem like this wouldn't arise, but it happened :(

After the dst updates on my fedora box, this broke, and worked fine before.. 
now gives me 3/10 instead of 3/11 for strtotime("last sunday") anyone 
know why? 3/10 was saturday!




$recent_period = strtotime('last sunday');
echo date("Y-m-d", $recent_period);
print_r($periods);
$test_recent_period = array_search($recent_period, $periods);
if ($test_recent_period == '')
 $recent_period = strtotime('last sunday', $recent_period);





Thanks,
Jake 


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



RE: [PHP] dst and strtotime

2007-03-12 Thread Peter Lauri
Is your system time correct?

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free




> -Original Message-
> From: Jake McHenry [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 12, 2007 6:10 PM
> To: PHP-General
> Subject: [PHP] dst and strtotime
> 
> Hi everyone,
> 
> I was hoping a problem like this wouldn't arise, but it happened :(
> 
> After the dst updates on my fedora box, this broke, and worked fine
> before..
> now gives me 3/10 instead of 3/11 for strtotime("last sunday") anyone
> know why? 3/10 was saturday!
> 
> 
> 
> $recent_period = strtotime('last sunday');
> echo date("Y-m-d", $recent_period);
> print_r($periods);
> $test_recent_period = array_search($recent_period, $periods);
> if ($test_recent_period == '')
>   $recent_period = strtotime('last sunday', $recent_period);
> 
> 
> 
> 
> 
> Thanks,
> Jake
> 
> --
> 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] Using array_search I get error

2007-03-12 Thread Richard Kurth
 

-Original Message-
From: Tijnema ! [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 12, 2007 1:16 AM
To: Richard Kurth
Cc: Stut; php-general@lists.php.net
Subject: Re: [PHP] Using array_search I get error

On 3/12/07, Richard Kurth <[EMAIL PROTECTED]> wrote:
>
>
>
> Richard Kurth wrote:
> >
> >
> > -Original Message-
> > From: Stut [mailto:[EMAIL PROTECTED]
> > Sent: Sunday, March 11, 2007 2:53 PM
> > To: Richard Kurth
> > Cc: php-general@lists.php.net
> > Subject: Re: [PHP] Using array_search I get error
> >
> > Richard Kurth wrote:
> >> This array comes from  $_REQUEST of all data submitted
> >>
> >> $array='Array ( [id] => 17 [takeaction] => saveCustomFields [notes] 
> >> =>
> >> -- Feb 4, 2007 @ 9:16 PM --fdsfdsfsdfdsfsfsfds -- Feb 4, 2007 @ 
> >> 9:21 PM --fdfdsfsdffsd -- February 11, 2007, @ 9:31 PM -- This is a 
> >> tes -- February 14, 2007, @ 10:10 PM -- jhafjhfa afjahfajfhda 
> >> kasjdaksdhADSKJL [firstname] => NANCY [lastname] => ADKINS  
> >> [phone2] =>
> > [address1] => 25 ALWARD CT.
> >> [address2] => [city] => MARTINSVILLE [State] => AK [other] => [zip] 
> >> =>
> >> 24112 [country] => US [date18] => 03-13-2007 [text19] => test1 
> >> [text20] => [rating] => 0 [status] => Active )';  when I use 
> >> array_search to find date18
> >>
> >> $key = array_search('date18', $array);  // $key = 1;
> >>
> >> I get Wrong datatype for second argument How come the array is 
> >> wrong datatype isn't a array an array or am I using this wrong
> >
> > $array is a string, and array_search is expecting an array, so it's
> correct.
> > Where did you get that "array"?
> >
> > -Stut
> >
> > This array comes from  $_REQUEST of all data submitted from a form
>
> Yeah, you said that in your first post. What I meant was where did it 
> come from?
>
> What you have there is the output from print_r($_REQUEST). How exactly 
> are you getting that string? Why are you creating it as a literal 
> array rather than using $_REQUEST directly?
>
> What you have there is the output from print_r($_REQUEST). How exactly 
> are you getting that string? Why are you creating it as a literal 
> array rather than using $_REQUEST directly?
>
> -Stut
>
> This is for saving data from custom fields created by the user I don't 
> know what they are named so I can't use $_REQUEST[name] to pull them 
> from the array.
> I am submitting a form to a script that will search thru the array and 
> find the fields that are in there date18 text19 text20 these are user 
> custom fields that I do not know what they are named. I what to 
> compare what is in the array  with a database table and if they match 
> then save the information in the array for that item to the database.


Somehow you managed to get an array become a string..., if your are using
$_REQUEST directly, or a copy of it, then you should have an array.
I also don't really understand what you are trying to do, as 'date18' is a
key, not a value, and array_search searches vor values, in this case it
searches for the value 'date18' and then try's to get the key of that value,
but date18 is a key, so it would probably return false.

Then how would I search for the Key date18 and once I find it how would I
get the value of that key. Because even if I change the date18 to it's value
03-13-2007 I still get the error Wrong datatype for second argument. I have
also tried print_r(array_keys($array)); and I get The first argument should
be an array.


 

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



Re: [PHP] dst and strtotime

2007-03-12 Thread Jake McHenry

yepper

date
Mon Mar 12 12:25:33 EDT 2007


- Original Message - 
From: "Peter Lauri" <[EMAIL PROTECTED]>
To: "'Jake McHenry'" <[EMAIL PROTECTED]>; "'PHP-General'" 


Sent: Monday, March 12, 2007 5:23 PM
Subject: RE: [PHP] dst and strtotime



Is your system time correct?

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free





-Original Message-
From: Jake McHenry [mailto:[EMAIL PROTECTED]
Sent: Monday, March 12, 2007 6:10 PM
To: PHP-General
Subject: [PHP] dst and strtotime

Hi everyone,

I was hoping a problem like this wouldn't arise, but it happened :(

After the dst updates on my fedora box, this broke, and worked fine
before..
now gives me 3/10 instead of 3/11 for strtotime("last sunday") anyone
know why? 3/10 was saturday!



$recent_period = strtotime('last sunday');
echo date("Y-m-d", $recent_period);
print_r($periods);
$test_recent_period = array_search($recent_period, $periods);
if ($test_recent_period == '')
  $recent_period = strtotime('last sunday', $recent_period);





Thanks,
Jake

--
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] Using array_search I get error

2007-03-12 Thread Németh Zoltán
2007. 03. 12, hétfő keltezéssel 09.21-kor Richard Kurth ezt írta:
>  
> -Original Message-
> From: Tijnema ! [mailto:[EMAIL PROTECTED] 
> Sent: Monday, March 12, 2007 1:16 AM
> To: Richard Kurth
> Cc: Stut; php-general@lists.php.net
> Subject: Re: [PHP] Using array_search I get error
> 
> On 3/12/07, Richard Kurth <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > Richard Kurth wrote:
> > >
> > >
> > > -Original Message-
> > > From: Stut [mailto:[EMAIL PROTECTED]
> > > Sent: Sunday, March 11, 2007 2:53 PM
> > > To: Richard Kurth
> > > Cc: php-general@lists.php.net
> > > Subject: Re: [PHP] Using array_search I get error
> > >
> > > Richard Kurth wrote:
> > >> This array comes from  $_REQUEST of all data submitted
> > >>
> > >> $array='Array ( [id] => 17 [takeaction] => saveCustomFields [notes] 
> > >> =>
> > >> -- Feb 4, 2007 @ 9:16 PM --fdsfdsfsdfdsfsfsfds -- Feb 4, 2007 @ 
> > >> 9:21 PM --fdfdsfsdffsd -- February 11, 2007, @ 9:31 PM -- This is a 
> > >> tes -- February 14, 2007, @ 10:10 PM -- jhafjhfa afjahfajfhda 
> > >> kasjdaksdhADSKJL [firstname] => NANCY [lastname] => ADKINS  
> > >> [phone2] =>
> > > [address1] => 25 ALWARD CT.
> > >> [address2] => [city] => MARTINSVILLE [State] => AK [other] => [zip] 
> > >> =>
> > >> 24112 [country] => US [date18] => 03-13-2007 [text19] => test1 
> > >> [text20] => [rating] => 0 [status] => Active )';  when I use 
> > >> array_search to find date18
> > >>
> > >> $key = array_search('date18', $array);  // $key = 1;
> > >>
> > >> I get Wrong datatype for second argument How come the array is 
> > >> wrong datatype isn't a array an array or am I using this wrong
> > >
> > > $array is a string, and array_search is expecting an array, so it's
> > correct.
> > > Where did you get that "array"?
> > >
> > > -Stut
> > >
> > > This array comes from  $_REQUEST of all data submitted from a form
> >
> > Yeah, you said that in your first post. What I meant was where did it 
> > come from?
> >
> > What you have there is the output from print_r($_REQUEST). How exactly 
> > are you getting that string? Why are you creating it as a literal 
> > array rather than using $_REQUEST directly?
> >
> > What you have there is the output from print_r($_REQUEST). How exactly 
> > are you getting that string? Why are you creating it as a literal 
> > array rather than using $_REQUEST directly?
> >
> > -Stut
> >
> > This is for saving data from custom fields created by the user I don't 
> > know what they are named so I can't use $_REQUEST[name] to pull them 
> > from the array.
> > I am submitting a form to a script that will search thru the array and 
> > find the fields that are in there date18 text19 text20 these are user 
> > custom fields that I do not know what they are named. I what to 
> > compare what is in the array  with a database table and if they match 
> > then save the information in the array for that item to the database.
> 
> 
> Somehow you managed to get an array become a string..., if your are using
> $_REQUEST directly, or a copy of it, then you should have an array.
> I also don't really understand what you are trying to do, as 'date18' is a
> key, not a value, and array_search searches vor values, in this case it
> searches for the value 'date18' and then try's to get the key of that value,
> but date18 is a key, so it would probably return false.
> 
> Then how would I search for the Key date18 and once I find it how would I
> get the value of that key.

$array['date18']

>  Because even if I change the date18 to it's value
> 03-13-2007 I still get the error Wrong datatype for second argument. I have
> also tried print_r(array_keys($array)); and I get The first argument should
> be an array.

first, you should make clear what array you use where
what is the output of var_dump($_REQUEST) ?
and what is the output of var_dump($array) ?
if there is difference between the above two, then there might be some
bug in your code where you create $array from $_REQUEST

hope that helps
Zoltán Németh

> 
> 
>  
> 

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



Re: [PHP] Using array_search I get error

2007-03-12 Thread Tijnema !

On 3/12/07, Richard Kurth <[EMAIL PROTECTED]> wrote:




-Original Message-
From: Tijnema ! [mailto:[EMAIL PROTECTED]
Sent: Monday, March 12, 2007 1:16 AM
To: Richard Kurth
Cc: Stut; php-general@lists.php.net
Subject: Re: [PHP] Using array_search I get error

On 3/12/07, Richard Kurth <[EMAIL PROTECTED]> wrote:
>
>
>
> Richard Kurth wrote:
> >
> >
> > -Original Message-
> > From: Stut [mailto:[EMAIL PROTECTED]
> > Sent: Sunday, March 11, 2007 2:53 PM
> > To: Richard Kurth
> > Cc: php-general@lists.php.net
> > Subject: Re: [PHP] Using array_search I get error
> >
> > Richard Kurth wrote:
> >> This array comes from  $_REQUEST of all data submitted
> >>
> >> $array='Array ( [id] => 17 [takeaction] => saveCustomFields [notes]
> >> =>
> >> -- Feb 4, 2007 @ 9:16 PM --fdsfdsfsdfdsfsfsfds -- Feb 4, 2007 @
> >> 9:21 PM --fdfdsfsdffsd -- February 11, 2007, @ 9:31 PM -- This is a
> >> tes -- February 14, 2007, @ 10:10 PM -- jhafjhfa afjahfajfhda
> >> kasjdaksdhADSKJL [firstname] => NANCY [lastname] => ADKINS
> >> [phone2] =>
> > [address1] => 25 ALWARD CT.
> >> [address2] => [city] => MARTINSVILLE [State] => AK [other] => [zip]
> >> =>
> >> 24112 [country] => US [date18] => 03-13-2007 [text19] => test1
> >> [text20] => [rating] => 0 [status] => Active )';  when I use
> >> array_search to find date18
> >>
> >> $key = array_search('date18', $array);  // $key = 1;
> >>
> >> I get Wrong datatype for second argument How come the array is
> >> wrong datatype isn't a array an array or am I using this wrong
> >
> > $array is a string, and array_search is expecting an array, so it's
> correct.
> > Where did you get that "array"?
> >
> > -Stut
> >
> > This array comes from  $_REQUEST of all data submitted from a form
>
> Yeah, you said that in your first post. What I meant was where did it
> come from?
>
> What you have there is the output from print_r($_REQUEST). How exactly
> are you getting that string? Why are you creating it as a literal
> array rather than using $_REQUEST directly?
>
> What you have there is the output from print_r($_REQUEST). How exactly
> are you getting that string? Why are you creating it as a literal
> array rather than using $_REQUEST directly?
>
> -Stut
>
> This is for saving data from custom fields created by the user I don't
> know what they are named so I can't use $_REQUEST[name] to pull them
> from the array.
> I am submitting a form to a script that will search thru the array and
> find the fields that are in there date18 text19 text20 these are user
> custom fields that I do not know what they are named. I what to
> compare what is in the array  with a database table and if they match
> then save the information in the array for that item to the database.


Somehow you managed to get an array become a string..., if your are using
$_REQUEST directly, or a copy of it, then you should have an array.
I also don't really understand what you are trying to do, as 'date18' is a
key, not a value, and array_search searches vor values, in this case it
searches for the value 'date18' and then try's to get the key of that
value,
but date18 is a key, so it would probably return false.

Then how would I search for the Key date18 and once I find it how would I
get the value of that key. Because even if I change the date18 to it's
value
03-13-2007 I still get the error Wrong datatype for second argument. I
have
also tried print_r(array_keys($array)); and I get The first argument
should
be an array.



if you know the name of a key, then u can just retrieve the value with
$value= $array[$key]

But your $array doesn't look like an array..
try var_dump($array);

Tijnema


Re: [PHP] PHP 5.2 + IE 7 = HTTP 304 in login procedure [SOLVED]

2007-03-12 Thread Doctorrock

2007/3/12, Yannick Warnier <[EMAIL PROTECTED]>:


The problem wasn't quite there. The 304 response was correct and didn't
really cause a problem in IE7.

In fact, the problem was somewhere else. As mentioned by someone in the
PHP doc comments (http://be.php.net/manual/en/ref.session.php#64125 ),
IE is the only one to reject urls of the likes of
http://example_demo.littleweb.com/ because of the "_" character.

This means that basically IE will display the site without a problem,
but will not register any cookie, and of course will not mention it, so
it makes it all much easier to detect. The fact that FF and Opera get a
session each does not help at all in finding the problem.

Changing the URL to http://exampledemo.littleweb.com/ will work perfectly.

Yannick



According to RFC1033 (
http://www.camtp.uni-mb.si/books/Internet-Book/DNS_NameFormat.html ),
underscores are forbidden in DNS names, including subdomains.


Re: [PHP] PHP 5.2 + IE 7 = HTTP 304 in login procedure [SOLVED]

2007-03-12 Thread Tijnema !

On 3/12/07, Doctorrock <[EMAIL PROTECTED]> wrote:


2007/3/12, Yannick Warnier <[EMAIL PROTECTED]>:
>
> The problem wasn't quite there. The 304 response was correct and didn't
> really cause a problem in IE7.
>
> In fact, the problem was somewhere else. As mentioned by someone in the
> PHP doc comments (http://be.php.net/manual/en/ref.session.php#64125 ),
> IE is the only one to reject urls of the likes of
> http://example_demo.littleweb.com/ because of the "_" character.
>
> This means that basically IE will display the site without a problem,
> but will not register any cookie, and of course will not mention it, so
> it makes it all much easier to detect. The fact that FF and Opera get a
> session each does not help at all in finding the problem.
>
> Changing the URL to http://exampledemo.littleweb.com/ will work
perfectly.
>
> Yannick


According to RFC1033 (
http://www.camtp.uni-mb.si/books/Internet-Book/DNS_NameFormat.html ),
underscores are forbidden in DNS names, including subdomains.




Yeah, meaning that the program where you created the subdomain with is not
following the RFC standards.
Some programmers have hard time following standards...


Re: [PHP] Extract url from string

2007-03-12 Thread Tijnema !

On 3/12/07, Brad Fuller <[EMAIL PROTECTED]> wrote:


Hey guys,

I've been banging my head against the wall trying to figure out the right
pattern to use to extract a URL from a string using preg_match().

I've been STFW for a while now, and all the examples that I find are for
extracting URLs from within a  tag.

Here's what I need, and I'm sure it's quite common, especially with forums
etc.; hopefully someone has a code snippet they can share.

INPUT:

This is some text http://www.example.com/page.html this is some more text.

OUTPUT:

This is some text http://www.example.com/page.html";>http://www.example.com/page.html

this is some more text.

Thx in advance,

-B



I'm not very familiar with PCRE, but you should search for a pattern
starting with http: and ends with a space.

Tijnema

--

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




[PHP] Re: Troubles from the newb again

2007-03-12 Thread Steve
The way I see it, you have two ways to avoid that error:

1) If you want to preserve indexes:

foreach ($array as $index => $name)
{
 if ($name->currentHP >0)
{
 $newarray[$index] = $name;
}
}

2) If you don't care about indexes at all
foreach ($array as $name)
{
 if ($name->currentHP >0)
{
 $newarray[] = $name;
}
}

Either way should make the error go away. The reason why it's coming up is 
because it looks like the $name value is non-numeric. Storing this stuff in 
arrays is perfectly acceptable, however using them as indexes is not.

""Jeff Taylor"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hey everyone,
> Newb back again - Im trying to populate my arrays, but getting this error
> again:
> Warning: Illegal offset type in
> c:\Inetpub\wwwroot\MyProjects\SecondOffering\myFuncs.php on line 242
>
> Code:
>   $newarray = array();
>   foreach ($array as $name)
>   {
>if ($name->currentHP >0)
>{
> $newarray[$name];
>}
>   } 

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



RE: [PHP] Extract url from string

2007-03-12 Thread Brad Fuller
> -Original Message-
> From: Tijnema ! [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 12, 2007 1:10 PM
> To: Brad Fuller
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] Extract url from string
> 
> On 3/12/07, Brad Fuller <[EMAIL PROTECTED]> wrote:
> >
> > Hey guys,
> >
> > I've been banging my head against the wall trying to figure out the
> right
> > pattern to use to extract a URL from a string using preg_match().
> >
> > I've been STFW for a while now, and all the examples that I find are for
> > extracting URLs from within a  tag.
> >
> > Here's what I need, and I'm sure it's quite common, especially with
> forums
> > etc.; hopefully someone has a code snippet they can share.
> >
> > INPUT:
> >
> > This is some text http://www.example.com/page.html this is some more
> text.
> >
> > OUTPUT:
> >
> > This is some text  > href="http://www.example.com/page.html";>http://www.example.com/page.html
> > 
> > this is some more text.
> >
> > Thx in advance,
> >
> > -B
> 
> 
> I'm not very familiar with PCRE, but you should search for a pattern
> starting with http: and ends with a space.
> 
> Tijnema
> 
> --

I tried this:

preg_match("/http(s)?:\/\/(*.?)\s/", $stringUrl, $matches)

But my pattern syntax is messed up cuz I get this error:

Warning: preg_match() [function.preg-match]: Compilation failed:
nothing to repeat at offset 15 in /path/to/myfile.php on line 5

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



Re: [PHP] php 4 and 5

2007-03-12 Thread Martin Marques

tedd escribió:

At 8:14 AM +0800 3/12/07, [EMAIL PROTECTED] wrote:

Dear All,

What different between 4 and 5 ?

Edward.


1


No! -1  :-D

Unless we are talkaing about absolute difference (distance between).

--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-
Martín Marqués  |   Programador, DBA
Centro de Telemática| Administrador
   Universidad Nacional
del Litoral
-

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



RE: [PHP] Extract url from string [SOLVED]

2007-03-12 Thread Brad Fuller
On 3/12/07, Brad Fuller <[EMAIL PROTECTED]> wrote:
> I tried this:
> 
>   preg_match("/http(s)?:\/\/(*.?)\s/", $stringUrl, $matches)
> 
> But my pattern syntax is messed up cuz I get this error:
> 
>   Warning: preg_match() [function.preg-match]: Compilation failed:
> nothing to repeat at offset 15 in /path/to/myfile.php on line 5
> 

OK - I must not have had enough caffeine today.  It's (.*?) not (*.?)

I figured it out.

echo preg_replace("/http(s)?:\/\/(.*?)\s/i", "$0",
$stringUrl);

Thx,

-B

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



Re: [PHP] Re: php 4 and 5

2007-03-12 Thread Martin Marques

Robert Cummings escribió:

On Mon, 2007-03-12 at 10:21 +0200, Haydar Tuna wrote:

Hello,
Most important change is Object Oriented Features. PHP 5 support 
Object Oriented programming features.


I think you mean supports "more" OOP features. PHP4 had plenty of OOP
support also.


But it was quite crappy.

--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-
Martín Marqués  |   Programador, DBA
Centro de Telemática| Administrador
   Universidad Nacional
del Litoral
-

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



Re: [PHP] Re: php 4 and 5

2007-03-12 Thread Robert Cummings
On Mon, 2007-03-12 at 14:18 -0300, Martin Marques wrote:
> Robert Cummings escribió:
> > On Mon, 2007-03-12 at 10:21 +0200, Haydar Tuna wrote:
> >> Hello,
> >> Most important change is Object Oriented Features. PHP 5 support 
> >> Object Oriented programming features.
> > 
> > I think you mean supports "more" OOP features. PHP4 had plenty of OOP
> > support also.
> 
> But it was quite crappy.

Don't blame the tool. I've never had a problem with the amount of OOP
support in PHP4.

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



[PHP] different and logic between PHP4 and PHP5

2007-03-12 Thread Vieri
Hi

The following code:



yields:

A = 0 in PHP 4
and
A =   in PHP 5

How can I get the same behavior in PHP5 as in PHP4
without changing the source code? Is there an option
in php.ini I'm missing?
 



 

Expecting? Get great news right away with email Auto-Check. 
Try the Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html 

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



[PHP] Posting variable outside of the post form

2007-03-12 Thread Otto Wyss

I submit a form back to itself with

  action="" methode="get"

yet I've a large PHP variable which I'd like to access afterwards as 
well. Is this possible somehow?


O. Wyss

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



Re: [PHP] Re: php 4 and 5

2007-03-12 Thread Martin Marques

Robert Cummings escribió:

On Mon, 2007-03-12 at 14:18 -0300, Martin Marques wrote:

But it was quite crappy.


Don't blame the tool. I've never had a problem with the amount of OOP
support in PHP4.


That's just taste. I started feeling very comfortable when I got to use 
constructors, destructors (very important, especially when dealing with 
DB objects), and even more with __autoload() and clone (referencing by 
default was a great thing).


I have to say, life is easier with PHP5 :-)

--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-
Martín Marqués  |   Programador, DBA
Centro de Telemática| Administrador
   Universidad Nacional
del Litoral
-

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



Re: [PHP] Posting variable outside of the post form

2007-03-12 Thread David Giragosian

On 3/12/07, Otto Wyss <[EMAIL PROTECTED]> wrote:


I submit a form back to itself with

  action="" methode="get"

yet I've a large PHP variable which I'd like to access afterwards as
well. Is this possible somehow?

O. Wyss



Cookie, session variable, session cookie, database layer...

David


Re: [PHP] Posting variable outside of the post form

2007-03-12 Thread Satyam


- Original Message - 
From: "David Giragosian" <[EMAIL PROTECTED]>

To: "Otto Wyss" <[EMAIL PROTECTED]>
Cc: 
Sent: Monday, March 12, 2007 8:18 PM
Subject: Re: [PHP] Posting variable outside of the post form



On 3/12/07, Otto Wyss <[EMAIL PROTECTED]> wrote:


I submit a form back to itself with

  action="" methode="get"

yet I've a large PHP variable which I'd like to access afterwards as
well. Is this possible somehow?

O. Wyss



Cookie, session variable, session cookie, database layer...

David



Or a hidden field  but, since you mentioned the value 
might be large, it might either be advisable to take any of David's 
sugestions or change to a method=post.


Satyam

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



Re: [PHP] different and logic between PHP4 and PHP5

2007-03-12 Thread Martin Marques

Vieri escribió:

Hi

The following code:



Change here:

echo "A = " . (int)$a;


--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-
Martín Marqués  |   Programador, DBA
Centro de Telemática| Administrador
   Universidad Nacional
del Litoral
-

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



[PHP] stream_get_contents() quite slow

2007-03-12 Thread Francois Aichelbaum

Hi guys,

I'm using stream_get_contents() to parse content of an HTTP session I 
opened with fsockopen. My requests headers is just fine and transmission 
is OK : (0.0007s)


But when I read the HTTP answer with stream_get_contents(), it lasts 
about 2.5s !

The webpage is about 5 kB.

The connection is opened on the box and ... itself. I use some OpenVZ on 
the machine. If I use links on commandline to test speed  (or even ab) 
the webpage is loaded about 0.6s !


But I need to use stream_get_contents() to continue on the opened 
connection to get the response of my specific request.


I don't know where to look for about this slow down...

Regards,
Francois.

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



[PHP] Redirecting in a PHP script

2007-03-12 Thread Larry Bradley
I need to "goto"  different PHP pages in my web site depending on what 
happens within some PHP code.


For example, if the user is not logged in when he goes to a page, I want to 
send him to a LOGIN page.


I've have everything working fine, using the following Javascript code:
$location = 'login.php';
echo "\n";
echo "document.location.href = '" . $location . "';\n";
echo "\n";

I also played around with using the header("location: ...") function.

I understand that the header() function must be issued before any HMTL is 
output.


But I'm not sure about the Javascript code. In every instance in my code, I 
use the Javascript before any HTML - this type of action normally occurs in 
PHP code called via a form POST.


I presume that the Javascript code really does the same as the PHP stuff, 
and thus must obey the same rules, but I'm not sure.

Comments?

Larry Bradley
Orleans (Ottawa), Ontario, CANADA 

Re: [PHP] Redirecting in a PHP script

2007-03-12 Thread Tijnema !

On 3/12/07, Larry Bradley <[EMAIL PROTECTED]> wrote:


I need to "goto"  different PHP pages in my web site depending on what
happens within some PHP code.

For example, if the user is not logged in when he goes to a page, I want
to
send him to a LOGIN page.

I've have everything working fine, using the following Javascript code:
$location = 'login.php';
echo "\n";
echo "document.location.href = '" . $location . "';\n";
echo "\n";

I also played around with using the header("location: ...") function.

I understand that the header() function must be issued before any HMTL is
output.

But I'm not sure about the Javascript code. In every instance in my code,
I
use the Javascript before any HTML - this type of action normally occurs
in
PHP code called via a form POST.

I presume that the Javascript code really does the same as the PHP stuff,
and thus must obey the same rules, but I'm not sure.
Comments?

Larry Bradley
Orleans (Ottawa), Ontario, CANADA



There's a difference in them, as the php header function defines the
redirect in the header, meaning that all body is not even parsed. And it
works also if javascript is disabled.
I prefer the header function, but if you already have data parsed, the
javascript could to the job, but even then it needs to be inside the 
tags i believe, or else it won't get automatically executed.

Tijnema


[PHP] Installing php and mysql on linux

2007-03-12 Thread Jonathan Kahan

Hi all,

I am attempting to start the mysql rpm in Red hat as a first step prior to 
downloading and activating the php-mysql rpm. I was attempting to follow 
steps based on the link below. the php rpm is loaded and activated as I have 
been able to execute php scripts. When I attempt to follow those directions, 
I get the below errors. Does anyone know why I got the below errors or can 
help me through this process?


Thanks

http://kbase.redhat.com/faq/FAQ_39_3633.shtm


[EMAIL PROTECTED] var]# rpm -q mysql-server
mysql-server-4.1.20-1.FC4.1
[EMAIL PROTECTED] var]# rpm -q mysql
mysql-4.1.20-1.FC4.1
[EMAIL PROTECTED]  var]# up2date mysql
bash: up2date: command not found
[EMAIL PROTECTED]  var]# up2date mysql-server
bash: up2date: command not found
[EMAIL PROTECTED]  var]# ./up2date mysql
bash: ./up2date: No such file or directory
[EMAIL PROTECTED] var]# ./up2date mysql-server
bash: ./up2date: No such file or directory
[EMAIL PROTECTED]  var]# ./up2date mysql
bash: ./up2date: No such file or directory
[EMAIL PROTECTED]  var]#


Kind Regards
Jonathan Kahan


Systems Developer
Estrin Technologies, inc.
1375 Broadway, 3rd Floor, New York, NY, 10018

Email: [EMAIL PROTECTED]
Web: http://www.estrintech.com 


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



Re: [PHP] Installing php and mysql on linux

2007-03-12 Thread Brad Bonkoski

I think up2date is *not* up2date ;-)
Google for 'yum' and all its flags for usage...

-B

Jonathan Kahan wrote:

Hi all,

I am attempting to start the mysql rpm in Red hat as a first step 
prior to downloading and activating the php-mysql rpm. I was 
attempting to follow steps based on the link below. the php rpm is 
loaded and activated as I have been able to execute php scripts. When 
I attempt to follow those directions, I get the below errors. Does 
anyone know why I got the below errors or can help me through this 
process?


Thanks

http://kbase.redhat.com/faq/FAQ_39_3633.shtm


[EMAIL PROTECTED] var]# rpm -q mysql-server
mysql-server-4.1.20-1.FC4.1
[EMAIL PROTECTED] var]# rpm -q mysql
mysql-4.1.20-1.FC4.1
[EMAIL PROTECTED]  var]# up2date mysql
bash: up2date: command not found
[EMAIL PROTECTED]  var]# up2date mysql-server
bash: up2date: command not found
[EMAIL PROTECTED]  var]# ./up2date mysql
bash: ./up2date: No such file or directory
[EMAIL PROTECTED] var]# ./up2date mysql-server
bash: ./up2date: No such file or directory
[EMAIL PROTECTED]  var]# ./up2date mysql
bash: ./up2date: No such file or directory
[EMAIL PROTECTED]  var]#


Kind Regards
Jonathan Kahan


Systems Developer
Estrin Technologies, inc.
1375 Broadway, 3rd Floor, New York, NY, 10018

Email: [EMAIL PROTECTED]
Web: http://www.estrintech.com


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



RE: [PHP] Installing php and mysql on linux

2007-03-12 Thread Jim Moseby
> I am attempting to start the mysql rpm in Red hat as a first 
> step prior to 
> downloading and activating the php-mysql rpm. I was 
> attempting to follow 
> steps based on the link below. the php rpm is loaded and 
> activated as I have 
> been able to execute php scripts. When I attempt to follow 
> those directions, 
> I get the below errors. Does anyone know why I got the below 
> errors or can 
> help me through this process?
> 
> Thanks
> 
> http://kbase.redhat.com/faq/FAQ_39_3633.shtm
> 
> 
> [EMAIL PROTECTED] var]# rpm -q mysql-server
> mysql-server-4.1.20-1.FC4.1
> [EMAIL PROTECTED] var]# rpm -q mysql
> mysql-4.1.20-1.FC4.1
> [EMAIL PROTECTED]  var]# up2date mysql
> bash: up2date: command not found
> [EMAIL PROTECTED]  var]# up2date mysql-server
> bash: up2date: command not found
> [EMAIL PROTECTED]  var]# ./up2date mysql
> bash: ./up2date: No such file or directory
> [EMAIL PROTECTED] var]# ./up2date mysql-server
> bash: ./up2date: No such file or directory
> [EMAIL PROTECTED]  var]# ./up2date mysql
> bash: ./up2date: No such file or directory
> [EMAIL PROTECTED]  var]#
> 

Unless the up2date binary is in the current directory, leave off the './' at
the beginning.  Type the command exactly as it appears in the directions.

JM

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



Re: [PHP] Installing php and mysql on linux

2007-03-12 Thread Jonathan Kahan

http://www.die.net/doc/linux/man/man8/yum.8.html

I checked the above page on 'Yum" and see no up2date command as you point 
out. However when I  tried update in the format suggested in the link, it 
still gives a command not found error.




"Brad Bonkoski" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

I think up2date is *not* up2date ;-)
Google for 'yum' and all its flags for usage...

-B

Jonathan Kahan wrote:

Hi all,

I am attempting to start the mysql rpm in Red hat as a first step prior 
to downloading and activating the php-mysql rpm. I was attempting to 
follow steps based on the link below. the php rpm is loaded and activated 
as I have been able to execute php scripts. When I attempt to follow 
those directions, I get the below errors. Does anyone know why I got the 
below errors or can help me through this process?


Thanks

http://kbase.redhat.com/faq/FAQ_39_3633.shtm


[EMAIL PROTECTED] var]# rpm -q mysql-server
mysql-server-4.1.20-1.FC4.1
[EMAIL PROTECTED] var]# rpm -q mysql
mysql-4.1.20-1.FC4.1
[EMAIL PROTECTED]  var]# up2date mysql
bash: up2date: command not found
[EMAIL PROTECTED]  var]# up2date mysql-server
bash: up2date: command not found
[EMAIL PROTECTED]  var]# ./up2date mysql
bash: ./up2date: No such file or directory
[EMAIL PROTECTED] var]# ./up2date mysql-server
bash: ./up2date: No such file or directory
[EMAIL PROTECTED]  var]# ./up2date mysql
bash: ./up2date: No such file or directory
[EMAIL PROTECTED]  var]#


Kind Regards
Jonathan Kahan


Systems Developer
Estrin Technologies, inc.
1375 Broadway, 3rd Floor, New York, NY, 10018

Email: [EMAIL PROTECTED]
Web: http://www.estrintech.com
- Original Message - 
From: "Brad Bonkoski" <[EMAIL PROTECTED]>

To: "Jonathan Kahan" <[EMAIL PROTECTED]>
Cc: 
Sent: Monday, March 12, 2007 4:30 PM
Subject: Re: [PHP] Installing php and mysql on linux



I think up2date is *not* up2date ;-)
Google for 'yum' and all its flags for usage...

-B

Jonathan Kahan wrote:

Hi all,

I am attempting to start the mysql rpm in Red hat as a first step prior 
to downloading and activating the php-mysql rpm. I was attempting to 
follow steps based on the link below. the php rpm is loaded and activated 
as I have been able to execute php scripts. When I attempt to follow 
those directions, I get the below errors. Does anyone know why I got the 
below errors or can help me through this process?


Thanks

http://kbase.redhat.com/faq/FAQ_39_3633.shtm


[EMAIL PROTECTED] var]# rpm -q mysql-server
mysql-server-4.1.20-1.FC4.1
[EMAIL PROTECTED] var]# rpm -q mysql
mysql-4.1.20-1.FC4.1
[EMAIL PROTECTED]  var]# up2date mysql
bash: up2date: command not found
[EMAIL PROTECTED]  var]# up2date mysql-server
bash: up2date: command not found
[EMAIL PROTECTED]  var]# ./up2date mysql
bash: ./up2date: No such file or directory
[EMAIL PROTECTED] var]# ./up2date mysql-server
bash: ./up2date: No such file or directory
[EMAIL PROTECTED]  var]# ./up2date mysql
bash: ./up2date: No such file or directory
[EMAIL PROTECTED]  var]#


Kind Regards
Jonathan Kahan


Systems Developer
Estrin Technologies, inc.
1375 Broadway, 3rd Floor, New York, NY, 10018

Email: [EMAIL PROTECTED]
Web: http://www.estrintech.com






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



Re: [PHP] Installing php and mysql on linux

2007-03-12 Thread Alberto Ferrer

I gonna suggest something very cool: Apache Friends.

http://www.apachefriends.org/en/xampp-linux.html

Its the best option on lamp packs.

Regards.

2007/3/12, Jonathan Kahan <[EMAIL PROTECTED]>:

http://www.die.net/doc/linux/man/man8/yum.8.html

I checked the above page on 'Yum" and see no up2date command as you point
out. However when I  tried update in the format suggested in the link, it
still gives a command not found error.



"Brad Bonkoski" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>I think up2date is *not* up2date ;-)
> Google for 'yum' and all its flags for usage...
>
> -B
>
> Jonathan Kahan wrote:
>> Hi all,
>>
>> I am attempting to start the mysql rpm in Red hat as a first step prior
>> to downloading and activating the php-mysql rpm. I was attempting to
>> follow steps based on the link below. the php rpm is loaded and activated
>> as I have been able to execute php scripts. When I attempt to follow
>> those directions, I get the below errors. Does anyone know why I got the
>> below errors or can help me through this process?
>>
>> Thanks
>>
>> http://kbase.redhat.com/faq/FAQ_39_3633.shtm
>>
>>
>> [EMAIL PROTECTED] var]# rpm -q mysql-server
>> mysql-server-4.1.20-1.FC4.1
>> [EMAIL PROTECTED] var]# rpm -q mysql
>> mysql-4.1.20-1.FC4.1
>> [EMAIL PROTECTED]  var]# up2date mysql
>> bash: up2date: command not found
>> [EMAIL PROTECTED]  var]# up2date mysql-server
>> bash: up2date: command not found
>> [EMAIL PROTECTED]  var]# ./up2date mysql
>> bash: ./up2date: No such file or directory
>> [EMAIL PROTECTED] var]# ./up2date mysql-server
>> bash: ./up2date: No such file or directory
>> [EMAIL PROTECTED]  var]# ./up2date mysql
>> bash: ./up2date: No such file or directory
>> [EMAIL PROTECTED]  var]#
>>
>>
>> Kind Regards
>> Jonathan Kahan
>>
>> 
>> Systems Developer
>> Estrin Technologies, inc.
>> 1375 Broadway, 3rd Floor, New York, NY, 10018
>> 
>> Email: [EMAIL PROTECTED]
>> Web: http://www.estrintech.com
- Original Message -
From: "Brad Bonkoski" <[EMAIL PROTECTED]>
To: "Jonathan Kahan" <[EMAIL PROTECTED]>
Cc: 
Sent: Monday, March 12, 2007 4:30 PM
Subject: Re: [PHP] Installing php and mysql on linux


>I think up2date is *not* up2date ;-)
> Google for 'yum' and all its flags for usage...
>
> -B
>
> Jonathan Kahan wrote:
>> Hi all,
>>
>> I am attempting to start the mysql rpm in Red hat as a first step prior
>> to downloading and activating the php-mysql rpm. I was attempting to
>> follow steps based on the link below. the php rpm is loaded and activated
>> as I have been able to execute php scripts. When I attempt to follow
>> those directions, I get the below errors. Does anyone know why I got the
>> below errors or can help me through this process?
>>
>> Thanks
>>
>> http://kbase.redhat.com/faq/FAQ_39_3633.shtm
>>
>>
>> [EMAIL PROTECTED] var]# rpm -q mysql-server
>> mysql-server-4.1.20-1.FC4.1
>> [EMAIL PROTECTED] var]# rpm -q mysql
>> mysql-4.1.20-1.FC4.1
>> [EMAIL PROTECTED]  var]# up2date mysql
>> bash: up2date: command not found
>> [EMAIL PROTECTED]  var]# up2date mysql-server
>> bash: up2date: command not found
>> [EMAIL PROTECTED]  var]# ./up2date mysql
>> bash: ./up2date: No such file or directory
>> [EMAIL PROTECTED] var]# ./up2date mysql-server
>> bash: ./up2date: No such file or directory
>> [EMAIL PROTECTED]  var]# ./up2date mysql
>> bash: ./up2date: No such file or directory
>> [EMAIL PROTECTED]  var]#
>>
>>
>> Kind Regards
>> Jonathan Kahan
>>
>> 
>> Systems Developer
>> Estrin Technologies, inc.
>> 1375 Broadway, 3rd Floor, New York, NY, 10018
>> 
>> Email: [EMAIL PROTECTED]
>> Web: http://www.estrintech.com
>
>
>

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





--
bet0x - Barrahome
http://www.barrahome.com.ar

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



Re: [PHP] dst and strtotime

2007-03-12 Thread Jake McHenry
Anyone know of anything I can check? I've been trying different things all 
afternoon and I'm still getting the wrong date from strtotime. date() works 
fine.


Thanks,
Jake

- Original Message - 
From: "Jake McHenry" <[EMAIL PROTECTED]>

To: "PHP-General" 
Sent: Monday, March 12, 2007 12:26 PM
Subject: Re: [PHP] dst and strtotime



yepper

date
Mon Mar 12 12:25:33 EDT 2007


- Original Message - 
From: "Peter Lauri" <[EMAIL PROTECTED]>
To: "'Jake McHenry'" <[EMAIL PROTECTED]>; "'PHP-General'" 


Sent: Monday, March 12, 2007 5:23 PM
Subject: RE: [PHP] dst and strtotime



Is your system time correct?

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free





-Original Message-
From: Jake McHenry [mailto:[EMAIL PROTECTED]
Sent: Monday, March 12, 2007 6:10 PM
To: PHP-General
Subject: [PHP] dst and strtotime

Hi everyone,

I was hoping a problem like this wouldn't arise, but it happened :(

After the dst updates on my fedora box, this broke, and worked fine
before..
now gives me 3/10 instead of 3/11 for strtotime("last sunday") 
anyone

know why? 3/10 was saturday!



$recent_period = strtotime('last sunday');
echo date("Y-m-d", $recent_period);
print_r($periods);
$test_recent_period = array_search($recent_period, $periods);
if ($test_recent_period == '')
  $recent_period = strtotime('last sunday', $recent_period);





Thanks,
Jake

--
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] My help with adding captcha

2007-03-12 Thread Joker7
In news: [EMAIL PROTECTED],
Chris  said:
>> Joker7 wrote:
>>> Hi- as you know I have been working on adding a captcha image to my
>>> guestbook.
>>> Well I have managed to get a very basic one working ;) but !I have
>>> been trying to get one that would make it more easy to use ,I have
>>> it working until I add it to my form.
>>>
>>> My form use's print see below and I need to add this to it:
>>>
>>>
>>>   
>>> Listen To This
>>
>> And what happens when you try?
>>
>> There's nothing in that snippet that shows an error (missing a
>> semi-colon won't stop it printing as Tijnema suggested).
>>
>>
>> --
>> Postgresql & php tutorials
>> http://www.designmagick.com/

When it "prints" it will print   http://site.com/
 and not the link formate as 
below.




I hope I have made my self clear.
Chris 

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



Re: [PHP] dst and strtotime

2007-03-12 Thread Tijnema !

On 3/12/07, Jake McHenry <[EMAIL PROTECTED]> wrote:


Anyone know of anything I can check? I've been trying different things all
afternoon and I'm still getting the wrong date from strtotime. date()
works
fine.

Thanks,
Jake

- Original Message -
From: "Jake McHenry" <[EMAIL PROTECTED]>
To: "PHP-General" 
Sent: Monday, March 12, 2007 12:26 PM
Subject: Re: [PHP] dst and strtotime


> yepper
>
> date
> Mon Mar 12 12:25:33 EDT 2007



Is this from PHP or from bash?
Sometimes those differ...

Tijnema



>
> - Original Message -
> From: "Peter Lauri" <[EMAIL PROTECTED]>
> To: "'Jake McHenry'" <[EMAIL PROTECTED]>; "'PHP-General'"
> 
> Sent: Monday, March 12, 2007 5:23 PM
> Subject: RE: [PHP] dst and strtotime
>
>
>> Is your system time correct?
>>
>> Best regards,
>> Peter Lauri
>>
>> www.dwsasia.com - company web site
>> www.lauri.se - personal web site
>> www.carbonfree.org.uk - become Carbon Free
>>
>>
>>
>>
>>> -Original Message-
>>> From: Jake McHenry [mailto:[EMAIL PROTECTED]
>>> Sent: Monday, March 12, 2007 6:10 PM
>>> To: PHP-General
>>> Subject: [PHP] dst and strtotime
>>>
>>> Hi everyone,
>>>
>>> I was hoping a problem like this wouldn't arise, but it happened :(
>>>
>>> After the dst updates on my fedora box, this broke, and worked fine
>>> before..
>>> now gives me 3/10 instead of 3/11 for strtotime("last sunday")
>>> anyone
>>> know why? 3/10 was saturday!
>>>
>>>
>>>
>>> $recent_period = strtotime('last sunday');
>>> echo date("Y-m-d", $recent_period);
>>> print_r($periods);
>>> $test_recent_period = array_search($recent_period, $periods);
>>> if ($test_recent_period == '')
>>>   $recent_period = strtotime('last sunday', $recent_period);
>>>
>>>
>>>
>>>
>>>
>>> Thanks,
>>> Jake
>>>
>>> --
>>> 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] My help with adding captcha

2007-03-12 Thread Tijnema !

On 3/12/07, Joker7 <[EMAIL PROTECTED]> wrote:


In news: [EMAIL PROTECTED],
Chris  said:
>> Joker7 wrote:
>>> Hi- as you know I have been working on adding a captcha image to my
>>> guestbook.
>>> Well I have managed to get a very basic one working ;) but !I have
>>> been trying to get one that would make it more easy to use ,I have
>>> it working until I add it to my form.
>>>
>>> My form use's print see below and I need to add this to it:
>>>
>>>
>>> 
>>> Listen To This
>>
>> And what happens when you try?
>>
>> There's nothing in that snippet that shows an error (missing a
>> semi-colon won't stop it printing as Tijnema suggested).
>>
>>
>> --
>> Postgresql & php tutorials
>> http://www.designmagick.com/

When it "prints" it will print   http://site.com/
 and not the link formate
as
below.




I hope I have made my self clear.
Chris



I don't understand it completly i think, but you are printing PHP code.
I think you are printing it now like so:
echo '
Listen To This';
then you should change it to
echo '
Listen To This';

Tijnema




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




Re: [PHP] My help with adding captcha

2007-03-12 Thread Joker7
In news: [EMAIL PROTECTED],
Chris  said:
>> Joker7 wrote:
>>> Hi- as you know I have been working on adding a captcha image to my
>>> guestbook.
>>> Well I have managed to get a very basic one working ;) but !I have
>>> been trying to get one that would make it more easy to use ,I have
>>> it working until I add it to my form.
>>>
>>> My form use's print see below and I need to add this to it:
>>>
>>>
>>>   
>>> Listen To This
>>
>> And what happens when you try?
>>
>> There's nothing in that snippet that shows an error (missing a
>> semi-colon won't stop it printing as Tijnema suggested).
>>
>>
>> --
>> Postgresql & php tutorials
>> http://www.designmagick.com/



I have add a link so you can see what is going on.
http://www.kick-butt.co.uk/captcha/test.php
is working

http://www.kick-butt.co.uk/captcha/test1.php
Is the one Im having a problem with :(

Chris 

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



Re: [PHP] dst and strtotime

2007-03-12 Thread Jake McHenry




On 3/12/07, Jake McHenry <[EMAIL PROTECTED]> wrote:


Anyone know of anything I can check? I've been trying different things 
all

afternoon and I'm still getting the wrong date from strtotime. date()
works
fine.

Thanks,
Jake

- Original Message -
From: "Jake McHenry" <[EMAIL PROTECTED]>
To: "PHP-General" 
Sent: Monday, March 12, 2007 12:26 PM
Subject: Re: [PHP] dst and strtotime


> yepper
>
> date
> Mon Mar 12 12:25:33 EDT 2007



Is this from PHP or from bash?
Sometimes those differ...




2007-03-12 17:34:22
2007-03-12 17:34:22








Tijnema



>
> - Original Message -
> From: "Peter Lauri" <[EMAIL PROTECTED]>
> To: "'Jake McHenry'" <[EMAIL PROTECTED]>; "'PHP-General'"
> 
> Sent: Monday, March 12, 2007 5:23 PM
> Subject: RE: [PHP] dst and strtotime
>
>
>> Is your system time correct?
>>
>> Best regards,
>> Peter Lauri
>>
>> www.dwsasia.com - company web site
>> www.lauri.se - personal web site
>> www.carbonfree.org.uk - become Carbon Free
>>
>>
>>
>>
>>> -Original Message-
>>> From: Jake McHenry [mailto:[EMAIL PROTECTED]
>>> Sent: Monday, March 12, 2007 6:10 PM
>>> To: PHP-General
>>> Subject: [PHP] dst and strtotime
>>>
>>> Hi everyone,
>>>
>>> I was hoping a problem like this wouldn't arise, but it happened :(
>>>
>>> After the dst updates on my fedora box, this broke, and worked fine
>>> before..
>>> now gives me 3/10 instead of 3/11 for strtotime("last sunday")
>>> anyone
>>> know why? 3/10 was saturday!
>>>
>>>
>>>
>>> $recent_period = strtotime('last sunday');
>>> echo date("Y-m-d", $recent_period);
>>> print_r($periods);
>>> $test_recent_period = array_search($recent_period, $periods);
>>> if ($test_recent_period == '')
>>>   $recent_period = strtotime('last sunday', $recent_period);
>>>
>>>
>>>
>>>
>>>
>>> Thanks,
>>> Jake
>>>
>>> --
>>> 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






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



Re: [PHP] Redirecting in a PHP script

2007-03-12 Thread Satyam


- Original Message - 
From: "Larry Bradley" <[EMAIL PROTECTED]>

To: 
Sent: Monday, March 12, 2007 9:02 PM
Subject: [PHP] Redirecting in a PHP script



I need to "goto"  different PHP pages in my web site depending on what
happens within some PHP code.

For example, if the user is not logged in when he goes to a page, I want 
to

send him to a LOGIN page.

I've have everything working fine, using the following Javascript code:
$location = 'login.php';
echo "\n";
echo "document.location.href = '" . $location . "';\n";
echo "\n";

I also played around with using the header("location: ...") function.

I understand that the header() function must be issued before any HMTL is
output.

But I'm not sure about the Javascript code. In every instance in my code, 
I
use the Javascript before any HTML - this type of action normally occurs 
in

PHP code called via a form POST.

I presume that the Javascript code really does the same as the PHP stuff,
and thus must obey the same rules, but I'm not sure.
Comments?

Larry Bradley
Orleans (Ottawa), Ontario, CANADA


The header function fails if anything at all is sent to the browser, be it 
plain HTML, JavaScript code or even a single space.   The header function 
does not differentiate between the visible part of the page (that within the 
) or what goes before, it fails even if a whitespace is sent before 
the  or 

A redirect via JavaScript can be done at any time and it is no different 
than a user clicking on a  tag.  It will be executed when found or 
when invoked.  If not contained within a function, it will be executed at 
once, no matter if the full page has not been loaded yet.  If within a 
function, whenever it is called.


Notice, though, the effect on the History.  The header() call will have only 
the destination page stored on the History, the JavaScript will have both 
the original and the final destination.   Thus, redirecting with JavaScript 
will get you into a loop if after reaching the destination you click on the 
back button, because you will fall in the page containing the redirection. 
I'm sure you found places like that.  The only way to actually go back in 
those is to open the dropdown list for the back button and skip over one 
item.  That does not happen when using the header() PHP function.


Satyam

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



Re: [PHP] Redirecting in a PHP script

2007-03-12 Thread Robert Cummings
On Mon, 2007-03-12 at 22:43 +0100, Satyam wrote:
> The only way to actually go back in 
> those is to open the dropdown list for the back button and skip over one 
> item.

I've found clicking really fast can get you back :)

> That does not happen when using the header() PHP function.

That is my recommendation also despite the success of frantic clicking
*grin*

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] Redirecting in a PHP script

2007-03-12 Thread Richard Lynch
You also may want to consider just using an 'include' instead of
bouncing the poor user around like a basketball in re-directs.

Each re-direct sends traffic back and forth over the network, which
could be slow/flaky.

Plus you are chewing up HTTP connections on your web-server, and
that's an expensive resource on a busy server.

If your architect a web application correctly in the first place, you
don't need a header re-direct, imho.

Simply pull in the correct PHP code to do what you want, when you
want, and give the user the answer now, instead of making them get
back in line for another HTTP request to get their answer.

On Mon, March 12, 2007 3:02 pm, Larry Bradley wrote:
> I need to "goto"  different PHP pages in my web site depending on what
> happens within some PHP code.
>
> For example, if the user is not logged in when he goes to a page, I
> want to
> send him to a LOGIN page.
>
> I've have everything working fine, using the following Javascript
> code:
>  $location = 'login.php';
>  echo "\n";
>  echo "document.location.href = '" . $location .
> "';\n";
>  echo "\n";
>
> I also played around with using the header("location: ...") function.
>
> I understand that the header() function must be issued before any HMTL
> is
> output.
>
> But I'm not sure about the Javascript code. In every instance in my
> code, I
> use the Javascript before any HTML - this type of action normally
> occurs in
> PHP code called via a form POST.
>
> I presume that the Javascript code really does the same as the PHP
> stuff,
> and thus must obey the same rules, but I'm not sure.
> Comments?
>
> Larry Bradley
> Orleans (Ottawa), Ontario, CANADA


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Posting variable outside of the post form

2007-03-12 Thread Richard Lynch
Use sessions.

http://php.net/session_start

On Mon, March 12, 2007 2:12 pm, Otto Wyss wrote:
> I submit a form back to itself with
>
>action="" methode="get"
>
> yet I've a large PHP variable which I'd like to access afterwards as
> well. Is this possible somehow?
>
> O. Wyss
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Extract url from string

2007-03-12 Thread Richard Lynch
The problem is that "URL" has a very specific meaning, and includes a
BUNCH of complexities you may or may not need...

Download "The Regex Coach" and play around with some sample inputs
until you find what works for your needs, which is not a full-blown
URL detector, since that would be very complicated indeed.

On Mon, March 12, 2007 12:06 pm, Brad Fuller wrote:
> Hey guys,
>
> I've been banging my head against the wall trying to figure out the
> right
> pattern to use to extract a URL from a string using preg_match().
>
> I've been STFW for a while now, and all the examples that I find are
> for
> extracting URLs from within a  tag.
>
> Here's what I need, and I'm sure it's quite common, especially with
> forums
> etc.; hopefully someone has a code snippet they can share.
>
> INPUT:
>
> This is some text http://www.example.com/page.html this is some more
> text.
>
> OUTPUT:
>
> This is some text  href="http://www.example.com/page.html";>http://www.example.com/page.html
> this is some more text.
>
> Thx in advance,
>
> -B
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] PHP URL issues

2007-03-12 Thread Richard Lynch
On Mon, March 12, 2007 7:50 am, Don Don wrote:
> I've got the following url rewriting problem.
>
>   on page 1 i've got this
>
> See
> 
>
>   and on page 2 i've got this
>
>   $messageID = $_REQUEST["messageId"];
> $userID = $_REQUEST["userId"];

You switched from Id to ID (capital 'D') and probably switched back
again in your 'echo' to see the values...

> when i check to see the values of these variables its says its empty,
> but when i place my cursor on the link in
> page 1 i can see both variables being show with their values in the
> browser.  But on page 2 i cant get the values
> Something seems wrong perharps ?

I am pretty sure that there are no harps involved.
:-)

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Caching options - trunkcache?

2007-03-12 Thread Richard Lynch
APC is getting rolled into PHP 6, allegedly.

So that's kind of a no-brainer to choose, imho, as then you can be
forwards-compatible with something that turns into the PHP Dev Teams'
maintenance work instead of your own.

Zend Cache may still be faster, as they got the jump on the PHP code
caching game.  So if you've got the $$$, benchmark both and see which
helps you more.

YMMV
NAIAA
IANAL

On Mon, March 12, 2007 7:18 am, Merlin wrote:
> Hi there,
>
> I am looking for a replacement of php trunkcache. As far as I can see,
> there is no further development and I had to take it offline due a
> system update and compatibility issues.
>
> What would you guys recommend for a free caching system on a LAMP
> environment running php 4.x apache 1.x and mysql 3.x
>
> Thank you for any advice.
>
> Merlin
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Installing php and mysql on linux

2007-03-12 Thread Edward Vermillion
You've either got path problems or up2date is not installed. That's  
what 'command not found' means, it can't find the 'up2date' command.


Do you just want to start the MySQL server? Or are you trying to  
update the MySQL rpm?


You should be able to start the server with a '/etc/init.d/mysql  
start', as root. If that doesn't work try 'mysqld' in place of  
'mysql'. I don't remember which one Fedora uses.


If you're trying to update the rpm then make sure you have up2date  
installed. 'rmp -qa | grep up2date' should get you something. If it  
is installed then try to ad the complete path to up2date, I can't  
remember where it is off the top of my head but '/usr/bin/up2date' or  
'/usr/sbin/up2date' should get it.


I would also suggest you either look online or get a good book on  
linux administration, especially if this system is doing anything  
important. As root you can really mess it up if you don't know what  
you're doing. And you could probably find a good used book fairly  
cheap. You shouldn't need to get the latest and greatest as the basic  
administration stuff has been relatively standard for quite a few  
years now.


Good Luck!

Ed

On Mar 12, 2007, at 3:56 PM, Jonathan Kahan wrote:


http://www.die.net/doc/linux/man/man8/yum.8.html

I checked the above page on 'Yum" and see no up2date command as you  
point out. However when I  tried update in the format suggested in  
the link, it still gives a command not found error.




"Brad Bonkoski" <[EMAIL PROTECTED]> wrote in message news: 
[EMAIL PROTECTED]

I think up2date is *not* up2date ;-)
Google for 'yum' and all its flags for usage...

-B

Jonathan Kahan wrote:

Hi all,

I am attempting to start the mysql rpm in Red hat as a first step  
prior to downloading and activating the php-mysql rpm. I was  
attempting to follow steps based on the link below. the php rpm  
is loaded and activated as I have been able to execute php  
scripts. When I attempt to follow those directions, I get the  
below errors. Does anyone know why I got the below errors or can  
help me through this process?


Thanks

http://kbase.redhat.com/faq/FAQ_39_3633.shtm


[EMAIL PROTECTED] var]# rpm -q mysql-server
mysql-server-4.1.20-1.FC4.1
[EMAIL PROTECTED] var]# rpm -q mysql
mysql-4.1.20-1.FC4.1
[EMAIL PROTECTED]  var]# up2date mysql
bash: up2date: command not found
[EMAIL PROTECTED]  var]# up2date mysql-server
bash: up2date: command not found
[EMAIL PROTECTED]  var]# ./up2date mysql
bash: ./up2date: No such file or directory
[EMAIL PROTECTED] var]# ./up2date mysql-server
bash: ./up2date: No such file or directory
[EMAIL PROTECTED]  var]# ./up2date mysql
bash: ./up2date: No such file or directory
[EMAIL PROTECTED]  var]#


Kind Regards
Jonathan Kahan


Systems Developer
Estrin Technologies, inc.
1375 Broadway, 3rd Floor, New York, NY, 10018

Email: [EMAIL PROTECTED]
Web: http://www.estrintech.com
- Original Message - From: "Brad Bonkoski"  
<[EMAIL PROTECTED]>

To: "Jonathan Kahan" <[EMAIL PROTECTED]>
Cc: 
Sent: Monday, March 12, 2007 4:30 PM
Subject: Re: [PHP] Installing php and mysql on linux



I think up2date is *not* up2date ;-)
Google for 'yum' and all its flags for usage...

-B

Jonathan Kahan wrote:

Hi all,

I am attempting to start the mysql rpm in Red hat as a first step  
prior to downloading and activating the php-mysql rpm. I was  
attempting to follow steps based on the link below. the php rpm  
is loaded and activated as I have been able to execute php  
scripts. When I attempt to follow those directions, I get the  
below errors. Does anyone know why I got the below errors or can  
help me through this process?


Thanks

http://kbase.redhat.com/faq/FAQ_39_3633.shtm


[EMAIL PROTECTED] var]# rpm -q mysql-server
mysql-server-4.1.20-1.FC4.1
[EMAIL PROTECTED] var]# rpm -q mysql
mysql-4.1.20-1.FC4.1
[EMAIL PROTECTED]  var]# up2date mysql
bash: up2date: command not found
[EMAIL PROTECTED]  var]# up2date mysql-server
bash: up2date: command not found
[EMAIL PROTECTED]  var]# ./up2date mysql
bash: ./up2date: No such file or directory
[EMAIL PROTECTED] var]# ./up2date mysql-server
bash: ./up2date: No such file or directory
[EMAIL PROTECTED]  var]# ./up2date mysql
bash: ./up2date: No such file or directory
[EMAIL PROTECTED]  var]#


Kind Regards
Jonathan Kahan


Systems Developer
Estrin Technologies, inc.
1375 Broadway, 3rd Floor, New York, NY, 10018

Email: [EMAIL PROTECTED]
Web: http://www.estrintech.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



Re: [PHP] Limiting speed when using CURL functions

2007-03-12 Thread Richard Lynch
On Mon, March 12, 2007 7:14 am, Tijnema ! wrote:
> Is there any way i can limit the transfer speed when using CURL?
>
> I'm uploading a file to a server, and i don't want the script to f***
> up all
> bandwidth.

I don't recall ever seeing that in curl, but check on the curl site,
linked from here:
http://php.net/curl

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Data Types Problem

2007-03-12 Thread Richard Lynch
By definition, all HTTP data is of type 'string' because that's the
ONLY data type HTTP supports.

PHP will cheerfully typecast it to whatever it needs to be later, but
when it first comes in from the GET (or POST or COOKIE or whatever)
data, it's going to start its life as a string, no matter how it
looks.

If you *know* it should be integer, typecast it as you get it:

$foo = (int) $_GET['foo'];

Do this to a) self-document your code, b) foil a ton of web-bots and
nasty people trying to cram the wrong kind of data into your
application to break/abuse it.


On Mon, March 12, 2007 2:26 am, Arno Coetzee wrote:
> Hi Guys
>
> I seem to have a problem with data types in php
>
> when executing the following script , i do not get the desired output.
>
> i a pass url parameter (message) to the script.
>
> if i pass a numeric value (1) , the script accepts it as '01' and vice
> versa.
> the same with 0 and '00'
>
> here is the script:
>
>  $theMessage = $_REQUEST['message'];
>
> echo "theMessage : '" . $theMessage . "'\n";
>
> if ($theMessage == "01")
> {
> echo "message : '01'";
> }else if ($theMessage == "00")
> {
> echo "message : '00'";
> }else if (is_numeric($theMessage))
> {
>  echo "Numeric Input : " . $theMessage;
> }else
> {
> echo "Invalid Input";
> }
> ?>
>
> i presume that i am not interpreting the data types it should be
> interpreted.
>
> can anyone please help
>
> --
> Arno Coetzee
> Flash Media Group
> Developer
> Mobile : 27 82 693 6180
> Office : 27 12 430 7597
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] xml parsing

2007-03-12 Thread Richard Lynch
I don't think that's valid XML, because you are mixing your content
with your XML tags in a way that will confuse the two...

If you can FIX the XML by using the CDATA stuff, or htmlentities
encoding the HTML or something, that would be best.

If you are STUCK with this bogus XML, you could probably write your
own parser for something this simple/small in about an hour using
http://php.net/strtok and friends...


On Sun, March 11, 2007 7:38 pm, Marije van Deventer wrote:
> I have been trying to parse this xml, and want to use it with
> childnodes  and , but sofar due to the  and  and
>  elements no luck. How can i do this in a simple way ???
>
> 
> 
>  
>   Algemeen
>   a
>  
>  
>   1-Atmosfeer
>   
>   a
>   bbb
>   ccc
>   dd
>/>qqq />
>  
>  
>   Betrouwbare drukcabine
>    alt="News" width="180" height="239"/> /> />
>  
> 


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] php 4 and 5

2007-03-12 Thread Richard Lynch
On Sun, March 11, 2007 7:14 pm, [EMAIL PROTECTED] wrote:
> What different between 4 and 5 ?

-1

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] PHP 5.2 + IE 7 = HTTP 304 in login procedure

2007-03-12 Thread Richard Lynch
Perhaps try sending various no-cache headers and a Date-Modified with
the current time-stamp in it.

You never know with IE what's actually going to work, and you could
mess up other browsers, though, so do lots of browser tests...

On Sun, March 11, 2007 6:01 pm, Yannick Warnier wrote:
> Hello,
>
> One of my clients is currently having a problem when logging into one
> of
> my site.
> Investigating further (because it works with Firefox with his
> login/pass
> from my machine), it appears the problem is caused for an obscure
> reason
> when IE7 requests the page and obviously does a "conditional GET",
> which
> only loads what's necessary for this login to proceed when the page
> has
> been updated since last time. The returned HTTP header is 304: Not
> modified, which is not returned with other browsers (others get a 200
> header).
> This is true for PHP pages as well as included CSS files, which
> triggers
> the question of having any link to PHP at all...
>
> I've looked on Google quite a bit, and if I have found people having
> the
> same kind of problems, they generally report it along with the fact
> that
> they use incorrectly the header('HTTP/1.1 ...'); or
> header('Status: ...'); function, so the fix is generally a change of
> these.
>
> However, my application doesn't set any of these headers from inside
> the
> PHP code.
>
> Before I start getting into the whole Apache2 config (which I'm not to
> good at) and try a lot of funny things in a bid to discover one
> element
> that would cause this, I'd like to know...
>
> Does anybody know the problem and have already found a fix?
>
> Thanks,
>
> Yannick
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Installing php and mysql on linux

2007-03-12 Thread Jonathan Kahan
Your point are well taken. I was ale to follow directions from the mysql 
website to start getting mysql to work instead of the linux site which was 
the basis for my original post. Does anyone know where I can go to download 
(aside from the red hat site where i would need to gather license info) a 
php-mysql rpm?
- Original Message - 
From: "Edward Vermillion" <[EMAIL PROTECTED]>

To: "Jonathan Kahan" <[EMAIL PROTECTED]>
Cc: "php Lists" 
Sent: Monday, March 12, 2007 6:27 PM
Subject: Re: [PHP] Installing php and mysql on linux


You've either got path problems or up2date is not installed. That's  what 
'command not found' means, it can't find the 'up2date' command.


Do you just want to start the MySQL server? Or are you trying to  update 
the MySQL rpm?


You should be able to start the server with a '/etc/init.d/mysql  start', 
as root. If that doesn't work try 'mysqld' in place of  'mysql'. I don't 
remember which one Fedora uses.


If you're trying to update the rpm then make sure you have up2date 
installed. 'rmp -qa | grep up2date' should get you something. If it  is 
installed then try to ad the complete path to up2date, I can't  remember 
where it is off the top of my head but '/usr/bin/up2date' or 
'/usr/sbin/up2date' should get it.


I would also suggest you either look online or get a good book on  linux 
administration, especially if this system is doing anything  important. As 
root you can really mess it up if you don't know what  you're doing. And 
you could probably find a good used book fairly  cheap. You shouldn't need 
to get the latest and greatest as the basic  administration stuff has been 
relatively standard for quite a few  years now.


Good Luck!

Ed

On Mar 12, 2007, at 3:56 PM, Jonathan Kahan wrote:


http://www.die.net/doc/linux/man/man8/yum.8.html

I checked the above page on 'Yum" and see no up2date command as you 
point out. However when I  tried update in the format suggested in  the 
link, it still gives a command not found error.




"Brad Bonkoski" <[EMAIL PROTECTED]> wrote in message news: 
[EMAIL PROTECTED]

I think up2date is *not* up2date ;-)
Google for 'yum' and all its flags for usage...

-B

Jonathan Kahan wrote:

Hi all,

I am attempting to start the mysql rpm in Red hat as a first step 
prior to downloading and activating the php-mysql rpm. I was 
attempting to follow steps based on the link below. the php rpm  is 
loaded and activated as I have been able to execute php  scripts. When 
I attempt to follow those directions, I get the  below errors. Does 
anyone know why I got the below errors or can  help me through this 
process?


Thanks

http://kbase.redhat.com/faq/FAQ_39_3633.shtm


[EMAIL PROTECTED] var]# rpm -q mysql-server
mysql-server-4.1.20-1.FC4.1
[EMAIL PROTECTED] var]# rpm -q mysql
mysql-4.1.20-1.FC4.1
[EMAIL PROTECTED]  var]# up2date mysql
bash: up2date: command not found
[EMAIL PROTECTED]  var]# up2date mysql-server
bash: up2date: command not found
[EMAIL PROTECTED]  var]# ./up2date mysql
bash: ./up2date: No such file or directory
[EMAIL PROTECTED] var]# ./up2date mysql-server
bash: ./up2date: No such file or directory
[EMAIL PROTECTED]  var]# ./up2date mysql
bash: ./up2date: No such file or directory
[EMAIL PROTECTED]  var]#


Kind Regards
Jonathan Kahan


Systems Developer
Estrin Technologies, inc.
1375 Broadway, 3rd Floor, New York, NY, 10018

Email: [EMAIL PROTECTED]
Web: http://www.estrintech.com
- Original Message - From: "Brad Bonkoski" 
<[EMAIL PROTECTED]>

To: "Jonathan Kahan" <[EMAIL PROTECTED]>
Cc: 
Sent: Monday, March 12, 2007 4:30 PM
Subject: Re: [PHP] Installing php and mysql on linux



I think up2date is *not* up2date ;-)
Google for 'yum' and all its flags for usage...

-B

Jonathan Kahan wrote:

Hi all,

I am attempting to start the mysql rpm in Red hat as a first step 
prior to downloading and activating the php-mysql rpm. I was 
attempting to follow steps based on the link below. the php rpm  is 
loaded and activated as I have been able to execute php  scripts. When 
I attempt to follow those directions, I get the  below errors. Does 
anyone know why I got the below errors or can  help me through this 
process?


Thanks

http://kbase.redhat.com/faq/FAQ_39_3633.shtm


[EMAIL PROTECTED] var]# rpm -q mysql-server
mysql-server-4.1.20-1.FC4.1
[EMAIL PROTECTED] var]# rpm -q mysql
mysql-4.1.20-1.FC4.1
[EMAIL PROTECTED]  var]# up2date mysql
bash: up2date: command not found
[EMAIL PROTECTED]  var]# up2date mysql-server
bash: up2date: command not found
[EMAIL PROTECTED]  var]# ./up2date mysql
bash: ./up2date: No such file or directory
[EMAIL PROTECTED] var]# ./up2date mysql-server
bash: ./up2date: No such file or directory
[EMAIL PROTECTED]  var]# ./up2date mysql
bash: ./up2date: No such file or directory
[EMAIL PROTECTED]  var]#


Kind Regards
Jonathan Kahan

--

RE: [PHP] Using array_search I get error

2007-03-12 Thread Richard Lynch
On Sun, March 11, 2007 6:00 pm, Richard Kurth wrote:
>
>
> Richard Kurth wrote:
>>
>>
>> -Original Message-
>> From: Stut [mailto:[EMAIL PROTECTED]
>> Sent: Sunday, March 11, 2007 2:53 PM
>> To: Richard Kurth
>> Cc: php-general@lists.php.net
>> Subject: Re: [PHP] Using array_search I get error
>>
>> Richard Kurth wrote:
>>> This array comes from  $_REQUEST of all data submitted
>>>
>>> $array='Array ( [id] => 17 [takeaction] => saveCustomFields [notes]
>>> =>
>>> -- Feb 4, 2007 @ 9:16 PM --fdsfdsfsdfdsfsfsfds -- Feb 4, 2007 @
>>> 9:21
>>> PM --fdfdsfsdffsd -- February 11, 2007, @ 9:31 PM -- This is a tes
>>> --
>>> February 14, 2007, @ 10:10 PM -- jhafjhfa afjahfajfhda
>>> kasjdaksdhADSKJL [firstname] => NANCY [lastname] => ADKINS
>>> [phone2]
>>> =>
>> [address1] => 25 ALWARD CT.
>>> [address2] => [city] => MARTINSVILLE [State] => AK [other] => [zip]
>>> =>
>>> 24112 [country] => US [date18] => 03-13-2007 [text19] => test1
>>> [text20] => [rating] => 0 [status] => Active )';  when I use
>>> array_search to find date18
>>>
>>> $key = array_search('date18', $array);  // $key = 1;
>>>
>>> I get Wrong datatype for second argument How come the array is
>>> wrong
>>> datatype isn't a array an array or am I using this wrong
>>
>> $array is a string, and array_search is expecting an array, so it's
> correct.
>> Where did you get that "array"?
>>
>> -Stut
>>
>> This array comes from  $_REQUEST of all data submitted from a form
>
> Yeah, you said that in your first post. What I meant was where did it
> come
> from?
>
> What you have there is the output from print_r($_REQUEST). How exactly
> are
> you getting that string? Why are you creating it as a literal array
> rather
> than using $_REQUEST directly?
>
> What you have there is the output from print_r($_REQUEST). How exactly
> are
> you getting that string? Why are you creating it as a literal array
> rather
> than using $_REQUEST directly?
>
> -Stut
>
> This is for saving data from custom fields created by the user I don't
> know
> what they are named so I can't use $_REQUEST[name] to pull them from
> the
> array.
> I am submitting a form to a script that will search thru the array and
> find
> the fields that are in there date18 text19 text20 these are user
> custom
> fields that I do not know what they are named. I what to compare what
> is in
> the array  with a database table and if they match then save the
> information
> in the array for that item to the database.

I would hazard a guess that as you try to pass the data along from
page to page, at some point you did something like:



Don't do that.

print_r is nice for humans to read, but totally useless for PHP to
re-construct an array.

You'll need to do more like this:
$v){
echo "\n";
  }
?>

But if $v itself is an array (possibly) then you need to write this
recursively...

I think you might be better off *NOT* passing this data around in your
form, but using sessions.
http://php.net/session_start

Or I could be totally wrong in my theory, too. :-)

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


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Stream Functions

2007-03-12 Thread Richard Lynch
On Sun, March 11, 2007 1:15 pm, [EMAIL PROTECTED] wrote:
> Can anyone suggest why the connection might be refused?

My first guess would be that you have a firewall blocking the connection.

PHP can't poke holes in your firewall for you.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] RE: looking for two remote functions

2007-03-12 Thread Jim Lucas

Riyadh S. Alshaeiq wrote:

Thank you Mickey, but I have already looked in there and the function posted
in the notes is working just fine for getting the size on disk which I am
not interested in, I need the actual size that when you download a file to a
machine you will get..

Riyadh

-Original Message-
From: Mikey [mailto:[EMAIL PROTECTED] 
Sent: 9/Mar/2007 2:57 PM

To: php-general@lists.php.net
Subject: Re: looking for two remote functions

Riyadh S. Alshaeiq wrote:

Hello everybody,

 I am looking for an HTTP function for getting remote filesizes. Keeping

in

mind that I am NOT interested in getting the "size on disk" figure, I need
the actual size of the files when downloaded to a local machine. Please

let

me know if there are any..

Another thing, I also need a remote function that gets the created date

and

last modified separately, if possible..

Best regards

 





Try looking here:

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

If the function itself isn't of use to you, look further down in the 
notes and I am sure you will find something useful.


Mikey


Ok, been listening/reading this for a few days now.

Are you wanting to get the block size of a file that you plan on 
downloading from a server to your local computer?


If so, is your client going to be on a windows box or *nix box or mac?

They all have different block size.

Default for linux is 1024, default for openbsd is 512, and probably even 
different for a mac even though it is running a flavor of bsd.


You can see how this might cause a problem in determining the number of 
blocks that a given file will occupy once downloaded.


There is now php/javascript/html/css/etc... function that will give you 
the block size of the client.  Only then would you be able to calculate 
the actually number of blocks that will be required for any given download.


You can, how ever, calculate the number of blocks that a file takes up 
on a server, by looking at various specs on the system.

ls -s 
will return to you the number of blocks that a file occupies on the 
server file system.  This number may, but probably not, correspond to 
the number of blocks the same file will occupy on your client system.


Hope this clears things up a bit.

I will be glad to offer more advice if more is needed.

--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different 
strings. But there are times for you and me when all such things agree.


- Rush

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



Re: [PHP] different and logic between PHP4 and PHP5

2007-03-12 Thread Richard Lynch
On Mon, March 12, 2007 1:53 pm, Vieri wrote:
> The following code:
>
>  $b="";
> $c="df";
> $a=($b and $c);

Why in the world would you use 'and' on two strings?

What is that supposed to even mean?...

Type-cast them to numbers if you want to use 'and'

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Why won't this query go through?

2007-03-12 Thread Richard Lynch
On Sun, March 11, 2007 11:24 am, Mike Shanley wrote:
> I am just not understanding what I could have possibly done wrong with
> this query. All of the variables are good, without special characters
> in
> any sense of the word... So why isn't it importing anything?
>
> Thanks!
>
>  $q = "INSERT INTO
> `visitors`(`username`,`password`,`email`,`firstname`,`lastname`,`birthdate`,`verifythis`)
> VALUES ('".$username."',
> '".md5($password1)."',
> '".$email."',
> '".$firstname."',
> '".$lastname."',
> '".$birthdate."',
> '".$verifythis."');";
> mysql_query($q);

I don't know.

But MySQL is just DYING to TELL you what went wrong.

mysql_query($q) or die(mysql_error());

is what you should be using.

For now.

Later, you'll want a better error handling method than "or die()"

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Array mysteries

2007-03-12 Thread Richard Lynch

Read the manual again, especially the part about "variable scope" near
the beginning.


On Sun, March 11, 2007 3:51 am, Otto Wyss wrote:
> I want to convert weekdays with a simple function like
>
>$wdays = array
>  (0 => "Sonntag"
>  ,1 => "Montag"
>  ,2 => "Dienstag"
>  ,3 => "Mittwoch"
>  ,4 => "Donnerstag"
>  ,5 => "Freitag"
>  ,6 => "Samstag"
>);
>
>function convert_from_weekday ($weekday) {
>  return $wdays[$weekday];
>}
>
> but this doesn't work while
>
>$wdays[$weekday];
>
> outside of the function works correct. Has anybody an idea where's my
> mistake? I'd like to use a function so I may return substrings of the
> weekday.
>
> O. Wyss
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] xml parsing

2007-03-12 Thread Myron Turner

Richard Lynch wrote:

I don't think that's valid XML, because you are mixing your content
with your XML tags in a way that will confuse the two...

If you can FIX the XML by using the CDATA stuff, or htmlentities
encoding the HTML or something, that would be best.

If you are STUCK with this bogus XML, you could probably write your
own parser for something this simple/small in about an hour using
http://php.net/strtok and friends...


On Sun, March 11, 2007 7:38 pm, Marije van Deventer wrote:
  

I have been trying to parse this xml, and want to use it with
childnodes  and , but sofar due to the  and  and
 elements no luck. How can i do this in a simple way ???



 
  Algemeen
  a
 
 
  1-Atmosfeer
  
  a
  bbb
  ccc
  dd
  qqq
 
 
  Betrouwbare drukcabine
  
 




  
I put the above xml text into an xml editor and it tests as valid, 
despite its raggedness, and I did manage to get it to parse with 
simplexml, using the following:


$string = the above xml;

$xml = simplexml_load_string($string);

foreach($xml->Item as $item ){
  trim($item->Label);
  echo $item->Label . "";
  if(isset($item->Tekst)) {
   trim($item->Tekst);
  echo $item->Tekst . "";
  }
}







--

_
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/

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



Re: [PHP] Why won't this query go through?

2007-03-12 Thread Stephen Johnson
> From: Richard Lynch <[EMAIL PROTECTED]>
> On Sun, March 11, 2007 11:24 am, Mike Shanley wrote:
>> I am just not understanding what I could have possibly done wrong with
>> this query. All of the variables are good, without special characters
>> in
>> any sense of the word... So why isn't it importing anything?
>> 
>> Thanks!
>> 
>>  $q = "INSERT INTO
>> `visitors`(`username`,`password`,`email`,`firstname`,`lastname`,`birthdate`,`
>> verifythis`)
>> VALUES ('".$username."',
>> '".md5($password1)."',
>> '".$email."',
>> '".$firstname."',
>> '".$lastname."',
>> '".$birthdate."',
>> '".$verifythis."');";
>> mysql_query($q);
> 
> I don't know.
> 
> But MySQL is just DYING to TELL you what went wrong.
> 
> mysql_query($q) or die(mysql_error());
> 
> is what you should be using.
> 
> For now.
> 
> Later, you'll want a better error handling method than "or die()"


And sending this to a MySQL user group, rather then a PHP group, might get a
better response too...

Just for future error reference.. ;)


http://www.ouradoptionblog.com
Join our journey of adoption

http://www.thelonecoder.com
[EMAIL PROTECTED]

continuing the struggle against bad code

*/ 
?>

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



Re: [PHP] Array mysteries

2007-03-12 Thread Richard Lynch
On Sun, March 11, 2007 12:02 pm, Edward Vermillion wrote:
>
> On Mar 11, 2007, at 10:02 AM, tedd wrote:
>
>> At 3:05 PM +0100 3/11/07, Tijnema ! wrote:
>>> On 3/11/07, tedd <[EMAIL PROTECTED]>
>>> wrote:
>>>
>>> At 10:05 AM +0100 3/11/07, Tijnema ! wrote:

 - You could define $wdays inside the function
 function convert_from_weekday ($weekday) {
 $wdays = array
(0 => "Sonntag"
,1 => "Montag"
,2 => "Dienstag"
,3 => "Mittwoch"
,4 => "Donnerstag"
,5 => "Freitag"
,6 => "Samstag"
  );
return $wdays[$weekday];
  }
 $day = convert_from_weekday(0) // $day = "Sonntag"
>>>
>>> Tijnema:
>>>
>>> That's also a shorter version of a simple switch statement.
>>>
>>> I haven't thought of, or seen, that before -- thanks.
>>>
>>> tedd
>>>
>>>
>>> Yeah it is, but i just used moved his $wdays inside the function...
>>>
>>> but well, there are ofcourse a lot of other options, as date("l")
>>> would also return the day of the month :)
>>>
>>> Tijnema
>>
>>
>> It's the technique and not the specific data thing I was
>> addressing. When I'm confronted with a case condition, I typically
>> use the switch statement. But, your solution provided me with
>> another way to look at that.
>>
>> Cheers,
>>
>> tedd
>
> But what's the cost of this in a loop, rebuilding the array each
> time, as compared to a switch statement? Just another thought...

If you are calling this function a ridiculous number of times, you
could use a static variable.

function convert_from_weekday($weekday){
  static $weeks = '';
  if ($weeks === '') $weeks = array('Sonntag', 'Montag', ...);
}

It's kind of a shame that PHP won't let you just initialize a static
to an array, but there it is.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Array mysteries

2007-03-12 Thread Richard Lynch
On Sun, March 11, 2007 2:57 pm, Edward Vermillion wrote:
> Would the array lookup be faster for a lesser-used option/key in a
> situation where there were quite a few options? (you wouldn't have to
> go through the whole switch to get to the option at the end (?) or
> would you? I have no idea how that all works internally)

Almost for sure, a 'switch' is going to win over the array hash lookup
in almost all cases, as the switch is built into the opcodes, and not
an array hash lookup.

If I understood a thread on Internals last month correctly,
internally, the order of the case statements does matter, somewhat,
but you *DO* have to be calling something a ZILLION times for it to
matter in the real world.

Stressing out over performance instead of maintainability is almost
always the wrong way to start a project.

You don't want to be a complete idiot, but often-times the performance
bottle-neck ends up being somewhere entirely different from where you
expected anyway.

Write the code as straight-forward and maintainable as you can first.

Then measure it for performance to see if it's acceptable.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Back to security

2007-03-12 Thread Richard Lynch
On Sat, March 10, 2007 12:41 pm, Alain Roger wrote:
> I'm continuing to work on securing my administration part of the
> website.
> based on previous posts and reading materials, I was thinking to use
> the
> following process :

Think of HTTPS as like a bank vault in the basement of a branch bank.

Anybody can walk in the door, but very very very few people can walk
into the vault.

> 1. user has to logon through a standard "http://"; web page
> 2. login and encrypted password are compared with what is stored in
> database, if it is the same, the user reach point 3. if not, an error
> message is displayed.
> 3. after successful authentication, user is redirected to https://
> pages, a
> session is opened in PHP and the sessionID is stored in database with
> user
> data.

There is a steel wall between the non-HTTPS and the HTTPS
pages/site/functionality.

If you authenticate users outside the steel wall, you then have to
pass them and their credentials THROUGH the steel wall.

Better off to do all of 1, 2, and 3 inside HTTPS.

Plus, the whole point of HTTPS is to stop network sniffers from
over-hearing passwords and other sensitive data, and if you
authenticate outside HTTPS, then you are sending the authentication
credentials over the wire for anybody to hear, so what's the point?

> 4. sessions holds encrypted password and every time that users do an
> action,
> sessionID is compared with the one in DB, as session encrypted
> password is
> compared with the one stored in DB. if everything match, action is
> performed. if not sessions is ended and user is redirected to logon
> page.

Don't store the password into the session data, imho.

If they authenticate, just store their username or user_id.
If they don't authenticate, don't store anything in session.

Valid username in session == authenticated user.

> A. do you think is enough secured like that ?
> B. i still do not understand how to be sure that user still use https
> (SSL
> protocol) ?

Compare the output of  on the two pages, one with
the 'S' and one without.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Variable variables and references

2007-03-12 Thread Richard Lynch
On Sat, March 10, 2007 6:28 am, Dave Goodchild wrote:
> Hi guys, I have just read 'Programming PHP' (O'Reilly) and although I
> think
> it's a great book, I am confused about variable variables and
> references -
> not the mechanics, just where you would use them.
>
> The subject of variable variables is explained but no examples are
> given as
> to why and where you would utilise them.

99% of the time, using variable variables means you screwed up and
should have used an array. :-)

The 1% remaining is something that should be attempted only by
experts, so you'll know when you get there that you need it.

> As for references, the examples given with regard to passing and
> returning
> by reference in functions is clear, but no real examples are given as
> to
> when this would be a preferred approcah - in fact, the authors stress
> that
> due to PHP's copy-on-write mechanism, it is not a frequently-used
> approcah.

In PHP5, the whole reference thing changed all around.

What version is the book targetted at, and what version are you running?

> So my question - are there any 'classic' situations in which either
> should
> be used, and where and when do you guys use them in your real-world
> efforts?

I don't even use OOP in PHP, much less &OOP.

I only used variable variables when I was young and foolish.

Well, younger and more foolish.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] DB_DataContainer

2007-03-12 Thread Richard Lynch
If you are using PHP 5.0.0 or greater, use the one class, other wise,
use the other.

The 'eval' BS is to avoid the PHP compiler complaining that you have
the same class defined twice.

Frankly, it's pretty ugly, if you ask me...

On Fri, March 9, 2007 7:08 pm, php trainer wrote:
> Could someone explain what this does and why it's beneficial?
>
> Thanks,
>
> Ed
>
> --
>
> if (version_compare(phpversion(), '5.0.0', 'ge')) {
>
> class DB_DataContainer_Overload {
> function __call($method,$args) {
> $retval = null;
> $this->___call($method,$args,$retval);
> return($retval);
> }
> }
>
> } else {
>
> eval('
> class DB_DataContainer_Overload {
> function __call($method,$args,&$retval) {
> return($this->___call($method,$args,$retval));
> }
> }
> ');
>
> }
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] looking for two remote functions

2007-03-12 Thread Richard Lynch
On Fri, March 9, 2007 5:15 am, Riyadh S. Alshaeiq wrote:
>  I am looking for an HTTP function for getting remote filesizes.
> Keeping in
> mind that I am NOT interested in getting the "size on disk" figure, I
> need
> the actual size of the files when downloaded to a local machine.
> Please let
> me know if there are any..

http://php.net/filesize

You may need to put something like this on the remote server:


Or maybe not, as PHP may be smart enough to handle something like this
on your local server:
The PHP homepage is currently this large:
http://php.net/');?>

I have no idea what you mean by "size on disk" number.

Bytes is bytes.

However big the file is, that's how big it is.

Well, maybe, under Windows, there is some other meaningless weird
number you can get... [shrug]

> Another thing, I also need a remote function that gets the created
> date and
> last modified separately, if possible..

http://php.net/filemtime
http://php.net/filectime

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] RE: looking for two remote functions

2007-03-12 Thread Richard Lynch
It seems MUCH more likely to me that the filesize() is being used on
some kind of URL that does a re-direct -- and the filesize() may not
follow the re-direct for you...

The size is the size, in bytes.

Overhead in the local OS for block management is not something PHP
will be able to predict for you, I don't think.

On Mon, March 12, 2007 5:52 pm, Jim Lucas wrote:
> Riyadh S. Alshaeiq wrote:
>> Thank you Mickey, but I have already looked in there and the
>> function posted
>> in the notes is working just fine for getting the size on disk which
>> I am
>> not interested in, I need the actual size that when you download a
>> file to a
>> machine you will get..
>>
>> Riyadh
>>
>> -Original Message-
>> From: Mikey [mailto:[EMAIL PROTECTED]
>> Sent: 9/Mar/2007 2:57 PM
>> To: php-general@lists.php.net
>> Subject: Re: looking for two remote functions
>>
>> Riyadh S. Alshaeiq wrote:
>>> Hello everybody,
>>>
>>>  I am looking for an HTTP function for getting remote filesizes.
>>> Keeping
>> in
>>> mind that I am NOT interested in getting the "size on disk" figure,
>>> I need
>>> the actual size of the files when downloaded to a local machine.
>>> Please
>> let
>>> me know if there are any..
>>>
>>> Another thing, I also need a remote function that gets the created
>>> date
>> and
>>> last modified separately, if possible..
>>>
>>> Best regards
>>>
>>>
>>>
>>>
>>
>> Try looking here:
>>
>> http://uk.php.net/manual/en/function.filesize.php
>>
>> If the function itself isn't of use to you, look further down in the
>> notes and I am sure you will find something useful.
>>
>> Mikey
>>
> Ok, been listening/reading this for a few days now.
>
> Are you wanting to get the block size of a file that you plan on
> downloading from a server to your local computer?
>
> If so, is your client going to be on a windows box or *nix box or mac?
>
> They all have different block size.
>
> Default for linux is 1024, default for openbsd is 512, and probably
> even
> different for a mac even though it is running a flavor of bsd.
>
> You can see how this might cause a problem in determining the number
> of
> blocks that a given file will occupy once downloaded.
>
> There is now php/javascript/html/css/etc... function that will give
> you
> the block size of the client.  Only then would you be able to
> calculate
> the actually number of blocks that will be required for any given
> download.
>
> You can, how ever, calculate the number of blocks that a file takes up
> on a server, by looking at various specs on the system.
>   ls -s 
> will return to you the number of blocks that a file occupies on the
> server file system.  This number may, but probably not, correspond to
> the number of blocks the same file will occupy on your client system.
>
> Hope this clears things up a bit.
>
> I will be glad to offer more advice if more is needed.
>
> --
> Enjoy,
>
> Jim Lucas
>
> Different eyes see different things. Different hearts beat on
> different
> strings. But there are times for you and me when all such things
> agree.
>
> - Rush
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] name of the variable

2007-03-12 Thread Richard Lynch
On Fri, March 9, 2007 4:27 am, Cefull Lo wrote:
> Hi everyone,
> Is there any function that return the name of the variable??
> i.e.
>
> $foo='abc';
> $bar=somefunc($foo); // $bar='foo' here

No.

And there cannot be, as any given variable could have multiple
references and be passed around through several functions, getting a
different name each time.

You probably should be putting 'foo' and 'abc' into an array instead.

$foobar['foo'] = 'abc';

You can then address 'foo' and 'abc' with various array functions.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] php, oci8 and oracle

2007-03-12 Thread Richard Lynch
PHP runs in the sandbox of the HTTP apache server, but I don't think
it inherits all of its Env variables...

At any rate, the answer you probably want is:



NOTE:
I began as "the answer guy" on this mailing list back when I realized
that the dude answering this same dang ORACLE_HOME question every week
was the same dude that could be fixing/adding PHP code to make PHP
better (Rasmus Lerdorf) instead of answering this same question every
week.

Back then, I had no idea what this setEnv thingie did, or what
ORACLE_HOME was all about -- I just parrotted back the answer, as it
hadn't changed in 6 months. :-)

Thank you for this nostalgic reminder of how I became arguably
"famous" in PHP. :-)

I'm also betting that you could find this answer in the mailing list
archives, the PHP FAQ and at http://php.net/oci

Just guessing.

On Fri, March 9, 2007 4:12 am, sirakov wrote:
>
> Hi,
> I have a problem with oci8. I installed ORACLE Enterprise with php5
> and
> apache, with this script :
>
> 
>
> I receive information for the set modules. I see that oci8 is enabled
> however ORACLE_HOME is empty. Additionally, I tried to write a little
> script
> which I run as a root. Due to this script, I set variables and start
> apache:
>
> cmd=`which apache2ctl`
> $cmd stop
> ORACLE_HOME=/u01/app/oracle/oracle/product/10.2.0/db_1;export
> ORACLE_HOME
> echo ORACLE_HOME: $ORACLE_HOME
> ORACLE_SID=orcl; export ORACLE_SID
> echo ORACLE_SID: $ORACLE_SID
> ORATAB=/etc/oratab; export ORATAB
> echo ORATAB: $ORATAB
> ORACLE_HOME_LISTNER=$ORACLE_BASE, export ORACLE_HOME_LISTNER
> echo ORACLE_HOME_LISTNER: $ORACLE_HOME_LISTNER
> ORACLE_BASE=$ORACLE_HOME; export ORACLE_BASE
> echo ORACLE_BASE: $ORACLE_BASE
> NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P15; export NLS_LANG
> echo NLS_LANG: $NLS_LANG
> LD_LIBRARY_PATH=$ORACLE_HOME/lib; export LD_LIBRARY_PATH
> echo LD_LIBRARY_PATH: $LD_LIBRARY_PATH
> LD_PRELOAD=/u01/app/oracle/oracle/product/10.2.0/db_1/lib/libclntsh.so
> echo LD_PRELOAD:$LD_PRELOAD
> $cmd start
>
> In /etc/php5/apache2/php.ini and /etc/php5/cli/php.ini I set the
> extension=oci8.sо, but ORACLE_HOME is still empty (see here
> http://www.picvalley.net/u/9/8466_726.PNG)
>
> If someone has an idea how to solve the problem, I will highly
> appreciate
> any advices with this regard. I read about an installation of ORACLE
> Instant
> client and oci8 but I do not know whether I need this instant client
> at all,
> because I use Oracle Enterprise.
>
> PS. i'm sorry for the bad english, i can't explain the problem better.
> --
> View this message in context:
> http://www.nabble.com/php%2C-oci8-and-oracle-tf3374589.html#a9390900
> Sent from the PHP - General mailing list archive at Nabble.com.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



RE: [PHP] FW: looking for two remote functions

2007-03-12 Thread Richard Lynch
If PHP is returning that goofy Windows 'size on disk' number, I want
to see your script...

Because, no, I don't think it does that...

On Sat, March 10, 2007 4:42 am, Riyadh S. Alshaeiq wrote:
> Actually if right click on any file or folder on a machine you will
> see that
> there are two values (Size on disk & Size). Files and folders are
> stored on
> the disk in what is called clusters (a group of disk sectors). Size on
> disk
> refers to the amount of cluster allocation a file is taking up,
> compared to
> file size which is an actual byte count.
>
> As I mentioned before what I want is a function for getting the result
> for
> the Size no for Size on Disk
>
> Riyadh
>
> -Original Message-
> From: Németh Zolt?n [mailto:[EMAIL PROTECTED]
> Sent: 10/Mar/2007 12:27 PM
> To: Riyadh S. Alshaeiq
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] FW: looking for two remote functions
>
> I'm afraid I don't understand what you want. The size of a file is its
> size in bytes, that is its size on the disk. So what else?
>
> greets
> Zolt?n Németh
>
> 2007. 03. 10, szombat keltezéssel 06.07-kor Riyadh S. Alshaeiq ezt
> ?rta:
>> Thank you Mickey, but I have already looked in there and the
>> function
> posted
>> in the notes is working just fine for getting the size on disk which
>> I am
>> not interested in..
>>
>> Riyadh
>>
>> -Original Message-
>> From: Mikey [mailto:[EMAIL PROTECTED]
>> Sent: 9/Mar/2007 2:57 PM
>> To: php-general@lists.php.net
>> Subject: Re: looking for two remote functions
>>
>> Riyadh S. Alshaeiq wrote:
>> > Hello everybody,
>> >
>> >  I am looking for an HTTP function for getting remote filesizes.
>> Keeping
>> in
>> > mind that I am NOT interested in getting the "size on disk"
>> figure, I
> need
>> > the actual size of the files when downloaded to a local machine.
>> Please
>> let
>> > me know if there are any..
>> >
>> > Another thing, I also need a remote function that gets the created
>> date
>> and
>> > last modified separately, if possible..
>> >
>> > Best regards
>> >
>> >
>> >
>> >
>>
>> Try looking here:
>>
>> http://uk.php.net/manual/en/function.filesize.php
>>
>> If the function itself isn't of use to you, look further down in the
>> notes and I am sure you will find something useful.
>>
>> Mikey
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Passing a class through an array

2007-03-12 Thread Richard Lynch
If line 140 is the $name1->name part, then you probably haven't
written your constructor correctly to cram 'Toon1' into the name
field...


On Thu, March 8, 2007 11:51 pm, Jeff Taylor wrote:
> Hey all,
> I'm very new to programming and PHP.
> I want to pass instances of a class through an array, and then use a
> foreach
> later to grab details of each class at once... but it returns a fatal
> error
>
> Code:
>
> $me = new Toon('Toon1','1')
> $him = new Toon('Toon2','0')
>
>$characterListing = array($me, $him);
>
>foreach ($characterListing as $name1)
>{
> if ($name1->GetIsPlayer())
> {
>  echo "Name:  ".$name1->$name;// etc etc etc
> }
>}
>
>
>
> the error I get is: Fatal error: Cannot access empty property in
> c:\Inetpub\wwwroot\MyProjects\SecondOffering\htmlFns.php on line 140
>
> Can anyone help?
>
> Thanks, Jeff
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Image from a secure site

2007-03-12 Thread Richard Lynch

Instead of trying to re-invent the authentication wheel, just use
http://php.net/curl


On Thu, March 8, 2007 4:51 pm, Manolet Gmail wrote:
> hi, i install 4 IP cameras and i want to extract the images from their
> web interface that is protected be a username and password (HTTP AUTH)
> and show it into another system. so i do a function to connect to it
> and get the image...
>
> function subd($host,$port,$ownername,$passw,$request) {
>   $sock = fsockopen($host,$port);
>   if(!$sock) {
> print('Socket error');
> exit();
>   }
>
>   $authstr = "$ownername:$passw";
>   $pass = base64_encode($authstr);
>   $in = "GET $request\r\n";
>   $in .= "HTTP/1.0\r\n";
>   $in .= "Host:$host\r\n";
>   $in .= "Authorization: Basic $pass\r\n";
>   $in .= "\r\n";
>
>   fputs($sock, $in);
>   while (!feof($sock)) {
>   $result .= fgets ($sock,128);
>   }
>   fclose( $sock );
>
>   return $result;
> }
>
>
> and next i want to print it into the browser..
>
>
> $request = "/IMAGE.JPG?cidx=20072261649239281";
> $result =
> subd('contelec.sytes.net',2002,"invitado","invitado",$request);
> header ('Content-type: image/jpeg');
> imagejpeg($result);
> exit();
>
> but doesnt work if you want to check the cam you can go to
> http://contelec.sytes.net:2002 the username is invitado and the
> password is invitado.
>
> please help me!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] $35 to the first person who can do this XML-parsing PHP script

2007-03-12 Thread Richard Lynch
For something that simple in PHP4, I didn't even bother with the
50-line expat lib solution...

A couple preg matches, or even just strtok and call it done...

//assume file_get_contents is too "new"...
//probably wrong, but be safe
$xml = implode('', file('www.librarytools.com/events/sampledata.txt'));

preg_match_all('|.*([^<]*).*(f
n="eventnextoccurrencedate">([^<]*))?|msiU', $xml, $eventdata);

var_dump($eventdata);

I probably got the regex wrong -- I usually do...

On Thu, March 8, 2007 2:59 pm, Rob Gould wrote:
> Ok, well after fiddling around with PHP samples from the web for a
> few hours, I'm shot.  But I have a project due soon that relies on
> this so I'm willing to pay someone:
>
> I'll send $35 to someone via paypal who can create a PHP script that
> will do the following:
>
> 1)  Read XML data from an URL (www.librarytools.com/events/
> sampledata.txt)
> 2)  Loop through all XML results and print to the screen the
> "eventname" and "eventnextoccurrencedate" (Just the date) values
>
>
> I'll probably kick myself once I see how easy it is, but I'm willing
> to pay to see it working.  Feel free to email me off-list.
>
> - Rob
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Creating variable names from values

2007-03-12 Thread Richard Lynch
On Thu, March 8, 2007 11:56 am, Otto Wyss wrote:
>  From an arry I create a table like
>
>foreach ($persons as $key => $pers) {
>  echo "
>...
>}
>
> so each checkbox field has its own name created from $key. Yet how can
> I
> access these fields (names) later on?
>
>foreach ($persons as $key => $pers) {
>  if ($K???) {
>$cnt += 1; ...
>  }
>}

This is where you use variable variables when you don't know that you
shouldn't have done that...

> Is there a better way to access multiple fields from a table?

Use arrays.




-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Intro to PHP question

2007-03-12 Thread Richard Lynch


You sure you don't have something like:

.
.
.

Or, perhaps, if you are usin CGI, and you have JUST set it up, and you
have the wrong command line flags to execute the input as PHP directly
somehow...

Does  work?

On Thu, March 8, 2007 11:43 am, Jonathan Kahan wrote:
> Hi all,
>
> I am using a linux server. When the php file below (uri.php) is run
> from the
> command line I get the following error. Any ideas on what I could do
> differently?
>
> Thanks for any help,
>
> Jonathan
>
> ../uri.php: line 1: syntax error near unexpected token `newline'
> ../uri.php: line 1: `'
>
> 
>  $d=date("D");
> if ($d=="Fri")
>   echo "Have a nice weekend!";
> else
>   echo "Have a nice day!";
> ?>
> 
>
>
> Kind Regards
> Jonathan Kahan
> 
> Systems Developer
> Estrin Technologies, inc.
> 1375 Broadway, 3rd Floor, New York, NY, 10018
> 
> Email: [EMAIL PROTECTED]
> Web: http://www.estrintech.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Intro to PHP question

2007-03-12 Thread Richard Lynch
You have managed to confuse the isntallation process and the way Perl
works with the way PHP works.

If you want to write a custom CGI script for each and every PHP, and
prepend #!/usr/local/bin/php, you just MIGHT be able to do it the way
you're doing it...

But don't do that. :-)

Configure Apache to use PHP, and don't make uri.php executable and
don't run it from the command line, and use something like:
php -q uri.php
when you want to run it from the command line.

On Thu, March 8, 2007 12:52 pm, Jonathan Kahan wrote:
> Hi all,
>
> Dave,
>
> I am attempting to use html for learning purposes. My goal is to begin
> working on a website.
>
> Tijnema,
>
> I tried the below and got the following errors. I can't imagine the
> error on line 3 is a tag issue.
>
> Jonathan
>
> [EMAIL PROTECTED] cgi-bin]# ./uri.php
> ./uri.php: line 2: ?php: No such file or directory
> ./uri.php: line 3: syntax error near unexpected token `"D"'
> ./uri.php: line 3: `$d=date("D");'
> [EMAIL PROTECTED] cgi-bin]# vi uri.php
> [EMAIL PROTECTED]  cgi-bin]# vi uri.php
>
>  $d=date("D");
> if ($d=="Fri")
>   echo "Have a nice weekend!";
> else
>   echo "Have a nice day!";
> ?>
>   - Original Message -
>   From: Dave Goodchild
>   To: Tijnema !
>   Cc: Jonathan Kahan ; php-general@lists.php.net
>   Sent: Thursday, March 08, 2007 12:43 PM
>   Subject: Re: [PHP] Intro to PHP question
>
>
>   If you are running that from the command line, why do you need html?
> Not sure why you're doing that.


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Joke of the day problem

2007-03-12 Thread Richard Lynch
create table alljokes (joke_id int unsigned auto_increment unique not
null primary key, joke text);
create table daily (whatdate date unique not null primrary key,
joke_id int);

Run a daily cron job that does this:


Your web page then just does:
Joke of the day$joke\n";
?>

YMMV

On Thu, March 8, 2007 8:30 am, Delta Storm wrote:
> Hi,
>
> again me with the silly questions...
>
> I need a script that will take data from MySQL database and display
> one
> row each day.
>
> I have googled, but with no luck.
>
> The database retrieving mechanism is of course clear but I really dont
> know how to do a 24h delay before the next row is displayed.
>
>
> Thanks in advance :)
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Oracle XMLTYPE column truncates

2007-03-12 Thread Richard Lynch
DB truncation could be either of the following:

#1.
The column is not large enough to hold that data.
Research LONGTEXT and BLOB

#2.
The query buffer is not large enough to pass the data in.
Re-configure your db/php setup.


Note that cramming all that XML into the DB seems kinda silly to me,
unless you are using Oracle XML functionality on the data.

We've beaten this horse to death lately, but you should CONSIDER the
option of just storing the XML in a file, and the filename in the DB.

Read the "images in db" thread last week to view the dead horse.

On Thu, March 8, 2007 5:47 am, Mikey wrote:
> Hi!
>
> I am running some tests for implementing variable metadata using
> Oracle's XMLTYPE.  Creating the XML and inserting it into the database
> works fine, however when trying to retrieve data it truncates the
> returned results.  The code I am using to fetch the data is as
> follows:
>
> $row_sql = "SELECT xml_metadata FROM mdt1_metadata WHERE key_id =
> :kid";
> $row_sth = oci_parse ($conn, $row_sql); // $conn defined elsewhere
> oci_bind_by_name ($row_sth, ":kid", $row['key_id']);
> if (oci_execute ($row_sth)) {
>   $xml_row = oci_fetch_array ($row_sth, OCI_ASSOC);
>   try {
>   $xml = new SimpleXMLElement ($xml_row['xml_metadata']);
>   }
>   catch (Exception $e) {
>   echo "\n\n{$xml_row['xml_metadata']}\n\n";
>   exit;
>   }
>   // stuff goes in here
> }
>
>
> I was wondering if anyone else on this list has had the same problem,
> or
> knows of a better way of returning long values using OCI?
>
> TIA,
>
> Mikey
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Creating variable names from values

2007-03-12 Thread Robert Cummings
On Mon, 2007-03-12 at 19:30 -0500, Richard Lynch wrote:
> On Thu, March 8, 2007 11:56 am, Otto Wyss wrote:
> >  From an arry I create a table like
> >
> >foreach ($persons as $key => $pers) {
> >  echo "
> >...
> >}
> >
> > so each checkbox field has its own name created from $key. Yet how can
> > I
> > access these fields (names) later on?
> >
> >foreach ($persons as $key => $pers) {
> >  if ($K???) {
> >$cnt += 1; ...
> >  }
> >}
> 
> This is where you use variable variables when you don't know that you
> shouldn't have done that...

Why? It's in the $_GET array. Just need to build the key.

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] why did it stop working?

2007-03-12 Thread Richard Lynch
On Thu, March 8, 2007 4:57 am, Ross wrote:
>
> Can someone explain to me why this used to work but then stopped
>
> header("Content-length: $size");
> header("Content-type: $type");
> header("Content-Disposition: attachment; filename=$name");
>
> and this now works
>
> header("Content-length: ".$size);
> header("Content-type: ".$type);
> header('Content-Disposition: attachment; filename="'.$name.'"');
> echo $content;
>
>
> Any suggestions?

It never worked properly the first time around, but you never noticed
the lack of quotes around "$name" because none of your filenames had
spaces or other "interesting" characters in them.

It only "breaks" when your $name has something other than a printable
character.

Actually, Content-Disposition also only works on newer browsers, but
that's another story...

If you want to force a download, the only correct type is
application/octet-stream.

If you want EVERY browser ever made to do the right thing for that
"Save As..." popup, then Content-Disposition is not the way to go, as
it won't work on legacy [*] browsers.

I ranted about this a big long time ago here:
http://richardlynch.blogspot.com

* There may not BE any real users of said legacy browsers any more,
mind you, but there it is.  I got bit hard by this Content-disposition
change and will never use it, no matter what decade we are in.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] $35 to the first person who can do this XML-parsing PHP script

2007-03-12 Thread Myron Turner

Richard Lynch wrote:

For something that simple in PHP4, I didn't even bother with the
50-line expat lib solution...

A couple preg matches, or even just strtok and call it done...

//assume file_get_contents is too "new"...
//probably wrong, but be safe
$xml = implode('', file('www.librarytools.com/events/sampledata.txt'));

preg_match_all('|.*([^<]*).*(f
n="eventnextoccurrencedate">([^<]*))?|msiU', $xml, $eventdata);

var_dump($eventdata);

I probably got the regex wrong -- I usually do...
  
Of course, there are all kinds of hacks which can be used for simple 
situations--even sometimes complex situations.  I recently wrote a Perl 
script for a complex screen-scraping task which by-passed all of Perl's 
standard parsers and used Perl's regular expression facilities.  But 
then I know how to use Perl's parsers if I have to, as well as when not 
to use them if I prefer.  So now Rob Gould, who asked the original 
question, knows a few things about the expat parser which he didn't 
understand before and will be able to use it in the future. That seems 
to me worthwhile, and more useful in the long run than scratching out a 
few regular expression hacks that have limited local applicability. 


Myron Turner

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



Re: [PHP] Javascript and PHP interaction

2007-03-12 Thread Richard Lynch
What you *COULD* do is this:

Use .htaccess to force your .css files to *really* be PHP files:


  ForceType application/x-httpd-php


[NOTE: Depending on your server configuration, the
application/x-httpd-php part could be *ANYTHING* the sysadmin felt was
appropriate...]

Inside your CSS, you now have the full-blown power of PHP to output
whatever you think is "right" for the CSS.

But you'll need to tell the browser that this *IS* CSS output, so
you'll need:

at the very tip-top.

Note that browsers can cache the CSS, so you'll want to add more
headers to stop that, probably, or have a random value in the LINK tag
in your HTML document.

On Thu, March 8, 2007 3:14 am, Alain Roger wrote:
> Hi,
>
> I would like to know if there is a way how PHP code can extract from
> ElementID some property values.
>
> for example, i have the following PHP page :
>
>  print "my main div";
> $new_Width = somefunction();
> print " style='width:".$new_Width."px;'>my child div";
> ?>
> in my CSS file (which is link to my HTML page), i have :
>
> .maindiv
> {
>  width : 300px;
>  height : 400px;
>  background-color : #EEBBEE;
> }
> .childdiv
> {
>  background-color : #BB;
> }
>
> my PHP code should be able :
> - to extract the width of id_maindiv ID (so to get 300px) and to
> reduce it
> by 50px
>
> the problem is that i tried with Javascript and if the property
> (style:width) is not define DIRECTLY to HTML code (but only in CSS
> file),
> the javascript is not able to return the value (but only 'undefined').
> So i would like to know if PHP could help me in this way ?
>
> thanks a lot,
>
> --
> Alain
> 
> Windows XP SP2
> PostgreSQL 8.1.4
> Apache 2.0.58
> PHP 5
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



  1   2   >