php-general Digest 20 Aug 2007 14:02:01 -0000 Issue 4972

Topics (messages 261029 through 261048):

Re: Redirection with header (was Re: [PHP] Cookies and sent headers)
        261029 by: tedd
        261037 by: Wouter van Vliet / Interpotential
        261039 by: tedd

is this a bug?
        261030 by: Augusto Morais
        261034 by: Tijnema
        261035 by: Tijnema
        261036 by: Thijs Lensselink

variables
        261031 by: Augusto Morais
        261033 by: Micky Hulse

This is a bug?
        261032 by: Augusto Morais

Re: getting from one table listing from another
        261038 by: tedd
        261040 by: Jay Blanchard
        261047 by: Larry Garfield

Pass $_GET to php cli.
        261041 by: N0K
        261042 by: Thijs Lensselink
        261043 by: Per Jessen
        261044 by: N0K
        261045 by: Thijs Lensselink
        261046 by: Per Jessen

PHP eval() fatal error
        261048 by: Maarten Balliauw

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 ---
At 10:40 PM +0200 8/19/07, Wouter van Vliet / Interpotential wrote:
What you're proposing, is to actually display some content on another page
then were the content is originally intended? I'm sorry, but I would
consider that 'bad practice'. To me, it makes perfect sense that you don't
want to leave the user on the page where login was originally handled. For
various reasons. One very obvious would be the 'refresh thing', where your
browser asks the user if they want to send the form again. Quite annoying.
Then, what about bookmarks? ...


No, what I had proposed was an alternate method to accomplish what you said you wanted. But, it appears that my efforts and the demo did not receive sufficient attention for you to understand what wass being presented. Instead, you tell me that what I've shown you is bad practice -- interesting.

You said that you wanted to remove login from the browser history, which is screwing around with the user's browser and is clearly bad practice.

My method simply stops the user from visiting the same page more than once during a session and leaves their browser data alone -- nothing bad practice about that!

AFTER my demo runs, if you repeatedly refresh the page you are directed to, then certainly that would become annoying. But that wasn't the intent, nor part of the demo, which you clearly didn't read and obviously didn't understand.

As far as "bookmarking the page", but of course you can bookmark the page! Did you even try?

Oh well, so much for trying to help someone understand sessions. As my mother often said "No good deed ever goes unpunished".

If you had simply said, I don't understand, please explain; or asked a question or two; or said thanks, but no thanks, I'm going to do it another way, then that would have been fine. But to say that the demo I prepared for you exhibited "bad practice", especially when you are absolutely friggen clueless as to what it is doing, is a bit too much -- I'll be sure to pass over your post in the future.

tedd

---


I would definately go for the Location: header solution!

On 19/08/07, tedd <[EMAIL PROTECTED]> wrote:

 At 8:52 AM +0200 8/19/07, Otto Wyss wrote:
 >In my case I could easilly do without redirection but just exit and
 >fall back on the calling page. Yet I want to remove the login page
 >from the browser history. Does the header function have the same
 >effect?
 >

 O. Wyss:

 Instead of messing with the user's browser (not good IMO), why not
 use $_SESSION and make it such that if the user selects the log-on
 page again, they are redirected to another page? You don't even need
 header() to do that.

 Here's an example:

 > http://webbytedd.com/bb/one-time

 You will only see that page only once -- unless you find a way to
 clear the session.

 The process is simply to set a session variable and allow the user to
 see the page once. Upon returning, the session variable is checked
 and if it is "not null", then the user is redirected to another page
 like so:

 if($visit != null)
         {
         ob_clean();
         include('a.php');
         exit(0);
         }

 Very simple.

 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




--
Interpotential.com
Phone: +31615397471


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

--- End Message ---
--- Begin Message ---
On 20/08/07, tedd <[EMAIL PROTECTED]> wrote:
>
> At 10:40 PM +0200 8/19/07, Wouter van Vliet / Interpotential wrote:
> >What you're proposing, is to actually display some content on another
> page
> >then were the content is originally intended? I'm sorry, but I would
> >consider that 'bad practice'. To me, it makes perfect sense that you
> don't
> >want to leave the user on the page where login was originally handled.
> For
> >various reasons. One very obvious would be the 'refresh thing', where
> your
> >browser asks the user if they want to send the form again. Quite
> annoying.
> >Then, what about bookmarks? ...
>
>
> No, what I had proposed was an alternate method to accomplish what
> you said you wanted. But, it appears that my efforts and the demo did
> not receive sufficient attention for you to understand what wass
> being presented. Instead, you tell me that what I've shown you is bad
> practice -- interesting.


