php-general Digest 14 Apr 2001 15:38:40 -0000 Issue 627

Topics (messages 48508 through 48555):

Re: HTML and PHP?
        48508 by: Steve Werby
        48509 by: Jason Caldwell
        48511 by: Jason Caldwell

Reading a file and changing <a href> tag values
        48510 by: Brett
        48515 by: Plutarck

Need a URL....
        48512 by: rm
        48513 by: Keyur Kalaria
        48518 by: rm

Re: Sessions?
        48514 by: Plutarck
        48525 by: Ashley M. Kirchner
        48542 by: Plutarck

PHP & MySQL Search Results
        48516 by: Jason Caldwell
        48522 by: Plutarck

antifraud logic for voting poll, banner clicks
        48517 by: Keyur Kalaria

Forcing Case
        48519 by: midget2000x
        48528 by: James Moore
        48532 by: Christian Reiniger

Backend system for skinz.org/deskmod.com?
        48520 by: Long Lam

Re: slashes added to template files
        48521 by: Floyd Piedad

Re: sorting multi-dimensional arrays
        48523 by: Delbono
        48524 by: Delbono
        48540 by: Plutarck

Installing PHP 4 as rpm on RedHat 6.2 !!
        48526 by: Mohamedou

PHP for Apache 2.0
        48527 by: Patrick Dunford
        48551 by: Alexander Wagner

Any one have PHP voteBOOTH source code...?!?
        48529 by: news.php.net

Re: header( )
        48530 by: Christian Reiniger

user info?
        48531 by: Ramiro Radjiman

Big sites running PHP
        48533 by: Phil Driscoll

session
        48534 by: E K L

Abnormal performance of PHP_MSSQL70.DLL
        48535 by: Jia Li

A slightly amusing, though mostly dangerous, endless loop
        48536 by: Plutarck

CLASSES AND OBJECTS..
        48537 by: alberto
        48538 by: Plutarck

htaccess question
        48539 by: Peter Van Dijck
        48541 by: Peter Van Dijck

W2K Install Problem
        48543 by: Jeff Oien
        48548 by: Jeff Oien

Explain recordset
        48544 by: Mike P
        48550 by: Plutarck

counter reseting help!
        48545 by: McShen
        48549 by: Plutarck

help on something simple?
        48546 by: Andrew Durk
        48552 by: Plutarck

Selected Radio Buttons
        48547 by: Jordan Elver
        48554 by: Plutarck

Extract from string
        48553 by: n e t b r a i n

PHP without a webserver
        48555 by: Plutarck

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------


"Les Neste" <[EMAIL PROTECTED]> wrote:
> Cool.  Does that work with echo too, do you know?


<?
echo <<<STOP

<html>
Yes, echo can use here-docs!  Is it really that *hard* to take 1 minute to
test for yourself? ;-)
And you can use whatever marker (the 'STOP' above and below) you choose.
Just make sure you don't indent the closing marker or the parser will miss
it!
</html>

STOP;
?>

--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/





oh... that rocks!

would i have to still add the slashes?

/n, /" -- etc?

"Les Neste" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Cool.  Does that work with echo too, do you know?
>
> At 06:19 PM 4/13/2001 -0700, DanO wrote:
> >try this:
> >
> ><?
> >print <<<EOP
> >
> ><html>
> >jldsfajlf;dsajfl;dkfl;dsa
> ></html>
> >
> >EOP;
> >?>
> >
> >AFAIK it is the easiest way to do multi-line printing!
> >
> >DanO
> >
> >
> >""Jason Caldwell"" <[EMAIL PROTECTED]> wrote in message
> >9b868e$2ca$[EMAIL PROTECTED]">news:9b868e$2ca$[EMAIL PROTECTED]...
> >> Is there a utility that I can use that will take a bunch of HTML and
> >> encapsulate it in the PRINT command?
> >>
> >> i.e.
> >>
> >> PRINT("{html stuff}\n");
> >>
> >> ??
> >>
> >> I have a ton of HTML pages that I want to make dynamic, but dread
having
> >to
> >> type the PRINT command in front of every line of html, and let alone
> >having
> >> at manually add the slashes... urg.
> >>
> >> Thanks.
> >> Jason
> >> [EMAIL PROTECTED]
> >>
> >>
> >>
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >> To contact the list administrators, e-mail:
[EMAIL PROTECTED]
> >>
> >
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
............................................................................
> Les Neste  678-778-0382  http://www.lesneste.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






actually just test this... don't need slashes... it works GREAT!

thanks.


