Re: [PHP] How to measure memory leakage/usage in PHP?

2008-03-05 Thread Frank Arensmeier

6 mar 2008 kl. 06.10 skrev Zareef Ahmed:


HI Chirs,

On 3/6/08, Chris <[EMAIL PROTECTED]> wrote:


Zareef Ahmed wrote:

Hi Chris,

  Thanks for such quick response.

quite good suggestion, but my application is using a framework  
and lots
of includes and even autoloads of classes are being done, so  
using break

point approach is not possible for me.



Why not? It just means the files are spread out in different folders
instead of one place.

If you're using a framework, set up a new very simple environment and
see how much memory that uses by itself (see
http://www.php.net/memory_get_peak_usage).

That'll at least tell you whether it's the framework using all the
memory or your specific changes to it.



 I have done that check and I am sure that only my changes are  
taking time,
but they are large in numbers, so I was looking something to pin  
point the
exact change which is consuming more memory. Thanks for your  
suggestions, I

will definitely use them.



You should be able to do that with a so called tick function.

From the manual: "A tick is an event that occurs for every N low- 
level statements executed by the parser within the declare block. The  
value for N is specified using ticks=N within the declare blocks's  
directive section."


Have a look at the function 'register_tick_function'. Take the  
function that was suggested previously by Chris and make it a tick  
function.


//frank






--


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





--
Zareef Ahmed
http://www.zareef.net
A PHP Developer in India



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



Re: [PHP] Re: imagettftext and utf-8 (swedish characters)

2008-03-05 Thread David Sveningsson

tedd skrev:

At 2:17 AM + 2/29/08, Nathan Rixham wrote:

Nathan Rixham wrote:

try changing:
imagettftext( $im, $title_size, 0, 50, 50, $white, $font, $title );

to:
imagettftext($im, $title_size, 0, 50, 50, $white, $font, 
utf8_decode($title));


Both statements work for me. -- see here:

http://www.webbytedd.com/b1/special-char/

But I don't know -- it looks Swedish to me.  :-)

Cheers,

tedd




I've started thinking something is wrong with my php installation as it 
seems to work for everyone else. Wrote more details in an earlier mail.


Sidenote: If I replace åäö with numerical html entities it works, but 
that's not a reasonable solution to me.


--


//*David Sveningsson [eXt]*

Freelance coder | Game Development Student
http://sidvind.com

Thou shalt make thy program's purpose and structure clear to thy fellow 
man by using the One True Brace Style, even if thou likest it not, for 
thy creativity is better used in solving problems than in creating 
beautiful new impediments to understanding.



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



Re: [PHP] How to measure memory leakage/usage in PHP?

2008-03-05 Thread Zareef Ahmed
Hi Chris,

  Thanks for such quick response.

quite good suggestion, but my application is using a framework and lots of
includes and even autoloads of classes are being done, so using break point
approach is not possible for me.

Well, trying to do something so I can call my memory usage function after
certain number of lines or predefined life time of php script, any
suggestion?

Thanks and Regards
Zareef Ahmed

On 3/6/08, Chris <[EMAIL PROTECTED]> wrote:
>
> Zareef Ahmed wrote:
> > Hi All,
> >
> >I am looking into the concepts behind memory management in PHP. Which
> > kind of approach will be best to measure memory leakage or usage in a
> PHP
> > script?
> >
> > I can measure my apache process but is there any way by which I can know
> > which exact part of script is consuming how much memory?
>
>
> Start off with putting something like this:
>
> error_log('in file ' . __FILE__ . ' at line ' . __LINE__ . ' memory
> usage is ' . memory_get_usage(true) . "\n", 3, '/path/to/log.file');
>
> every 100 lines and work out where your spikes are.
>
> When you're looking at a section that jumps a lot, put it every 10 lines
> - work out which parts are causing the big jumps and go from there.
>
>
> Or use xdebug profiling to work out which parts of your app are being
> used the most and start there - http://xdebug.org/docs/profiler
>
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>



-- 
Zareef Ahmed
http://www.zareef.net
A PHP Developer in India


Re: [PHP] How to measure memory leakage/usage in PHP?

2008-03-05 Thread Zareef Ahmed
HI Chirs,

On 3/6/08, Chris <[EMAIL PROTECTED]> wrote:
>
> Zareef Ahmed wrote:
> > Hi Chris,
> >
> >   Thanks for such quick response.
> >
> > quite good suggestion, but my application is using a framework and lots
> > of includes and even autoloads of classes are being done, so using break
> > point approach is not possible for me.
>
>
> Why not? It just means the files are spread out in different folders
> instead of one place.
>
> If you're using a framework, set up a new very simple environment and
> see how much memory that uses by itself (see
> http://www.php.net/memory_get_peak_usage).
>
> That'll at least tell you whether it's the framework using all the
> memory or your specific changes to it.


 I have done that check and I am sure that only my changes are taking time,
but they are large in numbers, so I was looking something to pin point the
exact change which is consuming more memory. Thanks for your suggestions, I
will definitely use them.





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



-- 
Zareef Ahmed
http://www.zareef.net
A PHP Developer in India


Re: [PHP] How to measure memory leakage/usage in PHP?

2008-03-05 Thread Chris

Zareef Ahmed wrote:

Hi Chris,

  Thanks for such quick response.

quite good suggestion, but my application is using a framework and lots 
of includes and even autoloads of classes are being done, so using break 
point approach is not possible for me.


Why not? It just means the files are spread out in different folders 
instead of one place.


If you're using a framework, set up a new very simple environment and 
see how much memory that uses by itself (see 
http://www.php.net/memory_get_peak_usage).


That'll at least tell you whether it's the framework using all the 
memory or your specific changes to it.


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

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



Re: [PHP] How to measure memory leakage/usage in PHP?

2008-03-05 Thread Chris

Zareef Ahmed wrote:

Hi All,

   I am looking into the concepts behind memory management in PHP. Which
kind of approach will be best to measure memory leakage or usage in a PHP
script?

I can measure my apache process but is there any way by which I can know
which exact part of script is consuming how much memory?


Start off with putting something like this:

error_log('in file ' . __FILE__ . ' at line ' . __LINE__ . ' memory 
usage is ' . memory_get_usage(true) . "\n", 3, '/path/to/log.file');


every 100 lines and work out where your spikes are.

When you're looking at a section that jumps a lot, put it every 10 lines 
- work out which parts are causing the big jumps and go from there.



Or use xdebug profiling to work out which parts of your app are being 
used the most and start there - http://xdebug.org/docs/profiler


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

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



[PHP] How to measure memory leakage/usage in PHP?

2008-03-05 Thread Zareef Ahmed
Hi All,

   I am looking into the concepts behind memory management in PHP. Which
kind of approach will be best to measure memory leakage or usage in a PHP
script?

I can measure my apache process but is there any way by which I can know
which exact part of script is consuming how much memory?


-- 
Zareef Ahmed
http://www.zareef.net
A PHP Developer in India


[PHP] Re: Alternative to Quickforms - Not Use Tables

2008-03-05 Thread Shawn McKenzie
Manuel Lemos wrote:
> Hello,
> 
> on 03/05/2008 08:22 PM Stephen said the following:
>> Subject says it.
>>
>> Is there an open source class for forms that provides for the use of CSS
>>  for the layout of forms?
> 
> You may want to try this forms generation and validation class. It comes
> with a vertical layout plug-in. By default it uses tables, so you do not
> have to hardcode widths to make field rows and label columns align, but
> you can override the default templates and set them to use tableless HTML.
> 
> http://www.phpclasses.org/formsgeneration
> 
> Take a look at the test_auto_layout_form.php example.
> 
I knew it!  I was going to suggest phpclasses.  Also, depending upon
what you do in your apps, consider a framework.  There are many to
choose from.  I have evaluated several and prefer cakephp.  Normally you
won't use php to build the form but use html templates.

-Shawn

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



[PHP] Re: Alternative to Quickforms - Not Use Tables

2008-03-05 Thread Manuel Lemos
Hello,

on 03/05/2008 08:22 PM Stephen said the following:
> Subject says it.
> 
> Is there an open source class for forms that provides for the use of CSS
>  for the layout of forms?

You may want to try this forms generation and validation class. It comes
with a vertical layout plug-in. By default it uses tables, so you do not
have to hardcode widths to make field rows and label columns align, but
you can override the default templates and set them to use tableless HTML.

http://www.phpclasses.org/formsgeneration

Take a look at the test_auto_layout_form.php example.

-- 

Regards,
Manuel Lemos

PHP professionals looking for PHP jobs
http://www.phpclasses.org/professionals/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



[PHP] SOAP PHP 5.2.5 and Outside WSDL's

2008-03-05 Thread Jonathan Pitcher
I am connecting to a Third Party WSDL that needs me to turn return an Array
of results to them. I do and PHP returns this ...





en
50d3c78a0213b3e083ce7b6c7fa760a299798246fb6bbf1dc2dc81
12a841454d5bcb9cb752b18e299cd9be84214175b6c971065d8df08b52283408b925dd854128
5a031ca29c39b945989b951e2523594f5c9c0aa7bbfc328c87441830b47cd0
1



163
99


163
99






Problem is they need something like:


163
99


163
99


I found a good read here that says it deals with the way PHP handles
outputting arrays.

http://archive.netbsd.se/?ml=soap&a=2006-01&m=1677392

Is this truly considered a bug ? If so has it been resolved in the current
releases of PHP ?

If not does anyone have a simple solution ?  I can figure out a way to code
the XML myself and send it but honestly was hoping for a simplier solution
that didn't envolve writing XML by hand.

Jonathan Pitcher



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



[PHP] Alternative to Quickforms - Not Use Tables

2008-03-05 Thread Stephen

Subject says it.

Is there an open source class for forms that provides for the use of CSS 
 for the layout of forms?


Thanks
Stephen

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



Re: [PHP] Array questions...

2008-03-05 Thread Jim Lucas
I won't address the main issue of your question, since it looks like that has 
been solved.  But I want to point out a few other things that might help you.


Follow along below...

Jason Pruim wrote:
So for some reason, arrays always mess me up... I don't know what it is, 
but it just hasn't clicked yet... So I'm sure this is a simple question 
for someone who knows and understands arrays :)


So with that being said here's the code I'm using:

$self = $_SERVER['PHP_SELF'];
$i="0";



if (isset($_GET['txtNum'])) {
$numBox= $_GET['txtNum'];
$_SESSION['num'] = $_GET['txtNum'];
}else{


here you need to make sure that $_SESSION['num'] exists.
If not you will get a E_NOTICE warning level error.

So, you should have this
 } else if ( isset($_SESSION['num']) ) {


$numBox = $_SESSION['num'];
}


And then follow up the previous thing with this else statement

} else {
echo 'no "num" set';
// AND / OR
$numBox = 0;
}



echo "store box variable". $_SESSION['num'];
echo <<
How many boxes? 


HTML;

$NumArray= Array($_POST['txtNumArray[]']);

echo <
Route #Pieces in 
routeWeight of route

TABLE;

echo "";


Change this to "post" <-- spec says lower case on the value

And, you could get rid of the echo and move it to the last line of the previous 
HEREDOC statement



while($i < $numBox){
echo <<



Here you would use just value="txtNumArray[{$i}]"


value="txtNumArray[$i]">


Here you would use just value="{$i}"






Here you would use just value="txtPiecesArray[{$i}]"


value="txtPiecesArray[$i]">


Here you would use just value="{$i}"






Here you would use just value="txtWeightArray[{$i}]"


value="txtWeightArray[$i]">


Here you would use just value="{$i}"




HTML;
$i++;

}   
echo "";


The reason I would do the above, is to make sure that all three arrays are in 
sync.




What I'm attempting to do, is grab the info out of txtNumArray[] and put 
it into the variable $numArray Sounds easy enough right? Well I've tried 
using $NumArray = Array($_POST['txtNumArray[]'); but that's not 
working... I've tried $NumArray = $_POST['txtNumArray[]']; which didn't 
work... and I've looked on the php manual, but they all assume you 
understand this stuff which I do not :)


Anyone know what I'm doing wrong? Or could at least point me to some 
text like "Array's for Dummies"? :)



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]







--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

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



[PHP] Open Source Software Recomendation

2008-03-05 Thread Joey
Hey All,

 

Can you guys tell me of a good open source package which does things like
craiglist/backpage etc?

 

Also has anyone had good success with PHPcalendar?

 

Thanks!

 

 



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



Re: [PHP] Pear Installation Problem - Ubuntu

2008-03-05 Thread Stephen

Shawn McKenzie wrote:


sudo pear install HTML_QuickForm


That was so easy.

Thank you!
Stephen



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



Re: [PHP] Pear Installation Problem - Ubuntu

2008-03-05 Thread Shawn McKenzie
Stephen wrote:
> Wolf wrote:
> 
>> Open a terminal window on the server
>> at the prompt type:
>>  locate QuickForm.php
>>
>> If it comes back with the path/file, make sure the path to the file is
>> in the include folder
>>
>> If it comes back to just a regular terminal prompt right away, then
>> you need to install it.
>>
>> The following is what you get when it is NOT located:
>> ~$ locate Quickform.php
>> ~$
>> You could also run the following:
>> ~$ pear list
>> Installed packages, channel pear.php.net:
>> =
>> Package  Version  State
>> Archive_Tar  1.3.2stable
>> Auth 1.5.4stable
>> .
> 
> Thank you.
> 
> I just have four packages installed. I need to grab some and install them.
> 
> Stephen
> 
sudo pear install HTML_QuickForm

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



Re: [PHP] Re: Preserving URL after redirect?

2008-03-05 Thread Shawn McKenzie
Skip Evans wrote:
> (Apologies to Shawn for sending this directly to him and not the entire
> list, that was an accident. Here it is for the list.)
> 
> Shawn McKenzie wrote:
> 
>>
>> Rewrite rule would look something like:
>>
>> 
>> RewriteEngine On
>> RewriteCond %{REQUEST_FILENAME} !-d
>> RewriteCond %{REQUEST_FILENAME} !-f
>> RewriteRule ^(.*)$ index.php?path=$1 [QSA,L]
>> 
>>
>> -Shawn
>>
> 
> My httpd.conf file has this
> 
> LoadModule rewrite_module
> libexec/apache2/mod_rewrite.so
> 
> But your .htaccess sample has
> 
> IfModule mod_rewrite.c
> 
> Is that okay?
> 

It Works for me and I have the same mod_rewrite.so line.  Not sure the
specifics of why this is as it is.

> Also, it does look like .htaccess is enabled in
> httpd.conf with entries like:
> 
> #
> # AllowOverride controls what directives may be
> placed in .htaccess files.
> # It can be "All", "None", or any combination of
> the keywords:
> #   Options FileInfo AuthConfig Limit
> #
> AllowOverride All
> 
> #
> # AccessFileName: The name of the file to look for
> in each directory
> # for additional configuration directives.  See
> also the AllowOverride
> # directive.
> #
> AccessFileName .htaccess
> 
> But when I tried out Shawn's file I got 404 errors
> on the URLs (after renaming the wi directory, to
> be sure the .htaccess file was in control.)
> 
> Any suggestions would be greatly appreciated.
> 
> I'm going through a pretty good page on htaccess files at
> 
> http://corz.org/serv/tricks/htaccess2.php
> 
> But it starts off with "Make no mistake, mod_rewrite is complex."
> 
> *gulp!*
> 
> Skip
> 
So you have the .htaccess file in the root dir alongside the index.php?

I just tested and this is working for me.  What I posted rewrites
everything to index.php so if you have other php pages that are loaded
by the browser then you would need better rules in .htaccess.

To see more you might add the following and then check the log:

RewriteLog "/somepath/rewrite.log"
RewriteLogLevel 3


-Shawn

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



Re: [PHP] Pear Installation Problem - Ubuntu

2008-03-05 Thread Stephen

Wolf wrote:


Open a terminal window on the server
at the prompt type:
 locate QuickForm.php

If it comes back with the path/file, make sure the path to the file is in the 
include folder

If it comes back to just a regular terminal prompt right away, then you need to 
install it.

The following is what you get when it is NOT located:
~$ locate Quickform.php
~$ 


You could also run the following:
~$ pear list
Installed packages, channel pear.php.net:
=
Package  Version  State
Archive_Tar  1.3.2stable
Auth 1.5.4stable

> .

Thank you.

I just have four packages installed. I need to grab some and install them.

Stephen


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



RES: [PHP] maintaining [user] state without a session ...

2008-03-05 Thread Thiago Pojda
At 10:45 AM -0500 3/5/08, Jason Pruim wrote:
>Me personally, I'm on Wife 1.0 (Still working out a few bugs before
>1.1 is released) But I do have Son 1.20 and in a few months Son 2.0 
>will be released into the wild.. The only problem I have found with 
>wife 1.0 and son 1.20 is my bank account which used to be 5.0 is much 
>closer to 1.0 now... Anyone else experience that? :)