First of all - I didn't ask the initial question ;-). Other than that, I
think our philosophies our basically the same. But when you say that you are
redirecting the user to another page, while you are actually including a php
script - that's not my understanding of redirecting.

You said that you wanted to remove login from the browser history,
> which is screwing around with the user's browser and is clearly bad
> practice.


Generally yes, removing a page from the browser's history would be
considered bad practice. However, we are not really talking about a page
here. What I understood from the initial question is as follows:

 - http://www.site.com/ contains some login form, action of that form is
(for example) /login.php
 - The user is sent to /login.php where the login is checked
 - From there, the user either gets to a content page where it would
typically show "welcome {user}" or something, or back to the index page when
login failed
 - As you see, login.php is not really a page but more of a 'pseudo page'
and therefore I cannot see any reason not to send a proper 303 header. see:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

My method simply stops the user from visiting the same page more than
> once during a session and leaves their browser data alone -- nothing
> bad practice about that!
>
> AFTER my demo runs, if you repeatedly refresh the page you are
> directed to, then certainly that would become annoying. But that
> wasn't the intent, nor part of the demo, which you clearly didn't
> read and obviously didn't understand.
>
> As far as "bookmarking the page", but of course you can bookmark the
> page! Did you even try?
>
> Oh well, so much for trying to help someone understand sessions. As
> my mother often said "No good deed ever goes unpunished".


I've got another one, "There is no selfless good deed".

If you had simply said, I don't understand, please explain; or asked
> a question or two; or said thanks, but no thanks, I'm going to do it
> another way, then that would have been fine. But to say that the demo
> I prepared for you exhibited "bad practice", especially when you are
> absolutely friggen clueless as to what it is doing, is a bit too much
> -- I'll be sure to pass over your post in the future.


I don't think there wasn't anybody who didn't appriciate your suggestion.
Only thing I was trying to do was chip in my two cents. Again, I wasn't the
one who originally asked the question and I certainly am not "friggen
clueless". I just came to think about what the teacher at my Flex course
from a couple of months ago said about "good and bad practice". He said
there is none. If your solution works good for you, that's your good
practice. And if mine doesn't work for you, it's your bad practice - while
it is still my good practice.

Something however I am trying to "fight" against, if you let me put it like
that - is people approaching "scripts" as if they are "pages". When you are
including a "script that is usually called as a page" into another script
you should be very aware for any clashes between variables. Another reason
why it may be easier to just put in a Location: header and call your script
as it was originally intended.

Wouter

tedd
>
> ---
>
> >
> >I would definately go for the Location: header solution!
> >
> >On 19/08/07, tedd <[EMAIL PROTECTED]> wrote:
> >>
> >>  At 8:52 AM +0200 8/19/07, Otto Wyss wrote:
> >>  >In my case I could easilly do without redirection but just exit and
> >>  >fall back on the calling page. Yet I want to remove the login page
> >>  >from the browser history. Does the header function have the same
> >>  >effect?
> >>  >
> >>
> >>  O. Wyss:
> >>
> >>  Instead of messing with the user's browser (not good IMO), why not
> >>  use $_SESSION and make it such that if the user selects the log-on
> >>  page again, they are redirected to another page? You don't even need
> >>  header() to do that.
> >>
> >>  Here's an example:
> >>
> >  > http://webbytedd.com/bb/one-time
> >>
> >>  You will only see that page only once -- unless you find a way to
> >>  clear the session.
> >>
> >>  The process is simply to set a session variable and allow the user to
> >>  see the page once. Upon returning, the session variable is checked
> >>  and if it is "not null", then the user is redirected to another page
> >>  like so:
> >>
> >>  if($visit != null)
> >>          {
> >>          ob_clean();
> >>          include('a.php');
> >>          exit(0);
> >>          }
> >>
> >>  Very simple.
> >>
> >>  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
> >>
> >>
> >
> >
> >--
> >Interpotential.com
> >Phone: +31615397471
>
>
> --
> -------
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>



-- 
Interpotential.com
Phone: +31615397471