""Jason Caldwell"" <[EMAIL PROTECTED]> wrote in message
9b8it7$npq$[EMAIL PROTECTED]">news:9b8it7$npq$[EMAIL PROTECTED]...
> oh... that rocks!
>
> would i have to still add the slashes?
>
> /n, /" -- etc?
>
> "Les Neste" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Cool.  Does that work with echo too, do you know?
> >
> > At 06:19 PM 4/13/2001 -0700, DanO wrote:
> > >try this:
> > >
> > ><?
> > >print <<<EOP
> > >
> > ><html>
> > >jldsfajlf;dsajfl;dkfl;dsa
> > ></html>
> > >
> > >EOP;
> > >?>
> > >
> > >AFAIK it is the easiest way to do multi-line printing!
> > >
> > >DanO
> > >
> > >
> > >""Jason Caldwell"" <[EMAIL PROTECTED]> wrote in message
> > >9b868e$2ca$[EMAIL PROTECTED]">news:9b868e$2ca$[EMAIL PROTECTED]...
> > >> Is there a utility that I can use that will take a bunch of HTML and
> > >> encapsulate it in the PRINT command?
> > >>
> > >> i.e.
> > >>
> > >> PRINT("{html stuff}\n");
> > >>
> > >> ??
> > >>
> > >> I have a ton of HTML pages that I want to make dynamic, but dread
> having
> > >to
> > >> type the PRINT command in front of every line of html, and let alone
> > >having
> > >> at manually add the slashes... urg.
> > >>
> > >> Thanks.
> > >> Jason
> > >> [EMAIL PROTECTED]
> > >>
> > >>
> > >>
> > >>
> > >> --
> > >> PHP General Mailing List (http://www.php.net/)
> > >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >> For additional commands, e-mail: [EMAIL PROTECTED]
> > >> To contact the list administrators, e-mail:
> [EMAIL PROTECTED]
> > >>
> > >
> > >
> > >
> > >--
> > >PHP General Mailing List (http://www.php.net/)
> > >To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >For additional commands, e-mail: [EMAIL PROTECTED]
> > >To contact the list administrators, e-mail:
[EMAIL PROTECTED]
> > >
> > >
> >
> >
>
............................................................................
> > Les Neste  678-778-0382  http://www.lesneste.com
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






I have been able to find out how to read a file and replace certain matches,
but I want to be able to take a web page stored in a string and change the
<a href> tags and add www.mysite.com?page=   before the actual link value so
the new url would read www.mysite.com?page=original_url.  Can I do this and
if so will someone give me an idea how?   Thanks.

Brett





All you need is a regular expression, provided by ereg function or preg
functions.

You'd have the regex look for <a href then capture everything up to </a>

Then just adjust the result as you want it to appear.


You'll need to either search around for code that already does this, or be
willing to learn regular expressions (which you should do anyway).

Otherwise it will seem impossible.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Brett"" <[EMAIL PROTECTED]> wrote in message
012701c0c4a2$cbc7f840$LocalHost@Default">news:012701c0c4a2$cbc7f840$LocalHost@Default...
> I have been able to find out how to read a file and replace certain
matches,
> but I want to be able to take a web page stored in a string and change the
> <a href> tags and add www.mysite.com?page=   before the actual link value
so
> the new url would read www.mysite.com?page=original_url.  Can I do this
and
> if so will someone give me an idea how?   Thanks.
>
> Brett
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






My hard drive died, lost my bookmarks.  Can someone
post the url of the site that archives this list...it
was marc something or other....need to find a piece of
code I know was posted to this list....thank

rm

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/




it is 

http://marc.theaimsgroup.com/

regards
keyur


----- Original Message ----- 
From: "rm" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, April 14, 2001 11:23 AM
Subject: [PHP] Need a URL....


> My hard drive died, lost my bookmarks.  Can someone
> post the url of the site that archives this list...it
> was marc something or other....need to find a piece of
> code I know was posted to this list....thank
> 
> rm
> 
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail. 
> http://personal.mail.yahoo.com/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 





Thank you

rm


--- Keyur Kalaria <[EMAIL PROTECTED]> wrote:
> it is 
> 
> http://marc.theaimsgroup.com/
> 
> regards
> keyur
> 
> 


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/




The way I do it is to stick all those global variables into an include file,
which I usually named something like global.php.

Just do that and require() the file at the top of all your scripts which
need it. Keep things like page color, text color, font, etc in the global
file.

If you ever need to change the color before you use them, just alter the
colors at the top of your scripts after the require(), but before you "do"
anything with them (such as echo them to the browser).


Once you have the site working like that, it's easy to add per-user
customization. So in the future you just check to see if a session variable
is set, and if it is you replace the global variable value with the session
variable value.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Ashley M. Kirchner"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
>     I'm used to building pages that contain links that have variables
> passed on the URL  (somepage.php?var1=1&var2=2...) and I'm now looking
> into building a site that will have quite a bit of these that will have
> to 'live' from page to page, occasionally getting reset, or changed by
> new page.  I'm told sessions are the way to go (specially since this
> will have several users using the site).
>
>     And consequently, now I'm lost.  Sessions..okay..how does the
> variable 'live' from one to the other?  What do I have to do different
> when setting variables that will be used globally across the site (and
> reset/changed from time to time)?  I don't need to STORE any of these
> (say for a future log-in), however if it's easy (easier?) to do it that
> way, that's fine as well.  I may eventually start making the site
> customizable on a per user basis.  But for right now, I need a startup
> primer first.
>
>     AMK4
>
> --
> W |
>   |  I haven't lost my mind; it's backed up on tape somewhere.
>   |____________________________________________________________________
>   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   Ashley M. Kirchner <mailto:[EMAIL PROTECTED]>   .   303.442.6410 x130
>   SysAdmin / Websmith                           .     800.441.3873 x130
>   Photo Craft Laboratories, Inc.             .        eFax 248.671.0909
>   http://www.pcraft.com                  .         3550 Arapahoe Ave #6
>   .................. .  .  .     .               Boulder, CO 80303, USA
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






Plutarck wrote:

> The way I do it is to stick all those global variables into an include file,
> which I usually named something like global.php.

  Um no.  These aren't static variables.  They change from page to
page.  For example, page one

  $foo=0, $bar=3, $baz='Closed'

They follow a particular link that changes them to,

  $foo=1, $bar=3, $baz='Open'

They follow yet another link, and this time only $bar changes,

  $foo=1, $bar=2, $baz='Open'

  Right now, the way I've always done that was to include it in the
URL: next_page.php?foo=0$bar=3&baz='Closed' - they follow a link, and
those variables get tacked again.  If it's a form, I pass hidden input
tags.

  But, there's got to be a better, transparent way of doing this.  No?

    AMK4

--
H | Hi, I'm currently out of my mind.  Please leave a message.  BEEEEP!
  |____________________________________________________________________
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Ashley M. Kirchner <mailto:[EMAIL PROTECTED]>   .   303.442.6410 x130
  Director of Internet Operations / SysAdmin    .     800.441.3873 x130
  Photo Craft Laboratories, Inc.             .        eFax 248.671.0909
  http://www.pcraft.com                  .        3550 Arapahoe Ave, #6
  .................. .  .  .     .            Boulder, CO 80303, U.S.A.






Ahh. I reread your post and now I see what you were originally asking.


Yes, sessions are the best way to handle it then. The variables "live" by
sending a specially augmented header to the client. The header sort of
"sticks" to the client so that their session ID is automatically sent in
their requests for new pages. It's basically a cookie that isn't stored on
the persons hard drive.

There are instances where a person's browser is, for lack of a better word,
"teflon coated" so that the header/cookie just doesn't "stick" to them.
That's when PHP appends the "PHPSESSID=[long string of characters]" to all
of your links.

So the short answer to your question is "Yes, it's the best way to handle
it".

But it must be noted that when someone submits a variable through the URL it
will _not_ change the value of any session variables. You must do that
explicitly in your code.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Ashley M. Kirchner"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Plutarck wrote:
>
> > The way I do it is to stick all those global variables into an include
file,
> > which I usually named something like global.php.
>
>   Um no.  These aren't static variables.  They change from page to
> page.  For example, page one
>
>   $foo=0, $bar=3, $baz='Closed'
>
> They follow a particular link that changes them to,
>
>   $foo=1, $bar=3, $baz='Open'
>
> They follow yet another link, and this time only $bar changes,
>
>   $foo=1, $bar=2, $baz='Open'
>
>   Right now, the way I've always done that was to include it in the
> URL: next_page.php?foo=0$bar=3&baz='Closed' - they follow a link, and
> those variables get tacked again.  If it's a form, I pass hidden input
> tags.
>
>   But, there's got to be a better, transparent way of doing this.  No?
>
>     AMK4
>
> --
> H | Hi, I'm currently out of my mind.  Please leave a message.  BEEEEP!
>   |____________________________________________________________________
>   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   Ashley M. Kirchner <mailto:[EMAIL PROTECTED]>   .   303.442.6410 x130
>   Director of Internet Operations / SysAdmin    .     800.441.3873 x130
>   Photo Craft Laboratories, Inc.             .        eFax 248.671.0909
>   http://www.pcraft.com                  .        3550 Arapahoe Ave, #6
>   .................. .  .  .     .            Boulder, CO 80303, U.S.A.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






Does anyone know (or have) of a good example of how to create search results
like a Yahoo or MSN search?

for example:

Say I do a search for "cars" and there are 10,000 records in my table that
match "car"... I would like to show the results in blocks of (say) 25 at a
time, therefore I will need a "Next Results", "Previous Results", "Total
Records found that match my query", and perhaps, between the "Previous
Results" and "Next Results" a set of numbers like so;

<Previous [1] [2] [3] [...] Next>

The numbers being "jump to" links, etc.

Thanks.
Jason






In a MySQL query you can use the LIMIT keyword, like in phpmyadmin.

Use limit 0,10 to get the first ten results in a query.

Then do the query again but use 10,10 for the limit.

The first number is the "offset", and the second one is the maximum results
to return.

That's the way most people do "pages".


--
Plutarck
Should be working on something...
...but forgot what it was.


""Jason Caldwell"" <[EMAIL PROTECTED]> wrote in message
9b8rgd$oot$[EMAIL PROTECTED]">news:9b8rgd$oot$[EMAIL PROTECTED]...
> Does anyone know (or have) of a good example of how to create search
results
> like a Yahoo or MSN search?
>
> for example:
>
> Say I do a search for "cars" and there are 10,000 records in my table that
> match "car"... I would like to show the results in blocks of (say) 25 at a
> time, therefore I will need a "Next Results", "Previous Results", "Total
> Records found that match my query", and perhaps, between the "Previous
> Results" and "Next Results" a set of numbers like so;
>
> <Previous [1] [2] [3] [...] Next>
>
> The numbers being "jump to" links, etc.
>
> Thanks.
> Jason
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






Hello everybody,

I am working on a banner exchange site and a site rating script.

Can anyone suggest me how to avoid the fraud rating and fraud banner clicks.
What all things we need to take care for the same etc.

Thanks in advance.

Keyur





Is there any way to force case...like if I have a string and want it to appear
in all lowercase (or uppercase, God forbid)?

Thanks,

Rory
 -----------
providing the finest in midget technology




RTFM:

http://www.php.net/manual/en/function.strtoupper.php
http://www.php.net/manual/en/function.strtolower.php
http://www.php.net/manual/en/function.ucfirst.php

- James

> -----Original Message-----
> From: midget2000x [mailto:[EMAIL PROTECTED]]
> Sent: 14 April 2001 08:16
> To: [EMAIL PROTECTED]
> Subject: [PHP] Forcing Case
> 
> 
> Is there any way to force case...like if I have a string and want 
> it to appear
> in all lowercase (or uppercase, God forbid)?
> 
> Thanks,
> 
> Rory
>  -----------
> providing the finest in midget technology
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]