Similar --

But it went for college for daughter 1.0, 2.0 and son 1.0.

And let's not to forget daughter 1.0 and her 1.0 and 2.0 weddings.

Cheers,

tedd
--




You don't have to go that far to have a bank account downgrade, I'm still on
Wife RC1 and that's already happening...

I hope I get newer versions of bank account before going to Final :)

Thiago



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



Re: [PHP] Universaly Accepted Naming Conventions..?

2008-03-05 Thread Eric Butera
On Wed, Mar 5, 2008 at 2:06 PM, John Papas <[EMAIL PROTECTED]> wrote:
> Are there any in PHP?
>
>  It seems like there are those that draw upon the C/unix naming
>  conventions and those that follow the Java/OO style.
>
>  Even PHP's native syntax (like function names pre/post v5) are not 
> consistent.
>
>  --
>  PHP General Mailing List (http://www.php.net/)
>  To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Not really, but here are a few of the more prominent ones:

http://lxr.php.net/source/php-src/CODING_STANDARDS

http://pear.php.net/manual/en/standards.php

http://framework.zend.com/manual/en/coding-standard.html

Take your pick. :)

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



Re: [PHP] Re: Preserving URL after redirect?

2008-03-05 Thread Skip Evans
(Apologies to Shawn for sending this directly to 
him and not the entire list, that was an accident. 
Here it is for the list.)


Shawn McKenzie wrote:



Rewrite rule would look something like:


RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?path=$1 [QSA,L]


-Shawn



My httpd.conf file has this

LoadModule rewrite_module
libexec/apache2/mod_rewrite.so

But your .htaccess sample has

IfModule mod_rewrite.c

Is that okay?

Also, it does look like .htaccess is enabled in
httpd.conf with entries like:

#
# AllowOverride controls what directives may be
placed in .htaccess files.
# It can be "All", "None", or any combination of
the keywords:
#   Options FileInfo AuthConfig Limit
#
AllowOverride All

#
# AccessFileName: The name of the file to look for
in each directory
# for additional configuration directives.  See
also the AllowOverride
# directive.
#
AccessFileName .htaccess

But when I tried out Shawn's file I got 404 errors
on the URLs (after renaming the wi directory, to
be sure the .htaccess file was in control.)

Any suggestions would be greatly appreciated.

I'm going through a pretty good page on htaccess 
files at


http://corz.org/serv/tricks/htaccess2.php

But it starts off with "Make no mistake, 
mod_rewrite is complex."


*gulp!*

Skip

--
Skip Evans
Big Sky Penguin, LLC
503 S Baldwin St, #1
Madison, WI 53703
608-250-2720
http://bigskypenguin.com
=-=-=-=-=-=-=-=-=-=
Check out PHPenguin, a lightweight and versatile
PHP/MySQL, AJAX & DHTML development framework.
http://phpenguin.bigskypenguin.com/

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



Re: [PHP] Pear Installation Problem - Ubuntu

2008-03-05 Thread Wolf
> > [snip!]
> >>  But there is no /usr/share/pear directory.
> >>
> >>  I have a /usr/share/php/PEAR and it has things that look like
> >>  installation files.
> > [snip!]
> >>  Can anyone help me figure out how to get the installation fixed?
> > 
> > Update your php.ini to add /usr/share/php/PEAR to the include
> > path, and remove /usr/share/php/pear if it's in there.  Then restart
> > Apache (service httpd stop;service httpd startssl) and you should be
> > good to go.
> > 
> 
> I don't think that it is that simple. The /usr/share/php/PEAR directory 
> does not include the HTML directory or the QuickForm.php file.
> 
> It looks like I have to run some kind of install process for PEAR.
> 
> Docs to read.
Open a terminal window on the server
at the prompt type:
 locate QuickForm.php

If it comes back with the path/file, make sure the path to the file is in the 
include folder

If it comes back to just a regular terminal prompt right away, then you need to 
install it.

The following is what you get when it is NOT located:
~$ locate Quickform.php
~$ 

You could also run the following:
~$ pear list
Installed packages, channel pear.php.net:
=
Package  Version  State
Archive_Tar  1.3.2stable
Auth 1.5.4stable
Cache1.5.5RC4 beta
Console_Getopt   1.2.2stable
Date 1.4.6stable
File 1.3.0stable
HTTP_Request 1.4.1stable
Image_Canvas 0.2.2alpha
Image_Graph  0.7.1alpha
Log  1.9.11   stable
Net_CheckIP  1.2.1stable
Net_DIME 0.3  beta
Net_FTP  1.3.2stable
Net_LDAP 0.7.2beta
Net_Sieve1.1.5stable
Net_SmartIRC 1.0.0stable
Net_URL  1.0.14   stable
PEAR 1.5.4stable
SOAP 0.10.1   beta
Services_Weather 1.4.2stable
Structures_Graph 1.0.2stable
XML_Serializer   0.18.0   beta
XML_Util 1.1.4stable



HTH,
Wolf

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



Re: [PHP] Pear Installation Problem - Ubuntu

2008-03-05 Thread Stephen

Daniel Brown wrote:


On Wed, Mar 5, 2008 at 12:59 PM, Stephen <[EMAIL PROTECTED]> wrote:

My LAMP is on Ubuntu 7.10

