|
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 8 Jun 2004 21:07:21 -0000 Issue 2810
php-general-digest-help
lists.php.net
Date: Tue Jun 08 2004 - 16:07:21 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 8 Jun 2004 21:07:21 -0000 Issue 2810
Topics (messages 187862 through 187915):
count number of occurences of character in a string
187862 by: Diana Castillo
187863 by: Richard Davey
187864 by: rich
187875 by: Daniel Clark
Re: if/elseif/else v. switch
187865 by: Aidan Lister
Problems with variable handling !
187866 by: php-general
187867 by: Jason Wong
187868 by: Marek Kilimajer
187869 by: php-general
187870 by: php-general
187871 by: Jason Wong
187872 by: php-general
187873 by: Jason Wong
dynamically build array from db
187874 by: Edward Peloke
187876 by: Torsten Roehr
187877 by: Edward Peloke
search engine optimization and php
187878 by: Edward Peloke
187879 by: Aaron Wolski
187880 by: Marek Kilimajer
187881 by: Manuel Lemos
187883 by: Aaron Wolski
187887 by: Manuel Lemos
How to disable output buffer per script
187882 by: Mike Zornek
187884 by: Michael Sims
187892 by: Curt Zirzow
187903 by: Michael Sims
187904 by: Curt Zirzow
187907 by: Mike Zornek
MySQL -- mysql_connect(), possible to use IP Address instead of localhost???
187885 by: Scott Fletcher
187886 by: Jay Blanchard
187888 by: raditha dissanayake
187891 by: Scott Fletcher
187893 by: raditha dissanayake
187894 by: Marek Kilimajer
187901 by: Curt Zirzow
Bug in utf8_encode (bit operations)?
187889 by: Bjoern Kraus
Running Arbitrary PHP Code
187890 by: Nathan Schmitz
187897 by: Curt Zirzow
Can someone explain this?
187895 by: Ren Fournier
187898 by: Adam Voigt
187899 by: Curt Zirzow
187900 by: Michal Migurski
187902 by: Ren Fournier
187905 by: Curt Zirzow
187906 by: Ren Fournier
PEAR - Oracle10g connection failure
187896 by: tonYa
info
astralsecurityandfinancebv.com emails every time I post
187908 by: Mike Zornek
Empty Variable Values Between Scripts
187909 by: Frank Hahn
187910 by: Jay Blanchard
187913 by: Frank Hahn
PDA / Normal Browser
187911 by: Shaun
187912 by: Matt Matijevich
187914 by: Daniel Clark
Sharing encrypted data with .Net?
187915 by: Todd Gruben
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:
what function can I use to count the number of occurences of a certain
character in a string?
--
Diana Castillo
Global Reservas, S.L.
C/Granvia 22 dcdo 4-dcha
28013 Madrid-Spain
Tel : 00-34-913604039
Fax : 00-34-915228673
email: diana
hotelkey.com
Web : http://www.hotelkey.com
http://www.destinia.com
attached mail follows:
Hello Diana,
Tuesday, June 8, 2004, 11:11:27 AM, you wrote:
DC> what function can I use to count the number of occurences of a certain
DC> character in a string?
substr_count or count_chars would work.
Best regards,
Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
"I am not young enough to know everything." - Oscar Wilde
attached mail follows:
>
> what function can I use to count the number of occurences of a certain
> character in a string?
substr_count() ...?
rich
attached mail follows:
substr_count()
http://www.php.net/manual/en/function.substr-count.php
>>what function can I use to count the number of occurences of a certain
>>character in a string?
>>
>>--
>>Diana Castillo
>>Global Reservas, S.L.
>>C/Granvia 22 dcdo 4-dcha
>>28013 Madrid-Spain
>>Tel : 00-34-913604039
>>Fax : 00-34-915228673
>>email: diana
hotelkey.com
>>Web : http://www.hotelkey.com
>> http://www.destinia.com
attached mail follows:
Hi Chris,
> oh right and that makes everything better. you're a fantastic person!
I don't see how criticising a silly question makes me a bad person in the
first place.
> you should be able to handle a little public humiliation/chastisement
> since you so easily dish it out.
You missed the point.
Anyway, stop flogging a dead horse. Stupid questions have stupid answers,
unfortunatly mine was one of the stupid answers - in hind site, I agree it
was an inapropriate thing to say.
Kind Regards,
Aidan
----- Original Message -----
From: "Chris W. Parker" <cparker
swatgear.com>
To: "Aidan Lister" <aidan
php.net>; <php-general
lists.php.net>
Sent: Tuesday, June 08, 2004 2:25 AM
Subject: RE: [PHP] Re: if/elseif/else v. switch
Aidan Lister <mailto:aidan
php.net>
on Saturday, June 05, 2004 6:19 AM said:
> You'll note I did not criticise the poster, merely his seemingly
> stupid question.
oh right and that makes everything better. you're a fantastic person!
> I suggest you practice what you preach. If you have a comment on my
> reply to a users post, feel free to contact me personally -
> aidan
php.net
you should be able to handle a little public humiliation/chastisement
since you so easily dish it out.
c.
attached mail follows:
Hi !
I have a Problem with hand over of variables;
My Page consists of three files which I have enclosed to
demonstrate the problem.
test.php:
----------------------
<html>
<head>
<title>test.php</title>
</head>
<frameset rows="274,*" cols="*" framespacing="1" frameborder="yes" border="1" bordercolor="#000000">
<frame src="test_oben.php" name="topFrame" scrolling="YES">
<frame src="test_0.php" name="buttom0Frame" scrolling="YES">
</frameset>
<body>
</body>
</html>
----------------------
test_oben.php:
----------------------
<html>
<head>
<title>test_oben.php</title>
</head>
<body>
<p><u>test</u></p>
<form action="test_0.php" method="post" enctype="multipart/form-data" name="form1" target="buttom0Frame">
<table width="856" height="30" border="0">
<tr>
<td width="77" height="26" align="right">String1</td>
<td width="223"><input name="var1" type="text" id="var1" size="25" maxlength="25"></td>
<td width="178" align="right">String2</td>
<td width="206"><input name="var2" type="text" id="var2" size="25" maxlength="25"> </td>
<td width="150"><input name="button1" type="submit" id="button1" value="Display strings">
<input name="button2" type="submit" id="button2" value="Display concatenated strings"></td>
</tr>
</table>
</form>
</body>
</html>
----------------------
test_0.php:
----------------------
<html>
<head>
<title>test_0.php</title>
</head>
<body>
<?php
if ($button1)
{
echo "Button 1 was pressed\n, ";
echo "String1=$var1\n, ";
echo "String2=$var2\n, ";
$var3 = "$var1$var2";
/*echo "concatenated string=$var3";*/
}
if ($button2)
{
echo "Button 2 was pressed\n, ";
/*echo "String1=$var1\n, ";
echo "String2=$var2\n, ";*/
echo "concatenated string=$var3";
}
?>
</body>
</html>
----------------------
In test_oben.php I want to insert two strings.
pressing the "Display strings"-button will output them in the button frame.
Only pressing the "Display concatenated strings"-button should output the concatenated string,
but this does not work, and I do not understand why.
Please give me a hint !
best regards
chrm
attached mail follows:
On Tuesday 08 June 2004 18:36, php-general wrote:
> In test_oben.php I want to insert two strings.
> pressing the "Display strings"-button will output them in the button frame.
>
> Only pressing the "Display concatenated strings"-button should output the
> concatenated string, but this does not work, and I do not understand why.
>
>
> Please give me a hint !
manual > Variables > Variables from outside PHP
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Radar tends to fail at night and in bad weather, and especially during both
-- Murphy's Military Laws n122
*/
attached mail follows:
php-general wrote:
> Hi !
>
> I have a Problem with hand over of variables;
> My Page consists of three files which I have enclosed to
> demonstrate the problem.
>
> test.php:
> ----------------------
> <html>
> <head>
> <title>test.php</title>
> </head>
>
> <frameset rows="274,*" cols="*" framespacing="1" frameborder="yes" border="1" bordercolor="#000000">
> <frame src="test_oben.php" name="topFrame" scrolling="YES">
> <frame src="test_0.php" name="buttom0Frame" scrolling="YES">
> </frameset>
> <body>
> </body>
> </html>
> ----------------------
>
>
>
> test_oben.php:
> ----------------------
> <html>
> <head>
> <title>test_oben.php</title>
> </head>
>
> <body>
> <p><u>test</u></p>
> <form action="test_0.php" method="post" enctype="multipart/form-data" name="form1" target="buttom0Frame">
> <table width="856" height="30" border="0">
> <tr>
> <td width="77" height="26" align="right">String1</td>
> <td width="223"><input name="var1" type="text" id="var1" size="25" maxlength="25"></td>
> <td width="178" align="right">String2</td>
> <td width="206"><input name="var2" type="text" id="var2" size="25" maxlength="25"> </td>
> <td width="150"><input name="button1" type="submit" id="button1" value="Display strings">
> <input name="button2" type="submit" id="button2" value="Display concatenated strings"></td>
> </tr>
> </table>
> </form>
> </body>
> </html>
> ----------------------
>
>
>
> test_0.php:
> ----------------------
> <html>
> <head>
> <title>test_0.php</title>
> </head>
>
> <body>
> <?php
> if ($button1)
> {
> echo "Button 1 was pressed\n, ";
> echo "String1=$var1\n, ";
> echo "String2=$var2\n, ";
> $var3 = "$var1$var2";
> /*echo "concatenated string=$var3";*/
> }
>
> if ($button2)
> {
> echo "Button 2 was pressed\n, ";
> /*echo "String1=$var1\n, ";
> echo "String2=$var2\n, ";*/
> echo "concatenated string=$var3";
> }
> ?>
> </body>
> </html>
> ----------------------
>
>
>
>
> In test_oben.php I want to insert two strings.
> pressing the "Display strings"-button will output them in the button frame.
>
> Only pressing the "Display concatenated strings"-button should output the concatenated string,
> but this does not work, and I do not understand why.
>
>
> Please give me a hint !
The hint: register_globals
>
> best regards
>
> chrm
attached mail follows:
phpinfo reports that register_globals=On
attached mail follows:
----- Original Message -----
From: php-general
To: php-general
lists.php.net
Sent: Tuesday, June 08, 2004 12:36 PM
Subject: Problems with variable handling !
Hi !
I have a Problem with hand over of variables;
My Page consists of three files which I have enclosed to
demonstrate the problem.
test.php:
----------------------
<html>
<head>
<title>test.php</title>
</head>
<frameset rows="274,*" cols="*" framespacing="1" frameborder="yes" border="1" bordercolor="#000000">
<frame src="test_oben.php" name="topFrame" scrolling="YES">
<frame src="test_0.php" name="buttom0Frame" scrolling="YES">
</frameset>
<body>
</body>
</html>
----------------------
test_oben.php:
----------------------
<html>
<head>
<title>test_oben.php</title>
</head>
<body>
<p><u>test</u></p>
<form action="test_0.php" method="post" enctype="multipart/form-data" name="form1" target="buttom0Frame">
<table width="856" height="30" border="0">
<tr>
<td width="77" height="26" align="right">String1</td>
<td width="223"><input name="var1" type="text" id="var1" size="25" maxlength="25"></td>
<td width="178" align="right">String2</td>
<td width="206"><input name="var2" type="text" id="var2" size="25" maxlength="25"> </td>
<td width="150"><input name="button1" type="submit" id="button1" value="Display strings">
<input name="button2" type="submit" id="button2" value="Display concatenated strings"></td>
</tr>
</table>
</form>
</body>
</html>
----------------------
test_0.php:
----------------------
<html>
<head>
<title>test_0.php</title>
</head>
<body>
<?php
if ($button1)
{
echo "Button 1 was pressed\n, ";
echo "String1=$var1\n, ";
echo "String2=$var2\n, ";
$var3 = "$var1$var2";
/*echo "concatenated string=$var3";*/
}
if ($button2)
{
echo "Button 2 was pressed\n, ";
/*echo "String1=$var1\n, ";
echo "String2=$var2\n, ";*/
echo "concatenated string=$var3";
}
?>
</body>
</html>
----------------------
In test_oben.php I want to insert two strings.
pressing the "Display strings"-button will output them in the button frame.
Only pressing the "Display concatenated strings"-button should output the concatenated string,
but this does not work, and I do not understand why.
Please give me a hint !
best regards
chrm
____________________________________________
phpinfo reports that register_globals=On
attached mail follows:
On Tuesday 08 June 2004 18:50, php-general wrote:
> Only pressing the "Display concatenated strings"-button should output the
> concatenated string, but this does not work, and I do not understand why.
$var3 is not defined.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Romance, like alcohol, should be enjoyed, but should not be allowed to
become necessary.
-- Edgar Friedenberg
*/
attached mail follows:
On Tuesday 08 June 2004 18:50, php-general wrote:
> Only pressing the "Display concatenated strings"-button should
> output the concatenated string, but this does not work, and I do not
> understand why.
$var3 is not defined.
--
$var3 is defined as
$var3 = "$var1$var2";
in the body of the if ($button1) statement !?
attached mail follows:
On Tuesday 08 June 2004 19:13, php-general wrote:
> $var3 is defined as
>
> $var3 = "$var1$var2";
>
> in the body of the if ($button1) statement !?
<sigh> what is button1 supposed to do and what is button2 supposed to do?
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
A woman, especially if she have the misfortune of knowing anything,
should conceal it as well as she can.
-- Jane Austen
*/
attached mail follows:
I have a class which builds a set of tabs...the class expects an array in
this form
array("Site Info"=>"siteinfo.php","Contact Us"=>"contactus.php")..where Site
Info is a link to siteinfo.php.
The build tabs method of the class then loops through the array outputing a
set of tabbed links on the page.
The problem is I am having trouble generating this array from a database. I
need to pull from my query:
$sql->query("select title, page from links");
while ($sql->nextRecord()){
//build the array
}
I have tried arraypush but can only get it to work with a standard
array...how can I do this?
Thanks,
Eddie
WARNING: The information contained in this message and any attachments is
intended only for the use of the individual or entity to which it is
addressed. This message may contain information that is privileged,
confidential and exempt from disclosure under applicable law. It may also
contain trade secrets and other proprietary information for which you and
your employer may be held liable for disclosing. You are hereby notified
that any unauthorized dissemination, distribution or copying of this
communication is strictly prohibited. If you have received this
communication in error, please notify HIPAA
echoman.com by E-Mail and then
destroy this communication in a manner appropriate for privileged
information.
attached mail follows:
"Edward Peloke" <epeloke
echoman.com> wrote in message
news:NKEFLLFBJFIKEGAGKPCAIEICDEAA.epeloke
echoman.com...
> I have a class which builds a set of tabs...the class expects an array in
> this form
>
> array("Site Info"=>"siteinfo.php","Contact Us"=>"contactus.php")..where
Site
> Info is a link to siteinfo.php.
>
> The build tabs method of the class then loops through the array outputing
a
> set of tabbed links on the page.
>
> The problem is I am having trouble generating this array from a database.
I
> need to pull from my query:
>
> $sql->query("select title, page from links");
> while ($sql->nextRecord()){
>
> file://build the array
>
> }
>
> I have tried arraypush but can only get it to work with a standard
> array...how can I do this?
$array = array();
while ($sql->nextRecord()){
// figure out how to get $title and $page from your record set (do
didn't say which DB layer you are using)
$array[$title] = $page;
}
Regards, Torsten Roehr
attached mail follows:
ah..yes, thanks, works like a charm.
-----Original Message-----
From: Torsten Roehr [mailto:roehr
zilleon.com]
Sent: Tuesday, June 08, 2004 8:49 AM
To: php-general
lists.php.net
Subject: [PHP] Re: dynamically build array from db
"Edward Peloke" <epeloke
echoman.com> wrote in message
news:NKEFLLFBJFIKEGAGKPCAIEICDEAA.epeloke
echoman.com...
> I have a class which builds a set of tabs...the class expects an array in
> this form
>
> array("Site Info"=>"siteinfo.php","Contact Us"=>"contactus.php")..where
Site
> Info is a link to siteinfo.php.
>
> The build tabs method of the class then loops through the array outputing
a
> set of tabbed links on the page.
>
> The problem is I am having trouble generating this array from a database.
I
> need to pull from my query:
>
> $sql->query("select title, page from links");
> while ($sql->nextRecord()){
>
> file://build the array
>
> }
>
> I have tried arraypush but can only get it to work with a standard
> array...how can I do this?
$array = array();
while ($sql->nextRecord()){
// figure out how to get $title and $page from your record set (do
didn't say which DB layer you are using)
$array[$title] = $page;
}
Regards, Torsten Roehr
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Just curious as to how people handle search engine optimization when most of
the page content is dynically built from the db. Doesn't the bots need to
crawl the static pages and match your keywords to actual words in the file?
Also, is it not a good idea to put all your meta keywords into a
header.inc.php script that is then pulled into each page when it is loaded?
Thanks,
Eddie
WARNING: The information contained in this message and any attachments is
intended only for the use of the individual or entity to which it is
addressed. This message may contain information that is privileged,
confidential and exempt from disclosure under applicable law. It may also
contain trade secrets and other proprietary information for which you and
your employer may be held liable for disclosing. You are hereby notified
that any unauthorized dissemination, distribution or copying of this
communication is strictly prohibited. If you have received this
communication in error, please notify HIPAA
echoman.com by E-Mail and then
destroy this communication in a manner appropriate for privileged
information.
attached mail follows:
Hi Edward,
A few things first:
1) Match keyword to actual words in the file:
Not sure what you are talking about but if you are referring to Meta tag
keyword data... this has been primarily outdated for several years now.
Do SE's read meta data? Yes and no, but rest assured if you are trying
to make it into top page indexes, meta data will do nothing to help
bolster your rank. It's generally considered useless.
2) Doesn't the bots need to crawl the static pages:
Bots can crawl dynamic pages with query strings in the URL. However, how
deep they spider is still in question. If you can create static looking
pages from dynamic content with URL re-writing you're much better off.
Example: after a client came to me to help with their search engine
marketing, we discovered only 200 of their 1500 products were being
indexed. With url-writing we were able to get all 1500 into Google and
Google continually spiders on a daily basis.
3) If you are concerned about search engine optimization for yourself,
or a client, you need to either A) learn the ins and outs yourself (a
lot of time and research) or work with a consultant to help you optimize
code, pages, copy, links, etc.
Good luck.
Aaron
> -----Original Message-----
> From: Edward Peloke [mailto:epeloke
echoman.com]
> Sent: June 8, 2004 10:20 AM
> To: Php-General
> Subject: [PHP] search engine optimization and php
>
> Just curious as to how people handle search engine optimization when
most
> of
> the page content is dynically built from the db. Doesn't the bots
need to
> crawl the static pages and match your keywords to actual words in the
> file?
> Also, is it not a good idea to put all your meta keywords into a
> header.inc.php script that is then pulled into each page when it is
> loaded?
>
> Thanks,
> Eddie
>
> WARNING: The information contained in this message and any
attachments
> is
> intended only for the use of the individual or entity to which it is
> addressed. This message may contain information that is privileged,
> confidential and exempt from disclosure under applicable law. It may
also
> contain trade secrets and other proprietary information for which you
and
> your employer may be held liable for disclosing. You are hereby
notified
> that any unauthorized dissemination, distribution or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, please notify HIPAA
echoman.com by E-Mail and
> then
> destroy this communication in a manner appropriate for privileged
> information.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Edward Peloke wrote:
> Just curious as to how people handle search engine optimization when most of
> the page content is dynically built from the db. Doesn't the bots need to
> crawl the static pages and match your keywords to actual words in the file?
All pages are static once you load them, the letters are not moving
around ;-)
> Also, is it not a good idea to put all your meta keywords into a
> header.inc.php script that is then pulled into each page when it is loaded?
Does not hurt. Even better, use meta keyword and description based on
the main content of the page.
attached mail follows:
Hello,
On 06/08/2004 11:20 AM, Edward Peloke wrote:
> Just curious as to how people handle search engine optimization when most of
> the page content is dynically built from the db. Doesn't the bots need to
> crawl the static pages and match your keywords to actual words in the file?
Practically, only Google matters these days as most sites get over 70%
of leads from Google.
For Google, it matters that your pages are served as fast as possible.
If your pages are taking too long to be served, Google assumes it is
causing too much load to your site and slows down giving more time
between crawls.
There is a myth regarding the interpretation of this explanation for
Google not indexing dynamic as many site pages because of the use of URL
with query parameters (?some=thing&this=too).
http://www.google.com/webmasters/2.html#A1
Query parameters is is not the reason why Google does not index so many
pages. I can demonstrate that just by let you see that Google indexes
for 700.000 pages of php.net, many of which have many query parameters:
http://www.google.com/search?q=site%3Aphp.net
So, do not bother with all those bogus advices telling you to use URL
rewriting because that is not what matters. What matters is that your
pages are served as fast as possible cause as less load to your server
as possible.
If your pages are generated with content taken from a database, you
would better use some content caching to avoid spending too much time
making repetitive database queries which is usually your site's bottleneck.
You may want to try caching whole pages or just parts using for instance
this class. It is very robust as it uses file locking to prevent cache
file corruption during updates that may happen during surges of many
simultaneous users accesses:
http://www.phpclasses.org/filecache
If you can, also use some PHP script caching engine, like for instance
Turck, which is free and provides great PHP execution speed up by
avoiding the implicit PHP script compilation step:
http://turck-mmcache.sourceforge.net/
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
attached mail follows:
> -----Original Message-----
> From: Manuel Lemos [mailto:mlemos
acm.org]
> Sent: June 8, 2004 10:54 AM
> To: php-general
lists.php.net
> Subject: [PHP] Re: search engine optimization and php
>
> Hello,
>
> On 06/08/2004 11:20 AM, Edward Peloke wrote:
> > Just curious as to how people handle search engine optimization when
> most of
> > the page content is dynically built from the db. Doesn't the bots
need
> to
> > crawl the static pages and match your keywords to actual words in
the
> file?
>
> Practically, only Google matters these days as most sites get over 70%
> of leads from Google.
Since Yahoo! Dropped their affiliation with Google, many, including
myself and my client, have seen a significant increase in Y! refers. 70%
is not the case anymore.
Keeping all your eggs in one basket is a bad decision at best.
>
> For Google, it matters that your pages are served as fast as possible.
> If your pages are taking too long to be served, Google assumes it is
> causing too much load to your site and slows down giving more time
> between crawls.
>
> There is a myth regarding the interpretation of this explanation for
> Google not indexing dynamic as many site pages because of the use of
URL
> with query parameters (?some=thing&this=too).
>
> http://www.google.com/webmasters/2.html#A1
>
> Query parameters is is not the reason why Google does not index so
many
> pages. I can demonstrate that just by let you see that Google indexes
> for 700.000 pages of php.net, many of which have many query
parameters:
>
> http://www.google.com/search?q=site%3Aphp.net
>
> So, do not bother with all those bogus advices telling you to use URL
> rewriting because that is not what matters. What matters is that your
> pages are served as fast as possible cause as less load to your server
> as possible.
Speed is a factor, page size is a factor but the number of query strings
within a URL is why Google (and other bots) only go so deep into a site
0 for fear of getting caught in a endless loop.
They are getting better, however.
It's definitely not bogus information. I can get a site's pages indexed
a lot quicker with URL rewriting than I can without.
>
> If your pages are generated with content taken from a database, you
> would better use some content caching to avoid spending too much time
> making repetitive database queries which is usually your site's
> bottleneck.
Agreed.
attached mail follows:
Hello,
On 06/08/2004 12:04 PM, Aaron Wolski wrote:
>>>Just curious as to how people handle search engine optimization when
>>
>>most of
>>
>>>the page content is dynically built from the db. Doesn't the bots
>
> need
>
>>to
>>
>>>crawl the static pages and match your keywords to actual words in
>
> the
>
>>file?
>>
>>Practically, only Google matters these days as most sites get over 70%
>>of leads from Google.
>
>
> Since Yahoo! Dropped their affiliation with Google, many, including
> myself and my client, have seen a significant increase in Y! refers. 70%
> is not the case anymore.
>
> Keeping all your eggs in one basket is a bad decision at best.
Yes, but if you just keep optimizing for Google you will be optimizing
for most of the others that have significant share because Google always
been the most successful in providing relevant results for the users and
others tend to imitate Google.
>>For Google, it matters that your pages are served as fast as possible.
>>If your pages are taking too long to be served, Google assumes it is
>>causing too much load to your site and slows down giving more time
>>between crawls.
>>
>>There is a myth regarding the interpretation of this explanation for
>>Google not indexing dynamic as many site pages because of the use of
>
> URL
>
>>with query parameters (?some=thing&this=too).
>>
>>http://www.google.com/webmasters/2.html#A1
>>
>>Query parameters is is not the reason why Google does not index so
>
> many
>
>>pages. I can demonstrate that just by let you see that Google indexes
>>for 700.000 pages of php.net, many of which have many query
>
> parameters:
>
>>http://www.google.com/search?q=site%3Aphp.net
>>
>>So, do not bother with all those bogus advices telling you to use URL
>>rewriting because that is not what matters. What matters is that your
>>pages are served as fast as possible cause as less load to your server
>>as possible.
>
>
> Speed is a factor, page size is a factor but the number of query strings
> within a URL is why Google (and other bots) only go so deep into a site
> 0 for fear of getting caught in a endless loop.
>
> They are getting better, however.
>
> It's definitely not bogus information. I can get a site's pages indexed
> a lot quicker with URL rewriting than I can without.
My point is that if your pages are served slowly, URL rewriting does not
matter and only a subset of your pages will be indexed. OTOH, if you
make your pages be served very fast, URL rewriting is not necessary, at
least for Google. I know that for experience. I have seen it several
times Google crawling thousands of pages with no URL rewriting.
As for other search engines, I don't know because it is possible that
they try to copy Google crawling logic the way they understand it, which
may not be the actual way it works as Google does not disclose it .
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
attached mail follows:
I wrote an importer script in PHP that outputs the percentage of items
finished in 5% chunks. When I run the script however (web or command line) I
dont get incremental output .. I get it all in one fell swoop.
I have a feeling PHP is buffering it or something. It there any command I
can use to disable such buffering for just this script so I can see some
useful feedback. Thanks!
~ Mike
-----
Mike Zornek
Web Designer, Media Developer, Programmer and Geek
Personal site: <http://MikeZornek.com>
attached mail follows:
Mike Zornek wrote:
> I wrote an importer script in PHP that outputs the percentage of items
> finished in 5% chunks. When I run the script however (web or command
> line) I dont get incremental output .. I get it all in one fell
> swoop.
>
> I have a feeling PHP is buffering it or something. It there any
> command I can use to disable such buffering for just this script so I
> can see some useful feedback. Thanks!
Try calling ob_end_flush() at the top of your script. Although I believe some
browsers will still buffer a portion of the output before displaying. But if you're
running from the command line it should display in real time. HTH...
attached mail follows:
* Thus wrote Mike Zornek (listguy
mikezornek.com):
> I wrote an importer script in PHP that outputs the percentage of items
> finished in 5% chunks. When I run the script however (web or command line) I
> dont get incremental output .. I get it all in one fell swoop.
>
> I have a feeling PHP is buffering it or something. It there any command I
> can use to disable such buffering for just this script so I can see some
> useful feedback. Thanks!
Use this at the top of the script:
ini_set('output_buffer', 0);
Or, as I usually set up for my cli environment (since they ususally
desire no buffering), create a php-cli.ini file that has
output_buffering turned off.
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!
attached mail follows:
Curt Zirzow wrote:
>> I have a feeling PHP is buffering it or something. It there any
>> command I can use to disable such buffering for just this script so
>> I can see some useful feedback. Thanks!
>
> Use this at the top of the script:
> ini_set('output_buffer', 0);
The "output_buffering" setting cannot be controlled via ini_set(), at least
according to the manual. I want to say that I confirmed this a long time ago but I
can't recall for sure.
> Or, as I usually set up for my cli environment (since they ususally
> desire no buffering), create a php-cli.ini file that has
> output_buffering turned off.
That's a good idea. But to do it on a per script basis (where it's undesirable to
alter the global buffering setting) I think the only way is to call ob_end_flush()
at the top of the script...
attached mail follows:
* Thus wrote Michael Sims (michaels
crye-leike.com):
> Curt Zirzow wrote:
> >
> > Use this at the top of the script:
> > ini_set('output_buffer', 0);
>
> The "output_buffering" setting cannot be controlled via ini_set(), at least
> according to the manual. I want to say that I confirmed this a long time ago but I
> can't recall for sure.
You're right.
>
> > Or, as I usually set up for my cli environment (since they ususally
> > desire no buffering), create a php-cli.ini file that has
> > output_buffering turned off.
>
> That's a good idea. But to do it on a per script basis (where it's undesirable to
> alter the global buffering setting) I think the only way is to call ob_end_flush()
> at the top of the script...
Another alternative is to change settings with shbang:
#!/usr/local/bin/php -d output_buffering=0
<?php
// continue on with no output_buffering.
Of course this will only work when the script is set executable and
is ran like a any other program, instead of 'php script.php`
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!
attached mail follows:
On 6/8/04 11:15 AM, "Michael Sims" <michaels
crye-leike.com> wrote:
> Try calling ob_end_flush() at the top of your script. Although I believe some
> browsers will still buffer a portion of the output before displaying. But if
> you're
> running from the command line it should display in real time.
I did this and it works well. I saw some of the other responses and they
seem useful as well. Thanks to all for your help.
~ Mike
-----
Mike Zornek
Web Designer, Media Developer, Programmer and Geek
Personal site: <http://MikeZornek.com>
attached mail follows:
Hi!
I had MySQL up and running. One glaring problem is that the hostname in
the 'user' table of 'mysql' database show it as 'localhost'. I thought it
would look better if I change it to '127.0.0.1' instead. I haven't got that
connection to work with IP address, so mysql_connect() doesn't work. What
is your thought on this?
Thanks,
Scott
attached mail follows:
[snip]
I had MySQL up and running. One glaring problem is that the
hostname in
the 'user' table of 'mysql' database show it as 'localhost'. I thought
it
would look better if I change it to '127.0.0.1' instead. I haven't got
that
connection to work with IP address, so mysql_connect() doesn't work.
What
is your thought on this?
[/snip]
Look better?
attached mail follows:
Scott Fletcher wrote:
>Hi!
>
> I had MySQL up and running.
>
If it's not broken don't fix it.
--
Raditha Dissanayake.
---------------------------------------------
http://www.raditha.com/megaupload/upload.php
Sneak past the PHP file upload limits.
attached mail follows:
Security rank higher than this....
"Raditha Dissanayake" <jabber
raditha.com> wrote in message
news:40C5E74E.6020509
raditha.com...
> Scott Fletcher wrote:
>
> >Hi!
> >
> > I had MySQL up and running.
> >
> If it's not broken don't fix it.
>
>
> --
> Raditha Dissanayake.
> ---------------------------------------------
> http://www.raditha.com/megaupload/upload.php
> Sneak past the PHP file upload limits.
attached mail follows:
Scott Fletcher wrote:
>Security rank higher than this....
>
>
How can connecting to localhost be more or less secure than connecting
to 127.0.0.x ?
>>
>>
>>>Hi!
>>>
>>> I had MySQL up and running.
>>>
>>>
>>>
>>If it's not broken don't fix it.
>>
>>
>>
--
Raditha Dissanayake.
---------------------------------------------
http://www.raditha.com/megaupload/upload.php
Sneak past the PHP file upload limits.
attached mail follows:
Scott Fletcher wrote:
> Security rank higher than this....
>
Use mysql socket and you are safe.
attached mail follows:
* Thus wrote Marek Kilimajer (lists
kilimajer.net):
> Scott Fletcher wrote:
> >Security rank higher than this....
> >
>
> Use mysql socket and you are safe.
iirc, by default mysql uses the socket if you connect via
localhost/127.0.0.1 and tcp any other way.
Although a mysql list probably would be more appropriate for this
whole topic.
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!
attached mail follows:
Hi!
I'm currently developing a nice script that generates OpenOffice SXW files
by filling the content.xml (which is UTF-8 encoded) with database content.
While trying to do this I found out that utf8_encode('"') (charcode 147)
returns '"'. But when I checked the whole result in OffenOffice '"' is
displayed as square (character unknown?!). So I made some tests with UTF-8
conversion (even mb_* functions) and recognized that characters between 128
and 160 returned by utf8_encode() don't seem to match the standard. As
mentioned above '"' is returned as '"' but should be '?T' (as you will get
it using UltraEdit for conversion).
Does anyone can give me some explanations here?
I'm not familiar with this UTF-8 / bit-conversion stuff, but I don't think
PHP does what it's supposed to do here. For a first workaround I simply
coded a custom_utf8_encode() that uses an own char map to override this
misbehaviour (see below). Can someone help my out with this strange bug?!
Regards
Bjoern Kraus
function custom_utf8_encode($str)
{
$chrMap = array(128 => ',', 129 => '', 130 => '?s', 131 => ''',
132 => '?z', 133 => '?', 134 => '? ', 135 => '?',
136 => '?', 137 => '?', 138 => ' ', 139 => '?',
140 => ''', 141 => '', 142 => 'Ž', 143 => '',
144 => '', 145 => '?~', 146 => '?T', 147 => '?o',
148 => '?', 149 => '?', 150 => '?"', 151 => '?"',
152 => 'o', 153 => '"', 154 => 'š', 155 => '?',
156 => '"', 157 => '', 158 => 'ž', 159 => 'Ÿ');
$newStr = '';
for ($i = 0; $i < strlen($str); $i++) {
$chrVal = ord($str[$i]);
if ($chrVal > 127 && $chrVal < 160) {
$newStr .= $chrMap[$chrVal];
}
else {
$newStr .= utf8_encode($str[$i]);
}
}
return $newStr;
}
attached mail follows:
I'm trying to take arbitrary PHP code from within C++.
I've noted the PHP embed module, but haven't found any sample code or
directions as
to how to use it.
The other idea is to call functions directly from the DLL.
A dumpbin has given me a function list, but attempts to call
php_execute_script( .. )
fails to link within VS 6.0.
Has anyone successfully done something similar?
Is there an exported function that simply takes a string rather then the
zend_file_handle?
Does anyone have sample code?
Nathan Schmitz
Software Developer
Biap Systems, Inc.
nschmitz
biap.com
attached mail follows:
* Thus wrote Nathan Schmitz (nschmitz
biap.com):
>
> I'm trying to take arbitrary PHP code from within C++.
>
> I've noted the PHP embed module, but haven't found any sample code or
> directions as
> to how to use it.
A little old but might work..
http://www.zend.com/lists/php-dev/200209/msg01063.html
GIYF,
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!
attached mail follows:
$dec = -333371788;
echo $dec."\n";
$hex = dechex($dec)."\n";
$dec2 = hexdec($hex)."\n";
echo $dec2."\n";
-= PRODUCES: =-
-333371788
3961595508
Is this something about signed versus unsigned integers? What I really
would like to do is convert that negative number (-333371788), which I
suppose is unsigned to a signed integer (3961595508) without having to
convert it to hex, then back to decimal.
....Rene
attached mail follows:
Forgive me if my math is askew, but doesn't the negative imply the
number is signed? If I remember from my C++ days, a declaration of:
unsigned int blah;
Meant you could not store negative numbers in that variable. Hence,
negatives would be signed. No?
On Tue, 2004-06-08 at 12:52, René Fournier wrote:
> $dec = -333371788;
> echo $dec."\n";
>
> $hex = dechex($dec)."\n";
> $dec2 = hexdec($hex)."\n";
>
> echo $dec2."\n";
>
> -= PRODUCES: =-
>
> -333371788
> 3961595508
>
>
> Is this something about signed versus unsigned integers? What I really
> would like to do is convert that negative number (-333371788), which I
> suppose is unsigned to a signed integer (3961595508) without having to
> convert it to hex, then back to decimal.
>
> ....Rene
--
Adam Voigt
adam
kotisprop.com
attached mail follows:
* Thus wrote Ren Fournier (m5
renefournier.com):
> -= PRODUCES: =-
>
> -333371788
> 3961595508
>
>
> Is this something about signed versus unsigned integers? What I really
> would like to do is convert that negative number (-333371788), which I
> suppose is unsigned to a signed integer (3961595508) without having to
> convert it to hex, then back to decimal.
You have it backwords.. -333371788 is signed and the 3961595508 is
unsigned.
But...
<?php
$dec = -333371788;
$unsigned = sprintf("%ul", $dec);
print $unsigned; // == 3961595508
Do note that php doesn't have native unsigned numbers so doing
something like this wont work right:
printf("%d", $unsigned); // == 2147483647
So to convert it back you have to do something like:
printf("%d", $unsigned+0); // == -333371788
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!
attached mail follows:
> Forgive me if my math is askew, but doesn't the negative imply the
> number is signed? If I remember from my C++ days, a declaration of:
>
> unsigned int blah;
>
> Meant you could not store negative numbers in that variable. Hence,
> negatives would be signed. No?
Yes, but once it become a hex string (after dechex()), all that info is
gone. I think the way to handle this situation is to use pack & unpack.
---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca http://mike.teczno.com/contact.html
attached mail follows:
OK, that makes sense. But here's the problem: I receive binary data
from SuperSPARC (big-endian), which I need to unpack according to
certain documented type definitions. For example, let's say that $msg
has the value "3961595508" and is packed as an unsigned long integer
(on the remote SPARC). But when I receive it, and unpack it...
$unpacked = unpack('Nval', $msg); // N for unsigned long integer,
big-endian (SPARC)
echo $unpacked["val"];
...the output value is "-333371788". (???) Which tells me that PHP is
NOT unpacking $msg as an unsigned long integer, but rather as a signed
integer (since unsigned integers cannot be negative).
Now, thanks to your suggestions, I can convert that number back to an
unsigned integeror at least make it positive. But I shouldn't have to
convert it, should I?
...Rene
On Tuesday, June 8, 2004, at 11:29 AM, Curt Zirzow wrote:
> * Thus wrote Ren Fournier (m5
renefournier.com):
>> -= PRODUCES: =-
>>
>> -333371788
>> 3961595508
>>
>>
>> Is this something about signed versus unsigned integers? What I really
>> would like to do is convert that negative number (-333371788), which I
>> suppose is unsigned to a signed integer (3961595508) without having to
>> convert it to hex, then back to decimal.
>
> You have it backwords.. -333371788 is signed and the 3961595508 is
> unsigned.
>
> But...
>
> <?php
> $dec = -333371788;
> $unsigned = sprintf("%ul", $dec);
> print $unsigned; // == 3961595508
>
> Do note that php doesn't have native unsigned numbers so doing
> something like this wont work right:
>
> printf("%d", $unsigned); // == 2147483647
>
> So to convert it back you have to do something like:
> printf("%d", $unsigned+0); // == -333371788
>
>
> Curt
> --
> First, let me assure you that this is not one of those shady pyramid
> schemes
> you've been hearing about. No, sir. Our model is the trapezoid!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
attached mail follows:
* Thus wrote Ren Fournier (m5
renefournier.com):
>
> Now, thanks to your suggestions, I can convert that number back to an
> unsigned integeror at least make it positive. But I shouldn't have to
> convert it, should I?
Not necessarily, it mostly due to the limitation that php doesn't
have unsigned integers. I have a patch for php that will return a
unsigned integer as a string, but I havn't gotten it put into php
yet.
http://www.phpbuilder.com/lists/php-general/2003121/0526.php
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!
attached mail follows:
Thanks. The fact that this behaviour is a bug somehow makes me feel
better. At least I'm not crazyor, not as crazy as I thought.
...Rene
On Tuesday, June 8, 2004, at 12:57 PM, Curt Zirzow wrote:
> * Thus wrote Ren Fournier (m5
renefournier.com):
>>
>> Now, thanks to your suggestions, I can convert that number back to an
>> unsigned integeror at least make it positive. But I shouldn't have to
>> convert it, should I?
>
> Not necessarily, it mostly due to the limitation that php doesn't
> have unsigned integers. I have a patch for php that will return a
> unsigned integer as a string, but I havn't gotten it put into php
> yet.
>
> http://www.phpbuilder.com/lists/php-general/2003121/0526.php
>
> Curt
> --
> First, let me assure you that this is not one of those shady pyramid
> schemes
> you've been hearing about. No, sir. Our model is the trapezoid!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
attached mail follows:
Hi there,
we are developing application for users with different database environment.
I ve tested it with MySQL and SQL.
Now I am stuck on Oracle 10g.
I am trying php and PEAR.
I have the following parameters:
Windows Server 2000
PHP 4.3.6
PEAR 1.8
APACHE 2.0.49
Oracle 10g
- ORACLE_HOME = C:\oracle\product\10.1.0\db_1 in ...Oracle\KEY_OraDb10g_home1 in Registry
ORACLE_SID = webEvalOracle
(same variables in ...Oracle\SYSMAN\OracleDBConsolewebEvalOracle in Registry)
- WEBEVALO =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = tonya)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = webEvalO)
)
)
in TNSnames.ora
- php.ini:
extension=php_oci8.dll
extension=php_oracle.dll
errors are:
1. for PEAR: [nativecode=ORA-12154: TNS:could not resolve the connect identifier specified]
/*php code:
$dbms="oci8";
$dbhost="tonya"; //localhost or tonya
$dbuser="root"; // schema name
$dbpass="my_pass";
$dbname="webevalo"; //or "webevaloracle" for the full name
$connectionObj=new connectionClass($dns);
*/
2. in PHP can't connect either( $dbconnect=OCILogon($dbuser, $dbpass, $dbname))
So I was wandering if you can help me - either give me some advises or may be point to the source where I can retrieve the info I need.
really appreciate your time and help
Tonya
www.one45.com
attached mail follows:
I'm sorry to be 0t but I couldn't find anyone specific to contact on the web
or in the email source.
Every time I post to this (and the PEAR list if I recall) I get an email
from Information Desk <info
astralsecurityandfinancebv.com>
> Thanks for contacting Astral Security and Finance BV. Your request is being
> processed, we will get back to you shortly. Information Desk
Best Google knows they are a fraud/scam thing:
http://www.google.com/search?q=Astral+Security+and+Finance+BV&ie=UTF-8&oe=UT
F-8
Can someone who has admin access PLEASE look into it. Thanks.
~ Mike
-----
Mike Zornek
Web Designer, Media Developer, Programmer and Geek
Personal site: <http://MikeZornek.com>
attached mail follows:
Hello:
I am just starting to learn php and have been reading tutorials that I
have found on the Internet.
The one I am reading now is:
http://www.freewebmasterhelp.com/tutorials/phpmysql/1
The problem I am having is with these two scripts.
Script 1:
(This script displays some forms to type in Contact information.)
<form action="insert.php" method="post">
First Name: <input type="text" name="first"><br>
Last Name: <input type="text" name="last"><br>
Phone: <input type="text" name="phone"><br>
Mobile: <input type="text" name="mobile"><br>
Fax: <input type="text" name="fax"><br>
E-mail: <input type="text" name="email"><br>
Web: <input type="text" name="web"><br>
<input type="Submit">
</form>
Script 2:
(This script (saved as insert.php) is called by Script 1 after
information has been typed into the above form.)
<?
$username="localuser";
$password="unknown";
$database="Contacts";
mysql_connect(localhost,$username,$password);
mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM Contacts";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
echo "<b><center>Database Output</center></b><br><br>";
$i=0;
while ($i < $num) {
$first=mysql_result($result,$i,"first");
$last=mysql_result($result,$i,"last");
$phone=mysql_result($result,$i,"phone");
$mobile=mysql_result($result,$i,"mobile");
$fax=mysql_result($result,$i,"fax");
$email=mysql_result($result,$i,"email");
$web=mysql_result($result,$i,"web");
echo "<b>$first $last</b><br>Phone: $phone<br>Mobile: $mobile<br>Fax:
$fax<br>E-
mail: $email<br>Web: $web<br><hr><br>";
++$i;
}
?>
I have created the database Contacts. It is a MySQL database. I open
the first script and enter my contact data, press Submit, and I believe
the second script is then called.
I go and check my Contacts database and a new record has been added, but
it is empty. I am guessing that the values assigned in the first script
are not being seen by the second script and that the empty variables are
being written to the database.
Is there something that has to be done to php so that it sees these
variables? Is this an operating system issue? Anything else I should be
looking at?
Other data:
Server Machine: Sun Sparc 20 with Solaris 2.6, Apache 2.0.49, MySQL
4.0.17, PHP 4.3.7.
Remote Machine: Homebuilt running MS Windows 2000, Mozilla Firebird 0.7
browser
If there is a better list for beginner questions, please let me know.
Thanks.
--
Frank Hahn
attached mail follows:
[snip]
Is there something that has to be done to php so that it sees these
variables? Is this an operating system issue? Anything else I should
be
looking at?
[/snip]
register globals is off, so all of your variables are in the POST array
$_POST['first']
$_POST['last']
etc. Replace all your variable references with the appropriate array
references and you'll be off to the races.
attached mail follows:
"Jay Blanchard" <jay.blanchard
niicommunications.com> wrote in
news:C8F323573C030A448F3E5A2B6FE2070B03522604
nemesis:
> register globals is off, so all of your variables are in the POST array
>
> $_POST['first']
> $_POST['last']
>
> etc. Replace all your variable references with the appropriate array
> references and you'll be off to the races.
>
Jay:
I edited the insert.php file and changed the $query line from what was
previously posted to that below (all one line):
$query = "INSERT INTO Contacts VALUES ('','$_POST[first]','$_POST
[last]','$_POST [phone]','$_POST[mobile]','$_POST[fax]','$_POST
[email]','$_POST[web]')";
This works like the article says it should.
Thank you for your help.
--
Frank Hahn
attached mail follows:
Hi,
Is it possible to use PHP to detect the type of browser accessing my site.
For example if a PDA is using it I would prefer not to include large
graphics...
Many thanks for your help
attached mail follows:
[snip]
Is it possible to use PHP to detect the type of browser accessing my
site.
For example if a PDA is using it I would prefer not to include large
graphics...
[/snip]
you can check the user-agent, no gaurantees what if anything that is
sent is accurate.
attached mail follows:
$_SERVER['HTTP_USER_AGENT'];
> [snip]
> Is it possible to use PHP to detect the type of browser accessing my
> site.
> For example if a PDA is using it I would prefer not to include large
> graphics...
> [/snip]
attached mail follows:
I am trying to send some encrypted data from a php application to be
decoded in a .Net application. Both apps encode/decode a given string
but generate different encrypted results. Anyone have any idea? Code
to follow:
php====>
<?php
// Designate string to be encrypted
$string = "This is a test";
// Encryption/decryption key
$key = pack('H*',md5("mysecretkey"));
echo "PHP:KeySize:";
echo mcrypt_get_key_size('tripledes', 'ecb')*8;
echo "<BR>";
echo "PHP:BlockSize:";
echo mcrypt_get_block_size('tripledes', 'ecb')*8;
echo "<BR>";
// Encryption Algorithm
$cipher_alg = MCRYPT_TRIPLEDES;
#$cipher_alg = ;
#$cipher_alg = ;
// Create the initialization vector for added security.
//$iv = mcrypt_create_iv(mcrypt_get_iv_size($cipher_alg,
MCRYPT_MODE_ECB), MCRYPT_RAND);
$iv = pack("H*","ec787813562c5be0");
// Output original string
echo "PHP:Original string:$string <br>";
echo "PHP:Original Key:". base64_encode($key)."<br>";
echo "PHP:Encryption Method: tripledes <br>";
echo "PHP:IV:".base64_encode($iv)."<br>";
// Encrypt $string
//$encrypted_string = mcrypt_encrypt($cipher_alg, $key, $string,
MCRYPT_MODE_CBC, $iv);
$encrypted_string = mcrypt_encrypt($cipher_alg, $key, $string,
MCRYPT_MODE_CFB, $iv);
$decrypted_string = mcrypt_decrypt($cipher_alg, $key,
$encrypted_string, MCRYPT_MODE_CFB, $iv);
echo "PHP:Encrypted string
Base64:".base64_encode($encrypted_string)."<br>";
echo "PHP:Decrypted string:$decrypted_string";
?>
<===================
PHP OUTPUTPHP:
KeySize:192
PHP:BlockSize:64
PHP:Original string:This is a test
PHP:Original Key:NNLkJVyOa+s8QvJN/X5tqQ==
PHP:Encryption Method: tripledes
PHP:IV:7Hh4E1YsW+A=
PHP:Encrypted string Base64:A+9SKuoLdZaATqa+qmTipg==
PHP:Decrypted string:This is a test
===========================>
C# (.NET)
using System;
using System.Security.Cryptography;
using System.Text;
namespace test
{
class TryDes{
public string EncryptTripleDES(string Plaintext,
string key) {
TripleDESCryptoServiceProvider DES = new
TripleDESCryptoServiceProvider();
MD5CryptoServiceProvider hashMD5 = new
MD5CryptoServiceProvider();
DES.Key =
hashMD5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(key));
DES.Mode = CipherMode.CFB;
DES.IV =
Convert.FromBase64String("7Hh4E1YsW+A=");
DES.Padding=PaddingMode.Zeros;
Console.WriteLine("");
Console.WriteLine("NET:KeySize:"+DES.KeySize);
Console.WriteLine("NET:BlockSize:"+DES.BlockSize);
Console.WriteLine("NET:Original
String:"+Plaintext);
Console.WriteLine("NET:Original
Key:"+Convert.ToBase64String(DES.Key));
Console.WriteLine("NET:Encryption
Method:TripeDES");
//DES.Mode = CipherMode.ECB;
Console.WriteLine(
"NET:IV:"+Convert.ToBase64String(DES.IV));
ICryptoTransform DESEncrypt =
DES.CreateEncryptor(DES.Key,DES.IV);
byte[] Buffer =
ASCIIEncoding.ASCII.GetBytes(Plaintext);
return
Convert.ToBase64String(DESEncrypt.TransformFinalBlock(Buffer, 0,
Buffer.Length));
}
public string DecryptTripleDES(string base64Text,
string key){
TripleDESCryptoServiceProvider DES = new
TripleDESCryptoServiceProvider();
MD5CryptoServiceProvider hashMD5 = new
MD5CryptoServiceProvider();
DES.Key =
hashMD5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(key));
DES.Mode = CipherMode.CFB;
DES.Padding=PaddingMode.Zeros;
DES.IV = Convert.FromBase64String("7Hh4E1YsW+A=");
ICryptoTransform DESDecrypt =
DES.CreateDecryptor(DES.Key,DES.IV);
byte[] Buffer =
Convert.FromBase64String(base64Text);
return
ASCIIEncoding.ASCII.GetString(DESDecrypt.TransformFinalBlock(Buffer,
0, Buffer.Length));
}
}
class Class1
{
static void Main(string[] args) {
TryDes md = new TryDes();
string secrekey = "mysecretkey";
string sometest = md.EncryptTripleDES("This is
a test",secrekey);
Console.WriteLine("NET:Encrypted string
Base64:"+sometest);
Console.WriteLine("NET:Decrypted
string:"+md.DecryptTripleDES(sometest,secrekey));
Console.WriteLine("");
}
}
}
<======================
.Net Output
NET:KeySize:192
NET:BlockSize:64
NET:Original String:This is a test
NET:Original Key:NNLkJVyOa+s8QvJN/X5tqQ==
NET:Encryption Method:TripeDES
NET:IV:7Hh4E1YsW+A=
NET:Encrypted string Base64:qbGgiTZp9YTGOutg8IGlqw==
NET:Decrypted string:This is a test
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]