--- End Message ---
--- Begin Message ---
At 12:42 PM +0200 8/20/07, Wouter van Vliet / Interpotential wrote:
Only thing I was trying to do was chip in my two cents. Again, I wasn't the one who originally asked the question and I certainly am not "friggen clueless".

Maybe not, but you made some pretty clueless remarks -- like if you could book-mark the page, the annoying refresh remark, and saying the demo displayed "bad practice". None were germane to the intent of the demo, let alone valid.


I just came to think about what the teacher at my Flex course from a couple of months ago said about "good and bad practice". He said there is none. If your solution works good for you, that's your good practice. And if mine doesn't work for you, it's your bad practice - while it is still my good practice.

That's just an excuse to do what you want and call it good -- but, there are good and bad practices.

Something however I am trying to "fight" against, if you let me put it like that - is people approaching "scripts" as if they are "pages". When you are including a "script that is usually called as a page" into another script you should be very aware for any clashes between variables. Another reason why it may be easier to just put in a Location: header and call your script as it was originally intended.

Now, I'm clueless as to what you're talking about.

I think most people agree as to what a web page is and if we are using web languages to communicate with the user, then that is our medium. There are many ways to use web pages and Location: is only one of them. Limit yourself as you see fit.

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

--- End Message ---
--- Begin Message ---
I dont know what is happening...


Can somebody clarify the situation for me?


here is the situation:

  i have 3 files:

class.php
foo.php
bar.php

// - class.php
class globalactions {

     function include_file($module) {
                if ($module) {
                        return 
("modules/".$module."/templates/".$module.".php");
                } else { return include("modules/main/templates/index.php"); }
     }
}


// - foo.php
include "lib/clients.class.php";
$clients = new clients(); //instatiating the clients class


// - bar.php
include 'class.php';
$globalactions = new globalactions ();
include $globalactions->include_file("foo");  //return ->
"modules/foo/templates/foo.php"

var_dump($clients); //will return the object



OK. All this works. but i want make some changes.

Well.. What i want to do is this:

class.php:

change the line:
return ("modules/".$module."/templates/".$module.".php");

to:
return include ("modules/".$module."/templates/".$module.".php");

and in the bar.php:


// - bar.php
include 'class.php';
$globalactions = new globalactions ();
$globalactions->include_file("foo");  //return -> "include
modules/foo/templates/foo.php"  // OK. This works.

var_dump($clients); //i dont get the object here. I got NULL!!! why?!?!!?



What is happening?

--- End Message ---
--- Begin Message ---
On 8/20/07, Augusto Morais <[EMAIL PROTECTED]> wrote:
> I dont know what is happening...
>
>
> Can somebody clarify the situation for me?
>
>
> here is the situation:
>
>   i have 3 files:
>
> class.php
> foo.php
> bar.php
>
> // - class.php
> class globalactions {
>
>      function include_file($module) {
>                if ($module) {
>                        return 
> ("modules/".$module."/templates/".$module.".php");
>                } else { return include("modules/main/templates/index.php"); }
>      }
> }
>
>
> // - foo.php
> include "lib/clients.class.php";
> $clients = new clients(); //instatiating the clients class
>
>
> // - bar.php
> include 'class.php';
> $globalactions = new globalactions ();
> include $globalactions->include_file("foo");  //return ->
> "modules/foo/templates/foo.php"
>
> var_dump($clients); //will return the object
>
>
>
> OK. All this works. but i want make some changes.
>
> Well.. What i want to do is this:
>
> class.php:
>
> change the line:
> return ("modules/".$module."/templates/".$module.".php");
>
> to:
> return include ("modules/".$module."/templates/".$module.".php");
>
> and in the bar.php:
>
>
> // - bar.php
> include 'class.php';
> $globalactions = new globalactions ();
> $globalactions->include_file("foo");  //return -> "include
> modules/foo/templates/foo.php"  // OK. This works.
>
> var_dump($clients); //i dont get the object here. I got NULL!!! why?!?!!?
>
>
>
> What is happening?
>

This is because in the second example, you're including the file in a
different scope than the first example. The file included (and so all
variables etc. declared in it) will be added to the scope where the
include is.

This manual page should help you:
http://www.php.net/manual/en/language.variables.scope.php

Tijnema
-- 
If this is a mailing list: DO NOT TOP POST! why?:
http://www.caliburn.nl/topposting.html

Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

--- End Message ---
--- Begin Message ---
On 8/20/07, aflavio <[EMAIL PROTECTED]> wrote:
>
> Strange..
>
> I'm return a include..

