|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 23 Mar 2005 11:17:24 -0000 Issue 3354
php-general-digest-help
lists.php.net
Date: Wed Mar 23 2005 - 05:17:24 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 23 Mar 2005 11:17:24 -0000 Issue 3354
Topics (messages 211338 through 211375):
Re: access violation
211338 by: Rob Agar
Re: Session destroy/unset question - the same session_id is regenerated.
211339 by: Chris Shiflett
Help! configure Apache as a proxy
211340 by: shimuqiheb.abchina.com
211354 by: Richard Lynch
211374 by: Burhan Khalid
Re: cache class
211341 by: Mister Jack
Re: Passing Arrays between pages
211342 by: PartyPosters
211348 by: Josh Whiting
Notice: Undefined offset: 3 in ..........
211343 by: PartyPosters
211344 by: Rasmus Lerdorf
Re: send email sample
211345 by: issin
Borrowed code- how to give credit
211346 by: C Drozdowski
211347 by: Bryan
211353 by: Richard Lynch
GIF instead of JPG..
211349 by: Ryan A
211351 by: Mike
211352 by: Richard Lynch
211361 by: Andras Kende
Re: seraching / indexing in php
211350 by: Forest Liu
211359 by: Richard Lynch
211365 by: Frank Arensmeier
211367 by: Chris Ramsay
211369 by: Reinhart Viane
Re: Problems with epoch date before 1970 on PHP 4.3.1
211355 by: Richard Lynch
Re: count with match probelm
211356 by: Richard Lynch
Re: "else if" problem
211357 by: Richard Lynch
Re: [semi OT]: Planning projects
211358 by: Richard Lynch
211363 by: Burhan Khalid
Re: Why not
?
211360 by: Richard Lynch
Re: fopen
211362 by: Richard Lynch
Re: Apache user can't use exec(), passthru(), etc.
211364 by: Richard Lynch
Arrays not recognized in Simple XML Objects (using print_r)
211366 by: Yashesh Bhatia
reduce the following code "if ($colorVar == 'Black' || $colorVar == 'Red' || $colorVar == 'White' || $colorVar == 'Blue' ){"
211368 by: Lupita
211370 by: Gerhard Pfeiffer
211372 by: Frank Arensmeier
SQL statement - date
211371 by: Jacques
211373 by: Jesper Goos
Re: http authentication with safe mode enabled?!
211375 by: Roman Stöckl-Schmidt
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
hi Leif
Glad to know I'm not the only one ;)
> The only system stuff we have in common is the OS. The
> webserver is Sambar, and PHP is 5.0.3. It didn't start having
> this issue till I updated the PHP to 5.0.3, so I'm going to
> reinstall it at some point to see if that helps any.
That's interesting - it also started happening for me after installing
PHP 5.0.3. But I have reverted to 4.3.10 for now, and I can't see how
installing 5.0.3 into an entirely separate directory can break my old
php install. Hmm..
Incidentally, are you using Pear at all?
Rob
attached mail follows:
Ken wrote:
> After unsetting and destroying the session, the same sid is generated.
No session identifier is generated at this point. This generation only
happens when there is no identifier presented by the client, or when you
explicitly regenerate it using something like session_regenerate_id().
> is this a normal behaviour?
Yes.
Are you sure you need a new session identifier?
> i did this:
>
> session_start()
>
> //kill session variables
> unset($_SESSION);
> session_destroy();
I'd have to do some tests to find out, but you might want to set
$_SESSION to attay() rather than just unset it, but these might have
essentially the same behavior (e.g., memory is freed but not overwritten).
Hope that helps.
Chris
--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/
attached mail follows:
I configured a Apache server as a proxy.
But it's very slow. when I use this server connect internet it is NOT so
slow.
I think it ss because,my config has some error!
Who can help me?
thank you
<IfModule mod_proxy.c>
Listen 8086
ProxyRequests On
ProxyVia On
ProxyRemote * http://192.168.1.9:8080
NoProxy 192.0.0.0/8
AllowCONNECT 8086
<Proxy *>
Order deny,allow
Deny from all
Allow from 192.168.2.100
</Proxy>
</IfModule>
Shi MuQi
LangFang ABC (China) ¡ãv¡ã
Tel:(86)-316-68382!^ /(_)\
E-mail:shimuqiheb
abchina.com ^ ^
attached mail follows:
On Tue, March 22, 2005 3:30 pm, shimuqiheb
abchina.com said:
> I configured a Apache server as a proxy.
> But it's very slow. when I use this server connect internet it is NOT so
> slow.
> I think it ss because,my config has some error!
> Who can help me?
WILD GUESS
You've got Apache configured to do a reverse DNS lookup to see the domain
name of the visitor... Only now it's trying to find a domain name for
192.168.2.100 which is not in your /etc/hosts file and ain't gonna show up
in DNS records any time soon...
Note that I don't really understand any of this proxy stuff you've done.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
shimuqiheb
abchina.com wrote:
> I configured a Apache server as a proxy.
> But it's very slow. when I use this server connect internet it is NOT so
> slow.
> I think it ss because,my config has some error!
> Who can help me?
This is a PHP programming list, not an Apache list. Ask in the Apache
list to get better responses.
attached mail follows:
Many thanks for all the answers.
I've checked that I was saving the right file (I even think about it
!), and even if I'm using Templeet (sort of smarty http://templeet.org
) i've disabled all cache, and this code is only PHP not
template-language.
I've checked the error.log, and it just said that the file does not
exists (which is normal, the page is generated when it's missing, by
Templeet, thus proving it's not using a cache). Now, i've put the
class definition inside by PHP file, (I do not include it anymore with
include ''), and it just hang with the error.log saying that it
exhausted all memory.
On Tue, 22 Mar 2005 15:18:17 -0500, Jeremiah Fisher
<thisisroot
gmail.com> wrote:
> I usually encounter this when there's an error of some sort. Tail your
> error log and see if the apache child thread is seg faulting (if you're
> using httpd).
>
> The web server may still be up, but your code is causing the particular
> connection to fail. Because the connection just dies, the browser never
> receives any content, and so never changes what's on screen.
>
> Look for scoping issues: i.e., accessing a singleton from an aggregate
> object's constructor (before the singleton has been instantiated).
>
> Alternatively, comment out everything but the first few lines, and start
> uncommenting more and more until it stops working all together. As a
> good test, try this:
>
> <?php
> [...trial code...]
>
> echo 'test run finished';
> exit;
>
> /*
> [...unknown code...]
> */
> ?>
>
> Hope this helps,
>
> Jeremy
>
>
> Mister Jack wrote:
> > Hi,
> >
> > I'm having a bit of a problem.
> > I include a class in my script, the first time run fine, and then if I
> > change anything in my class, changes are not reflected on the browser,
> > it's like it's still the old class which is used. I've cleared the
> > browser cache, force a pragma no-cache, but no, nothing do the trick.
> > even if I do "return;" at the beginning of the method I called, it
> > doesn't work... does someone have a clue about what is going on ?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Thanks for all your help!!! managed it with -
$testArray = implode('|', $testArray);
On next page: $testArray = explode('|', $testArray);
----- Original Message -----
From: <afan
afan.net>
To: "PartyPosters" <sales
partyposters.co.uk>
Cc: <php-general
lists.php.net>
Sent: Tuesday, March 22, 2005 10:06 PM
Subject: Re: [PHP] Passing Arrays between pages
> 1. you can put your array in string using implode() function and on next
> page create the array back using explode() function.
> $testArray = implode('|', $testArray);
> # you will get: "Apple|Banana|Peach"
> On next page: $testArray = explode('|', $testArray);
>
> 2. use serialize()/unserialize() functions
>
> For more info read manual.
>
> -afan
>
> PartyPosters wrote:
>
> >Hello,
> >Please can someone tell me how you pass arrays between PHP pages.
> >I have tried something like this and have tried many variations of this
but
> >nothing working yet ;
> >
> >
> >Page 1
> >$testArray[0] =Apple;
> >$testArray[1] =Banana;
> >$testArray[2] =Peach;
> >
> >echo "<INPUT NAME = \"kcompany[]\" TYPE = \"hidden\"
VALUE=\"$testArray\">";
> >
> >Page2
> >echo $testArray[1];
> >
> >
> >On different variations of this I keep on getting 'Array' when I to
return the variable on the second page
> >
> >Many Thanks.
> >Kaan.
> >
> >
> >
>
attached mail follows:
> >Please can someone tell me how you pass arrays between PHP pages.
>
> $var = serialize($testArray);
> echo "<INPUT NAME = \"kcompany[]\" TYPE = \"hidden\" VALUE=\"$var\">";
>
> Then unserialize the variable on the receiving page.
To this you might also add an MD5 hash to check for authenticity,
depending on what you're doing with that incoming data that you're
unserializing (consider an client who sends you a serialized array that
you didn't intend). You'll also want to encode the serialized data with
htmlentities:
$serialized = serialize($testArray);
$hash = md5($serialized . "my secret phrase");
echo '<input type="hidden" name="serialized" value="'.htmlentities($serialized).'">';
echo '<input type="hidden" name="hash" value="'.$hash.'">';
then on the receiving end:
if ($_POST['hash'] != md5($_POST['serialized'] . "my secret phrase") {
// the hash doesn't match up, consider the data unusable
} else{
$testArray = unserialize($_POST['serialized']);
}
HTH
/jw
attached mail follows:
Hello,
Please could someone tell me why I am getting (Notice: Undefined offset: 3 in ..........) from using this code.
for ($i=0; $i<=3; $i++){
mysql_query("INSERT INTO shipped(userID, productID, distID, username,ship_company, ship_add1,ship_add2) VALUES(1, '$productID','$v_distIDArray[$i]', userID, '$v_companyArray[$i]','$v_add1Array[$i]','$v_add2Array[$i]')");
}
Thanks
Kaan
----- Original Message -----
From: PartyPosters
To: php-general
lists.php.net
Sent: Tuesday, March 22, 2005 10:01 PM
Subject: Passing Arrays between pages
Hello,
Please can someone tell me how you pass arrays between PHP pages.
I have tried something like this and have tried many variations of this but
nothing working yet ;
Page 1
$testArray[0] =Apple;
$testArray[1] =Banana;
$testArray[2] =Peach;
echo "<INPUT NAME = \"kcompany[]\" TYPE = \"hidden\" VALUE=\"$testArray\">";
Page2
echo $testArray[1];
On different variations of this I keep on getting 'Array' when I to return the variable on the second page
Many Thanks.
Kaan.
attached mail follows:
PartyPosters wrote:
> Hello,
> Please could someone tell me why I am getting (Notice: Undefined offset: 3 in ..........) from using this code.
>
>
> for ($i=0; $i<=3; $i++){
> mysql_query("INSERT INTO shipped(userID, productID, distID, username,ship_company, ship_add1,ship_add2) VALUES(1, '$productID','$v_distIDArray[$i]', userID, '$v_companyArray[$i]','$v_add1Array[$i]','$v_add2Array[$i]')");
> }
Because you only have 3 elements in one or more of those arrays.
Remember, index 3 is the 4th element.
-Rasmus
attached mail follows:
PHPer,
Sorry, I caused a lot of trouble to you.
Because my company block 80 port, only use email.
Thanks for your help.
John Taylor-Johnston wrote:
> Burhan Khalid wrote:
>
>
>>> Can you give me a send email sample?
>>
>>RTFM : http://www.php.net/manual/en/function.mail.php
>
>
> Burhan,
> That's awfully polite. "RTFM". How are people supposed to get started?
Take that attitude back over to the Perl newsgroup. One of the joys of PHP
has been a non-techhead, non-stressful, Open Source spirit of teaching and
helping others, which in turn helps PHP grow and flourish.
I'm polite, but seems that the original poster took no effort on their
part to try and solve the problem first. I'm polite to people that try
and solve the problem first, before coming to others for help.
The original poster could have done any of the following things:
1. Simply type "mail" in the search box on the php.net website, which
would have taken them to the section titled "Mail Functions", where the
first line reads " The mail() function allows you to send mail." When
they would have clicked on mail(), the would have seen examples on how
to send an email.
2. Simply typing "sending email php" in Google would have gotten them a
lot better results.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
________ Information from NOD32 ________
This message was checked by NOD32 Antivirus System for Linux Mail Server.
http://www.nod32.com
attached mail follows:
Hey,
I used a single line of code (ver batim) from a pear class in my own
code. I try to always be honest and not steal code but this single line
does exactly what I need. The code is for a NPO website and will never
be sold or anything like that.
How should I give credit for the line of code in my own code?
attached mail follows:
You can add as many remarks as you want... It won't show up in the
code or mess it up.
Just say something like
"/* The next line of code came from my PEAR class. I did not create
it, it was something we created in class. Just giving credit where
credit is due */"
I myself, wouldn't care. I mean, the burden of proving it would be on
them. And who's to say that you didn't get it elsewhere.
Just my $.02...
Bryan
On Tue, 22 Mar 2005 19:54:27 -0500, C Drozdowski <c.d
earthlink.net> wrote:
> Hey,
>
> I used a single line of code (ver batim) from a pear class in my own
> code. I try to always be honest and not steal code but this single line
> does exactly what I need. The code is for a NPO website and will never
> be sold or anything like that.
>
> How should I give credit for the line of code in my own code?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
On Tue, March 22, 2005 4:54 pm, C Drozdowski said:
> I used a single line of code (ver batim) from a pear class in my own
> code. I try to always be honest and not steal code but this single line
> does exactly what I need. The code is for a NPO website and will never
> be sold or anything like that.
>
> How should I give credit for the line of code in my own code?
One line of code?
It's either a VERY long line, or not worth worrying about...
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
Hi,
I found this beautiful piece of code on the php site which make a
proportional thumbnail, problem is its only working with JPEG files...and
not with GIFs, can someone please help me convert it to GIF too?
I tried but got a bit confused as there are no functions that are equal to
"imagecreatetruecolor" that is in the below script.
The below script works perfectly for jpgs:
<?php
// The file
$filename = 'test.jpg';
// Set a maximum height and width
$width = 200;
$height = 200;
// Content type
header('Content-type: image/jpeg');
// Get new dimensions
list($width_orig, $height_orig) = getimagesize($filename);
if ($width && ($width_orig < $height_orig)) {
$width = ($height / $height_orig) * $width_orig;
} else {
$height = ($width / $width_orig) * $height_orig;
}
// Resample
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height,
$width_orig, $height_orig);
// Output
imagejpeg($image_p, null, 100);
?>
Beautiful, isnt it? Hats off to whoever wrote it and three cheers for the
online manual!
Thanks,
Ryan
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.0 - Release Date: 3/21/2005
attached mail follows:
> Hi,
> I found this beautiful piece of code on the php site which
> make a proportional thumbnail, problem is its only working
> with JPEG files...and not with GIFs, can someone please help
> me convert it to GIF too?
>
If your version of GD supports GIFs (which not all do), then it's almost as
simple as changing every place you see the string "jpeg" to "gif".
Look in the online manual for the image functions. You'll see reference to
the ones here (such as imagecreatfromjpeg()) and also ones for PNGs and GIFs
and a few others.
Just realize that when you are reading a file of a particular type, you need
to use those image<type>() functions... But in most cases they are
completely interchangable if you're passing paths to images of the
appropriate type.
Hope all of that makes sense :)
-M
> I tried but got a bit confused as there are no functions that
> are equal to "imagecreatetruecolor" that is in the below script.
> The below script works perfectly for jpgs:
>
>
> <?php
> // The file
> $filename = 'test.jpg';
>
> // Set a maximum height and width
> $width = 200;
> $height = 200;
>
> // Content type
> header('Content-type: image/jpeg');
>
> // Get new dimensions
> list($width_orig, $height_orig) = getimagesize($filename);
>
> if ($width && ($width_orig < $height_orig)) {
> $width = ($height / $height_orig) * $width_orig; } else {
> $height = ($width / $width_orig) * $height_orig; }
>
> // Resample
> $image_p = imagecreatetruecolor($width, $height); $image =
> imagecreatefromjpeg($filename); imagecopyresampled($image_p,
> $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
>
> // Output
> imagejpeg($image_p, null, 100);
> ?>
>
>
> Beautiful, isnt it? Hats off to whoever wrote it and three
> cheers for the online manual!
>
> Thanks,
> Ryan
>
>
>
>
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.8.0 - Release Date: 3/21/2005
>
> --
> PHP General Mailing List (http://www.php.net/) To
> unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
On Wed, March 23, 2005 5:30 am, Ryan A said:
> Hi,
> I found this beautiful piece of code on the php site which make a
> proportional thumbnail, problem is its only working with JPEG files...and
> not with GIFs, can someone please help me convert it to GIF too?
>
> I tried but got a bit confused as there are no functions that are equal to
> "imagecreatetruecolor" that is in the below script.
I believe all the imagecreatefromXYZ functions create a truecolor image
for internal manipulation...
Though I could be wrong, as GIF images do have pallet information within
them, and I supposed GD could be justified in using that to build a
256-color image...
At any rate, imagecreatetruecolor creates a "format-less" image -- It's
not a GIF, JPEG, TIFF, or anything, really. It's in an internal GD
format, and you can do whatever you want to it, and then output it as
whatever format you want.
> The below script works perfectly for jpgs:
As noted, just change jpg to gif everywhere, and it should work fine, if
your GD supports GIF.
Or you could even alter the script to determine the image format based on
its filename, then call the correct imagecreatefromXYZ and the correct
imageXYZ at the end.
Or, you could even use http://php.net/imagegetsize and IGNORE the
filename, and base your decision on what's actually *IN* the file, so when
some idiot renames a jpeg to ".gif" because they think that will make it a
GIF (yes, that really happens) then you won't get messed up.
> <?php
> // The file
> $filename = 'test.jpg';
>
> // Set a maximum height and width
> $width = 200;
> $height = 200;
>
> // Content type
> header('Content-type: image/jpeg');
>
> // Get new dimensions
> list($width_orig, $height_orig) = getimagesize($filename);
>
> if ($width && ($width_orig < $height_orig)) {
> $width = ($height / $height_orig) * $width_orig;
> } else {
> $height = ($width / $width_orig) * $height_orig;
> }
>
> // Resample
> $image_p = imagecreatetruecolor($width, $height);
> $image = imagecreatefromjpeg($filename);
> imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height,
> $width_orig, $height_orig);
>
> // Output
> imagejpeg($image_p, null, 100);
> ?>
>
>
> Beautiful, isnt it? Hats off to whoever wrote it and three cheers for the
> online manual!
>
> Thanks,
> Ryan
>
>
>
>
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.8.0 - Release Date: 3/21/2005
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
> Hi,
> I found this beautiful piece of code on the php site which make a
> proportional thumbnail, problem is its only working with JPEG files...and
> not with GIFs, can someone please help me convert it to GIF too?
>
> I tried but got a bit confused as there are no functions that are equal to
> "imagecreatetruecolor" that is in the below script.
> The below script works perfectly for jpgs:
>
>
> <?php
> // The file
> $filename = 'test.jpg';
>
> // Set a maximum height and width
> $width = 200;
> $height = 200;
>
> // Content type
> header('Content-type: image/jpeg');
>
> // Get new dimensions
> list($width_orig, $height_orig) = getimagesize($filename);
>
> if ($width && ($width_orig < $height_orig)) {
> $width = ($height / $height_orig) * $width_orig;
> } else {
> $height = ($width / $width_orig) * $height_orig;
> }
>
> // Resample
> $image_p = imagecreatetruecolor($width, $height);
> $image = imagecreatefromjpeg($filename);
> imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height,
> $width_orig, $height_orig);
>
> // Output
> imagejpeg($image_p, null, 100);
> ?>
>
>
> Beautiful, isnt it? Hats off to whoever wrote it and three cheers for the
> online manual!
>
> Thanks,
> Ryan
>
>
>
>
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.8.0 - Release Date: 3/21/2005
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Hello Ryan,
Im using the code below and works fine ...
Best regards,
Andras Kende
http://www.kende.com
//////////////////////////////////
<?php
function resample($src, $srcdir, $destdir, $width = '', $height = '')
{
if( is_file( $destdir . $src ) )
{
$src = $src; return;
}
$size = GetImageSize($srcdir . $src);
if (!$size[0] || !$size[1]) return;
$scale = min($width/$size[0], $height/$size[1]);
if ( $scale == 1 ) return;
$newwidth = (int)($size[0]*$scale);
$newheight = (int)($size[1]*$scale);
$xpos = (int)(($width - $newwidth)/2);
$ypos = (int)(($height - $newheight)/2);
$format = ereg_replace(".*\.(.*)$","\\1",$src);
$format = strtoupper($format);
if ($format == "JPG")
{
$destImg = ImageCreateTrueColor($width, $height);
$backColor=ImageColorAllocate($destImg, 255, 255, 255);
ImageFilledRectangle($destImg, 0, 0, $width, $height, $backColor);
$sourceImg = ImageCreateFromJPEG ($srcdir . $src);
ImageCopyResampled($destImg, $sourceImg, $xpos, $ypos, 0, 0, $newwidth,
$newheight, $size[0], $size[1]);
imagejpeg($destImg, $destdir . $src, 90);
}
elseif ($format == "GIF")
{
$destImg = ImageCreateTrueColor($width, $height);
$backColor=ImageColorAllocate($destImg, 255, 255, 255);
ImageFilledRectangle($destImg, 0, 0, $width, $height, $backColor);
$sourceImg = ImageCreateFromGIF ($srcdir . $src);
ImageCopyResampled($destImg, $sourceImg, $xpos, $ypos, 0, 0, $newwidth,
$newheight, $size[0], $size[1]);
imagegif($destImg, $destdir . $src, 90);
}
}
?>
//////////////////////////////////
attached mail follows:
or you can have a try on google:)
"xxxxxx site:www.yours.com"
On Tue, 22 Mar 2005 15:47:01 +0100, Reinhart Viane <rv
domos.be> wrote:
> I'm looking for a script which indexes the pages of a site (dynamic pages)
> in a dbase and makes it possible to search the site based on
> keywords/sentences/etc.
>
> Does anyone has any experience with such scripts and which do they
> recommend?
>
> Thx in advance
>
> Reinhart
>
>
--
Sincerely,
Forest Liu(刘云赟)
attached mail follows:
On Tue, March 22, 2005 7:01 am, Reinhart Viane said:
> One question: on most of these search engines I can't seem to find if the
> index and search dynamically generated pages.
Search engines do not generally index a page they can detect is
dynamically generated.
That means pages that have ? in the URL.
You can use $_SERVER['HTTP_PATHINFO'] to alter URLs to not have ? in them,
and they will get indexed by the search engines.
There are several on-line articles on how to do this.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
PHPdig comes with extensive documentation and you are free to rewrite
the code so that the search engine does exactly what you want. But, you
have to be rather familiar with PHP. My own impression was that it is
easy (more or less) to do some basic configuration on the search
engine. When it comes to adopting the code for your own needs, so to
say, it is sometime necessary to do some extensive research on the PHP
manual.
However, Phpdig is capable of indexing dynamically generated pages (I
just tested it). To write a little script in order to update the index
when the pages content changed, shouldn't be a problem either.
Download the package and take a look at the source code.
regards,
frank
2005-03-22 kl. 16.01 skrev Reinhart Viane:
> Thanks Frank,
>
> One question: on most of these search engines I can't seem to find if
> the
> index and search dynamically generated pages.
> The intention is to make a site where several users have one page each
> which
> they can edit on there own.
>
> Do you think most of those engines can index pages like that? Or
> should I
> create an index every time a page is updated / made?
>
> Greetings
>
> -----Oorspronkelijk bericht-----
> Van: Frank Arensmeier [mailto:frank.arensmeier
nikehydraulics.se]
> Verzonden: dinsdag 22 maart 2005 15:54
> Aan: php list general
> Onderwerp: Re: [PHP] seraching / indexing in php
>
> Hello!
>
> I suggest you take a look at:
>
> http://www.phpdig.net/
>
> Regards,
>
> Frank
>
> 2005-03-22 kl. 15.47 skrev Reinhart Viane:
>
>> I'm looking for a script which indexes the pages of a site (dynamic
>> pages)
>> in a dbase and makes it possible to search the site based on
>> keywords/sentences/etc.
>>
>> Does anyone has any experience with such scripts and which do they
>> recommend?
>>
>>
>>
>> Thx in advance
>>
>> Reinhart
>>
>>
>>
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
> --
> Internal Virus Database is out-of-date.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.7.3 - Release Date: 15/03/2005
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
attached mail follows:
If you are using Apache you also have the option of using the rewrite
rule to change your urls - for example
http://www.mydomain.com/index.php?a=foo&b=bar
to
http://www.mydomain.com/foo/bar
If you are interested there is plenty of info on the net about the
apache rewrite rule...
attached mail follows:
Thanks everyone,
Time to dig myself in and see what is best for my purpose. :)
-----Oorspronkelijk bericht-----
Van: Chris Ramsay [mailto:raz.net
gmail.com]
Verzonden: woensdag 23 maart 2005 9:53
Aan: php list general
Onderwerp: Re: [PHP] seraching / indexing in php
If you are using Apache you also have the option of using the rewrite
rule to change your urls - for example
http://www.mydomain.com/index.php?a=foo&b=bar
to
http://www.mydomain.com/foo/bar
If you are interested there is plenty of info on the net about the
apache rewrite rule...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
Internal Virus Database is out-of-date.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.7.3 - Release Date: 15/03/2005
attached mail follows:
On Tue, March 22, 2005 2:56 pm, Dan Rossi said:
> Hi there we have discovered a bug when trying to format a date which is
> before 1970 on one of our servers running PHP 4.3.1 , it will convert
> the 1966 year to 1970, is there any possible workaround for this ?
Errrr.
Unix epoch dates start with the integer 0 representing midnight 1/1/1970.
Rumor has it that the authors of this standard are big Disco fans, but
they have only replied with "No comment" :-)
I dunno what you expected to get from 1966 in an epoch date, but it's not
kosher input, so there ya go.
The only work-around for getting pre-1970 dates is not using Unix epoch to
represent your dates.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
On Tue, March 22, 2005 11:30 pm, Ryan A said:
> $q=mysql_query("select cno,date_and_time,MATCH(ad_sub, ad_text)
> AGAINST('$words') AS score from ".$tcname."ads WHERE MATCH(ad_sub,
> ad_text)
> AGAINST('$words') AND is_confirmed=1 LIMIT $limit1, $limit2");
This is pretty much a MySQL question, really...
But: There is a new-ish SQL_CALC_FOUND_ROWS constant you can use in your
query to get MySQL to tell you how many rows you would have gotten without
the LIMIT clause. You may be able to use that.
> which is running fine...my problem is I am using a class for pagination
> which requires the total number of records that will be returned to break
> the query into pages....and which will give me the values of $limit1 and ,
> $limit2 which i will use in the above statement...but running a count() is
> not working, it gives me an error, what other options do i have other than
> running the same query twice and using mysql_num_rows? (which i think
> would
> be quite intensive/wasteful as i am querying
100 rows each time)
>
> This is my count() query, maybe theres a problem here?
Probably.
But since you only told us "it gives me an error" and don't tell use
*WHAT* the error is, we really can't help you, can we?
> $how_many = mysql_result(mysql_query("SELECT COUNT(*), MATCH(ad_sub,
> ad_text) AGAINST('$words') AS score from ".$tcname."ads WHERE
> MATCH(ad_sub,
> ad_text) AGAINST('$words') FROM ".$tcname."ads where is_confirmed=1"),0);
Hmmmm. Actually, I *can* tell you that you shouldn't have FROM in there
twice. You've messed up your query something awful with that.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
On Tue, March 22, 2005 1:47 pm, M. Sokolewicz said:
> read the manual, you can use both ("else if" and "elseif").
>
> The script does exactly what you tell it to. The flaw(s) is(/are) in
> your logic.
"else if" and "elseif" are not exactly the same, as the manual indicates
(and glosses over a bit).
The will behave the same, if everything is parallel, but there is a gotcha
when you start embedding nested if/else and if/elseif statements.
If I try to give an example, I'm sure to screw it up, as I never use "else
if" for this very reason.
But this is the same as in C, and I think any decent C textbook will
diagram for you exactly what goes "wrong" when you confuse the two.
If you're not sure of the difference, use "elseif" when the words appear
that close to each other, and you will most likely not hurt yourself that
way.
You only get burned, and that only rarely, if you use "else if" in my
experience.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
On Tue, March 22, 2005 8:58 am, Chris W. Parker said:
> Jay Blanchard <mailto:jay.blanchard
niicommunications.com>
> on Tuesday, March 22, 2005 4:47 AM said:
>
>> +1 for pencil & paper or whiteboard. And in the words of Obi Jay, "Use
>> the flowchart Chris"
>
> I would very much like to use flowcharts but I haven't been able to use
> them effectively yet. That is, I'm not sure how to split up the macro
> from the micro. Macro being the flow a user would take through the
> checkout section of the site and micro being how a function works.
Personally, I'd opt for working on the macro first, and making that as
clean and clear as you can, really thinking deeply on it.
Put it away for a day or two and pull it out.
Does it all still make sense?
Are you REALLY providing the best functionality for the most users as
quickly and efficiently as possible?
It's much too easy (guilty!) to start diving in and writing
code/functions/pages without reflecting enough on the big picture.
Course, you sometimes have the PHB breathing down your neck who will
accuse you of "not working" if you aren't typing code. Sigh. Time to
quit *that* job and look for another one.
PS I'm looking for a new job. :-^
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
Chris W. Parker wrote:
> Jay Blanchard <mailto:jay.blanchard
niicommunications.com>
> on Tuesday, March 22, 2005 4:47 AM said:
>
>
>>+1 for pencil & paper or whiteboard. And in the words of Obi Jay, "Use
>>the flowchart Chris"
>
>
> I would very much like to use flowcharts but I haven't been able to use
> them effectively yet. That is, I'm not sure how to split up the macro
> from the micro. Macro being the flow a user would take through the
> checkout section of the site and micro being how a function works.
+1 on pen and paper.
One approach that I liked (I forgot what book it was mentioned in)
involves using a whiteboard and post-it notes.
You put your entities on the post it notes, then draw flow lines on the
whiteboard. This way, you can easily move your entities around.
It really helps when ironing out workflow issues. For example, what
happens when a user enters the wrong password in a login form? Easy to
figure out by just moving around the sticky notes. Once you have your
flow dailed down, then its just a matter of copying it on paper and
finalizing it.
>
>>Keep in mind that flowcharts are "living" docs....if you need to make
>>a change to the code somewhere down the line you can (and should)
>>change the flowchart to reflect it.
That sticky-notes + whiteboard helps with dynamic flowcharting a lot.
attached mail follows:
On Tue, March 22, 2005 3:42 am, Mário Gamito said:
> If you care to take a peak at http://www.dte.ua.pt/cv/
> and pass your mouse over the link "Mário Gamito", you'll see in the
> status bar that the link is:
>
> http://www.dte.ua.pt/cv/cv_show.php?email=gamito
gmail.com
>
> Allright.
>
> However, if you click and go to the respective page, you'll see that the
> "
" is switched by "%40".
But you *WANT* the
urlencoded into %40 so the email harvesters won't
find you, so do *NOT* change it.
It works just fine in all browsers except, like, AOHell 4.0 or something
like that.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
On Mon, March 21, 2005 9:29 pm, John Taylor-Johnston said:
>> > flock($results, 2); #lock file for writing
>> > fwrite($results, $filestr); #write $filestr to $results
>> > flock($results, 3); #unlock file
>> > fclose($results); #close file
>> This is an incorrect way to try to flock a file for writing.
>>
>> You should:
>> 1) Open the file for READING.
>> 2) flock that file handle, so only YOU have access to that file.
>> 3) Re-open the file for WRITING, now that you have control.
>> 4) Write your data
>> 5) Release the lock.
>
> Could you show me a correct method, or example please? I admit I'm a
> little too newbie with flock. I have not used it since my Perl days, and
> even then ...
http://php.net/flock
has several correct examples, along with reasons when to not use flock in
the first place, as well as alternative solutions.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
On Mon, March 21, 2005 8:20 pm, Jim Poserina said:
> If I run this PHP script:
> <?php
> echo '<pre>';
> echo exec('whoami');
The first most biggest thing wrong is that you aren't using the additional
arguments to exec() to find out what your output is, and if your command
generated an error.
For starters, I'm betting that at least one of the following is true:
whoami is not in the $PATH/$path of the PHP user.
whoami is not executable by the PHP user.
You'll never find out which unless you use the extra args to exec
http://php.net/exec
> echo '</pre>';
> ?>
>
> from the web, the output is
>
> <pre></pre>and from the command line running as the apache user(webuser),
> the output is.
> Content-type: text/html
> X-Powered-By: PHP/4.3.9
>
> <pre></pre>
EXCELLENT attempt to diagnose this, though!
> But if I run from the command line as root, the output is:
>
> Content-type: text/html
> X-Powered-By: PHP/4.3.9
>
> <pre>root</pre>and from the command line as a user in the root group, the
> output is:
> Content-type: text/html
> X-Powered-By: PHP/4.3.9
>
> <pre>jimpoz</pre>Safe mode is turned off. As webuser (or any
> non-root-group
> user), no shell commands work. Not echo, not ls, not whoami, not touch.
> And
> no shell functions work: no exec(), no passthru(), no shell_exec(), no
> backticks. Every command I'm trying to run is world-readable and
> world-executable.
But are they in the $path of webuser?
Use the full path to them if they aren't
exec("/bin/whoami", $output, $error);
if ($error) echo ("OS Error: $error.<br />\n");
echo implode("<br />", $output);
> If I turn safe mode on, it gives me a "safe mode is on" warning only about
> lines that call shell_exec(), and not for exec() or any of the others.
> Other
> than that, it doesn't hang or give any kind of error or anything when it
> comes to a shell function call; apparently it just ignores them.
No, it tries to run them, and fails, and provides the error messages and
error number in the variables you aren't using :-)
Some days, I think the PHP Dev Group should just make those arguments to
exec() required.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
hi! i'm trying to use the simple_xml functions to get an arrray of
data from a sample xml file.
here's my sample_data.xml
--------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<sample_data>
<first_names>
<first_name>amit</first_name>
<first_name>amar</first_name>
</first_names>
</sample_data>
--------------------------------------------------------------------------------------------
the php file
--------------------------------------------------------------------------------------------
<?php
$sample_data = simplexml_load_file("sample_data.xml");
print_r($sample_data);
print_r($sample_data->first_names);
print_r($sample_data->first_names->first_name);
?>
--------------------------------------------------------------------------------------------
output of "$ php test_xml_1.php"
--------------------------------------------------------------------------------------------
SimpleXMLElement Object
(
[first_names] => SimpleXMLElement Object
(
[first_name] => Array
(
[0] => amit
[1] => amar
)
)
)
SimpleXMLElement Object
(
[first_name] => Array
(
[0] => amit
[1] => amar
)
)
SimpleXMLElement Object
(
[0] => amit
)
--------------------------------------------------------------------------------------------
The above output shows $sample_data->first_names->first_name as an
ARRAY in the first 2 print_r 's however when a print_r is run on
itself it shows it as a SimpleXMLElementObject.
Question is why the last print_r gives different information
compared to the other 2.
I also tried running
$key = array_rand($sample_data->first_names->first_name)
and it gives a warning message
"Warning: array_rand(): First argument has to be an array in
/home/yvb/work/practice/php/XML/foo.php on line 16"
any clue how do i use the
$sample_data->first_names->first_name as an array ?
thx.
yashesh.
--
go pre
http://www2.localaccess.com/rlalonde/pre.htm
attached mail follows:
Hello;
Can any one show me a way to reduce the following code?
######################################################
<?php
if ($colorVar == 'Black' || $colorVar == 'Red' || $colorVar == 'White' ||
$colorVar == 'Blue' ){
$someVar = "Something";
}
?>
########################################################
I was thinking there must be a way to place all the Colors into a
$allColorVar and check to see if $colorVar = $allColorVar?
attached mail follows:
* Lupita <lupita
lanset.com>:
> Can any one show me a way to reduce the following code?
> [...]
> I was thinking there must be a way to place all the Colors into a
> $allColorVar and check to see if $colorVar = $allColorVar?
I think http://de3.php.net/manual/en/function.in-array.php is what you
want :)
Ciao,
Gerhard
attached mail follows:
<?php
$allColor = array('Black','Red','White','Blue');
if (in_array($colorVar, $allColor)) {
$someVar = 'Something';
}
?>
/frank
2005-03-23 kl. 09.54 skrev Lupita:
> Hello;
> Can any one show me a way to reduce the following code?
> ######################################################
> <?php
> if ($colorVar == 'Black' || $colorVar == 'Red' || $colorVar == 'White'
> ||
> $colorVar == 'Blue' ){
> $someVar = "Something";
> }
> ?>
> ########################################################
> I was thinking there must be a way to place all the Colors into a
> $allColorVar and check to see if $colorVar = $allColorVar?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
________________________________________________
Frank Arensmeier
Marketing Support
NIKE HYDRAULICS AB
Box 1107
631 80 Eskilstuna
Sweden
tel +46 16 82 34
fax +46 16 13 93 16
email: frank.arensmeier
nikehydraulics.se
www.nikehydraulics.com
attached mail follows:
How should I formulate my sql statement to create a result set of members
who registered between now and 7 days ago?
I have tried the following and it is obviously incorrect:
$sqlnewmembers = "Select uid, uprofilename from tblusers where udatereg
between (date() and date() - 7)";
Regards
Jacques
attached mail follows:
take a look here
http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html the first
example should help you...
regards
jesper
Jacques wrote:
>How should I formulate my sql statement to create a result set of members
>who registered between now and 7 days ago?
>
>I have tried the following and it is obviously incorrect:
>
>$sqlnewmembers = "Select uid, uprofilename from tblusers where udatereg
>between (date() and date() - 7)";
>
>Regards
>
>Jacques
>
>
>
attached mail follows:
Richard Lynch wrote:
> You can always add more .htaccess files in more directories, or edit the
> one that's there.
And that's precisely what I did. The only reason why I only have
.htaccess in the top-level directory is that I don't have any directives
specific to one subdomain that the others shouldn't use and according to
the apache docs when requesting a file apache looks in every
higher-level directory for .htaccess as well.
>>The fact that the uid of the script is appended to the realm specified
>>shouldn't require any changes in the code, or should it?
>
>
> No. It would only invalidate any "saved" logins or passwords from the old
> realm being managed by the browser.
>
> Different realm == different login/credentials needed.
Thanks for that info, seems my understanding of the matter is not as for
off as I thought it to be although I've read your posting saying you
only got to know the specifics through years of practice.
> That's your ISP being silly, not PHP 4.3.10 "changing"
That's what I thought.
> That said, HTTP Authentication WILL NOT WORK with CGI.
>
> It is disabled in PHP source because, because your password would be
> transmitted insecurely from Apache to PHP, and the PHP Team is not willing
> to do that for obvious reasons.
>
> Get your host to go back to PHP as Module, or switch to a form login.
I already contacted their support asking them to at least have PHP5
built as a module when they'll upgrade. I'm not to happy with their
support anyways, responses are fast but they've never told me anything I
hadn't known before asking them.
I've moved from trying to use HTTP based authentication-methods to php
sessions and html-form based authentication, it's much more configurable
especially visual-design-wise and wasn't half as challenging to
implement as I'd expected. Don't you just love when you teach yourself
something new and can use it to do what you want to, and it actually works.
Okay, enough chatting. I just wanted to thank you for your answers
Richard, very helpful and informative.
Cheers from germany, Roman.
P.S.:
> WILD GUESS:
>
> $_SERVER['REMOTE_PASSWORD']
>
> ???
Nope, tried dumping $_SERVER, $_ENV and $_REQUEST upon cancelling the
authentication, nothing useful in there. It says in a comment to the
manual that the authdata is in $_SERVER['REMOTE_USER'] and you can
either base64_transcode it (or whatever the function is called) or use
apache's ModRewrite but I can't confirm that, maybe the person that
suggested it was using apache2, in any case it didn't work.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]