On Saturday 14 April 2001 09:15, you wrote:
> Is there any way to force case...like if I have a string and want it to
> appear in all lowercase (or uppercase, God forbid)?

http://www.php.net/strtolower

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

...10001000110101011010101101011110111010113...????




I've been searching for a week for a script similar to the backend systems 
used on sites such as skinz.org and deskmod.com.  I'd like to adapt their 
user review/rating systems to allow my visitors to rate class courses and 
professors.  Does anyone know if there's a complete script available like 
this somewhere that I can setup and use?  I'm not a php developer so making 
something like that is impossible for me.  Please help.  I think something 
like this could be adapted for reviewing anything and would be great if it 
could be shared.


Thanks




Check your PHP config.  On the remote server, you probably have Magic Quotes Runtime 
Activated while on the local
machine it is not.  Best if you make both the same config.  Run php info command to 
check.

Floyd

Franklin Hays wrote:

> Apologies in advance if this has been discussed before or is a simple
> fubar on my part.  I can only search through the archives for so
> long...  :-)
>
> Experiencing a frustrating problem on this end with slashes being added to
> my template files.  Here are the details:
>
> Using PHP on a webhost that compiled php as a cgi in my www/cgi-bin
> directory.
>
> I have all HTML files in templates/filename.tpl and all PHP files in
> includes/filename.inc, this includes the template.inc file from PHPLib.
>
> I have a file called 'script' with the following in it:
>
>  <?php
> require('includes/Directory.inc');
> include('includes/Header.inc');
> // Now parse a second template:
> $t->set_file("MainHandle","MainGadget.tpl");
> // wholePage.ihtml has "{MyOutput}" in it
> $vari= $t->parse("MyFinalOutput","MainHandle");
> // All {MyOutput}'s get replaced
> $t->p("MyFinalOutput");
> // output the value of MyFinalOutput
> /*eval( "?>".$vari );*/
> include('includes/Footer.inc');
> ?>
>
> include/Directory.inc has the following in it:
>
> <?php
> include('includes/Template.inc');
> $url_array=explode("/",$REQUEST_URI);
> $url_cat=$url_array[3];
> $url_grp=$url_array[4];
> $url_misc=$url_array[5];
> $t = new Template("/www/hostname/ocean/templates/");
> $title = "name";
>
> if($url_misc == 'misc') {
> $Handle='MiscHandle';
> $Template='MiscGadget.tpl';
> }
> elseif ($url_grp == 'tanks') {
> $Handle='TankHandle';
>  $Template='TankGadget.tpl';
> }
> elseif ($url_cat == 'psupply') {
> // These three lines are the same as the first example:
> $Handle='PowerHandle';
> $Template='PowerGadget.tpl';
> }
> elseif ($url_cat == 'purpose') {
> $Handle='PurposeHandle';
> $Template='PurposeGadget.tpl';
> } else {
> $Handle='IntroHandle';
> $Template='IntroGadget.tpl';
> }
> $t->set_file("$Handle","$Template");
> $t->set_var("name",$title);
> $t->parse("MyOutput","$Handle");
> ?>
>
> Now, this setup work without a hitch on my personal development server
> where PHP is loaded as a module in Apache. The file called via the
> 'script' above is loaded into the MainGadget.tpl template and displayed
> without a problem. Everything, including javascript, works great.
>
> Now, I moved this code to the providers server, where the only difference
> I can tell is php works as a cgi , and I get output from the HTML files
> with slashes added to the HTML, such as:
>
> <a href=\'about.php\'
> onMouseOut=\'MM_swapImgRestore()\" 
>onMouseOver=\"MM_swapImage(\'about\',\'\',\'graphics/toolsbar3_01.gif\',1)\"><img
> name=\"about\" border=\"0\" src=\"graphics/toolsbar_01.gif\" width=\"105\" 
>height=\"35\"></a>
> <a href=\'contact.php\' onMouseOut=\'MM_swapImgRestore()\'
> onMouseOver=\'MM_swapImage(\'contact\',\'\',\'graphics/toolsbar3_02.gif\',1)\"><img
> name=\"contact\" border=\"0\" src=\"graphics/toolsbar_02.gif\" width=\"96\" 
>height=\"35\"></a>
>
> Everything else is output just fine. The only HTML with this in it is the
> {MyOutput} files from templates directory (.tpl files). I am not very
> familiar with PHPLib but imagine there is some other not so subtle item I
> am missing since things work great on my linux/apache/php4 server.
>
> Any ideas? I have tried using stripslashes() in the 'script' above but get
> errors. Is there something unique to the php cgi I am missing? Something
> else?
>
> Any all help is greaty appreciated!!
>
> Thanks,
>
> //frank
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]