Not exactly... you're returning the return value of an include.

Take this:
var.php:
<?php
return "bar";
?>
foo.php
<?php
function include_bar() {
return include "bar.php"
}
echo include_bar(); // echoes bar

>
> the file will be included in the scope of the class? Because this i cant use 
> the variables declared in the file ? all declared in the file only can be 
> access from the method that i use to include the class file.
>
> example:
>
<snip some code>
>
>
> Am i right?
>
> thanks
>
> ps.: Sorry by the english.
>
> Augusto Morais
>
Well, you're quite close, but you expect something different from the
return... Like I said above.

Tijnema

ps. I don't really care about your english, but top posting is
annoying. Read the site in my signature to know why. Also snipping
irrelevant parts of the original message is important.

pps. Make sure you use the "Reply to all" button when making a reply
to the list, as for now, I was the only one who got your message. If
you don't have a "Reply to all" button, make sure you put the php list
in the to or cc address.

-- 
If this is a mailing list: DO NOT TOP POST! why?:
http://www.caliburn.nl/topposting.html

Vote for PHP Color Coding (aka Syntax Highlighting) in Gmail! ->
http://gpcc.tijnema.info

--- End Message ---
--- Begin Message ---
On Mon, 20 Aug 2007 02:24:49 -0300, Augusto Morais <[EMAIL PROTECTED]> wrote:
> I dont know what is happening...
> 
> 
> Can somebody clarify the situation for me?
> 
> 
> here is the situation:
> 
>    i have 3 files:
> 
> class.php
> foo.php
> bar.php
> 
> // - class.php
> class globalactions {
> 
>       function include_file($module) {
>               if ($module) {
>                       return 
> ("modules/".$module."/templates/".$module.".php");
>               } else { return include("modules/main/templates/index.php"); }
>       }
> }
> 
> 
> // - foo.php
> include "lib/clients.class.php";
> $clients = new clients(); //instatiating the clients class
> 
> 
> // - bar.php
> include 'class.php';
> $globalactions = new globalactions ();
> include $globalactions->include_file("foo");  //return ->
> "modules/foo/templates/foo.php"
> 
> var_dump($clients); //will return the object
> 
> 
> 
> OK. All this works. but i want make some changes.
> 
> Well.. What i want to do is this:
> 
> class.php:
> 
> change the line:
> return ("modules/".$module."/templates/".$module.".php");
> 
> to:
> return include ("modules/".$module."/templates/".$module.".php");
> 
> and in the bar.php:
> 
> 
> // - bar.php
> include 'class.php';
> $globalactions = new globalactions ();
> $globalactions->include_file("foo");  //return -> "include
> modules/foo/templates/foo.php"  // OK. This works.
> 
> var_dump($clients); //i dont get the object here. I got NULL!!! why?!?!!?
> 
> 
> 
> What is happening?
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

No this is not a bug. And it also has nothing todo with scoping.
The object "client" returns NULL. This can only happen if the object is not 
instantiated.

I guess the foo.php file is not included at all.

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


I want create a variable based in another variable. Example:


$foo  (a simple variable);

$myvar_foo


Does it possible?


Thanks


Augusto Morais

--- End Message ---
--- Begin Message ---
Augusto Morais wrote:
I want create a variable based in another variable. Example:

Maybe this will give you some ideas?:

<http://us3.php.net/manual/en/language.variables.variable.php>

Good luck!
Cheers,
Micky

--
Wishlists: <http://snipurl.com/1gqpj>
   Switch: <http://browsehappy.com/>
     BCC?: <http://snipurl.com/w6f8>
       My: <http://del.icio.us/mhulse>

--- End Message ---
--- Begin Message ---
I dont know what is happening...


Can somebody clarify the situation for me?


here is the situation:

 i have 3 files:

class.php
foo.php
bar.php

// - class.php
class globalactions {

    function include_file($module) {
                if ($module) {
                        return 
("modules/".$module."/templates/".$module.".php");
                } else { return include("modules/main/templates/index.php"); }
    }
}


// - foo.php
include "lib/clients.class.php";
$clients = new clients(); //instatiating the clients class


// - bar.php
include 'class.php';
$globalactions = new globalactions ();
include $globalactions->include_file("foo"); //return -> "modules/foo/templates/foo.php"

var_dump($clients); //will return the object



OK. All this works. but i want make some changes.