[snip!]

 Fatal error: require_once() [function.require]: Failed opening required
 'HTML/QuickForm.php' (include_path='.:/usr/share/php:/usr/share/pear')
 in /home/stephen/www/roissy.ca/public_html/quotesForm.php on line 3

[snip!]

 But there is no /usr/share/pear directory.

 I have a /usr/share/php/PEAR and it has things that look like
 installation files.

[snip!]

 Can anyone help me figure out how to get the installation fixed?


Update your php.ini to add /usr/share/php/PEAR to the include
path, and remove /usr/share/php/pear if it's in there.  Then restart
Apache (service httpd stop;service httpd startssl) and you should be
good to go.



I don't think that it is that simple. The /usr/share/php/PEAR directory 
does not include the HTML directory or the QuickForm.php file.


It looks like I have to run some kind of install process for PEAR.

Docs to read.

Thanks
Stephen

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



[PHP] Universaly Accepted Naming Conventions..?

2008-03-05 Thread John Papas
Are there any in PHP?

It seems like there are those that draw upon the C/unix naming
conventions and those that follow the Java/OO style.

Even PHP's native syntax (like function names pre/post v5) are not consistent.

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



Re: [PHP] Logging session timeout in DB

2008-03-05 Thread Daniel Brown
On Wed, Mar 5, 2008 at 3:08 AM, Angelo Zanetti <[EMAIL PROTECTED]> wrote:
[snip!]
>  No what I would like to know is how can I record when a user closes the
>  browser or the session expires? There is no action for these items. So what
>  would the best way be to keep a record of this? Would the use of a cron job
>  be appropriate? I read in the archives that the banks use javascript but I
>  don't want to go that route.

One way that comes to mind right off the bat would be to utilize
an idea similar to the following.  You'll need to secure it and tailor
it to your own needs, but it should point you in the right direction.



 '".$diff_secs."'";
mysql_query($sql);
?>

Then, add this to your crontab:
*/1 * * * * `which php` /path/to/cron/script.php

It will run every minute, making users who have not accessed a
page within the previous 10 minutes inactive.  It's untested, but
hopefully it will point you in the right direction anyway.

-- 


Daniel P. Brown
Senior Unix Geek


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



[PHP] Re: Preserving URL after redirect?

2008-03-05 Thread Shawn McKenzie
Skip Evans wrote:
> Hey all,
> 
> I have a weird issue that's got me pretty stumped, and I'm not sure I
> can do what the client is asking, or at least not how I'm trying to do it.
> 
> I have a code base of my own I'm building sites on, fully AJAX enabled
> so that once the site loads it never fully refreshes a page, but AJAX
> runs everything through JS to server calls for content, updating only
> sections of the page only when needed, say for like the small calendar
> in the upper right corner when a new month is clicked.
> 
> The site is basically a CMS for school sports teams to create their own
> pages, and the schools are accessed via individual directories like
> 
> http://prepcube.com/wi/madison/
> 
> So I created the wi/madison/
> 
> ...directory when the school signs up and placed a file there that
> parses the URI to get the schools "shortname", in this case "madison",
> and then sets a session variables for school ID that allows the user to
> access this school's data.
> 
> Then it redirects back to
> 
> http://prepcube.com/
> 
> ...which of course loses the wi/madison portion of the URL, thought the
> client wants this preserved and to remain in the URL field.
> 
> And since this is a fully AJAX enables site, the URL in the browser's
> URL field would never change from
> 
> http://prepcube.com/wi/madison/
> 
> ...which is something the client really likes.
> 
> So, my question is how would I do that, and I strongly suspect if it's
> possible at all an .htaccess file with the proper entries would be the
> way to do it, not using PHP code to redirect as I am now.
> 
> Is this the case?
> 
> Unfortunately, I must confess to not being terribly familiar with
> htaccess files, I believe this would be rewrite rules to rewrite the URL
> and point it to the right place? But even with htaccess rewrite rules
> could this be done to preserve the full URL with state/school in the
> browser's URL field?
> 
> Any advice, as always, is greatly appreciated.
> 
> Thanks globules!
> Skip

Why create a "real" directory and put a file in it?  Here is one approach:

Client uses http://prepcube.com/wi/madison/ and .htaccess rewrites to
http://prepcube.com/index.php?path=wi/madison

index.php parses the path var to extract the short name and set the
session var:

Rewrite rule would look something like:


RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?path=$1 [QSA,L]


-Shawn

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



[PHP] Re: imagettftext and utf-8 (swedish characters)

2008-03-05 Thread tedd

At 2:17 AM + 2/29/08, Nathan Rixham wrote:

Nathan Rixham wrote:

try changing:
imagettftext( $im, $title_size, 0, 50, 50, $white, $font, $title );

to:
imagettftext($im, $title_size, 0, 50, 50, $white, $font, 
utf8_decode($title));


Both statements work for me. -- see here:

http://www.webbytedd.com/b1/special-char/

But I don't know -- it looks Swedish to me.  :-)

Cheers,

tedd


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

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



Re: [PHP] Preserving URL after redirect?

2008-03-05 Thread Ray Hauge

Richard Heyes wrote:
So, my question is how would I do that, and I strongly suspect if it's 
possible at all an .htaccess file with the proper entries would be the 
way to do it, not using PHP code to redirect as I am now.


Is this the case?


You would need to use mod_rewrite.



You might also be able to get this to work by changing the include_path 
and creating a special "loader" script in their folder.


define('INCLUDE_PATH', '');

ini_set("include_path", INCLUDE_PATH);

That way the application includes would still work if you didn't specify 
 absolute paths...


I have a few scripts that use the include_path, and they look something 
like:




That way I just have the initial call to set the include path, and I 
don't have to worry about it anymore.


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] Pear Installation Problem - Ubuntu

2008-03-05 Thread Daniel Brown
On Wed, Mar 5, 2008 at 12:59 PM, Stephen <[EMAIL PROTECTED]> wrote:
> My LAMP is on Ubuntu 7.10
[snip!]
>  Fatal error: require_once() [function.require]: Failed opening required
>  'HTML/QuickForm.php' (include_path='.:/usr/share/php:/usr/share/pear')
>  in /home/stephen/www/roissy.ca/public_html/quotesForm.php on line 3
[snip!]
>  But there is no /usr/share/pear directory.
>
>  I have a /usr/share/php/PEAR and it has things that look like
>  installation files.
[snip!]
>  Can anyone help me figure out how to get the installation fixed?

Update your php.ini to add /usr/share/php/PEAR to the include
path, and remove /usr/share/php/pear if it's in there.  Then restart
Apache (service httpd stop;service httpd startssl) and you should be
good to go.

-- 


Daniel P. Brown
Senior Unix Geek


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



[PHP] Pear Installation Problem - Ubuntu

2008-03-05 Thread Stephen

My LAMP is on Ubuntu 7.10

I am trying to use PEAR, for the first time, and get an error about the 
include file not being found.


It is not there.

phpinfo() has include_path set to .:/usr/share/php:/usr/share/pear

Here is my error:

Warning: require_once(HTML/QuickForm.php) [function.require-once]: 
failed to open stream: No such file or directory in 
/home/stephen/www/roissy.ca/public_html/quotesForm.php on line 3


Fatal error: require_once() [function.require]: Failed opening required 
'HTML/QuickForm.php' (include_path='.:/usr/share/php:/usr/share/pear') 
in /home/stephen/www/roissy.ca/public_html/quotesForm.php on line 3


Now I have always just used the Synaptic Package Manager, and I just did 
a reinstall of PEAR.


But there is no /usr/share/pear directory.

I have a /usr/share/php/PEAR and it has things that look like 
installation files.


I am venturing where I have not before. I have never performed any kind 
of CLI install.


Can anyone help me figure out how to get the installation fixed?

Thanks
Stephen

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



[PHP] Re: regular expressions question

2008-03-05 Thread Al

ctype_alpha ( string $text )


Adil Drissi wrote:

Hi,

Is there any way to limit the user to a set of characters for example say i 
want my user to enter any character between a and z (case insensitive). And if 
the user enters just one letter not belonging to [a-z], this will not be 
accepted.

I tried  eregi('[a-z]', $fname) but this allows the user to enter abdg4512kdkdk 
for example.

Thank you

   
-

Never miss a thing.   Make Yahoo your homepage.


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



Re: [PHP] Preserving URL after redirect?

2008-03-05 Thread Skip Evans

Wolf wrote:



Why does is redirect back to the beginning?  Seems to me that is where your 
issue is arising from.  The client wants /wi/madison to be in the URl, so you 
have a few things to do...

Stop redirecting to the root and leave it in the /wi/madison folder, then do 
stuff it needs to do just using the root+stored_path to give the site it's 
depth.

Or maybe I am missing something in the way your site works?

Wolf



Because each school has its own directory, really 
only to make access via...


http://www.prepcube.com/{state}/schools_short_name

But the system is up in the doc root, beginning with

http://www.prepcube.com/index.php

So the school's directory needs to redirect back 
to the system, after setting the session var that 
determines what data is read.


I think Richard probably hit the answer with a 
mod_rewrite. Basically, I need a rule that would 
take the URL


http://www.prepcube.com/{state}/schools_short_name

And call

http://www.prepcube.com/index.php

and perhaps pass the school's shortname value in a 
get var?


Richard, would that work, and still preserve the 
school's individual URL in the browser's URL field?


Is that what you're thinking?

I'm reading up on mod_rewrite right now to 
determine if this is possible.


--
Skip Evans
Big Sky Penguin, LLC
503 S Baldwin St, #1
Madison, WI 53703
608-250-2720
http://bigskypenguin.com
=-=-=-=-=-=-=-=-=-=
Check out PHPenguin, a lightweight and versatile
PHP/MySQL, AJAX & DHTML development framework.
http://phpenguin.bigskypenguin.com/

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



Re: [PHP] Preserving URL after redirect?

2008-03-05 Thread Richard Heyes
So, my question is how would I do that, and I strongly suspect if it's 
possible at all an .htaccess file with the proper entries would be the 
way to do it, not using PHP code to redirect as I am now.


Is this the case?


You would need to use mod_rewrite.

--
Richard Heyes
Employ me:
http://www.phpguru.org/cv

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



Re: [PHP] Preserving URL after redirect?

2008-03-05 Thread Wolf

 Skip Evans <[EMAIL PROTECTED]> wrote: 
> Hey all,
> 
> I have a weird issue that's got me pretty stumped, 
> and I'm not sure I can do what the client is 
> asking, or at least not how I'm trying to do it.
> 
> I have a code base of my own I'm building sites 
> on, fully AJAX enabled so that once the site loads 
> it never fully refreshes a page, but AJAX runs 
> everything through JS to server calls for content, 
> updating only sections of the page only when 
> needed, say for like the small calendar in the 
> upper right corner when a new month is clicked.
> 
> The site is basically a CMS for school sports 
> teams to create their own pages, and the schools 
> are accessed via individual directories like
> 
> http://prepcube.com/wi/madison/
> 
> So I created the wi/madison/
> 
> ...directory when the school signs up and placed a 
> file there that parses the URI to get the schools 
> "shortname", in this case "madison", and then sets 
> a session variables for school ID that allows the 
> user to access this school's data.
> 
> Then it redirects back to


