php-general Digest 12 Oct 2008 16:12:09 -0000 Issue 5731

Topics (messages 281738 through 281751):

Dear friend
        281738 by: John Jairo Vega Angulo

Re: Variable Variables and Super Global Arrays
        281739 by: Richard Heyes
        281750 by: Micah Gersten
        281751 by: Richard Heyes

template usage
        281740 by: Alain Roger
        281743 by: Ashley Sheridan
        281744 by: Alain Roger
        281745 by: Ashley Sheridan

Re: Remove index.php from url
        281741 by: Ashley Sheridan

Re: trouble uploading more than 500 bytes...
        281742 by: Ashley Sheridan
        281746 by: Karl St-Jacques
        281747 by: Ashley Sheridan
        281749 by: Daniel Brown

Re: Setcookie()
        281748 by: Bastien Koert

Administrivia:

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

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

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
   *       HOME <http://www.21st-trader.com/index.asp>

     ABOUT US <http://www.21st-trader.com/about.asp?action=about>

     PRODUCT <http://www.21st-trader.com/fenleiview.asp?lx=news>

     PAYMENT <http://www.21st-trader.com/about.asp?action=jtcg>


 EXCHANGE RATE <http://www.21st-trader.com/exrate.asp>

     MESSAGE BOARD <http://www.21st-trader.com/bjxbook.asp>

     CONTACT US <http://www.21st-trader.com/about.asp?action=lxwm>
* Dear friend:

*We are an electronic products wholesale .Our products are of high quality
and low price. If you want to do business , we can offer you the most
reasonable discount to make you get more profits. We are expecting for your
business*.

             Please visit our website:      http://www.21st-trader.com/

E-mail/MSN  : [EMAIL PROTECTED]

  [image: view big
picture]<http://www.21st-trader.com/bjxGpic/2006101121194156471.jpg><[EMAIL 
PROTECTED]>

*Looking forward to your contact and long cooperation with us! *

*  Our mainly products such the phones, PSP, display TV, notebook, video,
computers, Mp4, GPS, xbox 360, digital cameras and so on.*

*  Welcome to visit our website!*

--- End Message ---
--- Begin Message ---
> $varname = "\$_SERVER['REMOTE_ADDR']";
> $varvalue = $$varname;

That's wrong. Offhand you'll end up printing a string. I tried this:

<?php
    $a   = 365;
    $b   = 366;

    $var = $_GET['var'];

    echo $$var;
?>

And it was fine.

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org

--- End Message ---
--- Begin Message ---
That's fine as a test, but you never want to get a variable name from a
URL in practice.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Richard Heyes wrote:
>> $varname = "\$_SERVER['REMOTE_ADDR']";
>> $varvalue = $$varname;
>>     
>
> That's wrong. Offhand you'll end up printing a string. I tried this:
>
> <?php
>     $a   = 365;
>     $b   = 366;
>
>     $var = $_GET['var'];
>
>     echo $$var;
> ?>
>
> And it was fine.
>
>   

--- End Message ---
--- Begin Message ---
> That's fine as a test, but you never want to get a variable name from a
> URL in practice.

Of course you can, as long as it's sanitized and checked.

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org

--- End Message ---
--- Begin Message ---
Hi,

i would like to know if you are a lot to use PHP templates for your web
application or web sites ?
if yes, which one do you use (smarty, pear, yapter, phplib,...) ?
and for which reason ? what is/are the advantages over the others ?

thanks a lot,

-- 
Alain
------------------------------------
Windows XP SP3
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008

--- End Message ---
--- Begin Message ---
On Sun, 2008-10-12 at 11:09 +0200, Alain Roger wrote:
> Hi,
> 
> i would like to know if you are a lot to use PHP templates for your web
> application or web sites ?
> if yes, which one do you use (smarty, pear, yapter, phplib,...) ?
> and for which reason ? what is/are the advantages over the others ?
> 
> thanks a lot,
> 
I wouldn't really call them templates, they're more libraries, and they
all have their individual uses. Generally, your use of them will depend
on what you actually want.

