php-general Digest 4 Sep 2003 13:20:42 -0000 Issue 2277
Topics (messages 161606 through 161645):
Session_start() corrupt HTML output with IE
161606 by: hecchan
161615 by: Viraj Kalinga Abayarathna
161621 by: Curt Zirzow
161623 by: Curt Zirzow
161632 by: Christophe Chisogne
Re: password systems
161607 by: Jason Sheets
Re: Restart Apache with PHP???
161608 by: Jason Sheets
Re: register_globals
161609 by: Jason Sheets
Re: Gripe
161610 by: Jason Sheets
Re: Too Advanced? Re: Cookies & Hidden Image
161611 by: Viraj Kalinga Abayarathna
161634 by: Marek Kilimajer
vars between instantiate class...
161612 by: jsWalter
161613 by: Raditha Dissanayake
161614 by: murugesan
161617 by: jsWalter
Re: web-mail problem
161616 by: Viraj Kalinga Abayarathna
Q on "inhert" class code
161618 by: jsWalter
161633 by: Evan Nemerson
auto 'jump' to link
161619 by: DougD
161620 by: Andrew Brampton
161622 by: Jackson Miller
Thank you -- Re: auto 'jump' to link
161624 by: DougD
Am I dreaming or what :)
161625 by: John Taylor-Johnston
161627 by: Raditha Dissanayake
161629 by: Evan Nemerson
161631 by: Dynamical.biz
Re: cookie crumbles
161626 by: John Taylor-Johnston
Uploading files via SSH
161628 by: Ben C.
161630 by: Evan Nemerson
suggestion: recursive calls
161635 by: Ronald van Raaphorst
161637 by: Marek Kilimajer
161638 by: Ronald van Raaphorst
161639 by: Marco Schuler
161641 by: Andrew Brampton
Re: how to include() N lines?
161636 by: David Robley
mysql Pattern Matching
161640 by: Ralph Guzman
161642 by: electroteque
is there a php version with curl already integrated?
161643 by: Chris
161644 by: murugesan
Question about Error Redirect (URL ShortCuts)
161645 by: ccj
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 ---
Hi,
Using IE 6 (XP) i can't see the source generated for PHP even the page
works properly (It doesn't happend with Mozilla or Opera).
If i comment out the line:
session_start()
This behaviour stops.
Any idea what's going on?
Thanks
hecchan
--- End Message ---
--- Begin Message ---
Hi hecchan,
I don't have a crear idea on what your problem is, but i have read
an article on phpfreak.com, it says to work the sessioned PHP scripts
correctly with IE6 you have to insert..
header("Cache-control: private");
immediatly after starting the session.
try this.
Viraj
p.s.
and also if there is any one wo knows what exactly this header line
means,
please post a brief decription. thanks.
hecchan wrote:
>
> Hi,
> Using IE 6 (XP) i can't see the source generated for PHP even the page
> works properly (It doesn't happend with Mozilla or Opera).
>
> If i comment out the line:
> session_start()
> This behaviour stops.
> Any idea what's going on?
>
> Thanks
>
> hecchan
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
* Thus wrote Viraj Kalinga Abayarathna ([EMAIL PROTECTED]):
>
> header("Cache-control: private");
>
> p.s.
> and also if there is any one wo knows what exactly this header line
> means,
> please post a brief decription. thanks.
private means that only the intended person that is getting this
file is able to cache it. So if you're going through a proxy that
proxy must not cache that file.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
--- End Message ---
--- Begin Message ---
* Thus wrote hecchan ([EMAIL PROTECTED]):
> Hi,
> Using IE 6 (XP) i can't see the source generated for PHP even the page
> works properly (It doesn't happend with Mozilla or Opera).
>
> If i comment out the line:
> session_start()
> This behaviour stops.
> Any idea what's going on?
What is your session.cache_limiter ini setting?
private, nocache, public?
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
--- End Message ---
--- Begin Message ---
hecchan wrote:
Using IE 6 (XP) i can't see the source generated for PHP even the page
works properly (It doesn't happend with Mozilla or Opera).
The "View source" in IE 5 and 6 is buggy : it doesnt work as soon as
"there are too many files in the Temp Internetfiles folder". sic.
Solution is of course emptying IE cache... or switching to mozilla ;-)
See M$ Knowledge base article Q306907
--
Christophe Chisogne
Developper, Publicityweb sprl
http://www.publicityweb.com
--- End Message ---
--- Begin Message ---
Take a look at pwgen, it is a command line utility that makes it easy to
generate random passwords with a user specified length, it can generate
random words that are easier to remember or truly random secure
passwords with non alpha numeric characters in it. It is available in
the FreeBSD ports tree and probably easily found from google.
Jason
Chris W. Parker wrote:
Dennis Gearon <mailto:[EMAIL PROTECTED]>
on Sunday, August 31, 2003 12:36 AM said:
Anyone have any sources of noun/verb/adjective lists for password
generation?
Sorry I don't have a resource for you, but passwords shouldn't use
dictionary words in the first place. Have you considered creating random
passwords?
Chris.
--- End Message ---
--- Begin Message ---
More safely maybe, but even that solution could be exploited somewhat
easily. The script that writes the file would be better off as a CGI
than executed through the Apache module, this would allow you to
restrict write access to the directory where the file that triggers the
restart is stored to the owner of the script, you could then further
restrict access to this script through .htccess or other means. If you
make a file trigger a cronned job to restart the server if you are using
mod_php the directory must be writable to the user the web server runs
as which means that anyone who can execute php code through the
webserver can trigger a server restart by writing the file, you could
even cron it to write the file every minute effectively shutting the
server down (whether it be web or the actual system itself).
Doing something like this takes a lot of thought, it can be made
difficult to exploit but you need to do more than just make a cron
pickup a file, excellent starting place though.
Jason
Dan Anderson wrote:
Search the archives. Somebody wanted to restart their server using a
web page, and a clever solution was pointed out. By creating a script
that monitored for a particular file in temp and restarted the server if
it existed it, and cronning it for every minute, they could do it safely
and securely.
-Dan
On Tue, 2003-09-02 at 12:19, Joe Harman wrote:
Hey guys & gals...
Is there a way to restart Apache with a PHP command?
Joe Harman
--- End Message ---
--- Begin Message ---
Rather than turning on register globals system wide I'd use .htaccess to
enable register globals for the specific sites or applications that
require them. Because the super globals have been introduced the
problem with register globals and application security may be more
prounounced for applications that don't expect them to be on (granted
they should check and make sure they are off but you never know :)).
The PHP manual has a section on alterting PHP's configuration with the
.htaccess file.
Jason
Deependra b. Tandukar wrote:
Hi,
I have configured PHP 4.3.3 in which register_gloabals is set to be
off. I modified etc/php.ini and set it to be On but still it shows it
is off and some developed applications in php are asking for it to be
turned on. How do I do this?
Regards,
DT
--- End Message ---
--- Begin Message ---
This isn't really a problem with PHP, you will encounter it with many
other languages how is the parser supposed to know you haven't closed a
brace until it reaches the end of the file? It doesn't match using
indentation like humans do.
Indenting code and code syntax highlighting make it very easy to spot an
open brace, vim is an excellent editor, komodo, zend studio, eclipse, etc.
Jason
Mike Migurski wrote:
Cuz the the way the PHP parser is written makes it impossible to discover
the error before it gets to the end of the file, and realizes that there
are no more braces to go around.
It definitely sucks... almost as badly as a stray backtick. Try finding
that little bugger at 1600x1280...
This is where the benefits of a syntax-coloring text editor really come
into play - you find the missing backtick as soon as you see your code
colored like a text string.
---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca http://mike.teczno.com/contact.html
--- End Message ---
--- Begin Message ---
Hi Nicole,
You can not retrieve information stored in a cookie which set by
one domain from some other domain. Try passing all the information
you want with the image SRC tag.
regards
Viraj
Nicole wrote:
>
> OK. Thanks.
>
> I have the hidden image code:
>
> <img src=http://thetrackingurl/?param1=val1¶m2=val2&etc... height=0
> width=0 border=0>
>
> This hidden image code is placed on the ThankYou page that people see after
> they have bought something. What it does is load a script on the tracking
> site to let the owner know a sale was made.
>
> The tracking site is different from the site that the product is sold on.
>
> A cookie was placed on the client's (buyer) side to store where that client
> originated from. So when the hidden image is called, the tracking script is
> called and tries to access this cookie to retrieve where the buyer came
> from.
>
> But the script just gets a blank cookie when accessed this way(via hidden
> image); However, if the script was accessed directly, or the thankyou page
> resided on the same domain as the tracking script (which created the cookie
> to begin with), the cookie has the value that it was set with.
>
> Does this make sense? Thanks for any input. PHP's docs on sessions didn't
> seem to have anything relating to this situation; so I'm stuck.
>
> Nicole
>
> "Chris Shiflett" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > --- Nicole <[EMAIL PROTECTED]> wrote:
> > > Is this question too advanced for this newsgroup?
> >
> > Somehow I doubt it. But, that's a nice tactic for grabbing some attention.
> :-)
> >
> > Show us some sample code of a very small test case. I can't really follow
> your
> > description of what you are trying to do.
> >
> > Chris
> >
> > =====
> > Become a better Web developer with the HTTP Developer's Handbook
> > http://httphandbook.org/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I don't accept third party cookies. Maybe your browser is set up so it
does not too. Check the privacy & security settings.
Nicole wrote:
The cookie is being accessed by the same domain it was generated by. The
problem is, the script is being pulled up via a hidden image (which resides
on a different domain). So that may still be the problem anyway.
Thanks.
--
"Ernest E Vogelsinger" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
At 23:55 03.09.2003, Nicole said:
--------------------[snip]--------------------
But the script just gets a blank cookie when accessed this way(via hidden
image); However, if the script was accessed directly, or the thankyou
page
resided on the same domain as the tracking script (which created the
cookie
to begin with), the cookie has the value that it was set with.
--------------------[snip]--------------------
That's it - cookies will only be sent to the same domain (hostname) they
have been generated at. You cannot pass cookies between domains
(hostnames).
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/
--- End Message ---
--- Begin Message ---
I am trying to see how many times a person has tried to log in during a
session.
the login script...
$objAuth->start();
if ($objAuth->getAuth()) // is user logged in already
...display hello page...
else
...display login page
OK, so far so good.
If the user punches in anything wrong, the login gets displayed again.
Now I want to track this iteration of attempts.
In the START method, I did this...
$this->_loginAttempts = $this->_loginAttempts + 1;
then I added
echo $objAuth->getLoginAttempts();
before ...display login page... to see how it tracks.
It always displays '1'
To me, it looks like '$objAuth->start();' , which is called each time the
page runs, which is each time a login attempt is made, is re-initializing
all the class vars to their default state.
If I make _loginAttempts = 8, then it displays 9.
So, my question (this time) is how do I get the class to track this counter?
I hope I explained this well enough.
I really don't think this is a PEAR::Auth specific question. I think it's
just a "how do I keep this counter going in a class" question.
Thanks
Walter
--- End Message ---
--- Begin Message ---
hi,
This is because the life time of an object is only as long as the page.
Two solutions: store the login attempt count in the cookies. If you want
persistent objects serialize them and save them to disk or db. and
deserialize them again on the next page. This will have to be coupled
with a uinique identifier (usually associated with a session) so that
you know which object belongs to which user.
jsWalter wrote:
I am trying to see how many times a person has tried to log in during a
session.
the login script...
$objAuth->start();
if ($objAuth->getAuth()) // is user logged in already
...display hello page...
else
...display login page
OK, so far so good.
If the user punches in anything wrong, the login gets displayed again.
Now I want to track this iteration of attempts.
In the START method, I did this...
$this->_loginAttempts = $this->_loginAttempts + 1;
then I added
echo $objAuth->getLoginAttempts();
before ...display login page... to see how it tracks.
It always displays '1'
To me, it looks like '$objAuth->start();' , which is called each time the
page runs, which is each time a login attempt is made, is re-initializing
all the class vars to their default state.
If I make _loginAttempts = 8, then it displays 9.
So, my question (this time) is how do I get the class to track this counter?
I hope I explained this well enough.
I really don't think this is a PEAR::Auth specific question. I think it's
just a "how do I keep this counter going in a class" question.
Thanks
Walter
--
http://www.raditha.com/php/progress.php
A progress bar for PHP file uploads.
--- End Message ---
--- Begin Message ---
Pass the value $this->_loginAttempts to the same page, assign it to
$this->_loginAttempts and then increment it.
-Murugesan
"jsWalter" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I am trying to see how many times a person has tried to log in during a
> session.
>
> the login script...
>
> $objAuth->start();
>
> if ($objAuth->getAuth()) // is user logged in already
> ...display hello page...
> else
> ...display login page
>
> OK, so far so good.
>
> If the user punches in anything wrong, the login gets displayed again.
>
> Now I want to track this iteration of attempts.
>
> In the START method, I did this...
>
> $this->_loginAttempts = $this->_loginAttempts + 1;
>
> then I added
>
> echo $objAuth->getLoginAttempts();
>
> before ...display login page... to see how it tracks.
>
> It always displays '1'
>
> To me, it looks like '$objAuth->start();' , which is called each time the
> page runs, which is each time a login attempt is made, is re-initializing
> all the class vars to their default state.
>
> If I make _loginAttempts = 8, then it displays 9.
>
> So, my question (this time) is how do I get the class to track this
counter?
>
> I hope I explained this well enough.
>
> I really don't think this is a PEAR::Auth specific question. I think it's
> just a "how do I keep this counter going in a class" question.
>
> Thanks
>
> Walter
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Thanks.
That is waht I needed to know!
It works!
Thanks
Walter
--- End Message ---
--- Begin Message ---
Lingua,
i thought you solved this problem. any way, i just peep in to the
msg you have forward as a zip file.
you have tried few diffrent email adresses as the To: one of them
is already exceeded the allocated storage space. another one is not
exist in yahoo.com, i'll put some extract from that msgs..
<[EMAIL PROTECTED]>
(reason: 554 delivery error: dd Sorry, your message to
[EMAIL PROTECTED] cannot be delivered. This account is over quota. -
mta223.mail.scd.yahoo.com)
<[EMAIL PROTECTED]>
(reason: 554 delivery error: dd This user doesn't have a yahoo.com
account ([EMAIL PROTECTED]) [-5] - mta166.mail.scd.yahoo.com)
<[EMAIL PROTECTED]>
(reason: 550 Requested action not taken: mailbox unavailable)
can you change the To: to my email address and try. it's
[EMAIL PROTECTED] or [EMAIL PROTECTED] or [EMAIL PROTECTED]
regards
Viraj
Lingua2001 wrote:
>
> Hi Viraj and all,
>
> Did you figure out what is going on with the
> returned mails, Viraj?
>
> Thanks in advance,
>
> David
>
> >Thank you for your message.
>
> >I've attached one ZIP file that contains some of the
> >returned mails including the most recent one (one pair: details.txt and
> >message4.txt).
>
> >Thank you very much in advance.
>
> >David
> ----- Original Message -----
> From: "Viraj Kalinga Abayarathna" <[EMAIL PROTECTED]>
> To: "Lingua2001" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Tuesday, September 02, 2003 3:42 AM
> Subject: Re: [PHP] web-mail problem
> > David,
> > first, this is a meassage you are getting from your mail server,
> > not from PHP.
> >
> > according to my knowladge this is due to email address routing
> > problem which the mail server experience when it tries to relay the
> > mail.
> > if you can send me the complete bounce mail message you recieve
> > i'll tell you exactly whats going on there.
> >
> > Viraj
>
> ----- Original Message -----
> From: "Lingua2001" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, September 02, 2003 12:42 AM
> Subject: web-mail problem
>
> > Hi all,
> >
> > I am trying to solve a problem related to mail( ). I am not
> > sure whether it is from SMTP directly or html tags used for html form
> mail.
> > I got the following message, and has anyone seen this before?
> >
> > *********************************************************
> > This email is being returned to you because the remote server would not
> > or could not accept the message. The registeredsite servers are just
> > reporting to you what happened and are not the source of the problem.
> >
> > The address which was undeliverable is in the section labeled:
> > "----- The following addresses had permanent fatal errors -----".
> >
> > The reason your mail is being returned to you is in the section labeled:
> > "----- Transcript of Session Follows -----".
> >
> > The line beginning with "<<<" describes the specific reason your e-mail
> > could
> > not be delivered. The next line contains a second error message which is
> a
> > general translation for other e-mail servers.
> >
> > ***********************************************************
> >
> > Thank you in advance.
> >
> > David
> >
--- End Message ---
--- Begin Message ---
I have a parent Class that does this in one of it's methods...
$session = &Auth::_importGlobalVariable("session");
$session[$this->_sessionName]['registered'] = true;
I would like to "hook" into this in on eof my methods in a child class
I thought I could do this...
[538] $session = Auth::_importGlobalVariable("session");
[539] $session[Auth::_sessionName]['registered'] = true;
But I get this error:
Parse error: parse error, unexpected ']', expecting '(' in
mypath\AuthUser.php on line 539
OK, I guessed wrong (again).
This is how PEAR::Auth deals with inserting its class vars into a session
and I want to piggyback on that. No need to roll my own, I think.
Can someone show me the errors of my ways?
Thanks
Walter
--- End Message ---
--- Begin Message ---
It looks like you're trying to access a variable of a class, not an instance
of that class. try something more like
$authObj = new Auth;
$session = &Auth::_importGlobalVariable("session");
$session[$authObj->_sessionName]['registered'] = true;
I'm pretty sure php4 doesn't allow access to variables with the :: operator. I
sincerely doubt php5 does (although i suppose logically it could be used to
access static variables...?)
Does your class extend Auth? if so you should use $this-> instead of
instantiating a new object... I'm honestly not sure what you're trying to do
here... Even if your class extends Auth, i don't see how changing $session
would do you any good since it appears to be applicable only to whatever
function you took that snippet from, not the entire object (which would look
like $this->session instead of $session)
If you post a more thorough description of what you're trying to do, and
explain the OOP relationships a bit more, that would help....
-Evan
On Wednesday 03 September 2003 10:08 pm, jsWalter wrote:
> I have a parent Class that does this in one of it's methods...
>
>
> $session = &Auth::_importGlobalVariable("session");
> $session[$this->_sessionName]['registered'] = true;
>
> I would like to "hook" into this in on eof my methods in a child class
>
> I thought I could do this...
>
> [538] $session = Auth::_importGlobalVariable("session");
> [539] $session[Auth::_sessionName]['registered'] = true;
>
> But I get this error:
>
> Parse error: parse error, unexpected ']', expecting '(' in
> mypath\AuthUser.php on line 539
>
> OK, I guessed wrong (again).
>
> This is how PEAR::Auth deals with inserting its class vars into a session
> and I want to piggyback on that. No need to roll my own, I think.
>
> Can someone show me the errors of my ways?
>
> Thanks
>
> Walter
--- End Message ---
--- Begin Message ---
I've seen this somewhere (or I've gone crazy), but a function in PHP that
automatically forwards you to another web page. If want to do an 'if x=5
then jump to this other page on the site or an external site'.
Could anyone help me out here?
Thanks very much.
-Doug
--- End Message ---
--- Begin Message ---
if ($x == 5)
header('Location: http://blah.com/blah');
This what you were looking for?
Also make sure this is sent before any other output
Andrew
----- Original Message -----
From: "DougD" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 04, 2003 6:32 AM
Subject: [PHP] auto 'jump' to link
> I've seen this somewhere (or I've gone crazy), but a function in PHP that
> automatically forwards you to another web page. If want to do an 'if x=5
> then jump to this other page on the site or an external site'.
>
> Could anyone help me out here?
>
> Thanks very much.
>
> -Doug
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
--- End Message ---
--- Begin Message ---
header("Location: $url");
hope this helps.
-Jackson
On Thu, 2003-09-04 at 00:32, DougD wrote:
> I've seen this somewhere (or I've gone crazy), but a function in PHP that
> automatically forwards you to another web page. If want to do an 'if x=5
> then jump to this other page on the site or an external site'.
>
> Could anyone help me out here?
>
> Thanks very much.
>
> -Doug
--- End Message ---
--- Begin Message ---
exactly what I needed ... just couldn't get it searched out. Your help is
greatly appreciated...
"Dougd" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I've seen this somewhere (or I've gone crazy), but a function in PHP that
> automatically forwards you to another web page. If want to do an 'if x=5
> then jump to this other page on the site or an external site'.
>
> Could anyone help me out here?
>
> Thanks very much.
>
> -Doug
--- End Message ---
--- Begin Message ---
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
--- End Message ---
--- Begin Message ---
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
--
http://www.raditha.com/php/progress.php
A progress bar for PHP file uploads.
--- End Message ---
--- Begin Message ---
Watch out for line wraps.
<?php
/* I wrote this for private use, so don't be suprised if it sucks. */
$DIRECTORY = '/path/to/images';
$PATH_ROOT = &$DIRECTORY; // Kind of a document root for this script.
if ( isset($_SERVER['PATH_INFO']) &&
file_exists($DIRECTORY.$_SERVER['PATH_INFO']) && ereg("^$PATH_ROOT",
realpath($DIRECTORY.$_SERVER['PATH_INFO'])) ) {
$info = pathinfo($DIRECTORY.$_SERVER['PATH_INFO']);
switch(strtolower($info['extension'])) {
case 'jpe':
case 'jpg':
case 'jpeg':
header("Content-type: image/jpeg");
break;
case 'gif':
header("Content-type: image/gif");
break;
default:
exit();
break;
}
readfile($DIRECTORY.$_SERVER['PATH_INFO']);
exit();
}
if ($handle = opendir(trim($DIRECTORY)))
{
$files = array();
while (false !== ($file = readdir($handle)))
if ( (strcmp($file, '.') != 0) ) {
$info = pathinfo($file);
if ( in_array(strtolower($info['extension']), array('jpg', 'jpe',
'jpeg', 'gif')) )
array_push($files, $file);
}
closedir($handle);
$link = $files[mt_rand(0, (sizeof($files)-1))];
echo '<html>
<head>
<META HTTP-EQUIV=Refresh CONTENT="5; URL='.$_SERVER['REQUEST_URI'].'"/>
<title>'.$link.'</title>
</head>
<body>
<center>
<a
href="'.$_SERVER['REQUEST_URI'].'/'.$link.'">'.$link.'<br/>
<img border="0" src="'.$_SERVER['REQUEST_URI'].'/'.$link.'"
/></a>
</center>
</body>
</html>';
}
?>
On Wednesday 03 September 2003 11:07 pm, 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
--- End Message ---
--- Begin Message ---
this is the way I do if helps
//FILES IN DIR TO ARRAY
$imgdir = "user/home/";
$lista_imgs = array();
$handle = opendir($imgdir);
while ($file = readdir($handle)) {if ($file != "." && $file != "..")
{array_push ($lista_imgs, $file);}}
closedir($handle);
// RANDOM IMG
$rdnum = rand(0, count($lista_imgs) - 1);
$img_home = $lista_imgs[$rdnum];
I assume there are only GIF or JPG files in the directory
saludos
aniceto lopez :: DYNAMICAL.BIZ
web development & host services
Barcelona - Spain
-----Mensaje original-----
De: John Taylor-Johnston [mailto:[EMAIL PROTECTED]
Enviado el: jueves, 04 de septiembre de 2003 8:07
Para: [EMAIL PROTECTED]
Asunto: [PHP] Am I dreaming or what :)
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
As it turned out, all I had to do was get rid of the period "." and things began to
work better.
I also had to remember to close my browser and empty the cookie jar.
Thanks,
J
Jaap Van Ganswijk wrote:
> At 2003-09-01 00:49 -0400, John Taylor-Johnston wrote:
> >I create this cookie, using Javascript::
> >
> >testals.flsh.usherb.ca FALSE / FALSE 1062433227 weather.htm99999995 1
> >
> >If the browser is reloaded, I want php to read the cookie and do my else statement.
> >Even after a browser shut-down and restart, I cannot get PHP to read the cookie
> >(first part of my if statement).
> >
> >If I use phpinfo(), it does confirm that:
> >
> >_COOKIE["weather.htm99999995"] = 1
> >
> >What weird quirk have I missed this time?
> >
> >
> ><?php
> >
> >$StudentId = "weather.htm99999995";
>
> Remove 'weather.htm' from this string.
>
> >if (!isset($_COOKIE["weather.htm$StudentId"]))
> >{
> >echo "Cookie not found, not reading weather.htm$StudentId<br>";
> >echo "\$_COOKIE[\"weather.htm$StudentId\"]".
> >$_COOKIE["weather.htm$StudentId"]."-<hr>";
> >
> >}else{
> >echo "cookie found, yay! ".$_COOKIE["weather.htm$StudentId"]."-<hr>";
> >#phpinfo();
> >}
> >?>
>
> Greetings,
--- End Message ---
--- Begin Message ---
This is not a PHP question but didn't know where else to ask it. I am
uploading files via SSH Secure File Transfer and am getting the following
error message.
--error message start--
Failed to scan directories. Error 6: C:/Documents and Settings/My
Documents/My Webs/dynamic/1.php: No such file or directory..
DONE - 0 Files 0 Total
Encountered 1 errors.
--error message stop--
Does anyone know why I am getting this message. It only happens when I am
trying to add a file to a directory. Any advice or help is appreciated.
Ben
--- End Message ---
--- Begin Message ---
Google for "Failed to scan directories. Error 6" (including quotes). First
result is the ssh.com faq, which has a link to
http://www.ssh.com/support/faq/secureshell/qa_1_1198.html, which is your
answer
On Wednesday 03 September 2003 11:39 pm, Ben C. wrote:
> This is not a PHP question but didn't know where else to ask it. I am
> uploading files via SSH Secure File Transfer and am getting the following
> error message.
>
> --error message start--
> Failed to scan directories. Error 6: C:/Documents and Settings/My
> Documents/My Webs/dynamic/1.php: No such file or directory..
> DONE - 0 Files 0 Total
> Encountered 1 errors.
> --error message stop--
>
> Does anyone know why I am getting this message. It only happens when I am
> trying to add a file to a directory. Any advice or help is appreciated.
>
> Ben
--- End Message ---
--- Begin Message ---
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
--- End Message ---
--- Begin Message ---
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
--- End Message ---
--- Begin Message ---
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" <[EMAIL PROTECTED]> schreef in bericht
news:[EMAIL PROTECTED]
> 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
> >
--- End Message ---
--- Begin Message ---
Hi
Am Don, 2003-09-04 um 12.40 schrieb Ronald van Raaphorst:
> 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...
A computer cannot decide when a recursion is to deep. Imagine traversing
a realy big tree. There a recursion can get realy deep.
I don't know about the internals of php. But as it is an interpreter
language, I would say that all variables or even the parsing tree are
located on the heap. So this heap will probably be quite big! Thus, to
produce a heap overflow will take a rather long time. (Correct me if I
am wrong with my tought)
A workaround could be that you have a counter (static variable!) in your
recursion procedure or methode respectively. You increment this counter
on every entry into the procedure and compare it to a limit that _you_
specifiy.
--
Cheers!
Marco
> 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" <[EMAIL PROTECTED]> schreef in bericht
> news:[EMAIL PROTECTED]
> > 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
>
--- End Message ---
--- Begin Message ---
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" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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" <[EMAIL PROTECTED]> schreef in bericht
> news:[EMAIL PROTECTED]
> > 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
>
>
>
--- End Message ---
--- Begin Message ---
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says...
> hello!
>
> i need to include() only a given amount of lines (the first 10 for example)
> instead of a whole file.
>
> does someone know how this has to be done?
>
>
> thanks a lot for your effort,
> best regards
include and friends only load a complete file. You might try fopen/fread
and count the number of lines loaded.
Cheers
--
Quod subigo farinam
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?
--- End Message ---
--- Begin Message ---
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?
I tried the following, but it did not work:
AND amenities LIKE ('%pool%','%spa%','%fitness-center%')
Any suggestions?
--- End Message ---
--- Begin Message ---
i'm doin this offlist
-----Original Message-----
From: Ralph Guzman [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 04, 2003 10:23 PM
To: PHP General Mailing List
Subject: [PHP] mysql Pattern Matching
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?
I tried the following, but it did not work:
AND amenities LIKE ('%pool%','%spa%','%fitness-center%')
Any suggestions?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
hello,
i must admit, i'm quite a nub when it comes to compiling php myself, so
i'm wondering if there is any version of php with curl already bein part
of it? i'm running xp with apache 1.3.
cheers,
chris
--- End Message ---
--- Begin Message ---
Refer
http://in2.php.net/curl
-murugesan
----- Original Message -----
From: "Chris" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 04, 2003 5:02 PM
Subject: [PHP] is there a php version with curl already integrated?
> hello,
>
> i must admit, i'm quite a nub when it comes to compiling php myself, so
> i'm wondering if there is any version of php with curl already bein part
> of it? i'm running xp with apache 1.3.
>
> cheers,
> chris
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
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
--- End Message ---