Why does is redirect back to the beginning?  Seems to me that is where your 
issue is arising from.  The client wants /wi/madison to be in the URl, so you 
have a few things to do...

Stop redirecting to the root and leave it in the /wi/madison folder, then do 
stuff it needs to do just using the root+stored_path to give the site it's 
depth.

Or maybe I am missing something in the way your site works?

Wolf




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



[PHP] Preserving URL after redirect?

2008-03-05 Thread Skip Evans

Hey all,

I have a weird issue that's got me pretty stumped, 
and I'm not sure I can do what the client is 
asking, or at least not how I'm trying to do it.


I have a code base of my own I'm building sites 
on, fully AJAX enabled so that once the site loads 
it never fully refreshes a page, but AJAX runs 
everything through JS to server calls for content, 
updating only sections of the page only when 
needed, say for like the small calendar in the 
upper right corner when a new month is clicked.


The site is basically a CMS for school sports 
teams to create their own pages, and the schools 
are accessed via individual directories like


http://prepcube.com/wi/madison/

So I created the wi/madison/

...directory when the school signs up and placed a 
file there that parses the URI to get the schools 
"shortname", in this case "madison", and then sets 
a session variables for school ID that allows the 
user to access this school's data.


Then it redirects back to

http://prepcube.com/

...which of course loses the wi/madison portion of 
the URL, thought the client wants this preserved 
and to remain in the URL field.


And since this is a fully AJAX enables site, the 
URL in the browser's URL field would never change 
from


http://prepcube.com/wi/madison/

...which is something the client really likes.

So, my question is how would I do that, and I 
strongly suspect if it's possible at all an 
.htaccess file with the proper entries would be 
the way to do it, not using PHP code to redirect 
as I am now.


Is this the case?

Unfortunately, I must confess to not being 
terribly familiar with htaccess files, I believe 
this would be rewrite rules to rewrite the URL and 
point it to the right place? But even with 
htaccess rewrite rules could this be done to 
preserve the full URL with state/school in the 
browser's URL field?


Any advice, as always, is greatly appreciated.

Thanks globules!
Skip
--
Skip Evans
Big Sky Penguin, LLC
503 S Baldwin St, #1
Madison, WI 53703
608-250-2720
http://bigskypenguin.com
=-=-=-=-=-=-=-=-=-=
Check out PHPenguin, a lightweight and versatile
PHP/MySQL, AJAX & DHTML development framework.
http://phpenguin.bigskypenguin.com/

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



RES: [PHP] PHP performance

2008-03-05 Thread Thiago Pojda
De: Richard Lynch [mailto:[EMAIL PROTECTED] 

#1
Get the code, install it on a box in the closet, run valgrind 
--callgrind

This will give you a stack trace of what gets called the MOST 
in your application.

Look for "tall" trees in the call graph, and fix those first.

#2
You can use 'ab' (apache benchmark) or similar to test it externally.

#3
You can also script things with Selenium IDE and then use 
Selenium remote control to run them repeatedly, for the 
end-user experience.

Don't let server non-access stop you from doing #1 though...





  Sweet!

  I'll be trying those tools, Richard. Thanks :)

  Installing xdebug is getting rougher than expected as it's a RHEL4AS, php
4.3.4 w/o php-devel and a screwed up gcc :/


  I'll let you know what worked for me.


  Thiago




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



Re: [PHP] maintaining [user] state without a session ...

2008-03-05 Thread Daniel Brown
On Wed, Mar 5, 2008 at 11:19 AM, tedd <[EMAIL PROTECTED]> wrote:
> At 10:45 AM -0500 3/5/08, Jason Pruim wrote:
>  >Me personally, I'm on Wife 1.0 (Still working out a few bugs before
>  >1.1 is released) But I do have Son 1.20 and in a few months Son 2.0
>  >will be released into the wild.. The only problem I have found with
>  >wife 1.0 and son 1.20 is my bank account which used to be 5.0 is
>  >much closer to 1.0 now... Anyone else experience that? :)
>
>  Similar --
>
>  But it went for college for daughter 1.0, 2.0 and son 1.0.
>
>  And let's not to forget daughter 1.0 and her 1.0 and 2.0 weddings.
>
>  Cheers,
>
>  tedd

For me, Checking 1.0 has always experienced segfaults, but with
regard to Pre-Wife 1.0 (formerly released as Wife 1.0 RC2), the
database will occasionally collect too much information on old
software that I had installed, and the cron jobs seem to fire off when
I'm executing NightOut X, but the point-and-click interface is
fantastic.

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] maintaining [user] state without a session ...

2008-03-05 Thread tedd

At 10:45 AM -0500 3/5/08, Jason Pruim wrote:
Me personally, I'm on Wife 1.0 (Still working out a few bugs before 
1.1 is released) But I do have Son 1.20 and in a few months Son 2.0 
will be released into the wild.. The only problem I have found with 
wife 1.0 and son 1.20 is my bank account which used to be 5.0 is 
much closer to 1.0 now... Anyone else experience that? :)


Similar --

But it went for college for daughter 1.0, 2.0 and son 1.0.

And let's not to forget daughter 1.0 and her 1.0 and 2.0 weddings.

Cheers,

tedd

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

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



Re: [PHP] Variable post as array

2008-03-05 Thread Daniel Brown
On Wed, Mar 5, 2008 at 4:58 AM, Pieter du Toit <[EMAIL PROTECTED]> wrote:

And unless you have your (Apache|IIS|etc.) web server set to
disable direct-access and/or web serving of *.inc files, you should
change these to *.php or *.inc.php files ASAP.  Especially the first.
You're looking at a potentially severe security vulnerability there,
depending on what userpass.inc contains (at which I can take a guess).

>  
>  
>  


-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] validating mysql bound date

2008-03-05 Thread Daniel Brown
On Tue, Mar 4, 2008 at 8:16 PM, Larry Brown
<[EMAIL PROTECTED]> wrote:
> Does anyone know if there is a builtin function for checking the
>  formatting of an incoming date to verify it is /MM/DD.  I know how
>  to convert between formats but want a quick way to check an incoming
>  variable to ensure it will be handled properly by mysqld.

Larry, try this:


It's also up in my snippet library here:
[Demo]http://www.pilotpig.net/code-library/date-format-check.php
[Source]
http://www.pilotpig.net/code-library/source.php?f=date-format-check.php

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] Array questions...

2008-03-05 Thread Robert Cummings

On Wed, 2008-03-05 at 10:53 -0500, Jason Pruim wrote:
> On Mar 5, 2008, at 10:35 AM, Robert Cummings wrote:
> >
> > I think you want the following after performing a very cursory look at
> > your sample.
> >
> >  >
> > $NumArray
> >= isset( $_POST['txtNumArray'] )
> >? $_POST['txtNumArray']
> >: array();
> >
> > ?>
> 
> Mind if I ask why setting it that way would be bettter? Other then the  
> fact that it looks like it might possibly handle some of the errors  
> I'm getting right now because I don't have the arrays defined before  
> this?
> 
> Or did I just answer my own question?

It ensures you have an array in the event nothing was posted. I never
just assume that I received data I was supposed to receive.

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


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



Re: [PHP] Re: Variable post as array

2008-03-05 Thread Zoltán Németh
2008. 03. 5, szerda keltezéssel 13.42-kor Pieter du Toit ezt írta:
> This is line 49
> 
> $txtPhotoData = addslashes(fread(fopen($txtPhoto, "r"), 
> filesize($txtPhoto)));

add this before:
$txtPhoto = $_FILES['txtPhoto']['tmp_name'];

and don't use addslashes but rather mysql_real_escape_string or whatever
suits your database most

greets,
Zoltán Németh

> 
> the $txtPhoto is the parameter
> 
> ""Angelo Zanetti"" <[EMAIL PROTECTED]> wrote in message 
> news:[EMAIL PROTECTED]
> > What is on line 49?
> >
> > What variable are you passing as the parameter?
> >
> >
> >
> > -Original Message-
> > From: Pieter du Toit [mailto:[EMAIL PROTECTED]
> > Sent: 05 March 2008 13:36
> > To: php-general@lists.php.net
> > Subject: [PHP] Re: Variable post as array
> >
> > This is my problem
> >
> > Warning: fopen() expects parameter 1 to be string, array given in
> > /usr/www/users/zululr/marketplace/myzululand/specials_proc.php on line 49
> >
> > "Colin Guthrie" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> >> Pieter du Toit wrote:
> >>> Hi
> >>>
> >>> I have this weird problem, when i select a file to upload, the variable
> >>> arrives as an array at the action php file, this is the code, and the
> >>> variable name is txtPhoto
> >>
> >> I'd give a shorter example. People don't want to read through all your
> >> code..
> >>
> >> Also you shoudl post some sort of indication of what you are trying to
> >> do to get the results you describe... just saying "the variable arrives
> >> as an array" and we don't really know how you are accessing "the
> >> variable".
> >>
> >> A short example and expected/actual behaviour listing is good :)
> >>
> >> Col
> >>
> >
> >
> >
> > -- 
> > 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] Re: Variable post as array

2008-03-05 Thread Jim Lucas

Pieter du Toit wrote:
Just to add, if i try to echo the $_FILES['txtPhoto']['temp_name'] it tells 


The above reference is wrong.  'temp_name' should be 'tmp_name'

me that temp_name is also an array, but when i echo 
$_FILES['txtPhoto']['name'] it gives me the correct name. Also with a 
vardump i can see that temp name is ["tmp_name"]=> string(14) 
"/tmp/phplR1WSl" and not an array by itself.


So, like I said before.  Use the right key name, and all will be one with your 
universe.




Im going crazy here


That question is best answered by a professional






--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] Array questions...

2008-03-05 Thread Jason Pruim


On Mar 5, 2008, at 10:35 AM, Robert Cummings wrote:


I think you want the following after performing a very cursory look at
your sample.




Mind if I ask why setting it that way would be bettter? Other then the  
fact that it looks like it might possibly handle some of the errors  
I'm getting right now because I don't have the arrays defined before  
this?


Or did I just answer my own question?


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]




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



Re: [PHP] Array questions...

2008-03-05 Thread Jason Pruim


On Mar 5, 2008, at 10:41 AM, Ford, Mike wrote:


On 05 March 2008 15:34, Jason Pruim advised:


Okay so I'm replying to my own post... And top posting to boot! :P

Amazing what happens when you pull a few [] off for completness:

$NumArray = Array($_POST['txtNumArray']);

works as I wanted :)


Are you sure?? Looks a bit suspect to me, since $_POST['txtNumArray']
will already be an array, and what you've got there turns it into an
Array of Array.

From your original message, I was about to suggest you wanted simply

 $NumArray = $_POST['txtNumArray'];

and I still suspect that might be more the mark.


I think you may be right :) I just changed it to that without any  
issues... Few less bytes :)





(I was also wondering to myself whether you actually really, really
wanted $txtNumArray = $_POST['txtNumArray'], but perhaps you can  
easily

explain why not...?)


