php-general Digest 7 Sep 2003 02:48:39 -0000 Issue 2282

Topics (messages 161858 through 161880):

Re: simple Apache question I'm sure [solved]
        161858 by: Paul O'Neil

[imagick] converting to variable instead of file
        161859 by: Decapde Azur
        161875 by: Decapde Azur

Function calling from url
        161860 by: Robin Kopetzky
        161861 by: Larry E. Ullman
        161862 by: John W. Holmes
        161868 by: Dan Anderson

Unregistering several variables at once -- how?
        161863 by: James Johnson
        161864 by: John W. Holmes

$HTTP_REFERER / Hijacking
        161865 by: John Taylor-Johnston
        161869 by: Curt Zirzow

Cpanel or Plesk
        161866 by: Dasmeet
        161870 by: Curt Zirzow
        161872 by: andu
        161877 by: Oscar F

Re: Remove vars from memory?
        161867 by: Dan Anderson

Encrypt/Serialize Source Code for Sale
        161871 by: Charles Kline

String formatting function - First char Upper, rest lower
        161873 by: James Johnson
        161874 by: Thomas Hebinck

Memory used by script
        161876 by: \[cz\]Emo
        161878 by: Curt Zirzow

Running PHP scripts in PHP Nuke
        161879 by: Dan Anderson

Re: PHP code generation
        161880 by: Manuel Lemos

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 ---
Thanks for that answer. that was it. Theres alot going on in apache!

-----Original Message-----
From: David Otton [mailto:[EMAIL PROTECTED]
Sent: Saturday, September 06, 2003 4:40 AM
To: Paul O'Neil
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] simple Apache question I'm sure


On Fri, 5 Sep 2003 20:30:22 -0700, you wrote:

>This is more Apache related but I have a php/apache config'd box at home I
>want to test stuff out on before uploading to a public server. Every
>directory except wwwroot dir I must place a '/' after the dir name to get a
>listing such as http:://192.168.1.1/mydirectory will not load the index.php
>file until I type in the '/' like so http://192.168.1.1/mydirectory/ what
>gives?

[Assuming that "::" is a typo]

"http://192.168.1.1/mydirectory"; is an invalid URL - that resource doesn't
exist on that server.

When a server receives a request for "http://example.com/some/dir";, instead
of throwing a 404 error it politely issues a 301 (Moved Permanently),
telling the browser to go to "http://example.com/some/dir/"; instead.

The "example.com" bit is taken from httpd.conf. Look for the line:

ServerName example.com

to modify.

Your request for "http://192.168.1.1/mydirectory"; is being 301'd into
"http://example.com/mydirectory/";

This is why leaving training a '/' off a URL is a bad idea, even though it
appears to work - it causes a second HTTP roundtrip before you get your
file.

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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.515 / Virus Database: 313 - Release Date: 9/1/2003

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.515 / Virus Database: 313 - Release Date: 9/1/2003

--- End Message ---
--- Begin Message ---
hi all,

With imagick_writeimage() function, is it possible to send the image to a 
variable instead of dumping it to a file or to the client browser?


Thanks
PS (if I try this, it is to convert an image to xpm in a variable and use it 
in php-gtk)

--- End Message ---
--- Begin Message ---
I had thought too that it is possible to write a temp file for this image,
but it would be much better i think if there was another way...

Is it really impossible to prevent from this hard disk access ?

-- 
> Write it to a tem file then use file_get_contents() on the file name.
>
[...]
> >With imagick_writeimage() function, is it possible to send the image to
> > a variable instead of dumping it to a file or to the client browser?
> >
> >Thanks
> >PS (if I try this, it is to convert an image to xpm in a variable and
> > use it in php-gtk)

--- End Message ---
--- Begin Message ---
Good morning!

I would like to call a function from a <FORM>'s ACTION attribute. This is
what I'm trying to do:

<FORM
ACTION="www.example.com/PHP_FILENAME/function_name?parameter1=x&parameter2=y
" etc...>

I can include the PHP_FILENAME but passing parameters to the function I
can't figure out how to do. Any help would be appreciated.

Robin 'Sparky' Kopetzky
Black Mesa Computers/Internet Service
Grants, NM 87020

--- End Message ---
--- Begin Message ---
I would like to call a function from a <FORM>'s ACTION attribute. This is
what I'm trying to do:


<FORM
ACTION="www.example.com/PHP_FILENAME/function_name? parameter1=x&parameter2=y
" etc...>

Well, you're not going to call a function that way, but you will submit the form to the PHP page (PHP_FILENAME) and that page can call the function. If the action attribute was script.php?p1=x&p2=y


Then script.php would have
function_name ($_GET['x'], $_GET['y']);

You'll probably want to do some validity checking on the GET data, just in case.

Hope that helps,
Larry