Try this (it should work):

while(list($k, $v) = each($myarray)){
  $myarray[$k] = (int) $v;
}
arsort($myarray);
reset($myarray);
while(list($k, $v) = each($myarray)){
  echo $k, ' == ', $v, "<BR>\n;
}



For better comprehension look at this post:

>Hey guys..
>
>I have this array that looks like this:
>
>$myarray = ( "apples" => 0, "oranges" => 2, "peaches" => 9, "pineapples" =>
>12, "stovetopstuffing" => 3, "grits" => 8);
>
>Fine and dandy. But, when I try to sort it in reverse order:
>
>arsort($myarray);
>
>I get THIS for output, obviously NOT what I want:
>
>peaches => 9
>grits => 8
>stovetopstuffing => 3
>oranges => 2
>pineapples => 12
>apples => 0
>
>Obviously, I want the pineapples entry to be at the top, since it has the
>highest value. What do I need to do?

You have stored strings as your values, instead of ints.

IE:    (string) '9' > (string) '12' returns TRUE

You will need to take care in creating your array to have (int) values
instead of strings.

If all else fails, the following should work:

while(list($k, $v) = each($myarray)){
  $myarray[$k] = (int) $v;
}
arsort($myarray);
reset($myarray);
while(list($k, $v) = each($myarray)){
  echo $k, ' == ', $v, "<BR>\n;
}

