Well.. What i want to do is this:

class.php:

change the line:
return ("modules/".$module."/templates/".$module.".php");

to:
return include ("modules/".$module."/templates/".$module.".php");

and in the bar.php:


// - bar.php
include 'class.php';
$globalactions = new globalactions ();
$globalactions->include_file("foo"); //return -> "include modules/foo/templates/foo.php" // OK. This works.

var_dump($clients); //i dont get the object here. I got NULL!!! why?!?!!?



problem:

When the method(include_file) return "include FILE" the $client object stay NULL but when the same method only return "FILE" :

include $globalactions->include_file("foo");


the $client object isnt empty.



What is happening??!?!?



I dont have any idea...


Thanks


Augusto Morais

--- End Message ---
--- Begin Message ---
[snip]
However, the LEFT and RIGHT will take me a while to figure out.
[/snip]

FROM table a LEFT OUTER JOIN table b
ON(a.column = b.column)

Just follow the order tedd, a is on the left and b is on the right

LEFT OUTER -> a -> b (what may be in a might not be in b)
a <- b <- RIGHT OUTER (what may be in b might not be in a)

FROM table a INNER JOIN table b
ON(a.column = b.column)

a -> INNER JOIN -> b (only where in a and b)

Jay:

Question -- is it redundant to say:

FROM table a LEFT OUTER JOIN table b
ON(a.column = b.column)

when "table a" appears first? Wouldn't that be the same as:

FROM table a OUTER JOIN table b
ON(a.column = b.column)

???

I'm trying to understand why use LEFT and RIGHT if the tables' order also has meaning.

Thanks for your time.

Cheers,

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

--- End Message ---
--- Begin Message ---
[snip]
Question -- is it redundant to say:

FROM table a LEFT OUTER JOIN table b
ON(a.column = b.column)

when "table a" appears first? Wouldn't that be the same as:

FROM table a OUTER JOIN table b
ON(a.column = b.column)
[/snip]

An OUTER JOIN is essentially a FULL OUTER JOIN which will include
matches and non-matches from both tables. The order of tables is only
important when specifying LEFT or RIGHT outer join. Some RDBMS implement
this differently so for clarity you should always be very specific.

--- End Message ---
--- Begin Message ---
On Monday 20 August 2007, tedd wrote:

> Question -- is it redundant to say:
>
> FROM table a LEFT OUTER JOIN table b
> ON(a.column = b.column)
>
> when "table a" appears first? Wouldn't that be the same as:
>
> FROM table a OUTER JOIN table b
> ON(a.column = b.column)
>
> ???
>
> I'm trying to understand why use LEFT and RIGHT if the tables' order
> also has meaning.

Basically:

JOIN: Pull records from both tables.