It's a habit I picked up when I was in school and studied Visual basic  
for a semester... That way, I know for sure if I'm working with the  
original text verses the text stored in the variable.


Is there any reason not to do it the way I am? I'm completely self  
taught (With the help of many people from here!) so I'm open to  
suggestions about stuff like this :)



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]




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



Re: [PHP] maintaining [user] state without a session ...

2008-03-05 Thread Jason Pruim


On Mar 5, 2008, at 10:39 AM, Zoltán Németh wrote:


2008. 03. 4, kedd keltezéssel 18.05-kor Nathan Rixham ezt írta:

tedd wrote:

At 12:15 PM -0500 3/4/08, Daniel Brown wrote:

   Amazingly, I do get all of my stuff done.  Granted, I'm in front
of a computer seven days per week, and usually a minimum of 10-12
hours per day, but what else would I do?  Spend time with the
pre-wife?



You're working on wife 1.0 beta -- wait until you're fully developed
into wife 2.0.

Cheers,

tedd



If I ever had any doublt I was reading a programmer's list, I don't  
now.


ps: I'm on RC4


I've had a 1.0 a couple of years ago, but after some years it started
causing kernel panic and ended up crashing all my systems... since  
then

I had only pre-alfa candidates and one RC1, but none of them could
manage to release...


Me personally, I'm on Wife 1.0 (Still working out a few bugs before  
1.1 is released) But I do have Son 1.20 and in a few months Son 2.0  
will be released into the wild.. The only problem I have found with  
wife 1.0 and son 1.20 is my bank account which used to be 5.0 is much  
closer to 1.0 now... Anyone else experience that? :)




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]




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



RE: [PHP] Array questions...

2008-03-05 Thread Ford, Mike
On 05 March 2008 15:34, Jason Pruim advised:

> Okay so I'm replying to my own post... And top posting to boot! :P
> 
> Amazing what happens when you pull a few [] off for completness:
> 
> $NumArray = Array($_POST['txtNumArray']);
> 
> works as I wanted :)

Are you sure?? Looks a bit suspect to me, since $_POST['txtNumArray']
will already be an array, and what you've got there turns it into an
Array of Array.

From your original message, I was about to suggest you wanted simply

  $NumArray = $_POST['txtNumArray'];

and I still suspect that might be more the mark.

(I was also wondering to myself whether you actually really, really
wanted $txtNumArray = $_POST['txtNumArray'], but perhaps you can easily
explain why not...?)

 --
Mike Ford,  Electronic Information Services Adviser,
JG125, The Headingley Library,
James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 812 4730  Fax:  +44 113 812 3211


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



Re: [PHP] maintaining [user] state without a session ...

2008-03-05 Thread Zoltán Németh
2008. 03. 4, kedd keltezéssel 18.05-kor Nathan Rixham ezt írta:
> tedd wrote:
> > At 12:15 PM -0500 3/4/08, Daniel Brown wrote:
> >> Amazingly, I do get all of my stuff done.  Granted, I'm in front
> >> of a computer seven days per week, and usually a minimum of 10-12
> >> hours per day, but what else would I do?  Spend time with the
> >> pre-wife?
> > 
> > 
> > You're working on wife 1.0 beta -- wait until you're fully developed 
> > into wife 2.0.
> > 
> > Cheers,
> > 
> > tedd
> > 
> 
> If I ever had any doublt I was reading a programmer's list, I don't now.
> 
> ps: I'm on RC4

I've had a 1.0 a couple of years ago, but after some years it started
causing kernel panic and ended up crashing all my systems... since then
I had only pre-alfa candidates and one RC1, but none of them could
manage to release...

greets,
Zoltán Németh

> 


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



Re: [PHP] Array questions...

2008-03-05 Thread Robert Cummings

On Wed, 2008-03-05 at 10:28 -0500, Jason Pruim wrote:
> So for some reason, arrays always mess me up... I don't know what it  
> is, but it just hasn't clicked yet... So I'm sure this is a simple  
> question for someone who knows and understands arrays :)
> 
> So with that being said here's the code I'm using:
> 
>   $self = $_SERVER['PHP_SELF'];
>   $i="0";
>   if (isset($_GET['txtNum'])) {
>   $numBox= $_GET['txtNum'];
>   $_SESSION['num'] = $_GET['txtNum'];
>   }else{
>   $numBox = $_SESSION['num'];
>   }
>   echo "store box variable". $_SESSION['num'];
> echo <<   
>   How many boxes? 
>   
>   
> HTML;
> 
>   $NumArray= Array($_POST['txtNumArray[]']);
> 
> echo <<   Weight of 100 pieces:  name="txtPieceWeight">
>   Route #Pieces in route th>Weight of route
>   
> TABLE;
> echo "";
>   while($i < $numBox){
> echo <<   
>   
>value="txtNumArray[$i]">
>   
>   
>value="txtPiecesArray[$i]">
>   
>   
>value="txtWeightArray[$i]">
>   
>   
> HTML;
>   $i++;
>   
>   }   
> echo "";
> 
> 
> What I'm attempting to do, is grab the info out of txtNumArray[] and  
> put it into the variable $numArray Sounds easy enough right? Well I've  
> tried using $NumArray = Array($_POST['txtNumArray[]'); but that's not  
> working... I've tried $NumArray = $_POST['txtNumArray[]']; which  
> didn't work... and I've looked on the php manual, but they all assume  
> you understand this stuff which I do not :)
> 
> Anyone know what I'm doing wrong? Or could at least point me to some  
> text like "Array's for Dummies"? :)

I think you want the following after performing a very cursory look at
your sample.



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


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



Re: [PHP] Array questions...

2008-03-05 Thread Jason Pruim

Okay so I'm replying to my own post... And top posting to boot! :P

Amazing what happens when you pull a few [] off for completness:

$NumArray = Array($_POST['txtNumArray']);

works as I wanted :) Anyone have any texts that could help me get a  
better grasp on arrays though? :)



On Mar 5, 2008, at 10:28 AM, Jason Pruim wrote:

So for some reason, arrays always mess me up... I don't know what it  
is, but it just hasn't clicked yet... So I'm sure this is a simple  
question for someone who knows and understands arrays :)


So with that being said here's the code I'm using:

$self = $_SERVER['PHP_SELF'];
$i="0";
if (isset($_GET['txtNum'])) {
$numBox= $_GET['txtNum'];
$_SESSION['num'] = $_GET['txtNum'];
}else{
$numBox = $_SESSION['num'];
}
echo "store box variable". $_SESSION['num'];
echo <<
How many boxes? 


HTML;

$NumArray= Array($_POST['txtNumArray[]']);

echo <<	Weight of 100 pieces: name="txtPieceWeight">
	Route #Pieces in routeth>Weight of route


TABLE;
echo "";
while($i < $numBox){
echo <<

		value="txtNumArray[$i]">



		value="txtPiecesArray[$i]">



		value="txtWeightArray[$i]">



HTML;
$i++;

}   
echo "";


What I'm attempting to do, is grab the info out of txtNumArray[] and  
put it into the variable $numArray Sounds easy enough right? Well  
I've tried using $NumArray = Array($_POST['txtNumArray[]'); but  
that's not working... I've tried $NumArray =  
$_POST['txtNumArray[]']; which didn't work... and I've looked on the  
php manual, but they all assume you understand this stuff which I do  
not :)


Anyone know what I'm doing wrong? Or could at least point me to some  
text like "Array's for Dummies"? :)



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]





--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]




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



Re: [PHP] maintaining [user] state without a session ...

2008-03-05 Thread Zoltán Németh
2008. 03. 4, kedd keltezéssel 12.15-kor Daniel Brown ezt írta:
> but what else would I do?  Spend time with the
> pre-wife?

sure that's what you should :)

greets,
Zoltán Németh


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



[PHP] Array questions...

2008-03-05 Thread Jason Pruim
So for some reason, arrays always mess me up... I don't know what it  
is, but it just hasn't clicked yet... So I'm sure this is a simple  
question for someone who knows and understands arrays :)


So with that being said here's the code I'm using:

$self = $_SERVER['PHP_SELF'];
$i="0";
if (isset($_GET['txtNum'])) {
$numBox= $_GET['txtNum'];
$_SESSION['num'] = $_GET['txtNum'];
}else{
$numBox = $_SESSION['num'];
}
echo "store box variable". $_SESSION['num'];
echo <<
How many boxes? 


HTML;

$NumArray= Array($_POST['txtNumArray[]']);

echo <<	Weight of 100 pieces: name="txtPieceWeight">
	Route #Pieces in routeth>Weight of route


TABLE;
echo "";
while($i < $numBox){
echo <<

		value="txtNumArray[$i]">



		value="txtPiecesArray[$i]">



		value="txtWeightArray[$i]">



HTML;
$i++;

}   
echo "";


What I'm attempting to do, is grab the info out of txtNumArray[] and  
put it into the variable $numArray Sounds easy enough right? Well I've  
tried using $NumArray = Array($_POST['txtNumArray[]'); but that's not  
working... I've tried $NumArray = $_POST['txtNumArray[]']; which  
didn't work... and I've looked on the php manual, but they all assume  
you understand this stuff which I do not :)


Anyone know what I'm doing wrong? Or could at least point me to some  
text like "Array's for Dummies"? :)



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]





Re: [PHP] regular expressions question

2008-03-05 Thread Robert Cummings

On Wed, 2008-03-05 at 07:13 -0800, It Maq wrote:
> Hi,
> 
> I am using that right now and i have don't know how to include blank fields. 
> For example if a user does not fill a field in a form i want to accept it. I 
> tried the code you posted, for now it is blocking blank fields.
> 
> Thank you
> 
> - Original Message 
> From: Richard Lynch <[EMAIL PROTECTED]>
> To: Adil Drissi <[EMAIL PROTECTED]>
> Cc: php-general@lists.php.net
> Sent: Tuesday, March 4, 2008 3:09:09 PM
> Subject: Re: [PHP] regular expressions question
> 
> On Tue, March 4, 2008 1:19 pm, Adil Drissi wrote:
> > Is there any way to limit the user to a set of characters for example
> > say i want my user to enter any character between a and z (case
> > insensitive). And if the user enters just one letter not belonging to
> > [a-z], this will not be accepted.
> >
> > I tried  eregi('[a-z]', $fname) but this allows the user to enter
> > abdg4512kdkdk for example.
> 
> What you tried only requires ONE a-z character somewhere in the input.
> 
> Try this:
> 
> preg_match('^[a-z]+$', $fname);

preg_match('^[a-z]*$', $fname);

Someone else posted this also, but you may have missed it.

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


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



Re: [PHP] regular expressions question

2008-03-05 Thread It Maq
Hi,

I am using that right now and i have don't know how to include blank fields. 
For example if a user does not fill a field in a form i want to accept it. I 
tried the code you posted, for now it is blocking blank fields.

Thank you

- Original Message 
From: Richard Lynch <[EMAIL PROTECTED]>
To: Adil Drissi <[EMAIL PROTECTED]>
Cc: php-general@lists.php.net
Sent: Tuesday, March 4, 2008 3:09:09 PM
Subject: Re: [PHP] regular expressions question