----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, April 14, 2001 5:19 AM
Subject: [PHP] sorting multi-dimensional arrays


> I have a question about sorting multidimensional arrays. Here is my
problem:
>
> I have an 2-d array:
> $joke[1][rating]=10;
> $joke[2][rating]=20;
> $joke[3][rating]=15;
> ....
>
> I would like to sort the jokes into an array based on the rating from
highest
> to lowest. The end result would be something like this:
> Joke 2 : 20 points
> Joke 3: 15 points
> Joke 1: 10 points
>
> How do I accomplish this?
>
> I have tried fooling around with sort(), arsort(), and array_multisort(),
but
> I just can't get it. Thank you very much for your time.
>
> Shane
>





mmmmhh, no, maybe the samplecode I posted it's not your case, sorry...





> I have a question about sorting multidimensional arrays. Here is my
problem:
>
> I have an 2-d array:
> $joke[1][rating]=10;
> $joke[2][rating]=20;
> $joke[3][rating]=15;
> ....
>
> I would like to sort the jokes into an array based on the rating from
highest
> to lowest. The end result would be something like this:
> Joke 2 : 20 points
> Joke 3: 15 points
> Joke 1: 10 points
>
> How do I accomplish this?
>
> I have tried fooling around with sort(), arsort(), and array_multisort(),
but
> I just can't get it. Thank you very much for your time.
>
> Shane
>





The easiest way is probably to just use a for loop.

For instance (no pun intended...well, maybe just a little one):

$imax = sizeof($joke);

for ($i = 0; $i < $imax; $i++)
{
    if (sizeof($joke[$i]) > 1)
    {
        sort($joke[$i]);
    }
}


That will handle the sorting of any two-dimensional array. It won't effect
the first dimension however, so if you want to sort that you will need to do
it first.


--
Plutarck
Should be working on something...
...but forgot what it was.