PS Just to be clear: you can't call a PHP function using a form since a form is on the client and PHP is on the server.
--- End Message ---
--- Begin Message --- Robin Kopetzky wrote:

I would like to call a function from a <FORM>'s ACTION attribute. This is
what I'm trying to do:

<FORM
ACTION="www.example.com/PHP_FILENAME/function_name?parameter1=x&parameter2=y
" etc...>

I can include the PHP_FILENAME but passing parameters to the function I
can't figure out how to do. Any help would be appreciated.

Ummm... no. You call a PAGE from the action attribute of a form. There is no getting around that. You can call a PHP PAGE that passes variables in the query string, though...


action="www.example.com/phpfile.php?function=foo&param1=bar&param2=baar

This would give you $_GET['function'], $_GET['param1'], and $_GET['param2'] in your "phpfile.php" page. You then call your function using those variables. If you are smart, you'll put in some validation, also.

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
I know what you're trying to do you just don't quite know how to say
it...

I use something like:

if ($_GET['somevar'] AND $_GET['something_else'])
{
  do_something($_GET['somevar'], $_GET['something_else']);
}
else
{
  output_error_message();
}

-Dan
On Sat, 2003-09-06 at 13:19, Robin Kopetzky wrote:
> Good morning!
> 
> I would like to call a function from a <FORM>'s ACTION attribute. This is
> what I'm trying to do:
> 
> <FORM
> ACTION="www.example.com/PHP_FILENAME/function_name?parameter1=x&parameter2=y
> " etc...>
> 
> I can include the PHP_FILENAME but passing parameters to the function I
> can't figure out how to do. Any help would be appreciated.
> 
> Robin 'Sparky' Kopetzky
> Black Mesa Computers/Internet Service
> Grants, NM 87020

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

I have 15 - 20 $_SESSION vars that I want to clear when a user logs out.
I've been doing it with the following code:

if(session_is_registered($_SESSION['svUserID'])){
        session_unregister($_SESSION['svUserID']);
}

But, this is tedious. Is there a better way, like session_unregister(all)?

Thanks,
James

--- End Message ---
--- Begin Message --- James Johnson wrote:

Hi,

I have 15 - 20 $_SESSION vars that I want to clear when a user logs out.
I've been doing it with the following code:

if(session_is_registered($_SESSION['svUserID'])){
        session_unregister($_SESSION['svUserID']);
}

But, this is tedious. Is there a better way, like session_unregister(all)?

$_SESSION = array();


--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
This is kind of old-fashioned, but I created a counter that prevents hijacking.
"district" is a partial of the word in the URL. If it does not exist, echoes hijacking 
...

----snip---
if(stristr($HTTP_REFERER,"district"))
{
#...
#echo "document.write(\"$num_rows visitors since August 23, 2003\");";
echo "document.write(\"<font size=-1>$num_rows visitors since August 23, 2003 referred 
from: $HTTP_REFERER</font>\");";
}else{
echo "document.write(\"No hijacking from ".$_ENV["HOSTNAME"].", merci. \");";
}
----snip---

The problem is I noticed a friend was getting the hijacking message.
I had him clean his cache and reload, but no luck.

I wondered why he got that message, so I echoed $HTTP_REFERER to see what his IE6.x 
was spewing out. The result was:

$HTTP_REFERER =""

Anyone suggest a work around? Another variable maybe? I don't need it, but want that 
functionality in this counter:
if(stristr($HTTP_REFERER,"district"))

I do need this fucntionality, however, on another site, where two URLS share the same 
index.html on the same Apache server. One displays info one way for one URL, the other 
another way for a different URL.

P.S., I'm using the Javascript document.write because this site is not on a PHP 
server, so I used this code to help the non-PHP site out:
<script language=javascript src='http://foo.com/counters/05200.php'></script>

--- End Message ---
--- Begin Message ---
* Thus wrote John Taylor-Johnston ([EMAIL PROTECTED]):
> 
> The problem is I noticed a friend was getting the hijacking message.
> I had him clean his cache and reload, but no luck.
> 
> I wondered why he got that message, so I echoed $HTTP_REFERER to see what his IE6.x 
> was spewing out. The result was:
> 
> $HTTP_REFERER =""
> 
> Anyone suggest a work around? Another variable maybe? I don't need it, but want that 
> functionality in this counter:
> if(stristr($HTTP_REFERER,"district"))


> 
> I do need this fucntionality, however, on another site, where two URLS share the 
> same index.html on the same Apache server. One displays info one way for one URL, 
> the other another way for a different URL.

The referer isn't gaurenteed to be there, and there really isn't a
way around the problem.  

Ideally, if it's possible, have the user use a server side include instead
of javascript.  that will gaurentee no hijacking and also the
counter still will get displayed even if the end-user has javascript
off.