On Tue, March 4, 2008 1:19 pm, Adil Drissi wrote:
> Is there any way to limit the user to a set of characters for example
> say i want my user to enter any character between a and z (case
> insensitive). And if the user enters just one letter not belonging to
> [a-z], this will not be accepted.
>
> I tried  eregi('[a-z]', $fname) but this allows the user to enter
> abdg4512kdkdk for example.

What you tried only requires ONE a-z character somewhere in the input.

Try this:

preg_match('^[a-z]+$', $fname);

This will:
^ "anchor" the string at the beginning
[a-z]+ a to z, with at least one letter
$ "anchor" the string at the end

Note, however, that some people have other characters in their first
name, such as apostrophe, space, and dash.

Oh, and the digit 3, for "bo3b" who was a programmer on the first
Apple Macintosh.  His parents were hippies, and that really is his
name...

You may want to obtain a LARGE list of "first names" and run them
through your validator as a test.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/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







  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

Re: [PHP] Re: Variable post as array

2008-03-05 Thread M. Sokolewicz

And you don't do:

$txtPhotoData = addslashes(fread(fopen($_FILES['txtPhoto']['tmp_name'], 
"r"), filesize($_FILES['txtPhoto']['tmp_name'])));


because ?

- Tul

P.S. if you want more readable code (PHP >= 4.3.0, which you should have 
anyway) use:

$txtPhotoData = file_get_contents($_FILES['txtPhoto']['tmp_name']);

Pieter du Toit wrote:

This is line 49

$txtPhotoData = addslashes(fread(fopen($txtPhoto, "r"), 
filesize($txtPhoto)));


the $txtPhoto is the parameter

""Angelo Zanetti"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

What is on line 49?

What variable are you passing as the parameter?



-Original Message-
From: Pieter du Toit [mailto:[EMAIL PROTECTED]
Sent: 05 March 2008 13:36
To: php-general@lists.php.net
Subject: [PHP] Re: Variable post as array

This is my problem

Warning: fopen() expects parameter 1 to be string, array given in
/usr/www/users/zululr/marketplace/myzululand/specials_proc.php on line 49

"Colin Guthrie" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

Pieter du Toit wrote:

Hi

I have this weird problem, when i select a file to upload, the variable
arrives as an array at the action php file, this is the code, and the
variable name is txtPhoto

I'd give a shorter example. People don't want to read through all your
code..

Also you shoudl post some sort of indication of what you are trying to
do to get the results you describe... just saying "the variable arrives
as an array" and we don't really know how you are accessing "the
variable".

A short example and expected/actual behaviour listing is good :)

Col




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








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



[PHP] Re: Variable post as array

2008-03-05 Thread Pieter du Toit
Thanks Colin this will help me, like i said im just trying to help its not 
my code and i dont work with photos like this, but i Do appreciate your 
patience with me.
"Colin Guthrie" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Pieter du Toit wrote:
>> That is the problem, i can see the name of the file with 
>> $txtPhoto['name']
>> but when i use the same with temp_name, i get nothing, one weird thing is
>> this [error] => 0 [size] => 17008  , what is that?
>>
>> this is the code that is giving the problem
>> $txtPhotoData = addslashes(fread(fopen($txtPhoto, "r"),
>> filesize($txtPhoto)));
>>
>> And this is the error
>>
>> Warning: fopen() expects parameter 1 to be string, array given in
>>> /usr/www/users/zululr/marketplace/myzululand/specials_proc.php on line 
>>> 49
>>
>> I did not do the code im just trying to help out, if never use this kind 
>> of
>> code to work with photos, i normally use move_uploaded_file and put the 
>> path
>> in the databse, but it look like this code puts the photo in the database 
>> as
>> binary or something.
>
> OK, I'll try and spell it out seeing as the link to the PHP Manual
> didn't take ;)
>
> The variable $txtPhoto exists because you have register global option set.
>
> It will be the same value as $_FILES['txtPhoto'].
>
> This variable *is an array*. It is not meant to contain just a filename.
>
> Your fopen() statement assumes that this variable *is a string* and this
> is fundamentally wrong.
>
> The PHP Manula page cannot be more clear about what the various elements
> in this array mean:
>
> http://uk.php.net/manual/en/features.file-upload.php
> (here their element is called 'userfile', yours is called 'txtPhoto'.
>
>
> $_FILES['userfile']['name']
>The original name of the file on the client machine.
>
> $_FILES['userfile']['type']
>The mime type of the file, if the browser provided this information.
> An example would be "image/gif". This mime type is however not checked
> on the PHP side and therefore don't take its value for granted.
>
> $_FILES['userfile']['size']
>The size, in bytes, of the uploaded file.
>
> $_FILES['userfile']['tmp_name']
>The temporary filename of the file in which the uploaded file was
> stored on the server.
>
> $_FILES['userfile']['error']
>The error code associated with this file upload. This element was
> added in PHP 4.2.0
>
>
>
> The ['name'] is the original name of the file the person uploaded. Your
> code tries to load the contents of the file into a variable. To do this,
> this simplest way is to do:
>
> $photoData = file_get_contents($_FILES['txtPhoto']['tmp_name']);
>
> Your code calls addslashes() on it but that's pretty braindead as it's
> binary data. If it's going into a database you'd be better formatting it
> using a database formatting function (e.g. mysql_real_escape_string) and
> not just relying on an ad-hoc method.
>
> HTHs
>
> Col
>
>
>
>
>
> 



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



[PHP] Re: Variable post as array

2008-03-05 Thread Colin Guthrie
Pieter du Toit wrote:
> That is the problem, i can see the name of the file with $txtPhoto['name'] 
> but when i use the same with temp_name, i get nothing, one weird thing is 
> this [error] => 0 [size] => 17008  , what is that?
> 
> this is the code that is giving the problem
> $txtPhotoData = addslashes(fread(fopen($txtPhoto, "r"), 
> filesize($txtPhoto)));
> 
> And this is the error
> 
> Warning: fopen() expects parameter 1 to be string, array given in
>> /usr/www/users/zululr/marketplace/myzululand/specials_proc.php on line 49
> 
> I did not do the code im just trying to help out, if never use this kind of 
> code to work with photos, i normally use move_uploaded_file and put the path 
> in the databse, but it look like this code puts the photo in the database as 
> binary or something.

OK, I'll try and spell it out seeing as the link to the PHP Manual
didn't take ;)

The variable $txtPhoto exists because you have register global option set.

It will be the same value as $_FILES['txtPhoto'].

This variable *is an array*. It is not meant to contain just a filename.

Your fopen() statement assumes that this variable *is a string* and this
is fundamentally wrong.

The PHP Manula page cannot be more clear about what the various elements
in this array mean:

http://uk.php.net/manual/en/features.file-upload.php
(here their element is called 'userfile', yours is called 'txtPhoto'.


$_FILES['userfile']['name']
The original name of the file on the client machine.

$_FILES['userfile']['type']
The mime type of the file, if the browser provided this information.
An example would be "image/gif". This mime type is however not checked
on the PHP side and therefore don't take its value for granted.

$_FILES['userfile']['size']
The size, in bytes, of the uploaded file.

$_FILES['userfile']['tmp_name']
The temporary filename of the file in which the uploaded file was
stored on the server.

$_FILES['userfile']['error']
The error code associated with this file upload. This element was
added in PHP 4.2.0



The ['name'] is the original name of the file the person uploaded. Your
code tries to load the contents of the file into a variable. To do this,
this simplest way is to do:

$photoData = file_get_contents($_FILES['txtPhoto']['tmp_name']);

Your code calls addslashes() on it but that's pretty braindead as it's
binary data. If it's going into a database you'd be better formatting it
using a database formatting function (e.g. mysql_real_escape_string) and
not just relying on an ad-hoc method.

HTHs

Col







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



[PHP] Re: Variable post as array

2008-03-05 Thread Pieter du Toit
That is the problem, i can see the name of the file with $txtPhoto['name'] 
but when i use the same with temp_name, i get nothing, one weird thing is 
this [error] => 0 [size] => 17008  , what is that?

this is the code that is giving the problem
$txtPhotoData = addslashes(fread(fopen($txtPhoto, "r"), 
filesize($txtPhoto)));

And this is the error

Warning: fopen() expects parameter 1 to be string, array given in
> /usr/www/users/zululr/marketplace/myzululand/specials_proc.php on line 49

I did not do the code im just trying to help out, if never use this kind of 
code to work with photos, i normally use move_uploaded_file and put the path 
in the databse, but it look like this code puts the photo in the database as 
binary or something.


"Colin Guthrie" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Pieter du Toit wrote:
>> I ran a print_r on it and this is the results
>>
>> Array ( [txtPhoto] => Array ( [name] => g1.jpg [type] => image/pjpeg
>> [tmp_name] => /tmp/php3qkA4A [error] => 0 [size] => 17008 ) )
>>
>> The image received here must be inserted into a database as binary it 
>> looks
>> like it.
>
> "on it" is very vague dude. Be more specific... show code!!!
>
> From later posts it appears you are using register_globals to access the
> file as if it is a local variable.
>
> $txtPhotoData = addslashes(fread(fopen($txtPhoto, "r"),
> filesize($txtPhoto)));
>
> For file upload elements $txtPhoto will be an array. use
> $txtPhoto['tmp_name'] or something. It's all in the manual.
>
> PS just avoid register globals anyway, it's evil.
>
> Col
> 



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



[PHP] Re: Variable post as array

2008-03-05 Thread Colin Guthrie
Pieter du Toit wrote:
> This is my problem
> 
> Warning: fopen() expects parameter 1 to be string, array given in 
> /usr/www/users/zululr/marketplace/myzululand/specials_proc.php on line 49

Dude, just as a general observation, when you are asking for help, don't
just describe what you do, post the code. But don't post full files,
just post what's absolutely needed.

In this case you don't understand how file uploads work. Just read the
PHP manual and you'll see what needs to be done.

http://uk.php.net/manual/en/features.file-upload.php

Col


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



[PHP] Re: Variable post as array

2008-03-05 Thread Colin Guthrie
Pieter du Toit wrote:
> I ran a print_r on it and this is the results
> 
> Array ( [txtPhoto] => Array ( [name] => g1.jpg [type] => image/pjpeg 
> [tmp_name] => /tmp/php3qkA4A [error] => 0 [size] => 17008 ) )
> 
> The image received here must be inserted into a database as binary it looks 
> like it.

"on it" is very vague dude. Be more specific... show code!!!

>From later posts it appears you are using register_globals to access the
file as if it is a local variable.

$txtPhotoData = addslashes(fread(fopen($txtPhoto, "r"),
filesize($txtPhoto)));

For file upload elements $txtPhoto will be an array. use
$txtPhoto['tmp_name'] or something. It's all in the manual.

PS just avoid register globals anyway, it's evil.

Col


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



RE: [PHP] Re: Variable post as array

2008-03-05 Thread Angelo Zanetti
Well check what the value is. I think you must do more testing yourself
instead of just posting here because then you will not learn and also if you
trouble shoot it yourself it will allow you to fix errors in the future.



-Original Message-
From: Pieter du Toit [mailto:[EMAIL PROTECTED] 
Sent: 05 March 2008 13:43
To: php-general@lists.php.net
Subject: Re: [PHP] Re: Variable post as array

This is line 49

$txtPhotoData = addslashes(fread(fopen($txtPhoto, "r"), 
filesize($txtPhoto)));

the $txtPhoto is the parameter

""Angelo Zanetti"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> What is on line 49?
>
> What variable are you passing as the parameter?
>
>
>
> -Original Message-
> From: Pieter du Toit [mailto:[EMAIL PROTECTED]
> Sent: 05 March 2008 13:36
> To: php-general@lists.php.net
> Subject: [PHP] Re: Variable post as array
>
> This is my problem
>
> Warning: fopen() expects parameter 1 to be string, array given in
> /usr/www/users/zululr/marketplace/myzululand/specials_proc.php on line 49
>
> "Colin Guthrie" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> Pieter du Toit wrote:
>>> Hi
>>>
>>> I have this weird problem, when i select a file to upload, the variable
>>> arrives as an array at the action php file, this is the code, and the
>>> variable name is txtPhoto
>>
>> I'd give a shorter example. People don't want to read through all your
>> code..
>>
>> Also you shoudl post some sort of indication of what you are trying to
>> do to get the results you describe... just saying "the variable arrives
>> as an array" and we don't really know how you are accessing "the
>> variable".
>>
>> A short example and expected/actual behaviour listing is good :)
>>
>> Col
>>
>
>
>
> -- 
> 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] Re: Variable post as array

2008-03-05 Thread Pieter du Toit
This is line 49

$txtPhotoData = addslashes(fread(fopen($txtPhoto, "r"), 
filesize($txtPhoto)));

the $txtPhoto is the parameter

""Angelo Zanetti"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> What is on line 49?
>
> What variable are you passing as the parameter?
>
>
>
> -Original Message-
> From: Pieter du Toit [mailto:[EMAIL PROTECTED]
> Sent: 05 March 2008 13:36
> To: php-general@lists.php.net
> Subject: [PHP] Re: Variable post as array
>
> This is my problem
>
> Warning: fopen() expects parameter 1 to be string, array given in
> /usr/www/users/zululr/marketplace/myzululand/specials_proc.php on line 49
>
> "Colin Guthrie" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> Pieter du Toit wrote:
>>> Hi
>>>
>>> I have this weird problem, when i select a file to upload, the variable
>>> arrives as an array at the action php file, this is the code, and the
>>> variable name is txtPhoto
>>
>> I'd give a shorter example. People don't want to read through all your
>> code..
>>
>> Also you shoudl post some sort of indication of what you are trying to
>> do to get the results you describe... just saying "the variable arrives
>> as an array" and we don't really know how you are accessing "the
>> variable".
>>
>> A short example and expected/actual behaviour listing is good :)
>>
>> Col
>>
>
>
>
> -- 
> 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] Re: Variable post as array

2008-03-05 Thread Angelo Zanetti
What is on line 49?

What variable are you passing as the parameter?



-Original Message-
From: Pieter du Toit [mailto:[EMAIL PROTECTED] 
Sent: 05 March 2008 13:36
To: php-general@lists.php.net
Subject: [PHP] Re: Variable post as array

This is my problem

Warning: fopen() expects parameter 1 to be string, array given in 
/usr/www/users/zululr/marketplace/myzululand/specials_proc.php on line 49

"Colin Guthrie" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Pieter du Toit wrote:
>> Hi
>>
>> I have this weird problem, when i select a file to upload, the variable
>> arrives as an array at the action php file, this is the code, and the
>> variable name is txtPhoto
>
> I'd give a shorter example. People don't want to read through all your
> code..
>
> Also you shoudl post some sort of indication of what you are trying to
> do to get the results you describe... just saying "the variable arrives
> as an array" and we don't really know how you are accessing "the 
> variable".
>
> A short example and expected/actual behaviour listing is good :)
>
> Col
> 



-- 
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] Re: Variable post as array

