|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 5 Sep 2003 01:47:43 -0000 Issue 2278
php-general-digest-help
lists.php.net
Date: Thu Sep 04 2003 - 20:47:43 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 5 Sep 2003 01:47:43 -0000 Issue 2278
Topics (messages 161646 through 161711):
Question regarding OOP and interitance
161646 by: Webmaster
161647 by: Jay Blanchard
161671 by: Decapode Azur
161678 by: Jay Blanchard
Passing objects as a reference and extracting the index of an associative array.
161648 by: Webmaster
161674 by: CPT John W. Holmes
Re: suggestion: recursive calls
161649 by: Jason Sheets
161660 by: Robert Cummings
gettext i18n
161650 by: Catalin Trifu
161653 by: Desi
161654 by: Catalin Trifu
161655 by: Desi
161658 by: Christophe Chisogne
161659 by: Catalin Trifu
Re: Question about Error Redirect (URL ShortCuts)
161651 by: Jason Sheets
161711 by: ccj
Setting register globals in http.conf
161652 by: Chris Boget
cookies under php 4.06
161656 by: Chris Kranz
161657 by: Chris Kranz
161701 by: Comex
161702 by: Jennifer Goodie
Passing Objects between scripts and guarateeing that a language has been choosen.
161661 by: Webmaster
161665 by: Matt Matijevich
161676 by: Curt Zirzow
Re: mysql Pattern Matching
161662 by: CPT John W. Holmes
161663 by: Duncan Hill
PHP
161664 by: Jalene Joyner
161666 by: Chris Shiflett
-f function ???
161667 by: Guillermo Scharffenorth
161677 by: Curt Zirzow
PHP eqivalent of 'smartypants', and other text educating for XHTML, etc
161668 by: Justin French
session.save_path is a big security hole!
161669 by: Rx
161682 by: Curt Zirzow
161685 by: Rx
161691 by: Curt Zirzow
161697 by: CPT John W. Holmes
161699 by: Curt Zirzow
161710 by: Raditha Dissanayake
syntax error using header and SID
161670 by: bob pilly
161672 by: CPT John W. Holmes
161673 by: Chris Hayes
161680 by: Tyler Lane
Front Page User Logout
161675 by: John Welty
161679 by: Jay Blanchard
161693 by: John Welty
161696 by: CPT John W. Holmes
161698 by: Curt Zirzow
Thanks Richard Schwartz
161681 by: Joe Harman
161683 by: Curt Zirzow
161684 by: Chris W. Parker
HTML Template, PHP, Javascript & PATH_INFO
161686 by: Richard A. DeVenezia
Use of php_value in .htaccess is not working
161687 by: JR
RE:[PHP] HTML Template, PHP, Javascript & PATH_INFO
161688 by: Chris Sherwood
multiple select box
161689 by: Steve Goodman
161692 by: Robert Cummings
Re: Q on "inhert" class code
161690 by: jsWalter
A bd problem
161694 by: Carlos Castillo
161695 by: CPT John W. Holmes
161700 by: Ralph Guzman
Creating Images
161703 by: Jed R. Brubaker
161704 by: Catalin Trifu
161705 by: Curt Zirzow
Re: Am I dreaming or what :)
161706 by: John Taylor-Johnston
161707 by: Chris W. Parker
cURL and relative paths
161708 by: Colin Kettenacker
PEAR
161709 by: Richard Baskett
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
Good day,
I would like to know a constructor function is also inherited to a child
class.
I mean the child class also needs to have a constructor function but it must
have the same name as the class name.
How does that work?
Thank you very much.
BW
attached mail follows:
[snip]
I would like to know a constructor function is also inherited to a child
class.
I mean the child class also needs to have a constructor function but it
must
have the same name as the class name.
How does that work?
[/snip]
FYI ... anything below PHP5 has a pseudo constructor. Since you are
inheriting the class the 'constructor' for the parent class should work.
If it doesn't (I have not tested it, and neither have you)then the class
extension can contain a 'contstructor' that is a duplicate of the parent
class 'constructor' but with the extension name. You'll have to test it
to make sure.
attached mail follows:
> FYI ... anything below PHP5 has a pseudo constructor.
And how will it be in PHP5 ?
> Since you are inheriting the class the 'constructor' for the parent class
> should work. If it doesn't (I have not tested it, and neither have
> you)then the class extension can contain a 'contstructor' that is a
> duplicate of the parent class 'constructor' but with the extension name.
> You'll have to test it to make sure.
attached mail follows:
[snip]
> FYI ... anything below PHP5 has a pseudo constructor.
And how will it be in PHP5 ?
[/snip]
PHP5 will be using the Zend 2 Engine, and gives a standard way of
declaring constructor methods by calling them by the name __construct().
An example from http://www.php.net/zend-engine-2.php
<?php
class BaseClass {
function __construct() {
print "In BaseClass constructor\n";
}
}
class SubClass extends BaseClass {
function __construct() {
parent::__construct();
print "In SubClass constructor\n";
}
}
$obj = new BaseClass();
$obj = new SubClass();
?>
True destructors will also be available, as should be true private
methods.
attached mail follows:
Hi,
i am using the smarty template engine.
Here is the problem that I would like to ask about:
function initTop(&$page, $array)
{
for ($i=0; $i<sizeof($array)
{
$page->assignVars(, $array[$i])
}
}
The function is supposed to know which object's attributes she is supposed
to change. Do I have to pass the object as a reference? Have never worked
with References before.
The array is supposed to be associative.
The funcion assignVars() is called like this:
$objektname->assignVars("indexname of ass. array", $arraywert);
How do I get the indexname for each arrrayvalue, so I can pass it to the
function assignVars?
Is there a php function?
Thank you very much.
attached mail follows:
Webmaster wrote:
> Hi,
>
> i am using the smarty template engine.
> Here is the problem that I would like to ask about:
>
> function initTop(&$page, $array)
> {
> for ($i=0; $i<sizeof($array)
> {
> $page->assignVars(, $array[$i])
> }
> }
>
>
> The function is supposed to know which object's attributes she is supposed
> to change. Do I have to pass the object as a reference? Have never worked
> with References before.
>
> The array is supposed to be associative.
> The funcion assignVars() is called like this:
>
> $objektname->assignVars("indexname of ass. array", $arraywert);
>
> How do I get the indexname for each arrrayvalue, so I can pass it to the
> function assignVars?
There is no "assignVars" method within Smarty. Are you using something
else overtop of it?
You can assign the whole array to Smarty like this:
$smarty->assign('some_name',$some_array);
Then, say you have $some_array['one'] = "Bob", you'd use a placeholder
like {$some_name.one} to get the value "Bob" in your template.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
attached mail follows:
I wouldn't want to see a limit placed on recursion depth, IMHO it is
the responsibility of the programmer to limit recursion not the language
itself otherwise the language is limiting the programmer. Another
possiblity is hitting the execution time limit, sounds like you are
using IE with friendly errors turned on, I prefer turning them off.
Jason
Andrew Brampton wrote:
>I was just testing PHP with this code:
><?php
>
>function blah($varible) {
>
> if ($varible > 860)
> exit();
>
> echo $varible . '<br>';
> flush();
>
> blah($varible + 1);
>}
>
>blah(1);
>
>?>
>
>This would show 1 to 860, however if I tried any number greater than 860, ie
>861 then the page would give the "This page cannot be displayed" page like
>you were saying.
>
>Normally apps in C, etc would throw a stack overflow error when you recursed
>too high...
>
>I'm guessing PHP doesn't implement this as a normal stack, and is crashing
>out because we have hit the memory limit. The reason I say that is because
>860 seems a very odd number to set the stack size to.
>
>I'm also guessing that it wouldn't be too hard for the PHP Dev team to place
>a limit on the recursion depth, or maybe it is a bit too hard and thats why
>they didn't bother :)...
>
>Andrew
>----- Original Message -----
>From: "Ronald van Raaphorst" <Support
Compad.nl>
>To: <php-general
lists.php.net>
>Sent: Thursday, September 04, 2003 11:40 AM
>Subject: Re: [PHP] suggestion: recursive calls
>
>
>
>
>>I normally program in clarion (www.softvelocity.com) and an infinite
>>recursive call will cause a heap overflow...
>>
>>As I only got a "This page cannot be displayed" page, an error must have
>>occurred, but it's not displayed...
>>At first I thought I had lost contact with the site, but then, after a lot
>>of tracing, I found the source of the error.
>>
>>Ronald
>>
>>
>>
>>"Marek Kilimajer" <kilimajer
webglobe.sk> schreef in bericht
>>news:3F57156B.9070902
webglobe.sk...
>>
>>
>>>I don't think it is even possible, if the recursive calls don't seem
>>>infinite to inteligent human being, how should a stupid computer program
>>>find out.
>>>
>>>Ronald van Raaphorst wrote:
>>>
>>>
>>>
>>>>Hi all,
>>>>
>>>>Not a real bug, but a suggestion:
>>>>It would be nice if inifite recursive calls would somehow give an
>>>>
>>>>
>error.
>
>
>>>>I spend quite some time to find the error in my php script.
>>>>
>>>>Ronald
>>>>
>>>>
>>>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>
>>
>>
>
>
>
attached mail follows:
I've accidentally had infinite recursion at times. Under Linux if
configured, you can get a core dump which can be loaded in GDB to see
the stack. I usually know Its infinite recursion when GDB shows a
backtrack in the 10s of thousands.
Cheers,
Rob.
On Thu, 2003-09-04 at 06:04, Ronald van Raaphorst wrote:
> Hi all,
>
> Not a real bug, but a suggestion:
> It would be nice if inifite recursive calls would somehow give an error.
> I spend quite some time to find the error in my php script.
>
> Ronald
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
.---------------------------------------------.
| Worlds of Carnage - http://www.wocmud.org |
:---------------------------------------------:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the |
| stuff of nightmares grasp for your soul. |
`---------------------------------------------'
attached mail follows:
Hi,
I want to add i18n support for my web site, but
it doesn't seem to work.
PHP 4.3.3., Apache 1.3.28, Mandrake 9.0
Here comes the test code. As you can see I try all sorts of things.
<?php
echo putenv("LANG=de") . '<br>';
echo putenv("LC_ALL=de") . '<br>';
echo setlocale(LC_ALL, "de", "german") . '<br>';
echo bindtextdomain("messages", "/www/locale") . '<br>';
echo textdomain("messages") . '<br>';
echo gettext("User") . '<br>';
echo strftime ("%A %e %B %Y", time()) . '<br>';
?>
The funny thing is that strftime prints correctly.
Any ideas
Catalin.
attached mail follows:
Hello,
Try:
putenv("LANG=de_DE") . '<br>';
putenv("LC_ALL=de_DE") . '<br>';
setlocale(LC_ALL, "de_DE", "german") . '<br>';
Desi
Catalin Trifu wrote:
> Hi,
>
> I want to add i18n support for my web site, but
> it doesn't seem to work.
> PHP 4.3.3., Apache 1.3.28, Mandrake 9.0
> Here comes the test code. As you can see I try all sorts of things.
>
> <?php
> echo putenv("LANG=de") . '<br>';
> echo putenv("LC_ALL=de") . '<br>';
> echo setlocale(LC_ALL, "de", "german") . '<br>';
> echo bindtextdomain("messages", "/www/locale") . '<br>';
> echo textdomain("messages") . '<br>';
>
> echo gettext("User") . '<br>';
>
> echo strftime ("%A %e %B %Y", time()) . '<br>';
> ?>
>
> The funny thing is that strftime prints correctly.
> Any ideas
>
> Catalin.
attached mail follows:
Hi,
Thanks for the reply, but it doesn't work
this way either.
in /www/locale I do have
de/
LC_MESSAGES/
messages.mo
de_DE/
LC_MESSAGES/
messages.mo
btw! on win32 it works :(
Catalin
"Desi" <desi
mediate.sk> wrote in message
news:20030904140349.97568.qmail
pb1.pair.com...
> Hello,
>
> Try:
>
> putenv("LANG=de_DE") . '<br>';
> putenv("LC_ALL=de_DE") . '<br>';
> setlocale(LC_ALL, "de_DE", "german") . '<br>';
>
> Desi
>
>
> Catalin Trifu wrote:
> > Hi,
> >
> > I want to add i18n support for my web site, but
> > it doesn't seem to work.
> > PHP 4.3.3., Apache 1.3.28, Mandrake 9.0
> > Here comes the test code. As you can see I try all sorts of things.
> >
> > <?php
> > echo putenv("LANG=de") . '<br>';
> > echo putenv("LC_ALL=de") . '<br>';
> > echo setlocale(LC_ALL, "de", "german") . '<br>';
> > echo bindtextdomain("messages", "/www/locale") . '<br>';
> > echo textdomain("messages") . '<br>';
> >
> > echo gettext("User") . '<br>';
> >
> > echo strftime ("%A %e %B %Y", time()) . '<br>';
> > ?>
> >
> > The funny thing is that strftime prints correctly.
> > Any ideas
> >
> > Catalin.
attached mail follows:
Send me your messages.po file, I try it... Gettext is cool, it works
very well for me...
Desi
Catalin Trifu wrote:
> Hi,
>
> Thanks for the reply, but it doesn't work
> this way either.
> in /www/locale I do have
> de/
> LC_MESSAGES/
> messages.mo
> de_DE/
> LC_MESSAGES/
> messages.mo
>
> btw! on win32 it works :(
>
> Catalin
>
> "Desi" <desi
mediate.sk> wrote in message
> news:20030904140349.97568.qmail
pb1.pair.com...
>
>>Hello,
>>
>>Try:
>>
>>putenv("LANG=de_DE") . '<br>';
>>putenv("LC_ALL=de_DE") . '<br>';
>>setlocale(LC_ALL, "de_DE", "german") . '<br>';
>>
>>Desi
>>
>>
>>Catalin Trifu wrote:
>>
>>> Hi,
>>>
>>> I want to add i18n support for my web site, but
>>>it doesn't seem to work.
>>> PHP 4.3.3., Apache 1.3.28, Mandrake 9.0
>>> Here comes the test code. As you can see I try all sorts of things.
>>>
>>><?php
>>> echo putenv("LANG=de") . '<br>';
>>> echo putenv("LC_ALL=de") . '<br>';
>>> echo setlocale(LC_ALL, "de", "german") . '<br>';
>>> echo bindtextdomain("messages", "/www/locale") . '<br>';
>>> echo textdomain("messages") . '<br>';
>>>
>>> echo gettext("User") . '<br>';
>>>
>>> echo strftime ("%A %e %B %Y", time()) . '<br>';
>>>?>
>>>
>>> The funny thing is that strftime prints correctly.
>>> Any ideas
>>>
>>>Catalin.
attached mail follows:
Catalin Trifu wrote:
>>Try:
>>
>>putenv("LANG=de_DE") . '<br>';
>>putenv("LC_ALL=de_DE") . '<br>';
>>setlocale(LC_ALL, "de_DE", "german") . '<br>';
I would have done this:
putenv("LANG=de_DE");
putenv("LANGUAGE=de_DE"); // better to be paranoid, works for me ;-)
putenv("LC_ALL=de_DE");
setlocale(LC_ALL, "de_DE", "german");
(see some user comments in php manual)
Then you can try to reload the apache webserver
(because of the gettext cache, which could hide modifications).
"/etc/init.d/apache reload" on a Debian GNU/Linux system.
"/etc/rc.d/httpd reload" on RedHat likes
Perhaps check german locales are correctly installed on the *nix server.
(php uses the setlocale() system call). Yes, locales are system
specific. It should be better documented in the php manual :(
> btw! on win32 it works :(
I solved it the stupid way, because locale names are different on *nix
and windows (ex: fr_BE vs French_Belgium). On my test systems, some
aliases were common (french, dutch, german) but the path where php looks
for the mo file was different (ex fr_BE vs french, de_DE vs german).
So I simply copied the /de_DE dir to /german and so on.
(for french, I had fr/, fr_BE/ and french/ as dir for it to work
on 2 linux servers and 1 test NT server :(
Hope it helps,
--
Christophe Chisogne
Developper, Publicityweb sprl
http://www.publicityweb.com
attached mail follows:
Thank you!
> putenv("LANG=de_DE");
> putenv("LANGUAGE=de_DE"); // better to be paranoid, works for me ;-)
this one did the trick !
> putenv("LC_ALL=de_DE");
> setlocale(LC_ALL, "de_DE", "german");
>
> (see some user comments in php manual)
i already read the all before posting here :)
Again thx,
Catalin
attached mail follows:
Hi ccj,
GET data is passed in the URL, POST data is not so loss of the
information would be expected. It sounds like you should use sessions,
it is a better way of passing data between pages.
Take a look at http://www.php.net/manual/en/ref.session.php
Jason
ccj wrote:
>Hi all
>
>Based on descriptions in /urlhowto.php -- Get it on your site,
>I tried to redirect GET/POST data to a third page, say,
>
>aaa.php ---> error.php ---> bbb.php
>====
>aaa.php:
> <form action="unknown.php" method="GET">
> ....
>====
>error.php:
> <?
> $QSTRING = $_SERVER['REDIRECT_QUERY_STRING'] ;
> ....
> Header("Location: bbb.php?" . $QSTRING) ;
> ?>
>====
>Everything goes right with GET method, but POST goes wrong in error.php:
>
>The $HTTP_RAW_POST_DATA is lost.
>The error.php page could not get the posted data.
>
>Any idea ?
>
>Regards,
>CCJ
>
>
>
attached mail follows:
Thanks, but it's not the point, I think.
Because from aaa.php --> error.php is redirected by Apache.
The error.php could not get the POST data via $HTTP_RAW_POST_DATA.
If aaa.php send POST data to a existing file , say ccc.php,
of course we can get $_POST, $HTTP_RAW_POST_DATA in ccc.php,
But if aaa.php send POST data to a non-existing file , say bbb.php,
The apache redirects to error.php
(Via the mirror site setting : ERROR 401 /error.php in httpd.conf)
Thus the error.php can get some REDIRECT_XXXX variables,
but not $_POST, nor $HTTP_RAW_POST_DATA.
So the session does not work in this case.
Best Regards,
CCJ
> GET data is passed in the URL, POST data is not so loss of the
> information would be expected. It sounds like you should use sessions,
> it is a better way of passing data between pages.
>
> Take a look at http://www.php.net/manual/en/ref.session.php
>
> Jason
>
>
> ccj wrote:
>
> >Hi all
> >
> >Based on descriptions in /urlhowto.php -- Get it on your site,
> >I tried to redirect GET/POST data to a third page, say,
> >
> >aaa.php ---> error.php ---> bbb.php
> >====
> >aaa.php:
> > <form action="unknown.php" method="GET">
> > ....
> >====
> >error.php:
> > <?
> > $QSTRING = $_SERVER['REDIRECT_QUERY_STRING'] ;
> > ....
> > Header("Location: bbb.php?" . $QSTRING) ;
> > ?>
> >====
> >Everything goes right with GET method, but POST goes wrong in error.php:
> >
> >The $HTTP_RAW_POST_DATA is lost.
> >The error.php page could not get the posted data.
> >
> >Any idea ?
> >
> >Regards,
> >CCJ
> >
> >
> >
attached mail follows:
I'm fairly new to apache so if I say something wrong, that's why.
Anyways, I have my virtual host set up in my httpd.conf file as
follows:
<VirtualHost *>
Port 80
DocumentRoot /blah/blah/blah
ServerName www.register_globals_must_be_on.com
php_value include_path ".:/blah/blah/blah:/blah"
php_value register_globals 1
</VirtualHost>
I don't want it to be set to on for any of my other sites but for this
site, it has to be on. Looking at:
http://us3.php.net/register_globals
I see that the way that I'm turning it on in the container is correct.
However, if the value is set to '1', I can't get to the site at all. If
it is set to '0', I have no problems and can access the site normally.
I don't see anything in apache's error or access log that would give
any clue as to what is going wrong.
Does the above configuration look wrong to anyone? Should I be
doing it differently?
thnx,
Chris
attached mail follows:
okay, i know this is stupid, and i'm gonna kick myself when someone points
out the obvious...
i've just put a site online, and found the server's running an older version
of php (4.06). it's virtual hosting, so i have no control over this... also
can't tell you what OS it's running, but it is windows based...
the code works locally, although i had to change all $_COOKIE to
$HTTP_COOKIE_VARS, same with $_POST, $_SERVER, etc. etc.
i've had a quick look through the archives, and googled, but can't find much
help around for older installs of php.
my code, like i said, the functionality works, but it's just plain not
sending the cookie, my little print statements show up and all, but i get no
error, and i also get no cookie.
<?
$error=2;
require_once("../inc/db.inc.php");
db_connect('babc');
if(isset($HTTP_GET_VARS['logout']))
{
setcookie("UserName", "", time()-(60*60*24));
setcookie("Password", "", time()-(60*60*24));
print "logout";
$error=2;
}elseif(isset($HTTP_POST_VARS['login'])){
$SQL = "...";
$res = mysql_query($SQL) or die( mysql_errno." query error" );
$numRows = mysql_num_rows($res);
if($numRows==1)
{
extract(mysql_fetch_array($res));
setcookie("UserName", $HTTP_POST_VARS['UserName'], time()+(60*10), "/",
$HTTP_SERVER_VARS['SERVER_NAME']);
setcookie("Password", $password, time()+(60*10), "/",
$HTTP_SERVER_VARS['SERVER_NAME']);
print "login - set cookie";
$error=0;
}else{
$error=1;
}
}elseif (isset($HTTP_COOKIE_VARS ['UserName']) && isset($HTTP_COOKIE_VARS
['Password'])){
$SQL = "...";
$res = mysql_query($SQL) or die( mysql_errno." query error" );
$numRows = mysql_num_rows($res);
if($numRows==1)
{
extract(mysql_fetch_array($res));
setcookie("UserName", $HTTP_COOKIE_VARS['UserName'], time()+(60*10), "/",
$HTTP_SERVER_VARS['SERVER_NAME']);
setcookie("Password", $password, time()+(60*10), "/",
$HTTP_SERVER_VARS['SERVER_NAME']);
print "already logged in";
$error=0;
}else{
$error=1;
setcookie("UserName", "", time()-(60*60*24));
setcookie("Password", "", time()-(60*60*24));
print "problem with login, logout";
}
}
?>
attached mail follows:
> setcookie("UserName", $HTTP_POST_VARS['UserName'], time()+(60*10), "/",
> $HTTP_SERVER_VARS['SERVER_NAME']);
> setcookie("Password", $password, time()+(60*10), "/",
> $HTTP_SERVER_VARS['SERVER_NAME']);
> print "login - set cookie";
sorry for kinda answering my own post... but anyway...
setcookie("UserName", $HTTP_POST_VARS['UserName']);
setcookie("Password", $password);
solves my problem, although means i can't have a time limit on my cookies i
guess... but can set a time limit with another cookie...
attached mail follows:
> sorry for kinda answering my own post... but anyway...
Or you could use header()..
http://wp.netscape.com/newsref/std/cookie_spec.html
attached mail follows:
> > setcookie("UserName", $HTTP_POST_VARS['UserName'],
> time()+(60*10), "/",
> > $HTTP_SERVER_VARS['SERVER_NAME']);
> > setcookie("Password", $password, time()+(60*10), "/",
> > $HTTP_SERVER_VARS['SERVER_NAME']);
> > print "login - set cookie";
>
>
> sorry for kinda answering my own post... but anyway...
>
> setcookie("UserName", $HTTP_POST_VARS['UserName']);
> setcookie("Password", $password);
>
> solves my problem, although means i can't have a time limit on my
> cookies i
> guess... but can set a time limit with another cookie...
1.) I would not store the user's password in a cookie.
2.) As far as I know, set_cookie() has worked the same since PHP3, so your
problem is something else, not the PHP version. Are you sure
$HTTP_SERVER_VARS['SERVER_NAME'] is the same as what's in the location bar
in your browser. If the server name is set up as www.domain.com but the
user is just at http://domain.com the cookie won't set.
attached mail follows:
Hi,
I am just starting to understand how the session handling routines work in
php.
I can pass objects to other scripts. So I can put the language into the
object that the visitor chose at the very first page.
But what if a visitor bookmarked my homepage and comes back after a few
weeks.
How can I guarantee that a language is always choosen? I mean how is this
done professionally?
What do I have to write at the beginning of every page?
I hope it is clear what I am asking.
Thank you very much.
attached mail follows:
[snip]
How can I guarantee that a language is always choosen? I mean how is
this
done professionally?
What do I have to write at the beginning of every page?
[/snip]
You have a bunch of options.
on each page you could add something like this to everypage:
if (!isset($_SESSION['language'])){
header("Location: pick_language.php");
}
This will make sure you have a language chosen on each page
to set the language sessions variable you could use something like
this:
$_SESSION['language'] = $_POST['language'];
You could set a permanent cookie (be careful because some users block
cookies) once the user picks a language, then use that cookie to set a
session variable. This would be helpful is someone bookmarked the page,
something like this:
if (isset($_COOKIE['language'])) {
$_SESSION['language'] = $_COOKIE['language'];
}
but there is many more ways to do this. I would try a bunch of
differnet things just to see how things work.
attached mail follows:
* Thus wrote Webmaster (webmaster
dentona.de):
> Hi,
>
> I am just starting to understand how the session handling routines work in
> php.
> I can pass objects to other scripts. So I can put the language into the
> object that the visitor chose at the very first page.
> But what if a visitor bookmarked my homepage and comes back after a few
> weeks.
> How can I guarantee that a language is always choosen? I mean how is this
> done professionally?
> What do I have to write at the beginning of every page?
>
> I hope it is clear what I am asking.
You should check the 'Accept-Language' header [1] that the client
usually sends:
$languages = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
you'll have a string like: en;q=1.0, de;q=0.9, da;q=0.1
meaning that the user prefers english but if you don't have an
english translation, give me german, and last but not least, I can
read danish a bit.
If the client doesn't have the header then direct them to a page
that has them select their language choice. Then handle their
choice with session data [2].
I would have the session data override the Accept-language header
so that the user can manually override his browser settings.
You can see how google [3] does things by modifying your language
settings in your browser and your personal google settings. IMO
they have a very nice language detection system.
[1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4
[2] http://php.net/session
[3] http://www.google.com/
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
From: "Ralph Guzman" <ralph213
sbcglobal.net>
> I know this question is best for the mySQL mailing list, but I am unable
> to subscribe to their list at this moment so perhaps somebody here can
> help me out.
>
> I have a table with a field where amenities are listed together using a
> comma delimiter like: pool,spa,fitness-center
>
> To search this table I use a query that looks something like this:
>
> SELECT * FROM properties WHERE amenities LIKE '%pool%' AND amenities
> LIKE '%spa%' AND amenities LIKE '%fitness-center%'
>
> This works, however let's say the user chooses to search for more
> amenities. This means the query would need multiple 'AND amenities LIKE
> '%____%' statements.
>
> Is there a better way to write this?
You could use FIND_IN_SET().
SELECT * FROM properties WHERE FIND_IN_SET('pool',amenities) AND
FIND_IN_SET('spa',amenities) AND ...
It'll still grow as the number of amentities grow, but there's no getting
around that.
---John Holmes...
attached mail follows:
> From: "Ralph Guzman" <ralph213
sbcglobal.net>
>
>
>> I know this question is best for the mySQL mailing list, but I am unable
>> to subscribe to their list at this moment so perhaps somebody here can
>> help me out.
>>
>> I have a table with a field where amenities are listed together using a
>> comma delimiter like: pool,spa,fitness-center
Mmm.. I'm jumping in late, and without knowledge of your app, but why not
normalise that column to its own table:
recid masterrec amenity
1 22 pool
2 22 spa
3 12 fitness-center
And run a unique key across all three columns (or drop recid and use two
columns).
select masterrec from amenities where amenity = ....
The query will still grow in length, but it may be easier to work with..
*shrug*
attached mail follows:
I have a server running Redhat 7.3 and PHP version 4.1.2.###. I have a
user that needs for me to load a version of PHP 4.2.1 or higher. What I
want to know is this available for version 7.3 of Linux?
attached mail follows:
--- Jalene Joyner <Jalene.Joyner
mail.state.ar.us> wrote:
> I have a user that needs for me to load a version of PHP 4.2.1 or
> higher. What I want to know is this available for version 7.3 of
> Linux?
Yes, although I think you mean to say Red Hat or SuSe or something, as the
latest test version of Linux is only 2.6.0.
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/
attached mail follows:
Hello,
I am using a mailing list script which makes use of a function called -f,
according to the developers of the script. The fact is that some
functionality of the script is not working and the developers claim -f is
turned off in my system. I've looked everywhere trying to find info about
this, but only found a small, not very enlightening, reference in the php
manual under the function "mail." Anyone knows where to find info about -f?
Thanks
Guillermo Scharffenorth
attached mail follows:
* Thus wrote Guillermo Scharffenorth (gscharf
cantv.net):
> Hello,
>
> I am using a mailing list script which makes use of a function called -f,
> according to the developers of the script. The fact is that some
> functionality of the script is not working and the developers claim -f is
> turned off in my system. I've looked everywhere trying to find info about
> this, but only found a small, not very enlightening, reference in the php
> manual under the function "mail." Anyone knows where to find info about -f?
Its the fifth paramater to mail():
http://php.net/manual/en/function.mail.php
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
Hi all,
Does anyone know of a PHP-oriented tool that achieves some of / all of
/ more than the things that smartypants
(http://daringfireball.net/projects/smartypants/) does?
For those too lazy for the link, it does smart/curly quote replacement,
and a bunch of other cool ASCII => HTML conversions.
There is a Perl port, and I'm considering either writing a PHP port, or
writing a PHP based script with a similar (but smaller) feature set
from scratch.
I also want to achieve:
- a semantically correct version of nl2br() (converting the text into
<p>paragraphs</p>)
- automatic list generation, eg:
convert:
* something
* something else
* a third, exciting something
into:
<ul>
<li>something </li>
<li>something else </li>
<li>a third, exciting something </li>
</ul>
- and some other things i've got in my head
So, if anyone has seen anything similar (or part thereof), can they
please provide a link or snippet.
Please, not interested in non-PHP solutions (exec()'ing a Perl script
for example), because I want it to run on a base PHP install, and
integrate effortlessly into my CMS.
TIA
Justin French
attached mail follows:
Theres absolutely no control over session.save_path parameter in php. By
setting it to every directory he wants, every user can:
1. (!!!) Absolutely easily generate new sessions with any content for every
site on server.
2. Delete other users sessions by setting gc to 100 and probably legal files
starting with sess_*.
3. Flood every http server writable directory with thousands or millions
files.
session.save_path should be controlled under open_basedir variable or some
other mechanism.
attached mail follows:
* Thus wrote Rx (rxx
pisem.net):
> Theres absolutely no control over session.save_path parameter in php. By
> setting it to every directory he wants, every user can:
You can set the value with
php_admin_value save_path "/tmp"
>
> 1. (!!!) Absolutely easily generate new sessions with any content for every
> site on server.
prevented with open_basedir. Can you demonstrate how you expect to
do this? Using open_basedir most can also resovle this issue.
> 2. Delete other users sessions by setting gc to 100 and probably legal files
> starting with sess_*.
This might be a valid point if you also mention that if the user
sets gc_maxlifetime to a value of 1 or lower than cache_expire,
and the gc_probablity at 100. Although I havn't tested, and
probably should be.
I'm also not sure but technically gc_maxlifetime should never be
lower than cache_expire, if this is the case then there no issues
with setting gc_probablity to 100, cept for a bunch of overhead for
the users script.
> 3. Flood every http server writable directory with thousands or millions
> files.
Don't allow the person to create files. That is the only way to
prevent a user of doing this regardless of the save_path parameter.
>
> session.save_path should be controlled under open_basedir variable or some
> other mechanism.
Perhaps a better solution would be to have a php.ini setting for
disabling ini settings:
disable_ini session.save_path,session.gc_maxlifetime
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
"Curt Zirzow" <php-general
zirzow.dyndns.org> wrote in message
news:20030904174728.GB16462
bagend.shire...
> * Thus wrote Rx (rxx
pisem.net):
> > Theres absolutely no control over session.save_path parameter in php. By
> > setting it to every directory he wants, every user can:
>
> You can set the value with
> php_admin_value save_path "/tmp"
If i set php_admin_value, user STILL can change the value with ini_set()! I
tested it. php_admin_value only prevents changing value from .htaccess file.
Actually this also make sense for me, values set by php_admin_value shouldnt
be allowed to change ever.
>
> >
> > 1. (!!!) Absolutely easily generate new sessions with any content for
every
> > site on server.
>
> prevented with open_basedir. Can you demonstrate how you expect to
> do this? Using open_basedir most can also resovle this issue.
>
You didnt understand. I change save.session_path to other's site session
directory, do session_start(), write every variable what i want, write down
session number, go to this site and using this generated session. You cannt
prevent this ever!
> > 2. Delete other users sessions by setting gc to 100 and probably legal
files
> > starting with sess_*.
>
> This might be a valid point if you also mention that if the user
> sets gc_maxlifetime to a value of 1 or lower than cache_expire,
> and the gc_probablity at 100. Although I havn't tested, and
> probably should be.
>
> I'm also not sure but technically gc_maxlifetime should never be
> lower than cache_expire, if this is the case then there no issues
> with setting gc_probablity to 100, cept for a bunch of overhead for
> the users script.
>
Hm, what the connection with cache_expire? User set gc to 100 and
maxlifetime to 1 sec, then that script will delete every session in
directory.
>
> > 3. Flood every http server writable directory with thousands or millions
> > files.
>
> Don't allow the person to create files. That is the only way to
> prevent a user of doing this regardless of the save_path parameter.
>
No, its not a valid point. Every user can access only certain directory with
apache permissions or with his own. And i know which directory belongs to
whom. However with session.save_path user can flood EVERY directory on
server, and even i wont know which user did that!
> >
> > session.save_path should be controlled under open_basedir variable or
some
> > other mechanism.
>
> Perhaps a better solution would be to have a php.ini setting for
> disabling ini settings:
>
> disable_ini session.save_path,session.gc_maxlifetime
>
Well i agree, that should be done too.
>
>
> Curt
> --
> "I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
* Thus wrote Rx (rxx
pisem.net):
>
> "Curt Zirzow" <php-general
zirzow.dyndns.org> wrote in message
> news:20030904174728.GB16462
bagend.shire...
> > * Thus wrote Rx (rxx
pisem.net):
> >
> > You can set the value with
> > php_admin_value save_path "/tmp"
>
> If i set php_admin_value, user STILL can change the value with ini_set()! I
> tested it. php_admin_value only prevents changing value from .htaccess file.
> Actually this also make sense for me, values set by php_admin_value shouldnt
> be allowed to change ever.
I was not aware of this.
>
> >
> > >
> >
>
> You didnt understand. I change save.session_path to other's site session
> directory, do session_start(), write every variable what i want, write down
> session number, go to this site and using this generated session. You cannt
> prevent this ever!
hm. yes, I see your point on this.
>
> > > 2. Delete other users sessions by setting gc to 100 and probably legal
> files
> > > starting with sess_*.
> >
> > I'm also not sure but technically gc_maxlifetime should never be
> > lower than cache_expire, if this is the case then there no issues
> > with setting gc_probablity to 100, cept for a bunch of overhead for
> > the users script.
> >
> Hm, what the connection with cache_expire? User set gc to 100 and
> maxlifetime to 1 sec, then that script will delete every session in
> directory.
The conection is that the gc shouldn't clean up a session that has
a lifetime still. so if gc_maxlifetime = 9 and cache_expire = 10,
gc shouldn't clean up anything less than 11.
But then, this is a mute point since if you change cache_expire
at run time, gc wont know the difference.
>
> > Don't allow the person to create files. That is the only way to
> > prevent a user of doing this regardless of the save_path parameter.
> >
>
> No, its not a valid point. Every user can access only certain directory with
> apache permissions or with his own. And i know which directory belongs to
> whom. However with session.save_path user can flood EVERY directory on
> server, and even i wont know which user did that!
Thanks for clarifying this. I was not thinking on the same line as
you. So a malicious user can do something like:
while (1) {
session_save_path(pick_a_writeabledir());
session_start();
session_write_close();
}
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
>>You didnt understand. I change save.session_path to other's site session
>>directory, do session_start(), write every variable what i want, write down
>>session number, go to this site and using this generated session. You cannt
>>prevent this ever!
Does enabling safe_mode counter any of these writing file issues?
We all know the solution is to have a dedicated server, of course. :)
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
attached mail follows:
* Thus wrote John W. Holmes (holmes072000
charter.net):
> >>You didnt understand. I change save.session_path to other's site session
> >>directory, do session_start(), write every variable what i want, write
> >>down
> >>session number, go to this site and using this generated session. You
> >>cannt
> >>prevent this ever!
>
>
> Does enabling safe_mode counter any of these writing file issues?
unfortantly no.
>
> We all know the solution is to have a dedicated server, of course. :)
Or a jailed system, usually a bit cheaper for the client.
Perhaps that is the best way to go as a hosting company, and only
offer a really locked down (disabling a bunch of functions) to
simple virtual hosts.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
Mmmmm, very interesting thread, thanx for starting this. Good comments curt.
>>1. (!!!) Absolutely easily generate new sessions with any content for every
>>site on server.
>>
>>
>
>
>
It's because of the 'suspect' nature of sessions and cookies that i
never place userid,username or password in sessions. My tactic is to
aways have 2 column mysql table and store session identifier and
corresponding userid in it. So even if someone does create a bogus
session they still have to find a way to insert a userid into the mysql db.
>3. Flood every http server writable directory with thousands or millions
>files.
>
>
set quotas. Some admins even set quota for the root user, which is
inconvinient by safe.
>
>
--
http://www.raditha.com/php/progress.php
A progress bar for PHP file uploads.
attached mail follows:
Hi all
Can someone tell me what the correct syntax is to pass
a Session ID via the header redirect is? Im trying:
header( "Location: page2.php?<?echo strip_tags
(SID)?>" )
but it isnt working for me and all the docs i can find
just deal with tagging it to the end of a hyperlink.
Any help would be greatly appreciated!
________________________________________________________________________
Want to chat instantly with your online friends? Get the FREE Yahoo!
Messenger http://mail.messenger.yahoo.co.uk
attached mail follows:
bob pilly wrote:
> Hi all
>
> Can someone tell me what the correct syntax is to pass
> a Session ID via the header redirect is? Im trying:
>
> header( "Location: page2.php?<?echo strip_tags
> (SID)?>" )
> but it isnt working for me and all the docs i can find
> just deal with tagging it to the end of a hyperlink.
header("Location: page2.php?" . SID);
You should use a complete URL, btw, including http:// and the domain name.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
attached mail follows:
At 18:33 4-9-03, you wrote:
>Hi all
>
>Can someone tell me what the correct syntax is to pass
>a Session ID via the header redirect is? Im trying:
>
>header( "Location: page2.php?<?echo strip_tags
>(SID)?>" )
You are making a row of mistakes that suggest it is a good idea to read a
bit on PHP syntax and how variables are passed over pages.
For instance, you are calling a php function such as header(), you are
already inside php tags (<?PHP and ?>), or at least you SHOULD be.
Then, you work with SID, is that a CONSTANT ?
A good place to start is the first chapters of the online php manual on
uk.php.net/manual/en and a tutorial on sessions on
http://www.phpfreaks.com/tutorials/41/0.php
attached mail follows:
On Thu, 2003-09-04 at 09:33, bob pilly wrote:
> Hi all
>
> Can someone tell me what the correct syntax is to pass
> a Session ID via the header redirect is? Im trying:
>
> header( "Location: page2.php?<?echo strip_tags
> (SID)?>" )
header( "Location: page2.php?". strip_tags( SID ) );
the problem you are having is that you are already inside php tags when
you are using the header function and don't need to make new php tags to
use the echo statement. and for that matter, you don't need to use the
echo statement at all. just append the SID to the end of the location.
> but it isnt working for me and all the docs i can find
> just deal with tagging it to the end of a hyperlink.
>
> Any help would be greatly appreciated!
>
>
>
> ________________________________________________________________________
> Want to chat instantly with your online friends? Get the FREE Yahoo!
> Messenger http://mail.messenger.yahoo.co.uk
--
Tyler Lane <tlane
lyrical.net>
Lyrical Communications
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQA/V3ZfnV+u8RFxEIMRAgg5AJ9+a+ApJyKjO/J/bEVuvu+F7ZYH+QCggsa7
cqvl553cQtupVYJTKUIa8Tw=
=kNeu
-----END PGP SIGNATURE-----
attached mail follows:
How can I provide a link which will log the current user out so that they
will be prompted again to login. I'm using frontpage authentication on an
apache server. I'm using PHP4 to build the pages.
Thanks,
--John
attached mail follows:
[snip]
How can I provide a link which will log the current user out so that
they
will be prompted again to login. I'm using frontpage authentication on
an
apache server. I'm using PHP4 to build the pages.
[/snip]
Are you taking the frontpage variables into PHP? If so you can unset()
those variables.
attached mail follows:
I'm only accessing the result of the user logging in through
$GLOBALS["PHP_AUTH_USER"]
I've tried unsetting that but it doesn't change anything. The only thing
that logs a user out is them closing their browser and reopening it. I'd
like a user to be able to switch usernames by clicking a link that would
accomplish the same thing that closing the browser does. Perhaps I need
clientside scripting for this?
Thanks,
--John
"Jay Blanchard" <jay.blanchard
niicommunications.com> wrote in message
news:C8F323573C030A448F3E5A2B6FE2070B01AFA798
nemesis...
[snip]
How can I provide a link which will log the current user out so that
they
will be prompted again to login. I'm using frontpage authentication on
an
apache server. I'm using PHP4 to build the pages.
[/snip]
Are you taking the frontpage variables into PHP? If so you can unset()
those variables.
attached mail follows:
John Welty wrote:
> I'm only accessing the result of the user logging in through
> $GLOBALS["PHP_AUTH_USER"]
>
> I've tried unsetting that but it doesn't change anything. The only thing
> that logs a user out is them closing their browser and reopening it. I'd
> like a user to be able to switch usernames by clicking a link that would
> accomplish the same thing that closing the browser does. Perhaps I need
> clientside scripting for this?
There's no way to log out of Basic Authentication except by closing your
browser. There is one trick you can try, though. You can provide a link
to your side with a bad username and password, which will fail
authentication, and then redirect them back to the login page (assuming
that's what your application does). Have a "logout" link that points to
something like http://baduser:badpassword
www.yourdomain.com
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
attached mail follows:
* Thus wrote John W. Holmes (holmes072000
charter.net):
> John Welty wrote:
>
> >I'm only accessing the result of the user logging in through
> >$GLOBALS["PHP_AUTH_USER"]
> >
> >I've tried unsetting that but it doesn't change anything. The only thing
> >that logs a user out is them closing their browser and reopening it. I'd
> >like a user to be able to switch usernames by clicking a link that would
> >accomplish the same thing that closing the browser does. Perhaps I need
> >clientside scripting for this?
>
> There's no way to log out of Basic Authentication except by closing your
> browser. There is one trick you can try, though. You can provide a link
> to your side with a bad username and password, which will fail
> authentication, and then redirect them back to the login page (assuming
> that's what your application does). Have a "logout" link that points to
> something like http://baduser:badpassword
www.yourdomain.com
just to not frighten some end users (due to some browsers warning
about sending a password) mabey use:
http://user:logout
www.yourdomain.com/
That way the user can deduct at what it is doing and not worry
about sending it.
.0125
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
Dude stop being a jerk, I don't treat people this way... Ah, anyhow...
It's not me who will judge you.... Is it?
> -----Original Message-----
> From: Richard Schwartz [mailto:richas
earthlink.net]
> Sent: Thursday, September 04, 2003 11:28 AM
> To: Joe Harman
> Subject: Re: Thanks From Joe: ATM Archives and List Guidelines
>
>
> unsubscribe ***
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> OK, I already know your next post that will be such a great
> challenge. It
> will be a multipart question and all parts will have the same answer:
>
> 1. Where can I find a beautiful, bright, talented,
> compassionate, and well educated woman, half my age, who will
> love me and be devoted to me and our children.
>
> 2. Where can I find a doctor who will listen?
>
> 3. Where can I find a mechanic who will fix my car right the
> first time.
>
> 4. Where can I find an honest lawyer?
>
> 5. Where can I find a realtor who places community interests
> above profits?
>
>
>
>
> ----- Original Message -----
> From: "Joe Harman" <joe
harmanmedia.com>
> To: <atm
shore.net>
> Sent: Wednesday, September 03, 2003 9:42 PM
> Subject: Thanks From Joe: ATM Archives and List Guidelines
>
>
> >
> > <Cheers!>
> > Okay... Thanks to all of you... But this was the best email for
> > guidelines I have ever seen wrote. (the 11 below)... I will stick
> > through all the hazing... I promise... So filter me if you would
> > like... But I hope to soon be an asset to the list...
> >
> > My next post should be challenging to even the most
> seasoned ATMers...
> > I promise!
> >
> > </Cheers!>
> > Joe
> >
> > :o)
> >
> > > -----Original Message-----
> > > From: owner-atm
shore.net [mailto:owner-atm
shore.net] On
> Behalf Of
> > > George Anderson
> > > Sent: Wednesday, September 03, 2003 11:09 PM
> > > To: Joe Harman; atm
> > > Subject: Re: ATM Archives and List Guidelines
> > >
> > >
> > >
> > > Hi Joe
> > >
> > > Don't let the "rude manners" of some of the members put you off.
> > > They are actually quite nice people who are quite willing
> to share
> > > information and ideas. They are just a little cranky at
> responding
> > > to the same seven questions (you've asked the first) that
> get asked
> > > by all new members. Remember the two old guys on the muppet show?
> > > There are close to a thousand of us here. What you have just been
> > > through is sort of an initiation ceremony that most new members go
> > > through. The HTML thing is a combination of netiquette and
> > > the fact that some members pay by the byte and have slow
> > > connections. Besides the "read the archives" chant from
> > > almost every member you will encounter the following
> > > responses to questions that you will ask over the next few months.
> > >
> > > 1) Read the archives (stock answer for any question for which we
> > > may or may not have the answer)
> > >
> > > 2) Check Texereau, it is part of the requisite book list
> > >
> > > 3) Don't read Texereau, it is an outdated fascist novel
> > >
> > > 4) The answer is in Ingalls Book 2
> > >
> > > 5) Read the archives (I'm sure someone asked this same
> question back
> > > in
> > > '95)
> > >
> > > 6) Grind more worry less (actually very true and valuable)
> > >
> > > 7) Verify the secondary size with Newt
> > >
> > > 8) Don't use Newt, it doesn't give a true representation
> > >
> > > 9) Read the archives (Did I mention this yet?)
> > >
> > > 10) No it can't be done, Peter Hoffenstoffer tried that
> back in 98
> > > and the mirror suffered from stig and potatoe chipping (check the
> > > archives)
> > >
> > > 11) Yes it works, Peter fixed it with a new mirror cell and
> > > used/eliminated the sling in '99 (read the archives)
> > >
> > > And yes there is a Cabal in the ATM list, the proof is that they
> > > deny the presence of the Cabal. Why would they deny the
> presence if
> > > it didn't exist? <VBG> Pushing glass and making
> telescopes is a zen
> > > like pursuit, think back to the '70s and the show Kung-Fu
> "Can you
> > > snatch the pebble from my
> > > hand..." Welcome to the list Grasshopper.
> > >
> > > Hopefully none have been offended.
> > >
> > > George Anderson (who hasn't made enough mirrors to be
> allowed to be
> > > curmudgenly)
> > > Montreal Canada
> > >
> > > Clear skies and good health
> > >
> > > Joe Harman wrote:
> > > >
> > > > Hello,
> > > >
> > > > I really appreciate those who help here on this list... So
> > > thank you
> > > > to all of you... I've got a couple of really great
> > > recommendations...
> > > > I will be very honest about this, this list is extremely
> > > picky... NO
> > > > HTML Mail... Search the archives before you post.... So
> > > before I get
> > > > chewed out anymore, I am asking that someone please send me
> > > a link to
> > > > the guidelines for this mail list... And to the archives so I
> > > > don't accidentally offend anyone anymore... The site I got this
> > > email list
> > > > from listed no guidelines or archives.
> > > >
> > > > The majordomo response should include these guidelines when
> > > > someone subscribes. All I did was ask a question... I don't
> > > > deserve to get rude emails from people. The topic of this email
> > > > list is Amateur Telescope Makers, so I was thinking
> people would
> > > > be a
> > > little more open
> > > > to the fact that there could be a beginner here.
> > > >
> > > > Joe
> > >
> > >
> > >
> >
> >
> >
>
>
>
>
attached mail follows:
You should be more careful at whom your including these replies to :)
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
Curt Zirzow <mailto:php-general
zirzow.dyndns.org>
on Thursday, September 04, 2003 10:58 AM said:
> You should be more careful at whom your including these replies to :)
But public floggings are good every once in a while. :)
c.
attached mail follows:
Help:
--- problem
My page generated via a template can't find some javascript.
---- setup
I am hosted on Apache 1.*
I have a folder containing many *.html containing content which I want to be
displayed in another style of page.
Suppose there is
foo/
foo/content1.html
...
foo/contentN.html
foo/content1.js
foo/template.html
foo/js1.js
foo/js2.js
foo/slick.css
foo/slick.php
The content might have it's own style and javascript parts
template.html
---
<HTML>
<HEAD>
<TITLE>:title:</TITLE>
<LINK REL="stylesheet" HREF="slick.css" TYPE="text/css">
<SCRIPT SRC="js1.js" LANGUAGE="JavaScript"></SCRIPT>
<SCRIPT SRC="js2.js" LANGUAGE="JavaScript"></SCRIPT>
:script: :style: :link:
</HEAD>
<BODY>
<DIV ID="logo">Logo ...</DIV>
<DIV ID="main">
<DIV ID="links"><SCRIPT>/* navbar('js') */</SCRIPT></DIV>
<DIV ID="content">:content:</DIV>
</DIV>
<DIV ID="copyright">Copyright ...</DIV>
</BODY>
</HTML>
---
slick.css
---
div#logo { background: #AAA }
div#content { background: #DDD }
div#links { background: #CCC }
div#copyright { background: #EEE }
---
content1.html
---
<HTML>
<HEAD>
<TITLE>Content 1</TITLE>
<SCRIPT SRC="content1.js" LANGUAGE="JavaScript"></SCRIPT>
</HEAD>
<BODY>
<H1>Content is king</H1>
<SCRIPT LANGUAGE="JAVASCRIPT">
helloFromContent1()
</SCRIPT>
</BODY>
</HTML>
---
content1.js
---
function helloFromContent1 () {
document.write ('<P>Hello from content1.js</P>')
}
---
js1.js
---
alert ('js1 here')
---
js2.js
---
alert ('js2 here')
---
slick.php
---
<?
list ($slash, $page) = explode ('/', $HTTP_SERVER_VARS['PATH_INFO']);
if (!file_exists ($page)) {
header("HTTP/1.0 404 Not Found");
echo ("<HTML><HEAD><TITLE></TITLE></HEAD><BODY><P>$page not
found.</P></BODY></HTML>");
return;
}
$template = 'template.html';
$template = implode ("", file ($template));
$source = implode ("", file ($page));
preg_match ("|<HEAD.*?>(.*)?</HEAD>|is", $source, $head); // i
insensitive, s newlines are a character
preg_match ("|<TITLE.*>(.*)?</TITLE>|is", $head[1], $title);
preg_match_all ("|(<SCRIPT.*?>.*?/SCRIPT>)|isU",$head[1], $script); // U
ungreedy
preg_match_all ("|(<STYLE .*>.*/STYLE>)|isU", $head[1], $style);
preg_match_all ("|(<LINK .*>)|isU", $head[1], $link);
preg_match ("|<BODY.*?>(.*)</BODY>|is", $source, $content);
$title = isset($title [1]) ? $title[1] : '';
$script = isset($script [1]) ? implode ($script[1]) : '';
$style = isset($style [1]) ? implode ($style [1]) : '';
$link = isset($link [1]) ? implode ($link [1]) : '';
$content= isset($content[1]) ? $content[1] : '';
$html = preg_replace (
array ("/:title:/", "/:style:/", "/:script:/", "/:link:/",
"/:content:/" )
, array ( $title , $style , $script , $link , $content )
, $template
);
echo $html;
?>
---
I can do
- site.com/info/template.html and get two alerts
- site.com/info/content1.html and see a new text under H1
- site.com/info/slick.php/content1.html and get neither alert nor new text.
- instead I get 4 browser (IE) 'problem alerts', I presume
- 1. for not finding js1.js
- 2. for not finding js2.js
- 3. for not finding content1.js
- 4. for not finding helloFromContent1() function
I don't want to change my SRC references to be site absolute, I want them
relative.
Any ideas how I should 'wrap' my content using php and get functioning pages
?
Thanks
--
Richard A. DeVenezia
attached mail follows:
Hello Everyone,
I am running Red Hat Enterprise Linux ES release 2.1 (Panama).
Originally I was using the Red Hat PHP package. This package was not the
most current version so I removed it and compiled PHP 4.3.3.
Since doing this I am unable to set things like path using php_value in
a .htaccess file. The apache config is the same Red Hat default that is
in use on other boxes that are not having this problem. The only
difference between this box and boxes without the issue is the fact that
I compiled the 4.3.3 rather than going with the Red hat package.
The configure options I used are below.
I can do non-PHP things with the .htacess file like setup basic
authentication from a password file, so I know the .htaccess files are
being parsed.
Also Apache is unchanged from when this was not an issue. The only thing
changed is the removal of the old PHP install and re-install with 4.3.3.
Any help would be greatly appreciated.
Thanks,
JR
-----
John Rudnick
RHCE #808003122507415
MySQL Certification #206067847
SallyJo, Inc., provides Top Notch Web Hosting & Programming!
Ask me about Dedicated Hosting starting at just $89 per month.
./configure --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin
--sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --include
dir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec
--localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man
--infodir=/usr/share/info --prefix=/usr --with-config-file-path=/etc
--enable-force-cgi-redirect --disable-debug --enable-pic --disable-rpath
--enable-inline-optimization --with-bz2 --with-db3
--with-exec-dir=/usr/bin --with-freetype-dir=/usr --with-png-dir=/usr
--with-gd --enable-gd-native-ttf --with-ttf --with-gdbm --with-gettext
--with-ncurses --with-gmp --with-iconv --with-jpeg-dir=/usr --with-mm
--with-openssl --with-png --with-regex=system --with-xml
--with-expat-dir=/usr --with-zlib --with-layout=GNU --enable-bcmath
--enable-debugger --enable-exif --enable-ftp --with-pear=/usr/share/pear
--enable-magic-quotes --enable-safe-mode --enable-sockets
--enable-sysvsem --enable-sysvshm --enable-discard-path
--enable-track-vars --enable-trans-sid --enable-yp --enable-wddx
--without-oci8 --with-mysql --enable-memory-limit --enable-bcmath
--enable-shmop --enable-versioning --enable-calendar --enable-dbx
--enable-dio --enable-mbstring --enable-mbstr-enc-trans
--with-apxs=/usr/sbin/apxs
attached mail follows:
<-- snip -->
I can do
- site.com/info/template.html and get two alerts
- site.com/info/content1.html and see a new text under H1
- site.com/info/slick.php/content1.html and get neither alert nor new text.
- instead I get 4 browser (IE) 'problem alerts', I presume
- 1. for not finding js1.js
- 2. for not finding js2.js
- 3. for not finding content1.js
- 4. for not finding helloFromContent1() function
I don't want to change my SRC references to be site absolute, I want them
relative.
Any ideas how I should 'wrap' my content using php and get functioning pages
?
<-- snip -->
have you thoought about doing an echo on your script tags and do a getenv?
that way you can simulate a relative path
ie
it was
<SCRIPT SRC="js1.js" LANGUAGE="JavaScript"></SCRIPT>
<SCRIPT SRC="js2.js" LANGUAGE="JavaScript"></SCRIPT>
now
<?
echo "<SCRIPT SRC='(getenv("document_root")."/js1.js")' LANGUAGE='JavaScript'></SCRIPT>";
echo "<SCRIPT SRC='(getenv("document_root")."/js2.js")' LANGUAGE='JavaScript'></SCRIPT>";
?>
hope this takes care of some of your issues.
Chris
attached mail follows:
Hey all,
I'm curious if anyone else has ever come across this problem:
I have a multiple select box named 'chosen'. When it is submitted, only the
last option selected appears under $_POST['chosen'], when I print_r($_POST).
Any ideas?
Thanks in advance,
Steve
attached mail follows:
Did you remember the [] on the select field's name? Otherwise it will
treat data as a scalar and constantly overwrite until the last selected
entry is reached.
Cheers,
Rob.
On Thu, 2003-09-04 at 16:39, Steve Goodman wrote:
> Hey all,
> I'm curious if anyone else has ever come across this problem:
> I have a multiple select box named 'chosen'. When it is submitted, only the
> last option selected appears under $_POST['chosen'], when I print_r($_POST).
> Any ideas?
>
> Thanks in advance,
> Steve
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
.---------------------------------------------.
| Worlds of Carnage - http://www.wocmud.org |
:---------------------------------------------:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the |
| stuff of nightmares grasp for your soul. |
`---------------------------------------------'
attached mail follows:
Evans, thx for your effort.
I see what your says, as I noticed the trouble at 3 this morning!
This is how I fixed it...
$session = &Auth::_importGlobalVariable("session");
$session[$this->_sessionName]['data']['_loginAttempts'] =
$this->_loginAttempts;
Pretty much the way you indicated.
But then, as I read more, decoded the Class in my head more, I noticed that
they had a method to deal with this issue. So I figured I'd juut use that
method, in case something changes in future it won't bite me!
// Store class var in session data
Auth::setAuthData('_loginAttempts', $this->_loginAttempts);
Thanks for your help.
Walter
attached mail follows:
HI, i have the following problem
Im working with sql server 2000 in a windows xp pc, then in the bd i have a
table called "noticias" and a text type field, when i insert into the field
everything goes rigth, but when i try to get the info of teh field, i can
get all the info, is like the variable is not enough to save all the info
but im sure that all the info is in the bd, the code is the following:
$consulta = new BaseDatos;
$consulta->connect();
$sql = "select * from Noticias where Id=".$_GET["id"];
$res = $consulta->query($sql);
$not = $consulta->fetch_row($res);
$not["Descripcion"] = eregi_replace(chr(13),"<br>",$not["Descripcion"]);
echo $not["Descripcion"];
when i do an echo for $not["Descripcion"] i can see that it doesnt have all
the info of the field Descripcion on the table noticias.
can you help me please?, is urgent!
thanks!
Carlos A. Castillo.
Ingeniero de desarrollo
<mailto:ccastillo
imagine.com.co> ccastillo
imagine.com.co
____________________________________
Su Aliado Efectivo en Internet
<http://www.imagine.com.co/> www.imagine.com.co
(57 1)2182064 - (57 1)6163218
Bogotá - Colombia
____________________________________
- Soluciones web para Internet e Intranet
- Soluciones para redes
- Licenciamiento de Software
- Asesoría y Soporte Técnico
____________________________________
<http://skins.hotbar.com/Skins/mailskins/st/042802/042802hitech2_1.gif>
_____
<http://promos.hotbar.com/promos/promodll.dll?RunPromo&El=hotbar%5felement%3
bst%3b&SG=sub270&RAND=4007> Upgrade Your Email - Click here!
attached mail follows:
Carlos Castillo wrote:
>
> HI, i have the following problem
>
> Im working with sql server 2000 in a windows xp pc, then in the bd i have a
> table called "noticias" and a text type field, when i insert into the field
> everything goes rigth, but when i try to get the info of teh field, i can
> get all the info, is like the variable is not enough to save all the info
> but im sure that all the info is in the bd, the code is the following:
>
> $consulta = new BaseDatos;
> $consulta->connect();
> $sql = "select * from Noticias where Id=".$_GET["id"];
> $res = $consulta->query($sql);
> $not = $consulta->fetch_row($res);
> $not["Descripcion"] = eregi_replace(chr(13),"<br>",$not["Descripcion"]);
> echo $not["Descripcion"];
>
> when i do an echo for $not["Descripcion"] i can see that it doesnt have all
> the info of the field Descripcion on the table noticias.
If you're using a VARCHAR(x) column where x is greater than 255, then
you will not get anything past 255 characters. It's an issue with the
connection library to mssql. Use a text column for anything over 255
characters.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
attached mail follows:
First, do not use HTML email for posting questions to the list.
Take a look at:
$not = $consulta->fetch_row($res);
not familiar with your BaseDatos class, but fetch_row will normally
return an enumerated array, this means that rather than using
$not['Descripcion'] you should be using $not['0'], $not['1'], $not['2'],
etc.
if you want to use an associative array ($not['Descripcion']) you should
be using
$not = $consulta->fetch_array($res);
or
$not = $consulta->fetch_assoc($res);
-----Original Message-----
From: Carlos Castillo [mailto:ccastillo
imagine.com.co]
Sent: Thursday, September 04, 2003 2:34 PM
To: 'php-general
lists.php.net'
Cc: 'php-windows
lists.php.net'
Subject: [PHP] A bd problem
Importance: High
HI, i have the following problem
Im working with sql server 2000 in a windows xp pc, then in the bd i
have a table called "noticias" and a text type field, when i insert into
the field everything goes rigth, but when i try to get the info of teh
field, i can get all the info, is like the variable is not enough to
save all the info but im sure that all the info is in the bd, the code
is the following:
$consulta = new BaseDatos;
$consulta->connect();
$sql = "select * from Noticias where Id=".$_GET["id"];
$res = $consulta->query($sql);
$not = $consulta->fetch_row($res);
$not["Descripcion"] =
eregi_replace(chr(13),"<br>",$not["Descripcion"]);
echo $not["Descripcion"];
when i do an echo for $not["Descripcion"] i can see that it doesnt have
all the info of the field Descripcion on the table noticias.
can you help me please?, is urgent!
thanks!
Carlos A. Castillo.
Ingeniero de desarrollo
ccastillo
imagine.com.co
____________________________________
Su Aliado Efectivo en Internet
www.imagine.com.co
(57 1)2182064 - (57 1)6163218
Bogotá - Colombia
____________________________________
- Soluciones web para Internet e Intranet
- Soluciones para redes
- Licenciamiento de Software
- Asesoría y Soporte Técnico
____________________________________
attached mail follows:
I have been trying to write some image creation scripts, and although I have
a version of PHP that includes image support, I keep getting errors related
to imagecreatefrompng(). Here is the latest error:
Fatal error: Call to undefined function: imagecreatefrompng() in
/web/html-docs/psych/jb4920/public_html/pic/picture.php on line 12
Isn't imagecreatfrompng() a built in function? Anyone run across something
like this or a suggestion?
Thanks for the help!
Jed R. Brubaker
attached mail follows:
Hi,
RTFM: http://de.php.net/manual/en/ref.image.php
Cheers,
Catalin
"Jed R. Brubaker" <jed.brubaker
psych.utah.edu> wrote in message
news:20030904232855.34827.qmail
pb1.pair.com...
> I have been trying to write some image creation scripts, and although I
have
> a version of PHP that includes image support, I keep getting errors
related
> to imagecreatefrompng(). Here is the latest error:
>
> Fatal error: Call to undefined function: imagecreatefrompng() in
> /web/html-docs/psych/jb4920/public_html/pic/picture.php on line 12
>
> Isn't imagecreatfrompng() a built in function? Anyone run across something
> like this or a suggestion?
>
> Thanks for the help!
> Jed R. Brubaker
attached mail follows:
* Thus wrote Jed R. Brubaker (jed.brubaker
psych.utah.edu):
> I have been trying to write some image creation scripts, and although I have
> a version of PHP that includes image support, I keep getting errors related
> to imagecreatefrompng(). Here is the latest error:
>
> Fatal error: Call to undefined function: imagecreatefrompng() in
> /web/html-docs/psych/jb4920/public_html/pic/picture.php on line 12
>
> Isn't imagecreatfrompng() a built in function? Anyone run across something
> like this or a suggestion?
You need the png libraries installed. configure usually can figure
out where they are at but sometimes you may have to issue a
configure [other options] --with-png-dir=/path/to/libpng/dir/
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
But how do i get $files ?
thanks :)
John
Raditha Dissanayake wrote:
> this is in fact pretty easy.
> this should get you started
>
> [code]
> $files = split("\n",`ls *gif`);
> srand((double)microtime()*1000000);
>
> $num = rand(0, count($files));
> echo "$num = $files[$num]";
> [/code]
>
> John Taylor-Johnston wrote:
> >I have a directory jammed-packed with images.
> >I want to read the directory contents /www/usr/htm/images/
> >and display randomly any *.gif or *.jpg in said directory.
> >Do-able? Seriously? Ideas? Places to start?
--
John Taylor-Johnston
-----------------------------------------------------------------------------
"If it's not open-source, it's Murphy's Law."
Université de Sherbrooke:
http://compcanlit.ca/
attached mail follows:
John Taylor-Johnston <mailto:taylorjo
collegesherbrooke.qc.ca>
on Thursday, September 04, 2003 4:57 PM said:
> But how do i get $files ?
What do you mean "get $files"?
This line right here:
>> $files = split("\n",`ls *gif`);
"get"'s $files.
Try print_r($files); and see what happens.
Chris.
> thanks :)
> John
>
> Raditha Dissanayake wrote:
>
>> this is in fact pretty easy.
>> this should get you started
>>
>> [code]
>> $files = split("\n",`ls *gif`);
>> srand((double)microtime()*1000000);
>>
>> $num = rand(0, count($files));
>> echo "$num = $files[$num]";
>> [/code]
>>
>> John Taylor-Johnston wrote:
>>> I have a directory jammed-packed with images.
>>> I want to read the directory contents /www/usr/htm/images/
>>> and display randomly any *.gif or *.jpg in said directory.
>>> Do-able? Seriously? Ideas? Places to start?
>
> --
> John Taylor-Johnston
> -----------------------------------------------------------------------------
> "If it's not open-source, it's Murphy's Law."
> Université de Sherbrooke:
> http://compcanlit.ca/
attached mail follows:
I'm coming up against a brick wall on this one.
Can one cURL in a web page while automatically resolving all the relative
file paths? I've fooled around with regexp to resolve this issue, but it is
not a real stable solution.
I tried the archives and googled, but there appears to be no solution to
this.
Any advice?
ck
attached mail follows:
Ok I have loaded the new version of php 4.3.3, but now how in the world do I
enable PEAR? I have a couple of scripts that just