Can you explain a few details of what you are actually looking to do?


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
I'm just reading a book on PHP and they promote quite heavily smarty as
template designer tool for presenting information and data to users.

they absolutly do not talk about pear and i'm a little surprised. That's why
i'm wondering who use what and for which reason.

Basically let's say for data/information presentation to end user...what is
the best lib (pear, smarty....) ?

On Sun, Oct 12, 2008 at 11:32 AM, Ashley Sheridan
<[EMAIL PROTECTED]>wrote:

> On Sun, 2008-10-12 at 11:09 +0200, Alain Roger wrote:
> > Hi,
> >
> > i would like to know if you are a lot to use PHP templates for your web
> > application or web sites ?
> > if yes, which one do you use (smarty, pear, yapter, phplib,...) ?
> > and for which reason ? what is/are the advantages over the others ?
> >
> > thanks a lot,
> >
> I wouldn't really call them templates, they're more libraries, and they
> all have their individual uses. Generally, your use of them will depend
> on what you actually want.
>
> Can you explain a few details of what you are actually looking to do?
>
>
> Ash
> www.ashleysheridan.co.uk
>
>


-- 
Alain
------------------------------------
Windows XP SP3
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008

--- End Message ---
--- Begin Message ---
On Sun, 2008-10-12 at 11:33 +0200, Alain Roger wrote:
> I'm just reading a book on PHP and they promote quite heavily smarty as
> template designer tool for presenting information and data to users.
> 
> they absolutly do not talk about pear and i'm a little surprised. That's why
> i'm wondering who use what and for which reason.
> 
> Basically let's say for data/information presentation to end user...what is
> the best lib (pear, smarty....) ?
> 
> On Sun, Oct 12, 2008 at 11:32 AM, Ashley Sheridan
> <[EMAIL PROTECTED]>wrote:
> 
> > On Sun, 2008-10-12 at 11:09 +0200, Alain Roger wrote:
> > > Hi,
> > >
> > > i would like to know if you are a lot to use PHP templates for your web
> > > application or web sites ?
> > > if yes, which one do you use (smarty, pear, yapter, phplib,...) ?
> > > and for which reason ? what is/are the advantages over the others ?
> > >
> > > thanks a lot,
> > >
> > I wouldn't really call them templates, they're more libraries, and they
> > all have their individual uses. Generally, your use of them will depend
> > on what you actually want.
> >
> > Can you explain a few details of what you are actually looking to do?
> >
> >
> > Ash
> > www.ashleysheridan.co.uk
> >
> >
> 
> 
I'm not sure comparing Pear and Smarty is really how to go about it.
It's a bit like comparing a apples and oranges. Smarty is indeed a
template/presentation framework, but Pear is more a library of
components (as is phplib) which offers some presentation components, but
isn't solely designed towards that purpose. Personally, if I were you,
I'd go with Smarty for the time being, as it has been designed as a
template engine, so it should be easier to get to grips with.


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
On Sat, 2008-10-11 at 18:56 +0100, Richard Heyes wrote:

> > mod_rewite if you use Apache.
> 
> Or, if you don't have it (not very likely), directories. Eg For the
> URL you gave, make a dir called company and put a default document in
> there (usually index.html). You will end up with a trailing slash on
> the URL, and it does incur a redirect, but it works. This might even
> work with IIS, so it would be cross-server compatible.
> 
> -- 
> Richard Heyes
> 
> HTML5 Graphing for FF, Chrome, Opera and Safari:
> http://www.rgraph.org
> 

Thanks everyone, I'll look into these in a bit more depth when I get
back into work tomorrow.


Ash
www.ashleysheridan.co.uk

