[PHP] user-defined superglobals?

2003-08-23 Thread Matthias Nothhaft
Hi List,

is there a way (mybe in php5?) to define/declare a global var as a 
superglobal, so that I can use this var like the known superglobals
($_GET, $_SESSION, etc.) ???

If not, is there a list for "feature requests"?

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


Re: [PHP] user-defined superglobals?

2003-08-23 Thread Matthias Nothhaft
Hi Ray Hunter, you wrote:
you can define your own superglobals by defining the vars first then
accessing them thru the $GLOBALS var.
example:



function test() {
  echo $GLOBALS['var1'];
  echo $GLOBALS['var2'];
  echo "Test\n"
}
test();

?>

That should get you started with globals.

Well, this is clear, (I'm only new in the list - not in PHP ;-) )
but I want it in a better/shorter way
for the "master var" of a big project!
Is there a way to request such a feature and where?
I think this would be nice for application frameworks!?
Maybe also for PEAR...
Regards,
Matthias

--
BigDog
On Sat, 2003-08-23 at 11:45, Matthias Nothhaft wrote:

Hi List,

is there a way (mybe in php5?) to define/declare a global var as a 
superglobal, so that I can use this var like the known superglobals
($_GET, $_SESSION, etc.) ???

If not, is there a list for "feature requests"?

Regards,
Matthias





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


Re: [PHP] user-defined superglobals?

2003-08-23 Thread Matthias Nothhaft
Sorry this all is not what I'm looking for.
I see it is not possible at the moment.
It would be nice to have a php-function like

declare_superglobal($_MYFRAMEWORK);

And then use $_MYFRAMEWORK like $_GET.

Thanks nevertheless.

Regards,
Matthias
Ray Hunter wrote:
Well, this is clear, (I'm only new in the list - not in PHP ;-) )
but I want it in a better/shorter way
for the "master var" of a big project!


Yes you can set up a master file that includes all your master
vars...many php developers call this a configuration script and name it
config.php.
This allows users to set up global variables that are used through out
the application.

Is there a way to request such a feature and where?
I think this would be nice for application frameworks!?
Maybe also for PEAR...


There are implementations of this all thru PEAR.

--
BigDog




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


Re: [PHP] Expiration time of a cookie

2003-08-23 Thread Matthias Nothhaft
Stevie D Peele wrote:
What is the longest expiration time of a cookie?

Hm, good question ;-)
A day has 86400 seconds.
Multiply it by 'enough' days (eg 365) and always refresh
your cookie's expiration. This might solve your problem.
Regards,
Matthias

Thanks


The best thing to hit the internet in years - Juno SpeedBand!
Surf the web up to FIVE TIMES FASTER!
Only $14.95/ month - visit www.juno.com to sign up today!


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


Re: [PHP] timing a session

2003-08-23 Thread Matthias Nothhaft
Damian Brown wrote:
Hi,

i haven't looked into it properly yet,
but is there a way in PHP of recording
the length of time a visitor stays on
your website
i can record the entry, but i don't know how to
record the exit time
There is no way to get this exactly!

You cannot record the time a user
is really reading a single page.
It has to do something with the http protocol
being 'connectionless'!
I heared/read that there's a standard
of the 'advertisment-industry' saying
that a visit ends after 30 minutes after
the last (session-)request.
(A bad method if you really must have this
very exact is to do a short http-refresh,
eg every minute.)
I also think, this is no php problem
but a common problem of the http protocol
which wasn't designed to hold a connection
over a user's session - that's why session
management had to be invented ;-)
Regards,
Matthias

Regards,
Damian
www.phpexpert.org
UK FREEphone 0800 019 0924
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] file upload problem

2003-08-23 Thread Matthias Nothhaft
Did you get any error (displayed/logged) ?

Test it like that:

print_r($_FILES) // with php < 4.1 use $HTTP_POST_FILES

Now you can find your file at ...['tmp_name']

See also the php manual ;-)

Regards,
Matthias
Matthias Wulkow wrote:
Hallo Jim,

am Samstag, 23. August 2003 um 21:32 hast Du Folgendes gekritzelt:

JL> how are you checking to see if the files are getting uploaded?

JL> Jim Lucas

I'm looking in /tmp for new files... but there are none. I'm also
looking in the Apache-RootDirectory. No files neither.
SvT



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


Re: [PHP] user-defined superglobals?

2003-08-23 Thread Matthias Nothhaft
Hi Jason Sheets, you wrote:
Someone wrote a php module that did this around 6 to 9 months ago.  It 
was easy to install but you needed access to php.ini.
Do you know where to get/download this module?

Regards,
Matthias
Try using extract with the option to use references so you don't create 
a copy of the variable just a pointer to it.

Jason

Matthias Nothhaft wrote:

Sorry this all is not what I'm looking for.
I see it is not possible at the moment.
It would be nice to have a php-function like

declare_superglobal($_MYFRAMEWORK);