2008-03-05 Thread Pieter du Toit
This is my problem

Warning: fopen() expects parameter 1 to be string, array given in 
/usr/www/users/zululr/marketplace/myzululand/specials_proc.php on line 49

""Angelo Zanetti"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Have you tried print_r($_FILES); to see all the values in the variable?
>
> Its difficult to see whats going on as you posted your whole file.
>
>
>
> -Original Message-
> From: Pieter du Toit [mailto:[EMAIL PROTECTED]
> Sent: 05 March 2008 12:38
> To: php-general@lists.php.net
> Subject: [PHP] Re: Variable post as array
>
> Just to add, if i try to echo the $_FILES['txtPhoto']['temp_name'] it 
> tells
> me that temp_name is also an array, but when i echo
> $_FILES['txtPhoto']['name'] it gives me the correct name. Also with a
> vardump i can see that temp name is ["tmp_name"]=> string(14)
> "/tmp/phplR1WSl" and not an array by itself.
>
> Im going crazy here
>
> ""Pieter du Toit"" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> Hi
>>
>> I have this weird problem, when i select a file to upload, the variable
>> arrives as an array at the action php file, this is the code, and the
>> variable name is txtPhoto
>>
>> 
>>
>> 
>>
>> 
>>
>> Specials Update
>>
>> 
>>
>> 
>>
>> >
>> echo "> Special\" action=\"specials_proc.php\">\n";
>>
>> echo "> value=\"$g_client_id\">";
>>
>> echo "";
>>
>> echo "> value=\"$k_subsystem_id\">";
>>
>> echo "> cellspacing=\"0\" cellpadding=\"0\" width=\"80%\">\n";
>>
>>
>>
>> if ($special != "")
>>
>> {
>>
>> $new = 0;
>>
>> echo "Edit
>> Special\n";
>>
>> $result = mysql("zululandcoza", "select * from client_specials where
>> client_id = $g_client_id and special = $special");
>>
>> if (list($client_id, $special, $description, $special_type, $price,
>> $discount, $startdate, $enddate) = mysql_fetch_row($result))
>>
>> {
>>
>> }
>>
>> }
>>
>> else
>>
>> {
>>
>> $new = 1;
>>
>> echo "New Special (this page 
>> is
>
>> undergoing maintenance, please try again later)\n";
>>
>> $result = mysql("zululandcoza", "select max(special) from client_specials
>> where client_id = $client_id");
>>
>> if (list($max_special) = mysql_fetch_row($result))
>>
>> {
>>
>> $special = $max_special + 1;
>>
>> }
>>
>> }
>>
>>
>>
>> echo "\n";
>>
>> echo " Special Number\n";
>>
>> if ($new)
>>
>> echo " > name=\"txtSpecial\" maxlength=\"5\" size=\"5\"
>> value=\"$special\">\n";
>>
>> else
>>
>> echo " > name=\"txtSpecial\" maxlength=\"5\" size=\"5\" value=\"$special\"
>> enabled=\"0\">\n";
>>
>> echo "\n";
>>
>> echo "\n";
>>
>> echo " Description\n";
>>
>> echo " > name=\"txtDescription\" maxlength=\"200\" size=\"50\"
>> value=\"$description\">\n";
>>
>> echo "\n";
>>
>> echo "\n";
>>
>> echo " Special Type\n";
>>
>> echo " \n";
>>
>> $optPRICE = "";
>>
>> $optDISC = "";
>>
>> $optFROM = "";
>>
>> if ($special_type == "FROM")
>>
>> $optFROM = " SELECTED";
>>
>> elseif ($special_type == "DISC")
>>
>> $optDISC = " SELECTED";
>>
>> else
>>
>> $optPRICE = " SELECTED";
>>
>> echo " \n";
>>
>> echo " Special Price\n";
>>
>> echo " Discount %\n";
>>
>> echo " From\n";
>>
>> echo " \n";
>>
>> echo " \n";
>>
>> echo "\n";
>>
>> echo "\n";
>>
>> echo " Price\n";
>>
>> echo " > name=\"txtPrice\" maxlength=\"20\" size=\"10\"
>> value=\"$price\">\n";
>>
>> echo "\n";
>>
>> if ($k_subsystem_id == 2)
>>
>> {
>>
>> if (! $new)
>>
>> {
>>
>> echo "\n";
>>
>> echo " Current Photo\n";
>>
>> echo " >
> src=\"showpic.php?keySystem_Id=2&keyClient_Id=$g_client_id&keySpecial=$speci
> al\">\n";
>>
>> echo "\n";
>>
>> }
>>
>> echo "\n";
>>
>> echo " New Photo\n";
>>
>> echo " > name=\"txtPhoto\" size=\"50\">\n";
>>
>> echo "\n";
>>
>> }
>>
>> echo "\n";
>>
>> echo " \n";
>>
>> if ($new)
>>
>> {
>>
>> echo "  \n";
>>
>> }
>>
>> else
>>
>> {
>>
>> echo " > value=\"Update\"> \n";
>>
>> echo " > value=\"Delete\"> \n";
>>
>> }
>>
>> echo " \n";
>>
>> echo " \n";
>>
>> echo "\n";
>>
>> echo "\n";
>>
>> echo "\n";
>>
>> ?>
>>
>>
>>
>> 
>>
>> 
>>
>>
>>
>>
>>
>>
>
>
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> 



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



[PHP] Re: Variable post as array

2008-03-05 Thread Pieter du Toit
This is my problem

Warning: fopen() expects parameter 1 to be string, array given in 
/usr/www/users/zululr/marketplace/myzululand/specials_proc.php on line 49

"Colin Guthrie" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Pieter du Toit wrote:
>> Hi
>>
>> I have this weird problem, when i select a file to upload, the variable
>> arrives as an array at the action php file, this is the code, and the
>> variable name is txtPhoto
>
> I'd give a shorter example. People don't want to read through all your
> code..
>
> Also you shoudl post some sort of indication of what you are trying to
> do to get the results you describe... just saying "the variable arrives
> as an array" and we don't really know how you are accessing "the 
> variable".
>
> A short example and expected/actual behaviour listing is good :)
>
> Col
> 



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



[PHP] Re: Variable post as array

2008-03-05 Thread Pieter du Toit
I ran a print_r on it and this is the results

Array ( [txtPhoto] => Array ( [name] => g1.jpg [type] => image/pjpeg 
[tmp_name] => /tmp/php3qkA4A [error] => 0 [size] => 17008 ) )

The image received here must be inserted into a database as binary it looks 
like it.
"Colin Guthrie" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Pieter du Toit wrote:
>> Hi
>>
>> I have this weird problem, when i select a file to upload, the variable
>> arrives as an array at the action php file, this is the code, and the
>> variable name is txtPhoto
>
> I'd give a shorter example. People don't want to read through all your
> code..
>
> Also you shoudl post some sort of indication of what you are trying to
> do to get the results you describe... just saying "the variable arrives
> as an array" and we don't really know how you are accessing "the 
> variable".
>
> A short example and expected/actual behaviour listing is good :)
>
> Col
> 



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



Re: [PHP] Re: Variable post as array

2008-03-05 Thread Pieter du Toit
I ran it, and here is the output