Either way keep the referrer checking in there, most people have
that setting on so only a select few wouldn't get counted.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message --- Hi!
I guess many of you must have used both CPanel and Plesk. Can you tell me which one is better and what are the basic differences between them? Also can accounts hosted on WHM/CPanel moved to Plesk?
Any information would be of great help.
Thanks in advance!
Dasmeet


--
--
Domainwala.com
Domain Names from Rs. $7.99 at http://www.domainwala.com
http://www.domainwala.com/headlines/index.php
http://www.domainwala.com/links

--- End Message ---
--- Begin Message ---
* Thus wrote Dasmeet ([EMAIL PROTECTED]):
> Hi!
> I guess many of you must have used both CPanel and Plesk. Can you tell 

nope never have.

> me which one is better and what are the basic differences between them? 

I would suggest that maybe you research the products.

> Also can accounts hosted on WHM/CPanel moved to Plesk?

Contact plesk about this.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message ---
On Sat, 06 Sep 2003 23:58:39 +0530
Dasmeet <[EMAIL PROTECTED]> wrote:

> Hi!
> I guess many of you must have used both CPanel and Plesk. Can you tell 
> me which one is better and what are the basic differences between them? 
> Also can accounts hosted on WHM/CPanel moved to Plesk?
> Any information would be of great help.
> Thanks in advance!
> Dasmeet

Didn't use Plesk but i found CPanel to be pretty good for what it's supposed to
do. Has nothing to do with how accounts are set up though, that depends on
the distro/administrator and CPanel is configured accordingly.

> 
> -- 
> --
> Domainwala.com
> Domain Names from Rs. $7.99 at http://www.domainwala.com
> http://www.domainwala.com/headlines/index.php
> http://www.domainwala.com/links
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 


-- 
Andu

--- End Message ---
--- Begin Message --- I've used both and personally, I like CPanel a whole lot more, it has in my opinion a better and easier to understand interface for users. I don't know if account that use CPanel can be moved to Plesk but I would suppose you could, I don't know for sure tho.

Oscar.

Dasmeet wrote:
Hi!
I guess many of you must have used both CPanel and Plesk. Can you tell me which one is better and what are the basic differences between them? Also can accounts hosted on WHM/CPanel moved to Plesk?
Any information would be of great help.
Thanks in advance!
Dasmeet



--- End Message ---
--- Begin Message ---
> yes, you must use unset() to remove a variable, otherwise it will stay
> for the duration of the script.

Don't worry about memory management if you're going to use PHP.  The
point of using a high level language like PHP is you can just ignore
it.  Let's say you decided to:

if ($temp)
{ /*  something  */ }
unset $temp;     // save a couple bytes of memory

And you decided to reuse $temp a few weeks later:

if ($temp) // never will execute because you forgot you unset($temp);
{ /*  something  */ }

So unless you're dealing with an extreme scenario (i.e. a number of very
large mySQL queries), you probably don't need to worry.

-Dan

--- End Message ---
--- Begin Message --- What methods are available (ups and downs) for encrypting and serializing php applications for sale?

Thanks,
Charles

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

Newbie question.

Does anyone know of a function or script that will capitalize the first char
and lowercase the remaining chars of each word in a string?

Thanks,
James

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

>Does anyone know of a function or script that will capitalize the first
char
>and lowercase the remaining chars of each word in a string?

from the documentation:

$bar = ucwords(strtolower($bar));

http://de.php.net/manual/en/function.ucwords.php

Bye,
Thomas.

--- End Message ---
--- Begin Message ---
Hi all.

I would like to ask you if exist some way to get size of memory used by
current script.
I searched for sth, but didn't found any suitable result :o(

Thanx
Emo

--- End Message ---
--- Begin Message ---
* Thus wrote [cz]Emo ([EMAIL PROTECTED]):
> Hi all.
> 
> I would like to ask you if exist some way to get size of memory used by
> current script.
> I searched for sth, but didn't found any suitable result :o(

yes for php >= 4.3.2

http://php.net/memory_get_usage


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message ---
I have a client who wants me to install a script on their web site. 
Only problem is they use PHP nuke and when I edit a pages content and
type in :

<?php include("script.php"); ?>

Or do something like:

<OBJECT DATA="http://www.site.com/script.php";></OBJECT>

It doesn't work.  Can anybody tell me how to run a script from within a
PHP nuke page?

Thanks,

Dan Anderson

--- End Message ---
--- Begin Message --- Hello Chris,

On 09/05/2003 02:11 PM, Chris Hubbard wrote:
I'm working on a code generation project.  Is there anyone on the list who
has experience building these things, and, would like to discuss
architecture/patterns/structure of code generation off-list?

You may want to take a look at Metastorage project which is based on massive code generatiom based on meta-programming:


http://www.meta-language.net/metastorage.html

--

Regards,
Manuel Lemos

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

--- End Message ---

Reply via email to