And then use $_MYFRAMEWORK like $_GET.

Thanks nevertheless.

Regards,
Matthias
Ray Hunter wrote:

Well, this is clear, (I'm only new in the list - not in PHP ;-) )
but I want it in a better/shorter way
for the "master var" of a big project!




Yes you can set up a master file that includes all your master
vars...many php developers call this a configuration script and name it
config.php.
This allows users to set up global variables that are used through out
the application.

Is there a way to request such a feature and where?
I think this would be nice for application frameworks!?
Maybe also for PEAR...




There are implementations of this all thru PEAR.

--
BigDog








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


Re: [PHP] BMP -> GD image?

2003-09-09 Thread Matthias Nothhaft
DvDmanDT wrote:
Hello, I wanted to know if anyone has a good way to convert windows bitmaps
into png, jpeg, gif or something else that GD2 can work with? The reason for
this is that I wanna be able to colorize them in a special way which GD is
great at... Just that GD can't handle BMPs so... My first idea was to simply
convert the formats, but turns out that's not waay to easy... I only tried
the 8bit format which I nowdays think is VERY wierd... The palette indexing
isn't logical it seems... If anyone can explain the file format, I will just
write my own PHP script for this task...
Help anyone?

Google is your friend ;-)
Try this:
http://www.dcs.ed.ac.uk/home/mxr/gfx/2d/BMP.txt

Hope this will help you,
Regards,
Matthias
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Whats wrong with my code?

2003-09-16 Thread Matthias Nothhaft
Hi Stevie D Peele, you wrote:
Can someone spot what Is wrong with my code?

Please read your code carefully and check the
writing of your variable $include!
Sometimes you write $includes instead...

It has to have the same name everywhere,
PHP can't guess what you want ;-)
What is the certain error message?

And yes: if the file doesn't exists that should be included
PHP will not be happy about it.
PHP can't also guess what code is in the file you wanna include ;-)

Regards,
Matthias



$page = $_GET['id'];
switch ($page) 
{
case "home":
$include = "/includes/index.html";
break;

case "arts":
 $include = "/includes/arts.html";
break;
case "aaexpert":
 $include = "/includes/aaexpert.html";
break;
case "career":
 $include = "/includes/career.html";
break;
case "comics":
 $include = "/includes/comics.html";
break;
case "graphics":
 $include = "/includes/graphics.html";
break;
case "computers":
 $include = "includes/computers.html";
break;
case "consumers":
 $include = "/includes/consumer.html";
break;
case "dailies":
 $include = "/includes/dailies.html";
break;
case "forums":
 $include = "/includes/forums.html";
break;
case "downloads":
 $include = "/includes/downloads.html";
break;
case "editors":
 $include = "/includes/editors.html";
break;
case "educational":
 $include = "/includes/educational.html";
break;
case "electronics":
 $include = "/includes/electronics.html";
break;
case "entertainment":
 $include = "/includes/entertainment.html";
break;
case "shopping":
 $include = "/includes/shopping.html";
break;
case "free":
 $include = "/includes/freetime.html";
break;
case "government":
 $include = "/includes/government.html";
break;
case "governments":
 $includes = "/includes/governments.html";
break;
case "healthnews":
 $includes = "/includes/healthnews.html";
break;
case "homegarden":
 $includes = "/includes/homegarden.html";
break;
case "homework":
 $includes = "/includes/homework.html";
break;
case "stuffworks":
 $includes = "/includes/hsworks.html";
break;
case "inthenews":
 $includes = "/includes/inthenews.html";
break;
case "infokiosk":
 $includes = "/includes/kiosk.html";
break;
case "knowledge":
 $includes = "/includes/builder.html";
break;
case "money":
 $includes = "/includes/money.html";
break;
case "yahoo":
 $includes = "/includes/yahoo.html";
break;
case "museums":
 $includes = "/includes/museums.html";
break;
case "othernews":
 $includes = "/includes/othernews.html";
break;
case "pictures":
 $includes = "/includes/pictures.html";
break;
case "politics":
 $includes = "includes/politics.html";
break;
case "quotations":
$includes = "/includes/quotes.html";
break;
case "recreation":
 $includes = "/includes/recreation.html";
break;
case "reference":
 $includes = "/includes/reference.html";
break;
case "reviews":
 $includes = "/includes/reviews.html";
break;
case "search":
 $includes = "/includes/search.html";
break;
case "society":
 $include = "/includes/society.html";
break;
case "sports":
 $include = "/includes/sportsnews.html";
break;
case "studyhelp":
 $include = "/includes/study.html";
break;
case "travel":
 $include = "/includes/travel.html";
break;
case "USA":
 $includes = "/includes/usa.html";
break;
case "USNews":
 $includes = "includes/usnews.html";
break;
case "weather":
 $includes = "/includes/weather.html";
break;
case "webmaster":
$includes = "/includes/webmaster.html";
break;
case "goodbad":
 $includes = "/includes/goodbad.html";
break;
case "world":
 $includes = "/includes/world.html";
break;
}