Array ( [txtPhoto] => Array ( [name] => g1.jpg [type] => image/pjpeg 
[tmp_name] => /tmp/php3qkA4A [error] => 0 [size] => 17008 ) )

""Angelo Zanetti"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Have you tried print_r($_FILES); to see all the values in the variable?
>
> Its difficult to see whats going on as you posted your whole file.
>
>
>
> -Original Message-
> From: Pieter du Toit [mailto:[EMAIL PROTECTED]
> Sent: 05 March 2008 12:38
> To: php-general@lists.php.net
> Subject: [PHP] Re: Variable post as array
>
> Just to add, if i try to echo the $_FILES['txtPhoto']['temp_name'] it 
> tells
> me that temp_name is also an array, but when i echo
> $_FILES['txtPhoto']['name'] it gives me the correct name. Also with a
> vardump i can see that temp name is ["tmp_name"]=> string(14)
> "/tmp/phplR1WSl" and not an array by itself.
>
> Im going crazy here
>
> ""Pieter du Toit"" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> Hi
>>
>> I have this weird problem, when i select a file to upload, the variable
>> arrives as an array at the action php file, this is the code, and the
>> variable name is txtPhoto
>>
>> 
>>
>> 
>>
>> 
>>
>> Specials Update
>>
>> 
>>
>> 
>>
>> >
>> echo "> Special\" action=\"specials_proc.php\">\n";
>>
>> echo "> value=\"$g_client_id\">";
>>
>> echo "";
>>
>> echo "> value=\"$k_subsystem_id\">";
>>
>> echo "> cellspacing=\"0\" cellpadding=\"0\" width=\"80%\">\n";
>>
>>
>>
>> if ($special != "")
>>
>> {
>>
>> $new = 0;
>>
>> echo "Edit
>> Special\n";
>>
>> $result = mysql("zululandcoza", "select * from client_specials where
>> client_id = $g_client_id and special = $special");
>>
>> if (list($client_id, $special, $description, $special_type, $price,
>> $discount, $startdate, $enddate) = mysql_fetch_row($result))
>>
>> {
>>
>> }
>>
>> }
>>
>> else
>>
>> {
>>
>> $new = 1;
>>
>> echo "New Special (this page 
>> is
>
>> undergoing maintenance, please try again later)\n";
>>
>> $result = mysql("zululandcoza", "select max(special) from client_specials
>> where client_id = $client_id");
>>
>> if (list($max_special) = mysql_fetch_row($result))
>>
>> {
>>
>> $special = $max_special + 1;
>>
>> }
>>
>> }
>>
>>
>>
>> echo "\n";
>>
>> echo " Special Number\n";
>>
>> if ($new)
>>
>> echo " > name=\"txtSpecial\" maxlength=\"5\" size=\"5\"
>> value=\"$special\">\n";
>>
>> else
>>
>> echo " > name=\"txtSpecial\" maxlength=\"5\" size=\"5\" value=\"$special\"
>> enabled=\"0\">\n";
>>
>> echo "\n";
>>
>> echo "\n";
>>
>> echo " Description\n";
>>
>> echo " > name=\"txtDescription\" maxlength=\"200\" size=\"50\"
>> value=\"$description\">\n";
>>
>> echo "\n";
>>
>> echo "\n";
>>
>> echo " Special Type\n";
>>
>> echo " \n";
>>
>> $optPRICE = "";
>>
>> $optDISC = "";
>>
>> $optFROM = "";
>>
>> if ($special_type == "FROM")
>>
>> $optFROM = " SELECTED";
>>
>> elseif ($special_type == "DISC")
>>
>> $optDISC = " SELECTED";
>>
>> else
>>
>> $optPRICE = " SELECTED";
>>
>> echo " \n";
>>
>> echo " Special Price\n";
>>
>> echo " Discount %\n";
>>
>> echo " From\n";
>>
>> echo " \n";
>>
>> echo " \n";
>>
>> echo "\n";
>>
>> echo "\n";
>>
>> echo " Price\n";
>>
>> echo " > name=\"txtPrice\" maxlength=\"20\" size=\"10\"
>> value=\"$price\">\n";
>>
>> echo "\n";
>>
>> if ($k_subsystem_id == 2)
>>
>> {
>>
>> if (! $new)
>>
>> {
>>
>> echo "\n";
>>
>> echo " Current Photo\n";
>>
>> echo " >
> src=\"showpic.php?keySystem_Id=2&keyClient_Id=$g_client_id&keySpecial=$speci
> al\">\n";
>>
>> echo "\n";
>>
>> }
>>
>> echo "\n";
>>
>> echo " New Photo\n";
>>
>> echo " > name=\"txtPhoto\" size=\"50\">\n";
>>
>> echo "\n";
>>
>> }
>>
>> echo "\n";
>>
>> echo " \n";
>>
>> if ($new)
>>
>> {
>>
>> echo "  \n";
>>
>> }
>>
>> else
>>
>> {
>>
>> echo " > value=\"Update\"> \n";
>>
>> echo " > value=\"Delete\"> \n";
>>
>> }
>>
>> echo " \n";
>>
>> echo " \n";
>>
>> echo "\n";
>>
>> echo "\n";
>>
>> echo "\n";
>>
>> ?>
>>
>>
>>
>> 
>>
>> 
>>
>>
>>
>>
>>
>>
>
>
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> 



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



[PHP] Re: Variable post as array

2008-03-05 Thread Colin Guthrie
Pieter du Toit wrote:
> Hi
> 
> I have this weird problem, when i select a file to upload, the variable 
> arrives as an array at the action php file, this is the code, and the 
> variable name is txtPhoto

I'd give a shorter example. People don't want to read through all your
code..

Also you shoudl post some sort of indication of what you are trying to
do to get the results you describe... just saying "the variable arrives
as an array" and we don't really know how you are accessing "the variable".

A short example and expected/actual behaviour listing is good :)

Col


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



RE: [PHP] Re: Variable post as array

2008-03-05 Thread Angelo Zanetti
Have you tried print_r($_FILES); to see all the values in the variable?

Its difficult to see whats going on as you posted your whole file.



-Original Message-
From: Pieter du Toit [mailto:[EMAIL PROTECTED] 
Sent: 05 March 2008 12:38
To: php-general@lists.php.net
Subject: [PHP] Re: Variable post as array

Just to add, if i try to echo the $_FILES['txtPhoto']['temp_name'] it tells 
me that temp_name is also an array, but when i echo 
$_FILES['txtPhoto']['name'] it gives me the correct name. Also with a 
vardump i can see that temp name is ["tmp_name"]=> string(14) 
"/tmp/phplR1WSl" and not an array by itself.

Im going crazy here

""Pieter du Toit"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi
>
> I have this weird problem, when i select a file to upload, the variable 
> arrives as an array at the action php file, this is the code, and the 
> variable name is txtPhoto
>
> 
>
> 
>
> 
>
> Specials Update
>
> 
>
> 
>
> 
> echo " Special\" action=\"specials_proc.php\">\n";
>
> echo " value=\"$g_client_id\">";
>
> echo "";
>
> echo " value=\"$k_subsystem_id\">";
>
> echo " cellspacing=\"0\" cellpadding=\"0\" width=\"80%\">\n";
>
>
>
> if ($special != "")
>
> {
>
> $new = 0;
>
> echo "Edit 
> Special\n";
>
> $result = mysql("zululandcoza", "select * from client_specials where 
> client_id = $g_client_id and special = $special");
>
> if (list($client_id, $special, $description, $special_type, $price, 
> $discount, $startdate, $enddate) = mysql_fetch_row($result))
>
> {
>
> }
>
> }
>
> else
>
> {
>
> $new = 1;
>
> echo "New Special (this page is

> undergoing maintenance, please try again later)\n";
>
> $result = mysql("zululandcoza", "select max(special) from client_specials 
> where client_id = $client_id");
>
> if (list($max_special) = mysql_fetch_row($result))
>
> {
>
> $special = $max_special + 1;
>
> }
>
> }
>
>
>
> echo "\n";
>
> echo " Special Number\n";
>
> if ($new)
>
> echo "  name=\"txtSpecial\" maxlength=\"5\" size=\"5\" 
> value=\"$special\">\n";
>
> else
>
> echo "  name=\"txtSpecial\" maxlength=\"5\" size=\"5\" value=\"$special\" 
> enabled=\"0\">\n";
>
> echo "\n";
>
> echo "\n";
>
> echo " Description\n";
>
> echo "  name=\"txtDescription\" maxlength=\"200\" size=\"50\" 
> value=\"$description\">\n";
>
> echo "\n";
>
> echo "\n";
>
> echo " Special Type\n";
>
> echo " \n";
>
> $optPRICE = "";
>
> $optDISC = "";
>
> $optFROM = "";
>
> if ($special_type == "FROM")
>
> $optFROM = " SELECTED";
>
> elseif ($special_type == "DISC")
>
> $optDISC = " SELECTED";
>
> else
>
> $optPRICE = " SELECTED";
>
> echo " \n";
>
> echo " Special Price\n";
>
> echo " Discount %\n";
>
> echo " From\n";
>
> echo " \n";
>
> echo " \n";
>
> echo "\n";
>
> echo "\n";
>
> echo " Price\n";
>
> echo "  name=\"txtPrice\" maxlength=\"20\" size=\"10\" 
> value=\"$price\">\n";
>
> echo "\n";
>
> if ($k_subsystem_id == 2)
>
> {
>
> if (! $new)
>
> {
>
> echo "\n";
>
> echo " Current Photo\n";
>
> echo " 
src=\"showpic.php?keySystem_Id=2&keyClient_Id=$g_client_id&keySpecial=$speci
al\">\n";
>
> echo "\n";
>
> }
>
> echo "\n";
>
> echo " New Photo\n";
>
> echo "  name=\"txtPhoto\" size=\"50\">\n";
>
> echo "\n";
>
> }
>
> echo "\n";
>
> echo " \n";
>
> if ($new)
>
> {
>
> echo "  \n";
>
> }
>
> else
>
> {
>
> echo "  value=\"Update\"> \n";
>
> echo "  value=\"Delete\"> \n";
>
> }
>
> echo " \n";
>
> echo " \n";
>
> echo "\n";
>
> echo "\n";
>
> echo "\n";
>
> ?>
>
>
>
> 
>
> 
>
>
>
>
>
> 



-- 
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] Logging session timeout in DB

2008-03-05 Thread Angelo Zanetti


Hi all, 

I am implementing a system where when a user is logged in and out that a
date time is set in a database for each action for each used. We can then
trace who logged in a and when.

No what I would like to know is how can I record when a user closes the
browser or the session expires? There is no action for these items. So what
would the best way be to keep a record of this? Would the use of a cron job
be appropriate? I read in the archives that the banks use javascript but I
don't want to go that route.

If anyone has any idea how to do this please let me know, thanks in advance.



Elemental 
Telephone: +27 (021) 552 9799 
Mobile:   +27 (0) 72 441 3355 
Fax:+27 (0) 86 681 5885

Web: http://www.elemental.co.za 
E-Mail: [EMAIL PROTECTED] 



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