php-windows Digest 30 Jan 2003 16:43:27 -0000 Issue 1563
Topics (messages 18208 through 18240):
Register globals on and off
18208 by: Davy Obdam
Re: Unsetting PHP_AUTH_*
18209 by: DAS6804.red.cam.es
MySQL - question
18210 by: Bobo Wieland
18237 by: Cam Dunstan
Re:[PHP] Register globals on and off
18211 by: Daniel Leighton
Something like trim()
18212 by: Bobo Wieland
18220 by: Svensson, B.A.T. (HKG)
18221 by: Bobo Wieland
18238 by: Cam Dunstan
Re: Wierd Windows Problems
18213 by: Jill.Ramonsky.Aculab.com
18215 by: Bobo Wieland
18217 by: Jill.Ramonsky.Aculab.com
18218 by: Bobo Wieland
18223 by: Mikey
Re: Counter problems!
18214 by: J.Veenhuijsen
18219 by: Svensson, B.A.T. (HKG)
18222 by: Radovan Radic
18225 by: Jill.Ramonsky.Aculab.com
18226 by: Jill.Ramonsky.Aculab.com
18227 by: J.Veenhuijsen
18228 by: Jill.Ramonsky.Aculab.com
18230 by: J.Veenhuijsen
18231 by: J.Veenhuijsen
18233 by: Svensson, B.A.T. (HKG)
18234 by: Luis Ferro
18235 by: Radovan Radic
18236 by: Radovan Radic
Re: How do i load my new activex dll?
18216 by: Per Lundberg
Running PHP and ASP on same server.
18224 by: Fred Mastropasqua
Excel
18229 by: Sichta Daniel
18232 by: Jerry Nelson
IMAP - POP
18239 by: jab
Web pages don't show up in IE 6 w/SP1.
18240 by: Jammy Hall
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 ---
Hello people,
On my development machine (win XP/Apache 2.0.44/PHP 4.3.0/MySQL 3.23.55)
i have several websites that i made some time ago that require register
globals to be On in the php.ini. Ofcourse i know thats not a good idea
at all for security, but rewriting all this code is not an option.
However in my php.ini i have set register globals to Off because that
better. Is it possible to configure my webserver/php so that only those
sites that require register globals to be On have that setting, for
instance in a .htacces file?? Any help is appreciated:-)
Best regards,
Davy Obdam
mailto:[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
OK, thank you very much, Vladimir. I've used session variables and it's
solved ;)
Thanks for your helping!
Danny
> -----Mensaje original-----
> De: Vladimir Galkov [mailto:[EMAIL PROTECTED]]
> Enviado el: miércoles, 29 de enero de 2003 15:12
> Para: [EMAIL PROTECTED]
> Asunto: [PHP-WIN] Re: Unsetting PHP_AUTH_*
>
>
>
> I've the variables $PHP_AUTH_USER and $PHP_AUTH_PW set and I
> want to unset
> them because I check if they're set or not in order to show the
> authentication dialog box. The unset command appears not to
> be working with
> them (even if I try doing unset($GLOBALS['PHP_AUTH_USER'])...)
>
> Any suggestion? Thanks a lot!
> --------------------
>
> Well some time ago I tried to find solution too and lost.
> The problem, that
> the data (PHP_AUTH_USER/$PHP_AUTH_PW) stored in browser cache
> and browser
> send it again and again, even you change value of varibles.
> So if you'll
> find the way to clear browser cache you'll solve the problem.
>
> However, I use session varibles. It not good in all situations but...
>
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
Este correo electrónico contiene información privada y confidencial. Si
usted no es el destinatario del mensaje no está autorizado a leerlo,
copiarlo o difundirlo. Si lo ha recibido por error, por favor contacte con
el remitente y destruya su contenido.?Privileged/confidential information
may be contained in this e-mail. Any reading, copying o dissemination of
this communication by persons or entities other than its intended recipient
is prohibited. If you received this in error, please contact the sender and
delete it.
--- End Message ---
--- Begin Message ---
I'm most of the time using MySQL in conjuction with PHP and I hope that it's
okey to post questions regarding MySQL. There isn't much traffic here anyway
so I hope you can live with it...
Anyway... I'm going to put two different translations of the bible in a
MySQL-db. And before I do anything I would like to know a couple of things
that I couldn't make out of the MySQL manual.
Q1: This db won't be too big for MySQL to handle?
Q2: My first thought was to use two tables like this:
table1:
| book_id (PRI_KEY) | short_name | long_name | extended_name | bible_part |
table2:
.--------------(PRI_KEY)-------------.
| book_id (F_KEY) | chapther | verse | txt1917(text) | txt2000(text) |
Is this a good idea? Table2 will get huge! Any better ideas?
Q3: Can you do a search where the WHERE-clause searches the primary key in
table 2 or do I have to use "...WHERE book_id = '1' AND chapther = '1' AND
verse = '1'"....
Q4: Can you order the data in table 2 in the db itself and not just when
displaying the results so that the first primary key allways will be | 1 | 1
| 1 | and the last will be (in this case) | 77 | 22 | 21 |
Well... I think that is it... Please help me on this one. Feel free to
answer any or all of the questions...
thanks!
. bobo . www.elstudion.com . www.elstudion.com/bobo .
--- End Message ---
--- Begin Message ---
bobo
I doubt that the table will be too big myself given the limitations which
you will find in the mysql manual (far above your requirements). Spend a
bit of time and calculate the actual size of the table - while it sounds
huge you might be pleasantly surprised. A database of properties in a local
government area of some half a million records at around 1k or 2k each was
quicker than my wildest dreams on various searches and selects, not
admittedly on text/blob fields though.
mySQL specifics are slightly off topic strictly speaking - if anyone
grizzles just email direct.
----- Original Message -----
From: "Bobo Wieland" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 30, 2003 6:21 PM
Subject: [PHP-WIN] MySQL - question
> I'm most of the time using MySQL in conjuction with PHP and I hope that
it's
> okey to post questions regarding MySQL. There isn't much traffic here
anyway
> so I hope you can live with it...
>
> Anyway... I'm going to put two different translations of the bible in a
> MySQL-db. And before I do anything I would like to know a couple of things
> that I couldn't make out of the MySQL manual.
>
> Q1: This db won't be too big for MySQL to handle?
>
> Q2: My first thought was to use two tables like this:
>
> table1:
> | book_id (PRI_KEY) | short_name | long_name | extended_name | bible_part
|
>
> table2:
> .--------------(PRI_KEY)-------------.
> | book_id (F_KEY) | chapther | verse | txt1917(text) | txt2000(text) |
>
>
> Is this a good idea? Table2 will get huge! Any better ideas?
>
> Q3: Can you do a search where the WHERE-clause searches the primary key in
> table 2 or do I have to use "...WHERE book_id = '1' AND chapther = '1' AND
> verse = '1'"....
>
> Q4: Can you order the data in table 2 in the db itself and not just when
> displaying the results so that the first primary key allways will be | 1 |
1
> | 1 | and the last will be (in this case) | 77 | 22 | 21 |
>
>
> Well... I think that is it... Please help me on this one. Feel free to
> answer any or all of the questions...
>
>
> thanks!
>
>
> . bobo . www.elstudion.com . www.elstudion.com/bobo .
>
>
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Hi Davy,
I found the following in the php manual:
Please note that register_globals cannot be set at runtime (ini_set()). Although, you
can use .htaccess if your host allows it as described above. An example .htaccess
entry: php_flag register_globals on.
on this page: http://www.php.net/manual/en/configuration.directives.php
I've also used this format in apache conf files and, I believe, in .htaccess files:
php_value include_path /web/lib/php:.
Daniel
At 7:52 AM +0100 on 1/30/03, Davy Obdam wrote:
>Hello people,
>
>On my development machine (win XP/Apache 2.0.44/PHP 4.3.0/MySQL 3.23.55) i have
>several websites that i made some time ago that require register globals to be On in
>the php.ini. Ofcourse i know thats not a good idea at all for security, but rewriting
>all this code is not an option. However in my php.ini i have set register globals to
>Off because that better. Is it possible to configure my webserver/php so that only
>those sites that require register globals to be On have that setting, for instance in
>a .htacces file?? Any help is appreciated:-)
>
>Best regards,
>
>Davy Obdam
>mailto:[EMAIL PROTECTED]
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
--
Daniel Leighton
Chief Technology Officer
Webolution
http://www.webolution.com
This email may contain material that is confidential and privileged for the
sole use of the intended recipient. Any review, reliance or distribution
by others or forwarding without express permission is strictly prohibited.
If you are not the intended recipient, please contact the sender and delete
all copies.
--- End Message ---
--- Begin Message ---
Is there an easy way to get rid off white space characters in a string? Like
trim() but for the whole string and leaving single white spaces as they are
but removing all occurences of '\t','\n' and ' '(leaving a single '
')...
I've tried the manual but couldn't find anything...
. bobo . www.elstudion.com . www.elstudion.com/bobo .
--- End Message ---
--- Begin Message ---
Something like (not tested and compiled - please find the bugs :))
will remove white space dups:
char *TrimInString(char *pzWashMe)
{
if (!pzWashMe) return NULL;
register char *pzMarker = pzWashMe;
bool bStillTrimingString = false;
while (StrReplacee("\t", " ", pzMarkerrReplacee("\n", " ", pzMarker))
;;
while (*pzMarker) { // loop 1
bool bStillTrimingString = false;
while (*pzMarker && !isspace(*(pzMarker++)) // loop 2
;;
register int nIndex = 0;
while (isspace(*(pzMarker+nIndex++)) { // loop 3
bStillTrimingString = true;
}
if (nIndex) {
strcpy(pzMarker, (pzMarker + nIndex));
}
}
return pzMarker;
}
First it replace tabs and newlines with blank spaces, then
the function will scann the string after a whitespace (loop 2).
If it finds one. Then it will try to justify the hypothese H that
this white space is followed by another white space (loop 3). If
H is true it will count the number of whitepace, and then move
the moving down data to just leave the first white space left.
After that it falls into loop 1 again and check if we reach the
end of the string or not, if not, we do all the things once again.
> -----Original Message-----
> From: Bobo Wieland [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 30, 2003 8:26 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Something like trim()
>
>
> Is there an easy way to get rid off white space characters in a string? Like
> trim() but for the whole string and leaving single white spaces as they are
> but removing all occurences of '\t','\n' and ' '(leaving a single '
> ')...
>
> I've tried the manual but couldn't find anything...
>
>
>
> . bobo . www.elstudion.com . www.elstudion.com/bobo .
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
I'll answering it myself so that no one else has to bother;
$str = ereg_replace("[[:space:]]+", " ", trim($str));
. bobo
----- Original Message -----
From: "Bobo Wieland" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 30, 2003 8:26 AM
Subject: [PHP-WIN] Something like trim()
> Is there an easy way to get rid off white space characters in a string?
Like
> trim() but for the whole string and leaving single white spaces as they
are
> but removing all occurences of '\t','\n' and ' '(leaving a single '
> ')...
>
> I've tried the manual but couldn't find anything...
>
>
>
> . bobo . www.elstudion.com . www.elstudion.com/bobo .
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
check out str_replace() - you`ll find it in the "string functions"
section of the manual.
----- Original Message -----
From: "Bobo Wieland" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 30, 2003 6:26 PM
Subject: [PHP-WIN] Something like trim()
> Is there an easy way to get rid off white space characters in a string?
Like
> trim() but for the whole string and leaving single white spaces as they
are
> but removing all occurences of '\t','\n' and ' '(leaving a single '
> ')...
>
> I've tried the manual but couldn't find anything...
>
>
>
> . bobo . www.elstudion.com . www.elstudion.com/bobo .
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
I don't know if this is relevant, but that's dodgy HTML. Tag attributes
should always be quoted, thus:
<button type="submit" name="action" value="add">Add</Button>
It may not make any difference, but I thought I'd mention it just in case it
does.
Jill
-----Original Message-----
From: Chris Deam [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 30, 2003 3:41 AM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Wierd Windows Problems
2. I have a submit button that looks like this:
<button type=submit name=action value=add>Add</Button>
And corresponding PHP is:
if ($action == "add"){
do something;
}
--- End Message ---
--- Begin Message ---
in that case: since quoting attributes is only _really_ neccesary in xhtml,
</Button> should be </button>, since all tag and attribute namnes must be in
lower-case, too...
And I think that;
<button type="submit" name="action">Add</button>
if ($action == "Add"){
do something;
}
shold do the trick for att browsers and platforms...
. bobo . www.elstudion.com . www.elstudion.com/bobo .
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, January 30, 2003 9:02 AM
Subject: RE: [PHP-WIN] Wierd Windows Problems
> I don't know if this is relevant, but that's dodgy HTML. Tag attributes
> should always be quoted, thus:
> <button type="submit" name="action" value="add">Add</Button>
>
> It may not make any difference, but I thought I'd mention it just in case
it
> does.
>
> Jill
>
>
> -----Original Message-----
> From: Chris Deam [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 30, 2003 3:41 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Wierd Windows Problems
>
> 2. I have a submit button that looks like this:
> <button type=submit name=action value=add>Add</Button>
> And corresponding PHP is:
> if ($action == "add"){
> do something;
> }
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Actually I think it's that opening and closing tags must have the SAME case.
I don't think they have to be all lower case though. Thus <button> must be
matched with </button>, <BUTTON> with </BUTTON>, and <Button> with
</Button>.
I still don't know if any of this will help the original questioner, but at
least we're encouraging good practice.
Jill
-----Original Message-----
From: Bobo Wieland [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 30, 2003 8:28 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP-WIN] Wierd Windows Problems
in that case: since quoting attributes is only _really_ neccesary in xhtml,
</Button> should be </button>, since all tag and attribute namnes must be in
lower-case, too...
--- End Message ---
--- Begin Message ---
if it's xhtml, it _has_ to be all lower-case! tag names, attribute names,
event handlers, all lower-case... if it's html it can be what-ever... since
i guess xhtml will eventually replace html, and since the html-standard is a
some what crappy standard, the good practice would be to allways use
lower-case...
(and another good thing, while we're at it, is to allways close tags and
nest them properly. <br> should be <br /> and you shouldn't write
<strong>hello <em>world</strong></em> but <strong>Hello
<em>world</em></strong>)...
. bobo . www.elstudion.com . www.elstudion.com/bobo .
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, January 30, 2003 9:45 AM
Subject: RE: [PHP-WIN] Wierd Windows Problems
> Actually I think it's that opening and closing tags must have the SAME
case.
> I don't think they have to be all lower case though. Thus <button> must be
> matched with </button>, <BUTTON> with </BUTTON>, and <Button> with
> </Button>.
>
> I still don't know if any of this will help the original questioner, but
at
> least we're encouraging good practice.
>
> Jill
>
>
> -----Original Message-----
> From: Bobo Wieland [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 30, 2003 8:28 AM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: [PHP-WIN] Wierd Windows Problems
>
>
> in that case: since quoting attributes is only _really_ neccesary in
xhtml,
> </Button> should be </button>, since all tag and attribute namnes must be
in
> lower-case, too...
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
I always thought that it was <input type="submit" etc...> and not <button>
Just my 2c,
Mikey
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: 30 January 2003 08:45
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] Wierd Windows Problems
>
>
> Actually I think it's that opening and closing tags must have the
> SAME case.
> I don't think they have to be all lower case though. Thus <button> must be
> matched with </button>, <BUTTON> with </BUTTON>, and <Button> with
> </Button>.
>
> I still don't know if any of this will help the original
> questioner, but at
> least we're encouraging good practice.
>
> Jill
>
>
> -----Original Message-----
> From: Bobo Wieland [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 30, 2003 8:28 AM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: [PHP-WIN] Wierd Windows Problems
>
>
> in that case: since quoting attributes is only _really_ neccesary
> in xhtml,
> </Button> should be </button>, since all tag and attribute namnes
> must be in
> lower-case, too...
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
--- End Message ---
--- Begin Message ---
This is working on my test system.
<?
session_start();
if ( ! isset($_SESSION['count']) )
{
$fp=fopen("./counter.txt","r");
$_SESSION['count']=fread($fp,5);
fclose($fp);
$_SESSION['count']++;
$cnt=$_SESSION['count'];
$fp=fopen("./counter.txt","w");
fwrite($fp,$cnt);
fclose($fp);
}
$c= $_SESSION['count'];
print "Visited: .$c.<BR>";
?>
Jochem
Cybot wrote:
CORRECT use $_SESSION !
counter.php:
<?
if ( ! isset($_SESSION['count']) )
{
$fp=fopen("counter.txt","r");
$_SESSION['count']=fread($fp);
fclose($fp);
$_SESSION['count']++;
}
print "Visited: $_SESSION['count']<BR>";
?>
index.php
<?
session_start();
print "Simple page<BR>";
include("counter.php");
?>
Radovan Radic wrote:
Hi
I want to add simple counter on my index.php page.
counter.php:
<?
if (!session_is_registered("counter"))
{
$fp=fopen("counter.txt","r");
$counter=fread($fp);
fclose($fp);
$counter++;
session_register("counter");
}
print "Visited: $counter<BR>";
?>
index.php
<?
session_start();
print "Simple page<BR>";
include("counter.php");
?>
This should work, but when someone refreshes index.php page, counter is
increased! How can i stop it?
Thx,
Radovan
--- End Message ---
--- Begin Message ---
Well, the problem might be view as an ethical & philosophical one:
How much are you prepared to lie to achieve a certain goal?
Many properties/features with software are not what they
really look like anyway.
Software just pretends to work while it actually
does not work at all. It only stick together because it
has a high degree of fault tolerance or simply because it
contains so much data and code that particular things
that does not work is unlikely to be encounter (the big
grow principle; survival; by gig numbers).
Think about it; how can anybody check this anyway? They can't!
Some people can't even sketch a proper schema on how to connect
1 light bulb with 1 metal wire and 1 battery in order to make
the light bulb lit up. There concept of the physical world is
so screwed up that they even believes in animated sprits (gods).
So why would you bother to put to much development energy
into a perfect counter which you can fake anyway to give
about the right answer?
But as I said, this is a ethical view not a functional.
//Anders
> -----Original Message-----
> From: Radovan Radic [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 29, 2003 5:51 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-WIN] Re: Counter problems!
>
>
> So, is there some "perfect" counter? Or there is some simple solution?
> I tried this (index.php)
> <?
> session_start();
> if (!isset($QUERY_STRING))
> header("Location: index.php".SID);
> else
> {
> include("counter.php");
> }
> ?>
>
> This is helping when page is refreshed, but when someone types location in
> the address bar:
> http://mysite.com/index.php counter gets +1! Or this is normal behaviour?
> Someone opened door again...
>
> "J.Veenhuijsen" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > You've got a point there!!!!!!!!!!!
> >
> > Jochem
> >
> > B.A.T. Svensson wrote:
> > > There are some potential pitfalls involving:
> > >
> > > CASE 1: Multi user systems:
> > > You will see the same IP for all of the users on that system.
> > >
> > > CASE 2: Firewalls
> > > You might only see the firewalls IP# for each and every user behind it.
> > >
> > > CASE 3: Dynamically assigned IP#
> > > IP# might dynamically be assigned to different user at different times
> points
> > >
> > >
> > >
> > >
> > >>-----Original Message-----
> > >>From: J.Veenhuijsen [mailto:[EMAIL PROTECTED]]
> > >>Sent: Wednesday, January 29, 2003 2:35 PM
> > >>To: [EMAIL PROTECTED]
> > >>Subject: [PHP-WIN] Re: Counter problems!
> > >>
> > >>
> > >>You could check the IP adress of the visitor.
> > >>If it has not changed the the visitor is the same.
> > >>Last IP adress in the counter file?
> > >>
> > >>
> > >>Jochem
> > >>
> > >>Radovan Radic wrote:
> > >>
> > >>>Hi
> > >>>
> > >>>I want to add simple counter on my index.php page.
> > >>>
> > >>>counter.php:
> > >>><?
> > >>>if (!session_is_registered("counter"))
> > >>>{
> > >>> $fp=fopen("counter.txt","r");
> > >>> $counter=fread($fp);
> > >>> fclose($fp);
> > >>> $counter++;
> > >>> session_register("counter");
> > >>>}
> > >>>print "Visited: $counter<BR>";
> > >>>?>
> > >>>
> > >>>index.php
> > >>><?
> > >>>session_start();
> > >>>print "Simple page<BR>";
> > >>>include("counter.php");
> > >>>?>
> > >>>
> > >>>This should work, but when someone refreshes index.php page, counter is
> > >>>increased! How can i stop it?
> > >>>
> > >>>Thx,
> > >>>Radovan
> > >>>
> > >>>
> > >>
> > >>
> > >>--
> > >>PHP Windows Mailing List (http://www.php.net/)
> > >>To unsubscribe, visit: http://www.php.net/unsub.php
> > >>
> > >
> >
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Yes, but what if you refresh the page?
Or type in the address bar index.php and press enter, i think it will be
increased?
Radovan
"J.Veenhuijsen" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> This is working on my test system.
>
> <?
> session_start();
> if ( ! isset($_SESSION['count']) )
> {
> $fp=fopen("./counter.txt","r");
> $_SESSION['count']=fread($fp,5);
> fclose($fp);
> $_SESSION['count']++;
> $cnt=$_SESSION['count'];
> $fp=fopen("./counter.txt","w");
> fwrite($fp,$cnt);
> fclose($fp);
> }
> $c= $_SESSION['count'];
> print "Visited: .$c.<BR>";
> ?>
>
>
> Jochem
>
>
> Cybot wrote:
> > CORRECT use $_SESSION !
> >
> > counter.php:
> > <?
> > if ( ! isset($_SESSION['count']) )
> > {
> > $fp=fopen("counter.txt","r");
> > $_SESSION['count']=fread($fp);
> > fclose($fp);
> > $_SESSION['count']++;
> > }
> > print "Visited: $_SESSION['count']<BR>";
> > ?>
> >
> > index.php
> > <?
> > session_start();
> > print "Simple page<BR>";
> > include("counter.php");
> > ?>
> >
> >
> > Radovan Radic wrote:
> >
> >>> Hi
> >>>
> >>> I want to add simple counter on my index.php page.
> >>>
> >>> counter.php:
> >>> <?
> >>> if (!session_is_registered("counter"))
> >>> {
> >>> $fp=fopen("counter.txt","r");
> >>> $counter=fread($fp);
> >>> fclose($fp);
> >>> $counter++;
> >>> session_register("counter");
> >>> }
> >>> print "Visited: $counter<BR>";
> >>> ?>
> >>>
> >>> index.php
> >>> <?
> >>> session_start();
> >>> print "Simple page<BR>";
> >>> include("counter.php");
> >>> ?>
> >>>
> >>> This should work, but when someone refreshes index.php page, counter
is
> >>> increased! How can i stop it?
> >>>
> >>> Thx,
> >>> Radovan
> >>>
> >>>
> >>
> >
>
--- End Message ---
--- Begin Message ---
Try this...
<?
session_start();
if ( ! isset($_SESSION['been_here_before']) )
{
$_SESSION['been_here_before']=TRUE;
$fp=fopen("./counter.txt","r");
$count=fread($fp,5);
fclose($fp);
++$count;
$fp=fopen("./counter.txt","w");
fwrite($fp,$cnt);
fclose($fp);
}
print "Visited: .$count.<BR>";
?>
-----Original Message-----
From: Radovan Radic [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 30, 2003 1:06 PM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Re: Counter problems!
Yes, but what if you refresh the page?
Or type in the address bar index.php and press enter, i think it will be
increased?
Radovan
--- End Message ---
--- Begin Message ---
For reasons of scope, you may need to first use $count outside the braces.
This would give you...
<?
session_start();
$count = 0;
if ( ! isset($_SESSION['been_here_before']) )
{
$_SESSION['been_here_before']=TRUE;
$fp=fopen("./counter.txt","r");
$count=fread($fp,5);
fclose($fp);
++$count;
$fp=fopen("./counter.txt","w");
fwrite($fp,$cnt);
fclose($fp);
}
print "Visited: .$count.<BR>";
?>
--- End Message ---
--- Begin Message ---
I tested that and the counter does not increase when i hit
the refresh button or press enter in the adressbar.
It only increases when i quit the explorer and reopen the same link
afterwards. Which is ofcourse a new visit because the session is
distroyed when closing the browser.
Jochem
Radovan Radic wrote:
Yes, but what if you refresh the page?
Or type in the address bar index.php and press enter, i think it will be
increased?
Radovan
"J.Veenhuijsen" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
This is working on my test system.
<?
session_start();
if ( ! isset($_SESSION['count']) )
{
$fp=fopen("./counter.txt","r");
$_SESSION['count']=fread($fp,5);
fclose($fp);
$_SESSION['count']++;
$cnt=$_SESSION['count'];
$fp=fopen("./counter.txt","w");
fwrite($fp,$cnt);
fclose($fp);
}
$c= $_SESSION['count'];
print "Visited: .$c.<BR>";
?>
Jochem
Cybot wrote:
CORRECT use $_SESSION !
counter.php:
<?
if ( ! isset($_SESSION['count']) )
{
$fp=fopen("counter.txt","r");
$_SESSION['count']=fread($fp);
fclose($fp);
$_SESSION['count']++;
}
print "Visited: $_SESSION['count']<BR>";
?>
index.php
<?
session_start();
print "Simple page<BR>";
include("counter.php");
?>
Radovan Radic wrote:
Hi
I want to add simple counter on my index.php page.
counter.php:
<?
if (!session_is_registered("counter"))
{
$fp=fopen("counter.txt","r");
$counter=fread($fp);
fclose($fp);
$counter++;
session_register("counter");
}
print "Visited: $counter<BR>";
?>
index.php
<?
session_start();
print "Simple page<BR>";
include("counter.php");
?>
This should work, but when someone refreshes index.php page, counter
is
increased! How can i stop it?
Thx,
Radovan
--- End Message ---
--- Begin Message ---
Yes, Jochem's right.
One thing though, Radovan. If your script WRITES TO the file "counter.txt"
then I assume that script's directory must give write permission to the
whole world. That is a very dangerous thing to do. There would be nothing to
stop a hacker from saving arbitrary binary (or PHP) code in that directory,
and hence doing ANYTHING to your server.
A more secure counter could be stored in a mysql database.
Jill
-----Original Message-----
From: J Veenhuijsen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 30, 2003 1:45 PM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Re: Counter problems!
I tested that and the counter does not increase when i hit
the refresh button or press enter in the adressbar.
It only increases when i quit the explorer and reopen the same link
afterwards. Which is ofcourse a new visit because the session is
distroyed when closing the browser.
Jochem
Radovan Radic wrote:
> Yes, but what if you refresh the page?
> Or type in the address bar index.php and press enter, i think it will be
> increased?
--- End Message ---
--- Begin Message ---
A little trick could be to place couter.txt outside of the docroot.
I placed couter.txt as c:\couter.txt and that works.
Jochem
Jill Ramonsky wrote:
Yes, Jochem's right.
One thing though, Radovan. If your script WRITES TO the file "counter.txt"
then I assume that script's directory must give write permission to the
whole world. That is a very dangerous thing to do. There would be nothing to
stop a hacker from saving arbitrary binary (or PHP) code in that directory,
and hence doing ANYTHING to your server.
A more secure counter could be stored in a mysql database.
Jill
-----Original Message-----
From: J Veenhuijsen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 30, 2003 1:45 PM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Re: Counter problems!
I tested that and the counter does not increase when i hit
the refresh button or press enter in the adressbar.
It only increases when i quit the explorer and reopen the same link
afterwards. Which is ofcourse a new visit because the session is
distroyed when closing the browser.
Jochem
Radovan Radic wrote:
Yes, but what if you refresh the page?
Or type in the address bar index.php and press enter, i think it will be
increased?
--- End Message ---
--- Begin Message ---
I only set full rights on the counter.txt file (windows system)
I dont know if it works the same way on other OS'es
Full rightn the docroot means browser can open the file as
Http://url/counter.txt This is prevented by placing couter.txt
outside the docroot.
Or am I wrong here?
Jochem
Jill Ramonsky wrote:
Yes, Jochem's right.
One thing though, Radovan. If your script WRITES TO the file "counter.txt"
then I assume that script's directory must give write permission to the
whole world. That is a very dangerous thing to do. There would be nothing to
stop a hacker from saving arbitrary binary (or PHP) code in that directory,
and hence doing ANYTHING to your server.
A more secure counter could be stored in a mysql database.
Jill
-----Original Message-----
From: J Veenhuijsen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 30, 2003 1:45 PM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Re: Counter problems!
I tested that and the counter does not increase when i hit
the refresh button or press enter in the adressbar.
It only increases when i quit the explorer and reopen the same link
afterwards. Which is ofcourse a new visit because the session is
distroyed when closing the browser.
Jochem
Radovan Radic wrote:
Yes, but what if you refresh the page?
Or type in the address bar index.php and press enter, i think it will be
increased?
--- End Message ---
--- Begin Message ---
Doing so one will decrease the cohesion and increase the coupling of
the system (you want to do the other way around). Better put it into
the database, then an admin wont by "mistake" delete that file, and
as bonus you will decrease coupling with other components, e.g. "C:\.".
> -----Original Message-----
> From: J Veenhuijsen [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 30, 2003 3:00 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-WIN] Re: Counter problems!
>
>
> A little trick could be to place couter.txt outside of the docroot.
> I placed couter.txt as c:\couter.txt and that works.
>
> Jochem
>
>
> Jill Ramonsky wrote:
> > A more secure counter could be stored in a mysql database.
> >
> > Jill
--- End Message ---
--- Begin Message ---
counters...
1. make an 1px * 1px transparent image
2. make a php page that delivers that image always depending on the
exact url of it... and stores the result on the required record...
3. make a rotine that generates those url and that stores the reference
in a database...
4. make a rotine that generates the next url based on a previous one...
5. track url expiration to detect if it is a new request or a repeated
one...
Cheers...
Luis Ferro
TelaDigital.net
J Veenhuijsen wrote:
A little trick could be to place couter.txt outside of the docroot.
I placed couter.txt as c:\couter.txt and that works.
Jochem
Jill Ramonsky wrote:
Yes, Jochem's right.
One thing though, Radovan. If your script WRITES TO the file
"counter.txt"
then I assume that script's directory must give write permission to the
whole world. That is a very dangerous thing to do. There would be
nothing to
stop a hacker from saving arbitrary binary (or PHP) code in that
directory,
and hence doing ANYTHING to your server.
A more secure counter could be stored in a mysql database.
Jill
-----Original Message-----
From: J Veenhuijsen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 30, 2003 1:45 PM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Re: Counter problems!
I tested that and the counter does not increase when i hit
the refresh button or press enter in the adressbar.
It only increases when i quit the explorer and reopen the same link
afterwards. Which is ofcourse a new visit because the session is
distroyed when closing the browser.
Jochem
Radovan Radic wrote:
Yes, but what if you refresh the page?
Or type in the address bar index.php and press enter, i think it
will be
increased?
---
[This E-mail scanned for viruses by Declude Virus]
--- End Message ---
--- Begin Message ---
Thank you, i didnt try it yet and sorry - i assumed it will work wrong.
Radovan
"J Veenhuijsen" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I tested that and the counter does not increase when i hit
> the refresh button or press enter in the adressbar.
> It only increases when i quit the explorer and reopen the same link
> afterwards. Which is ofcourse a new visit because the session is
> distroyed when closing the browser.
>
> Jochem
>
>
> Radovan Radic wrote:
> > Yes, but what if you refresh the page?
> > Or type in the address bar index.php and press enter, i think it will be
> > increased?
> >
> > Radovan
> >
> > "J.Veenhuijsen" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >
> >>This is working on my test system.
> >>
> >><?
> >>session_start();
> >>if ( ! isset($_SESSION['count']) )
> >>{
> >> $fp=fopen("./counter.txt","r");
> >> $_SESSION['count']=fread($fp,5);
> >> fclose($fp);
> >> $_SESSION['count']++;
> >> $cnt=$_SESSION['count'];
> >> $fp=fopen("./counter.txt","w");
> >> fwrite($fp,$cnt);
> >> fclose($fp);
> >>}
> >>$c= $_SESSION['count'];
> >>print "Visited: .$c.<BR>";
> >>?>
> >>
> >>
> >>Jochem
> >>
> >>
> >>Cybot wrote:
> >>
> >>>CORRECT use $_SESSION !
> >>>
> >>>counter.php:
> >>><?
> >>>if ( ! isset($_SESSION['count']) )
> >>>{
> >>> $fp=fopen("counter.txt","r");
> >>> $_SESSION['count']=fread($fp);
> >>> fclose($fp);
> >>> $_SESSION['count']++;
> >>>}
> >>>print "Visited: $_SESSION['count']<BR>";
> >>>?>
> >>>
> >>>index.php
> >>><?
> >>>session_start();
> >>>print "Simple page<BR>";
> >>>include("counter.php");
> >>>?>
> >>>
> >>>
> >>>Radovan Radic wrote:
> >>>
> >>>
> >>>>>Hi
> >>>>>
> >>>>>I want to add simple counter on my index.php page.
> >>>>>
> >>>>>counter.php:
> >>>>><?
> >>>>>if (!session_is_registered("counter"))
> >>>>>{
> >>>>> $fp=fopen("counter.txt","r");
> >>>>> $counter=fread($fp);
> >>>>> fclose($fp);
> >>>>> $counter++;
> >>>>> session_register("counter");
> >>>>>}
> >>>>>print "Visited: $counter<BR>";
> >>>>>?>
> >>>>>
> >>>>>index.php
> >>>>><?
> >>>>>session_start();
> >>>>>print "Simple page<BR>";
> >>>>>include("counter.php");
> >>>>>?>
> >>>>>
> >>>>>This should work, but when someone refreshes index.php page, counter
> >>>>
> > is
> >
> >>>>>increased! How can i stop it?
> >>>>>
> >>>>>Thx,
> >>>>>Radovan
> >>>>>
> >>>>>
> >>>>
> >
> >
>
>
--- End Message ---
--- Begin Message ---
Yes, database is much better solution, but i wanted to make very simple
script for counter.
Thanks to all
Radovan
"Jill Ramonsky" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Yes, Jochem's right.
>
> One thing though, Radovan. If your script WRITES TO the file "counter.txt"
> then I assume that script's directory must give write permission to the
> whole world. That is a very dangerous thing to do. There would be nothing
to
> stop a hacker from saving arbitrary binary (or PHP) code in that
directory,
> and hence doing ANYTHING to your server.
>
> A more secure counter could be stored in a mysql database.
>
> Jill
>
>
>
> -----Original Message-----
> From: J Veenhuijsen [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 30, 2003 1:45 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Re: Counter problems!
>
>
> I tested that and the counter does not increase when i hit
> the refresh button or press enter in the adressbar.
> It only increases when i quit the explorer and reopen the same link
> afterwards. Which is ofcourse a new visit because the session is
> distroyed when closing the browser.
>
> Jochem
>
>
> Radovan Radic wrote:
> > Yes, but what if you refresh the page?
> > Or type in the address bar index.php and press enter, i think it will be
> > increased?
--- End Message ---
--- Begin Message ---
Wayne wrote:
But i get the following error, now, apache only works as a multi threaded
webserver doesn't it?
Apache for Windows, yes. (Apache for Linux and Unix is an altogether
different story)
Fatal error: dl() is not supported in multithreaded Web servers - use
extension statements in your php.ini in c:\servers\root\php_nuke\md5.php on
line 7
You should not use dl() for loading just any kind of DLL:s, but rather
PHP extensions.
What kind of error did you get when trying to use the COM support?
--
Best regards,
Per Lundberg / Capio ApS
Phone: +46-18-4186040
Fax: +46-18-4186049
Web: http://www.capio.com
--- End Message ---
--- Begin Message ---
Hello First time on here, have a problem, can you help or is there an old
archived mail about it.
Basically this is my problem. I've searched everywhere found bits of info
here and there but nothing that helps.
I have IIS 5 on Win2K.
If I install PHP 4.2.3 on my system using the ISAPI DLL I can run PHP files
just fine.
But when I go back to my ASP pages I get:
--------------------------
-2147417842 (0x8001010e) error on the pages
---------------------
If I try the Php.EXE CGI method then my ASP pages work but I get:
-------------------------
Security Alert! The PHP CGI cannot be accessed directly.
This PHP CGI binary was compiled with force-cgi-redirect enabled. This means
that a page will only be served up if the OLE_LINK1REDIRECT_STATUS CGI
variable is set, e.g. via an Apache Action directive.
For more information as to why this behavior exists, see the manual page for
CGI <http://php.net/security.cgi-bin> security.
For more information about changing this behavior or re-enabling this
webserver, consult the installation file that came with this distribution,
or visit the manual page <http://php.net/install.windows> .
---------------------
Do I really have to compile this on my own to get it to work? I set the
force-redirect in the ini to 0
Thanks.
Fred Mastropasqua
Sr. Windows Engineer for Masonite International
MCSE (Win2K & NT), MCDBA, A+, CCA, MCP+I
1-877-650-5927
<mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
Hi,
cfg: IIS 5.1, php4.1.2
After submiting web form I'm creating Excel file on server. Then I need to
show it in client browser. How can I do it ?
Ing. Daniel Šichta
EIF AS TIS
SWH s.r.o.
Bytčická 2
010 01 Žilina
tel.: +421 41 505 5889
fax: +421 41 505 5809
<mailto:[EMAIL PROTECTED]>
<http://www.swh.sk/>
ICQ:84700861
--- End Message ---
--- Begin Message ---
At 1/30/2003 08:47 AM, you wrote:
Hi,
cfg: IIS 5.1, php4.1.2
After submiting web form I'm creating Excel file on server. Then I need to
show it in client browser. How can I do it ?
Have the client use IE as their browser and put this at the beginning of
the module
header("Content-Type: application/vnd.ms-excel");
Then build a table in HTML
Jerry
*---------*-----------*----------*---------*---------*---------*--------*
Jerry Nelson
Project Manager / Analyst
Datanamics, Inc.
973-C Russell Ave
Gaithersburg, MD 20879
TEL: 301-948-3515
--- End Message ---
--- Begin Message ---
Hi,
since I do not have a computer background I´d like to ask if anybody can tell me how
to compile the c-client library . I intend to establish the web interface via pop.
thank you.
jab
--- End Message ---
--- Begin Message ---
I running Windows 2000 w/SP3 and IE 6 w/SP1 and I can't get pages using PHP
to show up in my browser....
I don't get any errors, just a blank space were the PHP info would be.
Any suggestions???
Thanks,
Jammy
--- End Message ---