include ($include)
?>


It says Line 195 which is the ?>

Would it matter I don't have all of these files (i.e.
/includes/world.html) were uploaded yet?
Thanks,

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


Re: [PHP] add element to an array

2003-09-29 Thread Matthias Nothhaft
Hi Angelo Zanetti, you wrote:
Hi, I want to add a new element to an array in php, is the following way the
correct way? assuming that $chk is an array and $ID contains a value.
$j = count($chk);
$j++;
$chk[$j] = $ID;
Keep it simple, this is enough:

	$chk[] = $ID;

This appends a new element at the end of your array.

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


Re: [PHP] Regular expression help

2003-11-25 Thread Matthias Nothhaft
Hi,

^ inside [] means "not the following chars", so your expression means:

if ($val contains no space " ", no tab "\t" and no newline "\n") {
//do the job ...
}
Regards,
Matthias


Ben wrote:
I need someone to tell me exactly what this regular-expression means:
if(ereg("[^ \t\n]",$val)) {
// do the job here
}
I'm looking for an intermittent bug, and I need to understand this to make
sure I have found the bug.
Thanks

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


[PHP] session with output compression?

2003-12-10 Thread Matthias Nothhaft
Hi List,

I wanna use PHP's session management with output compression,
but I have the following problem:
Session-IDs are not automatically appended to URLs. :-(

The compression works fine and makes the page nice for slow internet 
connections.

The session management works also fine, but only with cookies :-(

I guess the problem is that PHP can not append SID in (g)ziped output!?...

But is there a way to get this work with output compression?

Any hints would be great!

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


[PHP] Fatal Error: PDFlib error ...

2003-12-10 Thread Matthias Nothhaft
Hi,

I'm trying to get the pdflib work...

I use pdflib 4.0.3 downloaded from pdflib.de and php 4.3.4 on Debian Linux.

I wrote this test code:



dl("libpdf_php.so");

$pdf = pdf_new();
pdf_begin_page($pdf, 421, 595);
pdf_set_font($pdf, "Helvetica", 24, "host");
pdf_show_xy($pdf, "Hello World!", 75, 200);
pdf_end_page($pdf);
pdf_close($pdf);
$buffer = pdf_get_buffer($pdf);

$f = fopen("test.pdf", "bw");
fwrite($f, $buffer);
fclose($f);
?>

and got

Fatal error: PDFlib error: function 'PDF_begin_page' must not be called 
in 'object' scope in /var/www/Software/cms4rent/pdftest.php on line 5

Why is that?

Any help would be great.

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


Re: [PHP] Fatal Error: PDFlib error ...

2003-12-12 Thread Matthias Nothhaft
Evan Nemerson wrote:
On Wednesday 10 December 2003 09:08 pm, Matthias Nothhaft wrote:

Hi,

I'm trying to get the pdflib work...

[]
Fatal error: PDFlib error: function 'PDF_begin_page' must not be called
in 'object' scope in /var/www/Software/cms4rent/pdftest.php on line 5
Why is that?


google (including quotes): "must not be called in 'object' scope"
result #2: http://www.alt-php-faq.org/local/87/
Rather cryptic error message... hmpf.

Thanks, but this didn't solve my problem, what else could be?
Any ideas?
Regards,
Matthias

Any help would be great.

Regards,
Matthias


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


[PHP] cli input and screen question(s)

2004-02-13 Thread Matthias Nothhaft
Hi all of you,

does someone know how to "observe" the keyboard input
e.g. in a while loop so that I can do other stuff
between two keypresses!?
And is it possible to make a cli script responsable
for special keys like cursor, function (F1, F2...)
or Control/Alt-[somekey], PageUp/Down, Enter, Esc,...?
The other problem is: I would like to draw a screen
like midnight commander does. Is there a way to get that
work with PHP ?
How is it possible to clear the screen and to check out
row nums and column nums from within PHP?
Thanks in advance,
regards,
Matthias

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


Re: [PHP] cli input and screen question(s)

2004-02-15 Thread Matthias Nothhaft
Hi Adam Bregenzer, you wrote:
On Fri, 2004-02-13 at 18:25, Matthias Nothhaft wrote:

The other problem is: I would like to draw a screen
like midnight commander does. Is there a way to get that
work with PHP ?


Ahh, sounds like a Slackware fan. :)
don't really know what it is. I just wanna
write some stuff to simplify "daily administration"
on my Debian machines.
And I like the idea to make this work with PHP ;-)
You want to look at ncurses[1] in PHP.  This lets you draw on a screen. 
It does require a decent terminal interface but that should not be a
problem.  Also readline[2] may help you with reading input.

[1] http://www.php.net/ncurses
[2] http://www.php.net/readline
Oh, that seems to be the things I'm looking for,
thanks a lot!
Regards,
Matthias
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php