<[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have a question about sorting multidimensional arrays. Here is my
problem:
>
> I have an 2-d array:
> $joke[1][rating]=10;
> $joke[2][rating]=20;
> $joke[3][rating]=15;
> ....
>
> I would like to sort the jokes into an array based on the rating from
highest
> to lowest. The end result would be something like this:
> Joke 2 : 20 points
> Joke 3: 15 points
> Joke 1: 10 points
>
> How do I accomplish this?
>
> I have tried fooling around with sort(), arsort(), and array_multisort(),
but
> I just can't get it. Thank you very much for your time.
>
> Shane
>






Hello All,


I have already php 3.0.18 installed on my RH 6.2 box.
I want to install PHP 4 now.
But if I still the following message:

[root@proxy mohamedou]# rpm -Uvh php-4.0.4pl1-3.i386.rpm
error: failed dependencies:
        libdb-3.1.so is needed by php-4.0.4pl1-3
        libgd.so.1.8 is needed by php-4.0.4pl1-3
        libc.so.6(GLIBC_2.1.3) is needed by php-4.0.4pl1-3
        libc.so.6(GLIBC_2.2) is needed by php-4.0.4pl1-3
        libresolv.so.2(GLIBC_2.2) is needed by php-4.0.4pl1-3
        php = 3.0.18 is needed by php-imap-3.0.18-6.2horde1
        php = 3.0.18 is needed by php-mysql-3.0.18-6.2horde1
[root@proxy mohamedou]#          

Which rpms are responsible for that?

Every help will be apreciated
Thnx in advance

Moh




According to Apache, modules made for Apache 1.3 will not work as-is in 2.0 
due to changes in the API.

Is a version of PHP 4 for Apache 2.0 coming out?

-- 
=======================================================================
Patrick Dunford, Christchurch, NZ - http://pdunford.godzone.net.nz/

   Ill-gotten treasures are of no value, but righteousness delivers
from death.
    -- Proverbs 10:2
http://www.heartlight.org/cgi-shl/todaysverse.cgi?day=20010414
=======================================================================
Created by Mail2Sig - http://pdunford.godzone.net.nz/software/mail2sig/




Patrick Dunford wrote:
> According to Apache, modules made for Apache 1.3 will not work as-is
> in 2.0 due to changes in the API.
>
> Is a version of PHP 4 for Apache 2.0 coming out?

Try the configure-option --with-apxs2 instead of --with-apxs and it 
should work with Apache 2.

PHP 4 supports far more than one Webserver-API.

regards
Wagner

-- 
'When the computer industry is at a low, beer drinking is at a high.' 
Jon 'maddog' Hall said.
By combining both industries into a single course you can make sure you 
always have a job.




hello... anyone know where i can downlaod voteBOOTH.php w/ the image
viewer....?! or does anyone have it that you can send to me..?

thanxz....!







On Saturday 14 April 2001 03:47, you wrote:

> On 11 Apr 2001 08:12:20 -0700 AD in php.general, Chris Lee said:
> >I'll post you a simple HTTP auth script. but you should realize =
> >something about header()
> >
> >client -> server
> >server -> client
> >
> >the client sends some HTTP request to the server, then the server
> > sends = some HTTP response to the client. php is strictly server
> > side, you have = full control over the HTTP headers sent to the user,
> > but not from the = user to the server. ie. method=3D'post' that is
> > sending client data to = the server, you will have no control over
> > this at all...
>
> There are in fact two different servers: the web server and the PHP
> server. IMO it should be possible for the PHP server, executing PHP

Wrong. PHP runs as part of the webserver.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

...10001000110101011010101101011110111010113...????




Hi there,

I'm just wondering if there is a method to extract user specific info when
this user connects to the site.

U user must have a handle, but i don't want him to login. So i thaught if i
can get specific userinfo from the client, this info would be his handle to
walk trough the site.

If he logs in it aint a problem :-)

Could someone help.

I know there must be something, i ones read it.

with kind regards,

Ramiro Radjiman

HOLLAND






For those who need to convince their bosses that PHP (+mysql +apache) is up
to the job, the following (recently slashdotted) link may be useful:

http://www.webtechniques.com/archives/2001/05/hong/

Cheers
--
Phil Driscoll
Dial Solutions
+44 (0)113 294 5112
http://www.dialsolutions.com
http://www.dtonline.org







Hi,
   Is there anybody can help to do this:

   My web site has 3 pages :a.php, b.php and c.php. I want to capture the 
session in those 3 pages. Without an id, visitor can't view my page. When 
visitors leave the site, thier session should be removed.

   The problem is how to remove the session. I have tried several function 
of session such as session_destroy(), session_unregister. But, i still faild 
to clear the session. What should i do?

  For ur information, the session.cookie_lifetime is set to 0 in my server. 
Should i   change the value? If yes, then how to do it? Please give me your 
hands, thank you....

E K
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.





hi, thank you for taking time reading this email.
i experienced an abnormal happening from my php_MSSQL70.dll. My computer 
config:
AMD 850+SDRAM 256
OS: MS Windows 2000 SERVER + sp1
HTTPD Server :  Apache 1.3.19
PHP version : 4.0.4
MSSQL version : 2000

i altered the Extension part of the php.ini file so that it loads 
php_mssql70.dll (seems there is no php_mssql2000.dll for my MSSQL2000). the 
problem is whenever i load a local page (by typing add in the add bar or 
clicking a hyperlink) in IE, it takes around 10 sec. and i observed that 
when the page is being loaded, the cpu usage reflected from the Task Manager 
is 100% and stays for about 5 sec. THIS HAPPENS EVEN IF THE SCRIPT DIDN"T 
CALL MSSQL FUNCITONS. the problem disappears if i comment that line in 
php.ini which loads that dll.
Why is this happening? anyone can help me?

aijil
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.





This is a bug which was apparently fixed in v 4.0.4pl1 at least, but it
still present in 4.0.3

I just found it kind of amusing and it makes a nice warning.

Consider this:

print_r($GLOBALS);


That's it. It prints all the variables available, however part of it is an
array called GLOBALS. Which then prints all available variables, including
an array called GLOBALS...

And it will continue until you hit the Stop button or until the script times
out. But if you have ignore.user.abort on, it will continue till it times
out. If you've screwed with your scripts timeout settings...

...so be wary of that, and ensure you don't try and print out the variables
available in GLOBALS in older versions of PHP. It was fixed with the
anti-recursion feature, which automatically breaks endless loops.



--
Plutarck
Should be working on something...
...but forgot what it was.








Anyone know if one day PHP will support multiple inheritance?
I think it's very important...

For example, will PHP support this code:

class A extends B,  extends C   {
....
}

where B and C are classes?

Thanks!
Alberto






Nope, I'm afraid not.

Currently PHP will support single level inheritance only. So A can extend B,
but C cannot extend B. You will need to create a class of B to extend it
with C.