LEFT OUTER JOIN: Pull records from both tables, but restrict the one on the 
left (in the order of the SQL string's text).

RIGHT OUTER JOIN: Pull records from both tables, but restrict the ones on the 
right (in the order of the SQL string's text).

INNER JOIN: Pull from both tables and restrict on both tables.

The join condition itself is what specifies how the tables should be joined.  
The type of join specifies how the records should be restricted.  

In practice I really don't remember the last time I used anything but INNER 
JOIN or LEFT OUTER JOIN.

-- 
Larry Garfield                  AIM: LOLG42
[EMAIL PROTECTED]               ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

--- End Message ---
--- Begin Message ---
Hello.

I trying something without results.

I have a zend optimized php script. This script only request you a password, and then you go to admin page.
If a do in a browser:
http://www.example.com/administration.php

Then i go to this web where the password is request. I put the password and go to the administration web.

But if i do in a browser:
http://www.example.com/administration.php?varpass=112233&checkpass=Submit

Then i go directly to the administration web, without request pass.

So, im trying to the the same in php command line

i have test with many things, but i dont know how to specify this variable to the php cli,
some tested example:

php administration.php --varpass=112233 --checkpass=Submit
php administration.php --"varpass=112233&checkpass=Submit"
php administration.php --"varpass=112233" --"checkpass=Submit

And a lot of more combination.

Can i do this by php command line ?

Thanks and regards.

--- End Message ---
--- Begin Message ---
On Mon, 20 Aug 2007 14:15:47 +0200, N0K <[EMAIL PROTECTED]> wrote:
> Hello.
> 
> I trying something without results.
> 
> I have a zend optimized php script. This script only request you a
> password, and then you go to admin page.
> If a do in a browser:
> http://www.example.com/administration.php
> 
> Then i go to this web where the password is request. I put the password
> and go to the administration web.
> 
> But if i do in a browser:
> http://www.example.com/administration.php?varpass=112233&checkpass=Submit
> 
> Then i go directly to the administration web, without request pass.
> 
> So, im trying to the the same in php command line
> 
> i have test with many things, but i dont know how to specify this
> variable to the php cli,
> some tested example:
> 
> php administration.php --varpass=112233 --checkpass=Submit
> php administration.php --"varpass=112233&checkpass=Submit"
> php administration.php --"varpass=112233" --"checkpass=Submit
> 
> And a lot of more combination.
> 
> Can i do this by php command line ?
> 
> Thanks and regards.
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

You can use the 'argc' and 'argv' arrays for this.
http://nl3.php.net/manual/en/features.commandline.php

--- End Message ---
--- Begin Message ---
N0K wrote:

> So, im trying to the the same in php command line
> 
> i have test with many things, but i dont know how to specify this
> variable to the php cli,
> some tested example:
> 
> php administration.php --varpass=112233 --checkpass=Submit
> php administration.php --"varpass=112233&checkpass=Submit"
> php administration.php --"varpass=112233" --"checkpass=Submit
> 
> And a lot of more combination.
> Can i do this by php command line ?

Yes, but not that way.  There is no automagic mapping of argv[]
variables to $_GET.  Take a look at the 'getopt' function. 


/Per Jessen, Zürich

--- End Message ---
--- Begin Message ---
Hello.

I trying something without results.

I have a zend optimized php script. This script only request you a
password, and then you go to admin page.
If a do in a browser:
http://www.example.com/administration.php

Then i go to this web where the password is request. I put the password
and go to the administration web.

But if i do in a browser:
http://www.example.com/administration.php?varpass=112233&checkpass=Submit

Then i go directly to the administration web, without request pass.

So, im trying to the the same in php command line

i have test with many things, but i dont know how to specify this
variable to the php cli,
some tested example:

php administration.php --varpass=112233 --checkpass=Submit
php administration.php --"varpass=112233&checkpass=Submit"
php administration.php --"varpass=112233" --"checkpass=Submit

And a lot of more combination.

Can i do this by php command line ?

Thanks and regards.

--- End Message ---
--- Begin Message ---
On Mon, 20 Aug 2007 14:41:03 +0200, Per Jessen <[EMAIL PROTECTED]> wrote:
> N0K wrote:
> 
>> So, im trying to the the same in php command line
>>=20
>> i have test with many things, but i dont know how to specify this
>> variable to the php cli,
>> some tested example:
>>=20
>> php administration.php --varpass=3D112233 --checkpass=3DSubmit
>> php administration.php --"varpass=3D112233&checkpass=3DSubmit"
>> php administration.php --"varpass=3D112233" --"checkpass=3DSubmit
>>=20
>> And a lot of more combination.
>> Can i do this by php command line ?
> 
> Yes, but not that way.  There is no automagic mapping of argv[]
> variables to $_GET.  Take a look at the 'getopt' function.=20
> 
> 
> /Per Jessen, Z=C3=BCrich
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

I don't see where N0K asks for mapping of $_GET to commandline parameters.

getopt is a good solution. But not very portable (it only works on *nix systems)
And with list() and the argv array you can get the same effect.

--- End Message ---
--- Begin Message ---
Thijs Lensselink wrote:

> I don't see where N0K asks for mapping of $_GET to commandline
> parameters.

He did't specifically ask, but his attempts seem to suggest that's what
he was hoping for. 


/Per Jessen, Zürich

--- End Message ---
--- Begin Message --- Here's the thing: I'm trying to do some dynamic code compilation within PHP using eval(). The code I'm trying to compile raises an E_ERROR (Fatal).

Here's a simple example:

<?php
$code = '  $returnValue = 12*A+;  '; // Clearly incorrect code :-)
$returnValue = 0;

eval($code);
?>

Now, I'd like to catch the error made by eval:

// ...
try {
  eval($code);
} catch (Exception $ex) {
  var_dump($ex);
}
// ...

Problem persists: a fatal error occurs.
Using set_error_handler() and set_exception_handler() is not working either...

Is there any way to gracefully catch this error?

Regards,
Maarten

--- End Message ---

Reply via email to