--- End Message ---
--- Begin Message ---
On Sat, 2008-10-11 at 22:31 -0400, Karl St-Jacques wrote:
> Hello, 
>  
> I have trouble uploading files to a server. Actually I can't upload more than 
> 500 bytes or so.
>  
> Here's a quick print_r of the $_FILES 
>  
> [_FILES] => Array(  [avatar] => Array  (    [name] => index.html    [type] => 
> text/html    [tmp_name] => /tmp/phpRbmXK5    [error] => 0    [size] => 505  ))
> If I try bigger file (540 bytes or 2mb) it's simply return this. 
>  
> [_FILES] => Array([avatar] => Array(  [name] => ajax-loader.gif  [type] =>   
> [tmp_name] =>   [error] => 3  [size] => 0)
> )
>  
> error 3 is partial files sended. (By the way, there's no processing, only a 
> print_r();
>  
> So here's my setup from the php.ini
>  
> PHP Version 5.2.4-2ubuntu5.3
>  
> max_execution_time 1000 1000 
> max_input_nesting_level 64 64 
> max_input_time 1000 1000 
> memory_limit 999M 999M
> post_max_size 200M 200M
> upload_max_filesize 200M 200M
> upload_tmp_dir no value no value
> 
> 
> I run Apache/2.2.8
>  
> I checked the /tmp folder. it's empty, even if uploading really big file, 
> same for /var/tmp. the permission seems to be ok (chmod 777).
>  
> So, I'm pretty clueless about that one.
> Anyone have any insight about this ? 
>  
> Thanks, 
> Karl.
>  
> _________________________________________________________________
> 
Bit of a silly question, but it's bit me in the ass before. Are you sure
you're editing the right php.ini file? I was working on a server at work
where someone had left 3 php.ini files, all in places that looked like
they were meant to be, and the only way to find the real one was through
a phpinfo() check. Also, have you restarted the web server (Apache or
IIS) since making the changes?


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
> > Hello, > > > > I have trouble uploading files to a server. Actually I can't 
> > upload more than 500 bytes or so.> > > > Here's a quick print_r of the 
> > $_FILES > > > > [_FILES] => Array( [avatar] => Array ( [name] => index.html 
> > [type] => text/html [tmp_name] => /tmp/phpRbmXK5 [error] => 0 [size] => 505 
> > ))> > If I try bigger file (540 bytes or 2mb) it's simply return this. > > 
> > > > [_FILES] => Array([avatar] => Array( [name] => ajax-loader.gif [type] 
> > => [tmp_name] => [error] => 3 [size] => 0)> > )> > > > error 3 is partial 
> > files sended. (By the way, there's no processing, only a print_r();> > > > 
> > So here's my setup from the php.ini> > > > PHP Version 5.2.4-2ubuntu5.3> > 
> > > > max_execution_time 1000 1000 > > max_input_nesting_level 64 64 > > 
> > max_input_time 1000 1000 > > memory_limit 999M 999M> > post_max_size 200M 
> > 200M> > upload_max_filesize 200M 200M> > upload_tmp_dir no value no value> 
> > > > > > > I run Apache/2.2.8> > > > I checked the /tmp folder. it's empty, 
> > even if uploading really big file, same for /var/tmp. the permission seems 
> > to be ok (chmod 777).> > > > So, I'm pretty clueless about that one.> > 
> > Anyone have any insight about this ? > > > > Thanks, > > Karl.> > > > 
> > _________________________________________________________________> > > Bit 
> > of a silly question, but it's bit me in the ass before. Are you sure> 
> > you're editing the right php.ini file? I was working on a server at work> 
> > where someone had left 3 php.ini files, all in places that looked like> 
> > they were meant to be, and the only way to find the real one was through> a 
> > phpinfo() check. Also, have you restarted the web server (Apache or> IIS) 
> > since making the changes?> > > Ash> www.ashleysheridan.co.uk> 
(Do you have rules or code of conduct for reply in this mailing list ?)
 
Yup, the setting I wrote was the setting I took directly from the phpinfo(); 
And I restarted apache more than enough for the next 2 years (even the server 
:| ).
 
I'm totally lost about that one ! 
 
Thank,
Karl
_________________________________________________________________


--- End Message ---
--- Begin Message ---
On Sun, 2008-10-12 at 07:54 -0400, Karl St-Jacques wrote:
> > > Hello, > > > > I have trouble uploading files to a server. Actually I 
> > > can't upload more than 500 bytes or so.> > > > Here's a quick print_r of 
> > > the $_FILES > > > > [_FILES] => Array( [avatar] => Array ( [name] => 
> > > index.html [type] => text/html [tmp_name] => /tmp/phpRbmXK5 [error] => 0 
> > > [size] => 505 ))> > If I try bigger file (540 bytes or 2mb) it's simply 
> > > return this. > > > > [_FILES] => Array([avatar] => Array( [name] => 
> > > ajax-loader.gif [type] => [tmp_name] => [error] => 3 [size] => 0)> > )> > 
> > > > > error 3 is partial files sended. (By the way, there's no processing, 
> > > only a print_r();> > > > So here's my setup from the php.ini> > > > PHP 
> > > Version 5.2.4-2ubuntu5.3> > > > max_execution_time 1000 1000 > > 
> > > max_input_nesting_level 64 64 > > max_input_time 1000 1000 > > 
> > > memory_limit 999M 999M> > post_max_size 200M 200M> > upload_max_filesize 
> > > 200M 200M> > upload_tmp_dir no value no value> > > > > > I run 
> > > Apache/2.2.8> > > > I checked the /tmp folder. it's empty, even if 
> > > uploading really big file, same for /var/tmp. the permission seems to be 
> > > ok (chmod 777).> > > > So, I'm pretty clueless about that one.> > Anyone 
> > > have any insight about this ? > > > > Thanks, > > Karl.> > > > 
> > > _________________________________________________________________> > > 
> > > Bit of a silly question, but it's bit me in the ass before. Are you sure> 
> > > you're editing the right php.ini file? I was working on a server at work> 
> > > where someone had left 3 php.ini files, all in places that looked like> 
> > > they were meant to be, and the only way to find the real one was through> 
> > > a phpinfo() check. Also, have you restarted the web server (Apache or> 
> > > IIS) since making the changes?> > > Ash> www.ashleysheridan.co.uk> 
> (Do you have rules or code of conduct for reply in this mailing list ?)
>  
> Yup, the setting I wrote was the setting I took directly from the phpinfo(); 
> And I restarted apache more than enough for the next 2 years (even the server 
> :| ).
>  
> I'm totally lost about that one ! 
>  
> Thank,
> Karl
> _________________________________________________________________
> 
No, not sure where the code of conduct is, but hang about for a while
and you should get the general idea ;)

As for your problem, I had a quick look at the error code you're
getting, and it means that the file was only partially uploaded. Is the
file being changed on your local machine before it's being uploaded?
Also, try to see if you can test the same script with different
browsers, and if possible on a different server. That should isolate
where the problem is.


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
On Sun, Oct 12, 2008 at 8:58 AM, Ashley Sheridan
<[EMAIL PROTECTED]> wrote:
>>
> No, not sure where the code of conduct is, but hang about for a while
> and you should get the general idea ;)

    Just the stuff at http://php.net/mailinglists.

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

--- End Message ---
--- Begin Message ---
On Sat, Oct 11, 2008 at 12:33 PM, Per Jessen <[EMAIL PROTECTED]> wrote:

> Ben Stones wrote:
>
> > What I mean is I cannot use setcookie, I need to check if user
> > credentials are correct first (which is BEFORE setcookie) and if so,
> > set a cookie. I can't do that unless setcookie is first, but I need to
> > check if the user credentials is correct. Furthermore I cannot use
> > setcookie in the header as I want to display a message saying that
> > they have successfully logged in in the correct area of my template.
>
> Well, I'm doing exactly that and it works just fine. This is a rough
> outline of the flow:
>
> GET  <login page>   (form with user and password fields)
> POST <login page>
>
>     validate user+password, save in session
>     setcookie().
>     redirect with 303 to <welcome page>
>
> GET <welcome page>
>
>
> /Per Jessen, Zürich
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> Its likely just a little html or a blank line that is setting the headers
before you are attempting to set the cookie


-- 

Bastien

Cat, the other other white meat

--- End Message ---

Reply via email to