I suppose PHP may one day support it, but I am guessing that the Zend API
can't currently handle it. I think it will need to be retooled.


Sounds like a nice thing to shoot for for PHP5, perhaps?


--
Plutarck
Should be working on something...
...but forgot what it was.


""alberto"" <[EMAIL PROTECTED]> wrote in message
9b9eu7$s6n$[EMAIL PROTECTED]">news:9b9eu7$s6n$[EMAIL PROTECTED]...
> Anyone know if one day PHP will support multiple inheritance?
> I think it's very important...
>
> For example, will PHP support this code:
>
> class A extends B,  extends C   {
> ....
> }
>
> where B and C are classes?
>
> Thanks!
> Alberto
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






Hi,
i installed Apache, PHP and mySQL on winNT.
I am trying to get htaccess files to work.

I created a .htaccess file in a directory with this line in it:
errordocument 404 /404.php

I changed the httpd.conf file for apache and restarted apache like this:
# AllowOverride None
AllowOverride All

But when I enter a url that doesn't exist I get this error in the browser:
Not found
The requested URL /peter personal/applications 
development/generic/htdocs/subfolder/dfdfdf was not found on this server.
Additionally, a 500 Internal Server Error error was encountered while 
trying to use an ErrorDocument to handle the request.

What is a good way to check if htaccess files are working, and what can I 
do to get them to work?
Thanks for any ideas, hints, ...!
Peter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://liga1.com building multiple language/culture websites
http://poorbuthappy.editthispage.com online ethnology, up&down





Also,
I am trying to find a way to get this to work:
within the directory I'm in,

1/5/2/3
should be rewritten to
index.php?a=1&b=5&c=2&d=3

I'm sure lots of people have done this before, but the Apache examples 
don't seem to include this. Where can I find a working example?
Thanks!
Peter


>Hi,
>i installed Apache, PHP and mySQL on winNT.
>I am trying to get htaccess files to work.
>
>I created a .htaccess file in a directory with this line in it:
>errordocument 404 /404.php
>
>I changed the httpd.conf file for apache and restarted apache like this:
># AllowOverride None
>AllowOverride All
>
>But when I enter a url that doesn't exist I get this error in the browser:
>Not found
>The requested URL /peter personal/applications 
>development/generic/htdocs/subfolder/dfdfdf was not found on this server.
>Additionally, a 500 Internal Server Error error was encountered while 
>trying to use an ErrorDocument to handle the request.
>
>What is a good way to check if htaccess files are working, and what can I 
>do to get them to work?
>Thanks for any ideas, hints, ...!
>Peter
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>http://liga1.com building multiple language/culture websites
>http://poorbuthappy.editthispage.com online ethnology, up&down
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://liga1.com building multiple language/culture websites
http://poorbuthappy.editthispage.com online ethnology, up&down





When I try to run a PHP script through a Web browser it just
displays the code. I did a clean install of W2K and installed
Apache. I copied the php.ini to the WINNT and system folders.
Not sure where to go from here.

BTW how do you open a command window in W2K? Thanks.
Jeff Oien




I got it to work. I would still like to know how to open a command
window in W2K though.

I had a reference to d:/php4/ instead of d:/php/ which is where I 
have it.
Jeff Oien

> When I try to run a PHP script through a Web browser it just
> displays the code. I did a clean install of W2K and installed
> Apache. I copied the php.ini to the WINNT and system folders.
> Not sure where to go from here.
> 
> BTW how do you open a command window in W2K? Thanks.
> Jeff Oien
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 




I'm trying to figure out the way recordsets are handled with php and 
mysql.After I issue a query to the Db with $result = mysql_query ($query) 
is the recordset contained in $result or is this just a pointer.I want a 
persistant recordset on the client computer that can be manipulated without 
going to the server.Is this possable.fetchrow seems to go to the server 
each time or am i wrong?
Thanks
Mike P
[EMAIL PROTECTED]




$result holds a "resource id". When you do anything like mysql_fetch_row it
sends a request to the database. All results, until you "fetch" them, are
kept in MySQL.

If you want to store the results away from the DB you will need to do
something like:

while ($array[] = mysql_fetch_row($result));

That will store all the results into $array...hopefully.


--
Plutarck
Should be working on something...
...but forgot what it was.



"Mike P" <[EMAIL PROTECTED]> wrote in message
9b9lvb$u57$[EMAIL PROTECTED]">news:9b9lvb$u57$[EMAIL PROTECTED]...
> I'm trying to figure out the way recordsets are handled with php and
> mysql.After I issue a query to the Db with $result = mysql_query ($query)
> is the recordset contained in $result or is this just a pointer.I want a
> persistant recordset on the client computer that can be manipulated
without
> going to the server.Is this possable.fetchrow seems to go to the server
> each time or am i wrong?
> Thanks
> Mike P
> [EMAIL PROTECTED]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






hi

I am writing a small counter for my site. But i am not sure how to reset the
counter every 24h. How should i do it? any suggestions would be much
appreaciated!






How are you saving the current counter amount?

For instance if it's in a database, add a date field.

Check to see if the date is more than 24 hours old before displaying the
current counter. If it is then update the database and make the counter
number 0. If it's not older than 24 hours, just do your counter as normal.


--
Plutarck
Should be working on something...
...but forgot what it was.


""McShen"" <[EMAIL PROTECTED]> wrote in message
9b9mg0$26o$[EMAIL PROTECTED]">news:9b9mg0$26o$[EMAIL PROTECTED]...
> hi
>
> I am writing a small counter for my site. But i am not sure how to reset
the
> counter every 24h. How should i do it? any suggestions would be much
> appreaciated!
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






I can get connected to my host's MySQL database w/o error, but I cannot seem
to do anything after that.

I do:
$db = mysql_connect("localhost", "username");
mysql_select_db("subsurface_net",$db);

No problem, but if I do this:
$result = mysql_query("SELECT * FROM customer_genre",$db);

I eventually get:
Warning: 0 is not a MySQL result index in /test.phtml on line 35

And customer_genre _is_ a table in my database...

Help, anyone!?
--
Andrew Durk
[EMAIL PROTECTED]






What function are you calling on $result when it returns the error?

Try doing this, all in one place:

$db = mysql_connect("localhost", "username");
mysql_select_db("subsurface_net", $db);

$result = mysql_query("SELECT * FROM customer_genre", $db);

echo mysql_num_rows($result);


When you use a SELECT query the function "mysql_affected_rows" is not valid.
When using an UPDATE, INSERT, or DELETE query, "mysql_num_rows" is invalid.

That may be your problem, because the code you paste in seems not to have
anything wrong with it.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Andrew Durk"" <[EMAIL PROTECTED]> wrote in message
9b9n47$7ej$[EMAIL PROTECTED]">news:9b9n47$7ej$[EMAIL PROTECTED]...
> I can get connected to my host's MySQL database w/o error, but I cannot
seem
> to do anything after that.
>
> I do:
> $db = mysql_connect("localhost", "username");
> mysql_select_db("subsurface_net",$db);
>
> No problem, but if I do this:
> $result = mysql_query("SELECT * FROM customer_genre",$db);
>
> I eventually get:
> Warning: 0 is not a MySQL result index in /test.phtml on line 35
>
> And customer_genre _is_ a table in my database...
>
> Help, anyone!?
> --
> Andrew Durk
> [EMAIL PROTECTED]
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






Hi,
I think I'm being stupid. Why won't this code work. The $article_active 
variable is showing y when I echo it?

    
if($article_active == 'y') {
        echo"<INPUT TYPE=\"radio\" NAME=\"active\" VALUE=\"y\" SELECTED>Yes";
} else {
        echo"<INPUT TYPE=\"radio\" NAME=\"active\" VALUE=\"y\">Yes";
}

if($article_active == 'n') {
        echo"<INPUT TYPE=\"radio\" NAME=\"active\" VALUE=\"n\" SELECTED>No";
} else {
                echo"<INPUT TYPE=\"radio\" NAME=\"active\" VALUE=\"n\">No";
}


Thanks,

Jord




I'm not sure I understand. In the first loop you are seing if
$article_active equals y. And no where in the code do you set
$article_active to anything else.

Why would you think $article_active would be anything but "y" or "n"?


--
Plutarck
Should be working on something...
...but forgot what it was.


"Jordan Elver" <[EMAIL PROTECTED]> wrote in message
01041415474000.10298@localhost">news:01041415474000.10298@localhost...
> Hi,
> I think I'm being stupid. Why won't this code work. The $article_active
> variable is showing y when I echo it?
>
>
> if($article_active == 'y') {
> echo"<INPUT TYPE=\"radio\" NAME=\"active\" VALUE=\"y\" SELECTED>Yes";
> } else {
> echo"<INPUT TYPE=\"radio\" NAME=\"active\" VALUE=\"y\">Yes";
> }
>
> if($article_active == 'n') {
> echo"<INPUT TYPE=\"radio\" NAME=\"active\" VALUE=\"n\" SELECTED>No";
> } else {
>         echo"<INPUT TYPE=\"radio\" NAME=\"active\" VALUE=\"n\">No";
> }
>
>
> Thanks,
>
> Jord
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






Hi all,
anyone have or know where I can find a small function in order to extract
from a string the most relevant words in it?

something like this:

$var="I love coffe ... Coffe is from Brazil and coffe with milk ..";
$occurence=2;
//$occurence means word that are repeat 2 or more times
my_dream_funct($var,$occurence);
//the funct now return the word _ coffe _

many thanks in advance
max

ps.plz note: I need that it works on php3





I've heard much about how PHP is far more than just a language for web
programming, and I agree. I agree enough that I would like to actually try
it. I'd like to use PHP scripting in a C/C++ program that doesn't need a
webserver as an intermediary. I basically want to use PHP in a
standalone/TCP-IP program rather than having to build a whole "IMF-esk"
hairball myself.


Are there any articles or documentation which focuses, or at least would
give me useful information, on how such a task would be accomplished? I'm
looking at the API documentation itself which will be helpful, but is there
anything a little more "pointed" than that?

I'd love to see PHP grow an arm of offline scripting. It would just be
_perfect_ for compiling high-level developer-friendly scripts into a format
usable for 3D real-time environment manipulation, for instance.



--
Plutarck
Should be working on something...
...but forgot what it was.






Reply via email to