php-general Digest 4 May 2001 05:25:59 -0000 Issue 665

Topics (messages 51302 through 51368):

Re: REG_BADPAT ERROR!
        51302 by: CC Zona

Re: Include and require
        51303 by: Johnson, Kirk
        51305 by: Philip Olson

File Uploads and Get Method
        51304 by: Omar Elkassir
        51307 by: Johnson, Kirk

PHP 4.0.5 & Apache 2.0
        51306 by: Devin Atencio

BET News
        51308 by: MTV Jams

MySQL select rand() with weighting?
        51309 by: James, Yz
        51311 by: Mark Maggelet

Shorten String or encode/decode a string
        51310 by: Jared Howard

Re: Starting PHP script with crontab
        51312 by: Noah Spitzer-Williams
        51313 by: MaD dUCK
        51315 by: Michael Kimsal

Redirect With Authentication Question
        51314 by: stan
        51323 by: Philip Hallstrom

question about broadcast application
        51316 by: Michael Geier

Need a partner for PHP dev.
        51317 by: cedric.smashweb.com
        51322 by: Michael Kimsal

changing a file on the server using a web form
        51318 by: Sherman

using an array with form list values
        51319 by: Claudia
        51321 by: Johnson, Kirk
        51324 by: Philip Hallstrom

problem search in array
        51320 by: Jan Grafström

Session Variables
        51325 by: Nikhil Goyal
        51326 by: Johnson, Kirk
        51327 by: Nikhil Goyal
        51332 by: Johnson, Kirk
        51333 by: Nikhil Goyal
        51336 by: Johnson, Kirk

Session Problems....HELP!!!!
        51328 by: Bruno Freire
        51329 by: Johnson, Kirk
        51330 by: Nikhil Goyal
        51331 by: Altunergil, Oktay

PHP Training Course Offered - June 25th
        51334 by: Keith Elder
        51335 by: Fred

parsing "problem" with 4.0.5
        51337 by: Ken

authentication to https server
        51338 by: Wei Weng

install issue with 4.0.5
        51339 by: Jerry Lake
        51342 by: Martín Marqués

Re: Returning Lowest Number Not In Array
        51340 by: Phillip Bow

Finding the point
        51341 by: Chris Mason
        51345 by: Henrik Hansen

GetImageSize() problem...
        51343 by: Eric Knudstrup
        51365 by: Eric Knudstrup

enable-trans-sid
        51344 by: Walgamotte, David

simple database extraction problem :(
        51346 by: Sandeep Hundal
        51351 by: Phillip Bow
        51352 by: Jack Dempsey

Protecting programs
        51347 by: Richard Kurth
        51348 by: Dave Mariner
        51349 by: MaD dUCK
        51350 by: Richard Kurth
        51366 by: Steve Werby

% always return int?
        51353 by: Christian Dechery

Getting  the first part out of a string
        51354 by: Richard Kurth

HELP can not see data or tables in database
        51355 by: Richard Kurth

Running from user home directory
        51356 by: Alan Kong

cybercash and php3
        51357 by: Tobe Johnson

Need to know this
        51358 by: YoBro
        51360 by: ddogbruce.home.com
        51362 by: Ankur Verma
        51364 by: Chris Adams

Real Time
        51359 by: Budi
        51361 by: Jack Dempsey

Re: session_register()
        51363 by: Jon Peccarelli
        51368 by: Jennifer

Searching for array keys
        51367 by: Martin Skjöldebrand

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]


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


In article <007001c0d38f$c50929b0$a0a6ca18@renttib>,
 [EMAIL PROTECTED] ("Martin Bittner-Lamy") wrote:

> Warning: REG BADPAT in /usr/home/64.157.1.190/public html/test/segrabs.php on 
> line 236
> 
> and the line 236 is:  $url=ereg replace("&amp;","&",$url);

Why are bother to use a regex function for this?  str_replace() can do the 
job just as well, not to mention faster.

-- 
CC




> According to the docu u should not require() files or 
> external code in loops
> or u must use curly Bracket when used in if conditions.
> 
> But everythink works fine. I require() successfully in for 
> loops, I can use
> it in if..elseif..else constucts without curly brackets. 
> (only one line of
> cause)
> 
> So where is the difference between require() and include().

It depends on how you are using it. If you want what you are require()'ing
to *vary* on each loop iteration, you must use include(). A require() is
only executed once, during the initial parse of the file. An include() gets
re-evaluated on each loop iteration, so you can vary the filename, etc. See
http://www.php.net/manual/en/function.require.php for more.

Kirk





for a lengthy post on the subject that clearly explains the
differences/similarities/history between require and include, see this
post by Zeev :

  RE: [PHP] Require() vs Include()
  ------------------------------------------------------------
  http://marc.theaimsgroup.com/?l=php-general&m=97419027907315

regards,
philip


On Thu, 3 May 2001, Johnson, Kirk wrote:

> > According to the docu u should not require() files or 
> > external code in loops
> > or u must use curly Bracket when used in if conditions.
> > 
> > But everythink works fine. I require() successfully in for 
> > loops, I can use
> > it in if..elseif..else constucts without curly brackets. 
> > (only one line of
> > cause)
> > 
> > So where is the difference between require() and include().
> 
> It depends on how you are using it. If you want what you are require()'ing
> to *vary* on each loop iteration, you must use include(). A require() is
> only executed once, during the initial parse of the file. An include() gets
> re-evaluated on each loop iteration, so you can vary the filename, etc. See
> http://www.php.net/manual/en/function.require.php for more.
> 
> Kirk
> 
> -- 
> 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]
> 





when i upload a file, the form method must be POST because when GET is used,
it adds backslashes to the windows path name that already has backslashes,
and this causes an error.  for instance, the following snippet of code --

if ($add){
    $newimage = "whatever.gif";
    copy($image, $directory. "/" .$newimage);
}
print("<form action=thispage.html action=GET enctype='multipart/form-data'>
<input type=file name=image><input type=submit name=add></form>");

produces the following error

Warning: Unable to open C:\\My Documents\\My Pictures\\Sample.jpg

which is the image i'm trying to upload.  notice the double slashes in the
path (btw, adding $image = str_replace("\\\\","\\",$image);  does not help).
so the solution is to use the POST method.


now, on the same form, i have a multiple select box, where you can select
multiple values from one select box.  the code is as follows --

<select name=country size=3 multiple>
<option value=3>Australia</option>
<option value=4>Brazil</option>
<option value=2>Russia</option>
<option value=1>USA</option>
</select>

if the user selects more than one country, then if you echo $country, it
will show you only the last selected value for country.  however, what you
can do is break the query string at the ampersands, figure out all the
countries the user has selected and put them in an array.  in order to have
a query string,  the GET mothod must be used.  that solves this problem.

OOPS....to upload the image, the POST method must be used, but to figure out
the values from a multiple select box, the GET method must be used.  if i
use one, then the other breaks.  does anyone have any ideas?








> -----Original Message-----
> now, on the same form, i have a multiple select box, where 
> you can select
> multiple values from one select box.  the code is as follows --
> 
> <select name=country size=3 multiple>
[ snip ]
> </select>
> 
> if the user selects more than one country, then if you echo 
> $country, it
> will show you only the last selected value for country.  
> however, what you
> can do is break the query string at the ampersands, figure out all the
> countries the user has selected and put them in an array.  in 
> order to have
> a query string,  the GET mothod must be used.  that solves 
> this problem.

If you name the field "country[]", with the square brackets, all the user's
selections will be in an array named $country when POST'ed. So, you can use
POST to address both problems.

Kirk 





I was wondering if anyone has gotten Apache 2.0 Beta to install with DSO
Support and got PHP 4.0.5 to compile as a DSO using Apache 2.0? I am
using FreeBSD 4.3 and can't seem to get it to work for the life of me.

                                               /'^'\
                                              ( o o )
------------------------------------------oOOO--(_)--OOOo----
    Devin Atencio
    ArosNet Systems Administration         .oooO
    EMail: [EMAIL PROTECTED]               (   )   Oooo.
--------------------------------------------\ (----(   )-----
                                             \_)    ) /
                                                   (_/
 




http://www.mp3.com/mcpedro     from [EMAIL PROTECTED] 

The question is this, If you placed a Jamaican born MC on a Hip 
Hop/Trance/Techno track and told him to flow without losing his yard essence 
(Jamaican Vibes), what would you get? Most likely confusion of course, 
unless the MC was Pedro!
Peter Gracey a.k.a. MCPedro (Mp3Eternity) was born and raised in Kingston 
Jamaica, and later moved to Florida where he honed his skills. Pedro would be 
the first to admit, being raised on the streets of Waterhouse in a rough political 
climate, and then later in Miami, plays a large part in his "no-nonsense" 
militant aura. Influenced by artists such as Shabba Ranks, Garnett Silk, Bob 
Marley,Papa San, Maxi Priest, Luciano and Sanchez, and fused with his 
passion for writing, it was inevitable that Pedro would be heard.
Leaving Jamaica College at 17, Pedro resided in Miami, San Diego, Seattle and 
back to Miami where he mingled with the underground culture, toasting on local 
sound systems and appearing at parties in all three cities. After taking time off 
from the military, Pedro returned with a vengeance to show his skills. Working 
the underground Dance Hall circuit with the likes of Tinga Stewart, RPI, 
Sanchez, Luciano, Barrington Levy, Buju Banton and Gloria Estefan. He 
continued to record his first single entitled "Life" in 1996. By this time Pedro 
has been touring with 303Infinity who then introduced him to Nadine Renee 
(The voice behind Planet Soul.. " Set U Free")where melodic Dance Hall hooks 
combined with a smooth yet rugged Hip Hop/ Trance-Techno flow. He managed 
to touch Electronic fans like no other Dance Hall artist ever did, representing 
the "real Hip Hop/Techno" without losing his Jamaican borne flavor, "yardcore."
Please visit Pedro Music Station and feel free to download his tracks at no 
charge at  

http://www.mp3.com/mcpedro 

[EMAIL PROTECTED]  : Email us with any comments or if you wish to 
stop recieving updates on Pedro.





Hi Guys,

Does anyone know how to select one field randomnly from a MySQL table
against a weighting column in the same row the field is selected from?

For example, "SELECT id, url, image FROM table ORDER BY rand() LIMIT 1".....

And have a column like "weighting" where values between 1 and 100 are held -
The larger values making it more likely that they're going to get pulled
out.  So say I have three rows in the table, one "weighing" 100, the others
weighing 50, the one weighhing 100 stands a better chance of being selected
randomnly?

I know I've not explained this too well, but hopefully *someone* will know
what I'm rambling on about ;)

Thanks as always,

James.






On Thu, 3 May 2001 20:15:26 +0100, James, Yz ([EMAIL PROTECTED])
wrote:
>Hi Guys,
>
>Does anyone know how to select one field randomnly from a MySQL
table
>against a weighting column in the same row the field is selected
>from?
>
>For example, "SELECT id, url, image FROM table ORDER BY rand() LIMIT
>1".....

i guess you'd just go ' order by rand()*weighting'

- Mark

>And have a column like "weighting" where values between 1 and 100
>are held -
>The larger values making it more likely that they're going to get
>pulled
>out.  So say I have three rows in the table, one "weighing" 100, the
>others
>weighing 50, the one weighhing 100 stands a better chance of being
>selected
>randomnly?
>
>I know I've not explained this too well, but hopefully *someone*
>will know
>what I'm rambling on about ;)
>
>Thanks as always,
>
>James.
>
>
>
>--
>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: php-list-
>[EMAIL PROTECTED]






I want to shorten a string that I'll be throwing through the url.  It's not
so much that it's too long, but it's ugly.  What it is, is my query string
that I need to pass through to different pages, i.e. viewing multiple pages.  
Anyway, I was looking at encode and decode features but not really sure
that they could shorten it down significantly.  Now I understand that I
won't be able to use it, but I tried the crypt() function and liked how
small it made it.  The string information doesn't need to be secure in
anyway, just smaller (and look like nothing understandable would be good
also).






is there a service on the web that can do this for you? i once found a site
that would accept a url and an interval and would retrieve that url
(therefore running any code you had in there) on your interval

- Noah

"Anuradha Ratnaweera" <[EMAIL PROTECTED]> wrote in message
Pine.LNX.4.21.0105021110320.342-100000@presario">news:Pine.LNX.4.21.0105021110320.342-100000@presario...
>
> If you are not careful, anyone will be able to run the script!
>
> Anuradha
>
> On Thu, 19 Apr 2001, Bertjan Schrader wrote:
>
> > I need tot start a PHP script at night with the crontab. I tried to do
it
> > with lynx (lynx http://www.domain.nl/test.php) as a commandline within
the
> > crontab. Lynx is starting but the PHP script is not working. Anyone an
idea
> > how to do it?
> >
> > OS:  Redhat Linux 5.2
> > Apache
> > PHP as a apache module
> >
> > thanks!
>
>
> --
> 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]
>






also sprach Noah Spitzer-Williams (on Thu, 03 May 2001 03:34:02PM -0400):
> > > with lynx (lynx http://www.domain.nl/test.php) as a commandline within

did you use 'lynx -dump <url>'???

martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:"; net@madduck
-- 
"may your future be limited only by your dreams."
                                                  -- christa mcauliffe






Noah Spitzer-Williams wrote:

> is there a service on the web that can do this for you? i once found a site
> that would accept a url and an interval and would retrieve that url
> (therefore running any code you had in there) on your interval
>
> - Noah

cronservice.com is one.






Authentication Question...

My company subscribes to several pay-to-view e-commerce sites that
require
htaccess-type authentication.  To keep things simple for our users and
to
ensure that our users don't use these accounts w/out our permission, we
would
like to keep the account IDs and passwords from the user's direct view.
A
simple but not entirely effective solution is to include the id/password
in the
URL...

  http://user:[EMAIL PROTECTED]/index.html

The problem with the above-noted method is that the account ID and
password
are clearly visible.  What I would rather do is point the users at a PHP

script that then redirects them to the correct site with authentication
already handled.  I can easily handle the redirect using...

  header("Location: ... ")

What I haven't figured out is how to include the authentication in the
redirect.  I understand how to use base64_encode() to encode the
ID:password string.  What I can't figure out is how to pass this info
along with
the redirect.  Any thoughts on if/how this could be accomplished?

For the record, I tried a different approach where I used fsockopen(),
fputs(), and fpassthru() to successfully connect/authenticate and
receive
the HTML stream.  This will actually display the results (messy).  The
problem with this approach is that the links on the page are all broken
as the user's browser is still pointing at the local web server.

In a nutshell, how can I redirect a web client to a remote site and
include
the authentication info as part of the redirect.

Thanks,

Stan






Take a look at: ftp://ftp.isi.edu/in-notes/rfc2617.txt

To receive authorization, the client sends the userid and password,
   separated by a single colon (":") character, within a base64 [7]
   encoded string in the credentials.

      basic-credentials = base64-user-pass
      base64-user-pass  = <base64 [4] encoding of user-pass,
                       except not limited to 76 char/line>
      user-pass   = userid ":" password
      userid      = *<TEXT excluding ":">
      password    = *TEXT

   Userids might be case sensitive.

   If the user agent wishes to send the userid "Aladdin" and password
   "open sesame", it would use the following header field:

      Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==

   A client SHOULD assume that all paths at or deeper than the depth of
   the last symbolic element in the path field of the Request-URI also
   are within the protection space specified by the Basic realm value of
   the current challenge. A client MAY preemptively send the
   corresponding Authorization header with requests for resources in
   that space without receipt of another challenge from the server.
   Similarly, when a client sends a request to a proxy, it may reuse a
   userid and password in the Proxy-Authorization header field without
   receiving another challenge from the proxy server. See section 4 for
   security considerations associated with Basic authentication.


In article <[EMAIL PROTECTED]> you write:
>Authentication Question...
>
>My company subscribes to several pay-to-view e-commerce sites that
>require
>htaccess-type authentication.  To keep things simple for our users and
>to
>ensure that our users don't use these accounts w/out our permission, we
>would
>like to keep the account IDs and passwords from the user's direct view.
>A
>simple but not entirely effective solution is to include the id/password
>in the
>URL...
>
>  http://user:[EMAIL PROTECTED]/index.html
>
>The problem with the above-noted method is that the account ID and
>password
>are clearly visible.  What I would rather do is point the users at a PHP
>
>script that then redirects them to the correct site with authentication
>already handled.  I can easily handle the redirect using...
>
>  header("Location: ... ")
>
>What I haven't figured out is how to include the authentication in the
>redirect.  I understand how to use base64_encode() to encode the
>ID:password string.  What I can't figure out is how to pass this info
>along with
>the redirect.  Any thoughts on if/how this could be accomplished?
>
>For the record, I tried a different approach where I used fsockopen(),
>fputs(), and fpassthru() to successfully connect/authenticate and
>receive
>the HTML stream.  This will actually display the results (messy).  The
>problem with this approach is that the links on the page are all broken
>as the user's browser is still pointing at the local web server.
>
>In a nutshell, how can I redirect a web client to a remote site and
>include
>the authentication info as part of the redirect.
>
>Thanks,
>
>Stan
>
>
>
>-- 
>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 bosses came to me and asked me to spec out a broadcast mailer (spam box)
that clients could:

        - log into
        - choose a pre-approved list (clients could have multiple lists)
        - choose a stored email
        - send sample
        - send broadcast

I know that Qmail and EzMLM are the products to use, but does anyone have
any tips or suggestions, or see any possible problems with this (besides the
obvious UCE issue)??  Commercial/Open Source application suggestions
appreciated.

thanx.
mike.






Hi,

   I know this isn't the best place to post this, but I tried a lot of
other places without much success.

   I am developing a very flexible shopping cart system, as I have clients
who needs one and I think that the available software is either overpriced
or lacks features / flexibility. I have a good part of the job done,
although I am really busy and I need to get it done ASAP. I am looking for
someone who has about the same skills as me, and could work from home.
Very motivated
Knows PHP with mySQL (I have 4-5 months experience)
An idea of what ecommerce is
If possible knows unix environment

I am a full time student and plan on doing this during summer break, so
you'll understand that I am not looking for a professional here, which is
why I have so much troubles finding someone.

Please, email me for more info.

--
Cedric Veilleux,
[EMAIL PROTECTED]




Perhaps you could post this project on sourceforge - you might be able to
attract some developers that way.

[EMAIL PROTECTED] wrote:

> Hi,
>
>    I know this isn't the best place to post this, but I tried a lot of
> other places without much success.
>
>    I am developing a very flexible shopping cart system, as I have clients
> who needs one and I think that the available software is either overpriced
> or lacks features / flexibility. I have a good part of the job done,
> although I am really busy and I need to get it done ASAP. I am looking for
> someone who has about the same skills as me, and could work from home.
> Very motivated
> Knows PHP with mySQL (I have 4-5 months experience)
> An idea of what ecommerce is
> If possible knows unix environment
>
> I am a full time student and plan on doing this during summer break, so
> you'll understand that I am not looking for a professional here, which is
> why I have so much troubles finding someone.
>
> Please, email me for more info.





Hi,

      I have installed mod_php on my Apache web server and there is
something I was curious about.  I would like there to be a web page with a
form that a user can enter some info into.. and it change a file in say
/etc/file.txt when they submit the form .. any tips or advice on how I would
get started doing this?  Thanks in advance.

Sherman






I need to check that a form entry defined as an array contains a value
before initiating the foreach code in my script.

I have my form field defined in my form as:

<?php
       print '
                      <select name="preferred_location[]"size="3" MULTIPLE>
                        <option value="Bermuda">Bermuda</option>
                        <option value="California">California</option>
                        <option value="Caribbean">Caribbean</option>
                        <option value="Carolinas">Carolinas</option>
                        <option
value="Florida-Atlantic">Florida-Atlantic</option>
                        <option value="Florida-Gulf coast">Florida-Gulf
coast</option>
                        <option value="Florida-Pan handle">Florida-Pan
handle</option>
                        <option value="Hawaii">Hawaii</option>
                        <option value="Mediterranean">Mediterranean</option>
                        <option value="Mexico">Mexico</option>
                        <option
value="S.Pacific/Autralia">S.Pacific/Autralia</option>
                      </select>';
       ?>

And my script code as:

 foreach ( $preferred_location as $location )
    {
    $msg .= "$location\n";
     }

As long as the user selects at least one form value from the list box, the
script processes without error.  If no item is selected -- This msg is
rcved:

Warning: Non array argument supplied for foreach() in
/usr/local/etc/httpd/htdocs/test/beaches/beaches_quote.scp.php3 on line 30








Try enclosing the foreach inside an:
- if block which checks that count($preferred_location) > 0; or,
- if block which checks if it is defined, if($preferred_location).

Hopefully, one of these should work :)

Kirk


> -----Original Message-----
> From: Claudia [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 03, 2001 2:08 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] using an array with form list values
> 
> 
> I need to check that a form entry defined as an array contains a value
> before initiating the foreach code in my script.
> 
> I have my form field defined in my form as:
> 
> <?php
>        print '
>                       <select 
> name="preferred_location[]"size="3" MULTIPLE>
>                         <option value="Bermuda">Bermuda</option>
>                         <option value="California">California</option>
>                         <option value="Caribbean">Caribbean</option>
>                         <option value="Carolinas">Carolinas</option>
>                         <option
> value="Florida-Atlantic">Florida-Atlantic</option>
>                         <option value="Florida-Gulf 
> coast">Florida-Gulf
> coast</option>
>                         <option value="Florida-Pan handle">Florida-Pan
> handle</option>
>                         <option value="Hawaii">Hawaii</option>
>                         <option 
> value="Mediterranean">Mediterranean</option>
>                         <option value="Mexico">Mexico</option>
>                         <option
> value="S.Pacific/Autralia">S.Pacific/Autralia</option>
>                       </select>';
>        ?>
> 
> And my script code as:
> 
>  foreach ( $preferred_location as $location )
>     {
>     $msg .= "$location\n";
>      }
> 
> As long as the user selects at least one form value from the 
> list box, the
> script processes without error.  If no item is selected -- This msg is
> rcved:
> 
> Warning: Non array argument supplied for foreach() in
> /usr/local/etc/httpd/htdocs/test/beaches/beaches_quote.scp.php
> 3 on line 30




Something like this should help:

if( is_array($preferred_location) )  {
        #your code goes here.
}

In article <9csden$8qu$[EMAIL PROTECTED]> you write:
>I need to check that a form entry defined as an array contains a value
>before initiating the foreach code in my script.
>
>I have my form field defined in my form as:
>
><?php
>       print '
>                      <select name="preferred_location[]"size="3" MULTIPLE>
>                        <option value="Bermuda">Bermuda</option>
>                        <option value="California">California</option>
>                        <option value="Caribbean">Caribbean</option>
>                        <option value="Carolinas">Carolinas</option>
>                        <option
>value="Florida-Atlantic">Florida-Atlantic</option>
>                        <option value="Florida-Gulf coast">Florida-Gulf
>coast</option>
>                        <option value="Florida-Pan handle">Florida-Pan
>handle</option>
>                        <option value="Hawaii">Hawaii</option>
>                        <option value="Mediterranean">Mediterranean</option>
>                        <option value="Mexico">Mexico</option>
>                        <option
>value="S.Pacific/Autralia">S.Pacific/Autralia</option>
>                      </select>';
>       ?>
>
>And my script code as:
>
> foreach ( $preferred_location as $location )
>    {
>    $msg .= "$location\n";
>     }
>
>As long as the user selects at least one form value from the list box, the
>script processes without error.  If no item is selected -- This msg is
>rcved:
>
>Warning: Non array argument supplied for foreach() in
>/usr/local/etc/httpd/htdocs/test/beaches/beaches_quote.scp.php3 on line 30
>
>
>
>
>
>-- 
>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!
This file will not work for me.
I have tried in several ways and I want it to print "Got word" if it
find $word.
----
$filename = "test.xml";
$fp = fopen($filename, "r");
$string = fread($fp, filesize($filename));
$string = strip_tags($string);
$refined_string = explode(" ", $string);
if (in_array ($word, $refined_string)){
print "Got word";
}
fclose ($fp);
------
If You know what is wrong I am very thankful for help.

Regards
Jan





When does a session variable become available? Immediately after the
session_register command or after the script ends?

And if the commands are as follows:

session_start();
session_register("hello");
$hello=3;

will the session variable $hello be set to 3 or do I have to add another
session_register() call after changing the value?

Really appreciate any help,

Nikhil






> -----Original Message-----
> From: Nikhil Goyal [mailto:[EMAIL PROTECTED]]

> When does a session variable become available? Immediately after the
> session_register command or after the script ends?

Immediately after it is assigned.

> And if the commands are as follows:
> 
> session_start();
> session_register("hello");
> $hello=3;
> 
> will the session variable $hello be set to 3 or do I have to 
> add another
> session_register() call after changing the value?

No additional calls are needed. You will need to do session_start() on the
next page if you want to access $hello there.

Kirk




Funnily - doesn't work for me. Here's what I got:

Script #1
#!/usr/local/bin/php
<?php
session_start();
if (!isset($count)) { echo "Setting count"; session_register("count"); }
else echo $count;
$count++;
sleep(60);
?>

Script #2
#!/usr/local/bin/php
<?php
session_start();
echo $count;
?>

If I start script#1 (and it sleep()s), wait 10 seconds, then launch script
#2 in a separate browser window, script #2 returns empty. However once the
sleep() is completed and I refresh the window with script #2, the output is
okay (1).

Why does this happen?

Nikhil

""Johnson, Kirk"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > -----Original Message-----
> > From: Nikhil Goyal [mailto:[EMAIL PROTECTED]]
>
> > When does a session variable become available? Immediately after the
> > session_register command or after the script ends?
>
> Immediately after it is assigned.
>
> > And if the commands are as follows:
> >
> > session_start();
> > session_register("hello");
> > $hello=3;
> >
> > will the session variable $hello be set to 3 or do I have to
> > add another
> > session_register() call after changing the value?
>
> No additional calls are needed. You will need to do session_start() on the
> next page if you want to access $hello there.
>
> Kirk
>
> --
> 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]
>






The session variable values get stored to the session file (or database, or
wherever your configuration is set to store them) at the end of script 1.
When session_start() is called in script 2, those values get restored from
the session file. So, your results are expected: PHP  needs to store the
session values from script 1 before they can be retrieved by script 2.

Kirk

> -----Original Message-----
> From: Nikhil Goyal [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 03, 2001 2:41 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Session Variables
> 
> 
> Funnily - doesn't work for me. Here's what I got:
> 
> Script #1
> #!/usr/local/bin/php
> <?php
> session_start();
> if (!isset($count)) { echo "Setting count"; 
> session_register("count"); }
> else echo $count;
> $count++;
> sleep(60);
> ?>
> 
> Script #2
> #!/usr/local/bin/php
> <?php
> session_start();
> echo $count;
> ?>
> 
> If I start script#1 (and it sleep()s), wait 10 seconds, then 
> launch script
> #2 in a separate browser window, script #2 returns empty. 
> However once the
> sleep() is completed and I refresh the window with script #2, 
> the output is
> okay (1).
> 
> Why does this happen?
> 
> Nikhil
> 
> ""Johnson, Kirk"" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > -----Original Message-----
> > > From: Nikhil Goyal [mailto:[EMAIL PROTECTED]]
> >
> > > When does a session variable become available? 
> Immediately after the
> > > session_register command or after the script ends?
> >
> > Immediately after it is assigned.
> >
> > > And if the commands are as follows:
> > >
> > > session_start();
> > > session_register("hello");
> > > $hello=3;
> > >
> > > will the session variable $hello be set to 3 or do I have to
> > > add another
> > > session_register() call after changing the value?
> >
> > No additional calls are needed. You will need to do 
> session_start() on the
> > next page if you want to access $hello there.
> >
> > Kirk 




so the session variable is set only when the script ends? I thought you
indicated that they were set immediately...

Thanks for the quick reply,

Nikhil

""Johnson, Kirk"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> The session variable values get stored to the session file (or database,
or
> wherever your configuration is set to store them) at the end of script 1.
> When session_start() is called in script 2, those values get restored from
> the session file. So, your results are expected: PHP  needs to store the
> session values from script 1 before they can be retrieved by script 2.
>
> Kirk
>
> > -----Original Message-----
> > From: Nikhil Goyal [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, May 03, 2001 2:41 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP] Session Variables
> >
> >
> > Funnily - doesn't work for me. Here's what I got:
> >
> > Script #1
> > #!/usr/local/bin/php
> > <?php
> > session_start();
> > if (!isset($count)) { echo "Setting count";
> > session_register("count"); }
> > else echo $count;
> > $count++;
> > sleep(60);
> > ?>
> >
> > Script #2
> > #!/usr/local/bin/php
> > <?php
> > session_start();
> > echo $count;
> > ?>
> >
> > If I start script#1 (and it sleep()s), wait 10 seconds, then
> > launch script
> > #2 in a separate browser window, script #2 returns empty.
> > However once the
> > sleep() is completed and I refresh the window with script #2,
> > the output is
> > okay (1).
> >
> > Why does this happen?
> >
> > Nikhil
> >
> > ""Johnson, Kirk"" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > > -----Original Message-----
> > > > From: Nikhil Goyal [mailto:[EMAIL PROTECTED]]
> > >
> > > > When does a session variable become available?
> > Immediately after the
> > > > session_register command or after the script ends?
> > >
> > > Immediately after it is assigned.
> > >
> > > > And if the commands are as follows:
> > > >
> > > > session_start();
> > > > session_register("hello");
> > > > $hello=3;
> > > >
> > > > will the session variable $hello be set to 3 or do I have to
> > > > add another
> > > > session_register() call after changing the value?
> > >
> > > No additional calls are needed. You will need to do
> > session_start() on the
> > > next page if you want to access $hello there.
> > >
> > > Kirk
>
> --
> 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]
>






Sorry for the confusion. The variable has a value as soon as you assign it,
and you can use the variable in other statements within the same script.
However, the value does not get stored to the session file until after the
script ends.

Kirk

> -----Original Message-----
> From: Nikhil Goyal [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 03, 2001 2:51 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Session Variables
> 
> 
> so the session variable is set only when the script ends? I 
> thought you
> indicated that they were set immediately...
> 
> Thanks for the quick reply,
> 
> Nikhil
> [EMAIL PROTECTED]




Hi! my name is bruno, from Brazil and i'm having some problems with
sessions.
Look my code:
<html>
   <head>
   ...
   </head>
   <body>
      <?php
         session_start();
         session_register("test");
      ?>
   </body>
   </html>

The message returned in my browser is:

Warning: Cannot send session cookie - headers already sent by (output
started at /home/httpd/html/intranet/teste.php:11) in
/home/httpd/html/intranet/teste.php on line 12

Warning: Cannot send session cache limiter - headers already sent (output
started at /home/httpd/html/intranet/teste.php:11) in
/home/httpd/html/intranet/teste.php on line 12
<!--
A { text-decoration: none; }
A:hover { text-decoration: underline; }
H1 { font-family: arial,helvetica,sans-serif; font-size: 18pt; font-weight:
bold;}
H2 { font-family: arial,helvetica,sans-serif; font-size: 14pt; font-weight:
bold;}
BODY,TD { font-family: arial,helvetica,sans-serif; font-size: 10pt; }
TH { font-family: arial,helvetica,sans-serif; font-size: 11pt; font-weight:
bold; }
//-->
What's wrong???
Maybe the PHP's configuration file... Or some command is needed first....

Please, if somebody  know the solution...help me.
Thanks.

Bruno




Just move these two lines to the beginning of the file:

         session_start();
         session_register("test");

These have to be before any output is sent to the browser.

Kirk

> -----Original Message-----
> From: Bruno Freire [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 03, 2001 2:42 PM
> To: '[EMAIL PROTECTED]'
> Subject: [PHP] Session Problems....HELP!!!!
> 
> 
> Hi! my name is bruno, from Brazil and i'm having some problems with
> sessions.
> Look my code:
> <html>
>    <head>
>    ...
>    </head>
>    <body>
>       <?php
>          session_start();
>          session_register("test");
>       ?>
>    </body>
>    </html>
> 
> The message returned in my browser is:
> 
> Warning: Cannot send session cookie - headers already sent by (output
> started at /home/httpd/html/intranet/teste.php:11) in
> /home/httpd/html/intranet/teste.php on line 12
> 
> Warning: Cannot send session cache limiter - headers already 
> sent (output
> started at /home/httpd/html/intranet/teste.php:11) in
> /home/httpd/html/intranet/teste.php on line 12
> <!--
> A { text-decoration: none; }
> A:hover { text-decoration: underline; }
> H1 { font-family: arial,helvetica,sans-serif; font-size: 
> 18pt; font-weight:
> bold;}
> H2 { font-family: arial,helvetica,sans-serif; font-size: 
> 14pt; font-weight:
> bold;}
> BODY,TD { font-family: arial,helvetica,sans-serif; font-size: 10pt; }
> TH { font-family: arial,helvetica,sans-serif; font-size: 
> 11pt; font-weight:
> bold; }
> //-->
> What's wrong???
> Maybe the PHP's configuration file... Or some command is 
> needed first....
> 
> Please, if somebody  know the solution...help me.
> Thanks.
> 
> Bruno
> 




the session_start() should be placed at the top, before the <HTML>

<?php session_start(); ?>
<html>
  <head>
...
<?php
  session_register("test")
...

Nikhil

"Bruno Freire" <[EMAIL PROTECTED]> wrote in message
454D444FF5C0D211891800A0C98C7D90359A54@SERVIDOR">news:454D444FF5C0D211891800A0C98C7D90359A54@SERVIDOR...
> Hi! my name is bruno, from Brazil and i'm having some problems with
> sessions.
> Look my code:
> <html>
>    <head>
>    ...
>    </head>
>    <body>
>       <?php
>          session_start();
>          session_register("test");
>       ?>
>    </body>
>    </html>
>
> The message returned in my browser is:
>
> Warning: Cannot send session cookie - headers already sent by (output
> started at /home/httpd/html/intranet/teste.php:11) in
> /home/httpd/html/intranet/teste.php on line 12
>
> Warning: Cannot send session cache limiter - headers already sent (output
> started at /home/httpd/html/intranet/teste.php:11) in
> /home/httpd/html/intranet/teste.php on line 12
> <!--
> A { text-decoration: none; }
> A:hover { text-decoration: underline; }
> H1 { font-family: arial,helvetica,sans-serif; font-size: 18pt;
font-weight:
> bold;}
> H2 { font-family: arial,helvetica,sans-serif; font-size: 14pt;
font-weight:
> bold;}
> BODY,TD { font-family: arial,helvetica,sans-serif; font-size: 10pt; }
> TH { font-family: arial,helvetica,sans-serif; font-size: 11pt;
font-weight:
> bold; }
> //-->
> What's wrong???
> Maybe the PHP's configuration file... Or some command is needed first....
>
> Please, if somebody  know the solution...help me.
> Thanks.
>
> Bruno
>






If you don't use output buffering, the session stuff has to be the first
thing in you script. In other words, you should not send anything to the
browser before the session functions.

In your case you are sending html tags to the browser before the session
functions.
Rewrite it as the following:
    <?php
         session_start();
         session_register("test");
      ?>
<html>
   <head>
   ...
   </head>
   <body>
  
   </body>
   </html>


-----Original Message-----
From: Bruno Freire [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 03, 2001 4:42 PM


To: '[EMAIL PROTECTED]'
Subject: [PHP] Session Problems....HELP!!!!


Hi! my name is bruno, from Brazil and i'm having some problems with
sessions.
Look my code:
<html>
   <head>
   ...
   </head>
   <body>
      <?php
         session_start();
         session_register("test");
      ?>
   </body>
   </html>

The message returned in my browser is:

Warning: Cannot send session cookie - headers already sent by (output
started at /home/httpd/html/intranet/teste.php:11) in
/home/httpd/html/intranet/teste.php on line 12

Warning: Cannot send session cache limiter - headers already sent (output
started at /home/httpd/html/intranet/teste.php:11) in
/home/httpd/html/intranet/teste.php on line 12
<!--
A { text-decoration: none; }
A:hover { text-decoration: underline; }
H1 { font-family: arial,helvetica,sans-serif; font-size: 18pt; font-weight:
bold;}
H2 { font-family: arial,helvetica,sans-serif; font-size: 14pt; font-weight:
bold;}
BODY,TD { font-family: arial,helvetica,sans-serif; font-size: 10pt; }
TH { font-family: arial,helvetica,sans-serif; font-size: 11pt; font-weight:
bold; }
//-->
What's wrong???
Maybe the PHP's configuration file... Or some command is needed first....

Please, if somebody  know the solution...help me.
Thanks.

Bruno





Do you need to get your staff up to speed on PHP?  Are you a PHP programmer, looking 
for a hands on approach to learning PHP? If you fit any of these conditions or just 
want to learn more about building dynamic web sites with PHP, then consider taking our 
PHP training course this coming June.  Space is limited so be sure to act fast!

PHP TRAINING COURSE OFFERED JUNE 25TH-29TH 2001

WHO CAN ATTEND?
The course is open to the general public who wish to get a more indepth look at PHP.

WHEN AND WHERE
June 25th-29th.  The course is an all day course (8 hours) and will be a hands on 
course.  The course will be held at the Eagle Crest Resort in Ypsilanti, Michigan

MORE INFORMATION
For more detailed information in regards to the course and course information, please 
visit the following link:

http://www.tapinternet.com/lc/index/bcbc1e/html/training.html

or call:

Tap Internet, Inc.
Keith Elder
Phone: 734-482-1371
Toll Free: 866-745-3660
Email: [EMAIL PROTECTED]
Web: http://www.tapinternet.com






*humps ad*

Keith Elder <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> Do you need to get your staff up to speed on PHP?  Are you a PHP
programmer, looking for a hands on approach to learning PHP? If you fit any
of these conditions or just want to learn more about building dynamic web
sites with PHP, then consider taking our PHP training course this coming
June.  Space is limited so be sure to act fast!
>
> PHP TRAINING COURSE OFFERED JUNE 25TH-29TH 2001
>
> WHO CAN ATTEND?
> The course is open to the general public who wish to get a more indepth
look at PHP.
>
> WHEN AND WHERE
> June 25th-29th.  The course is an all day course (8 hours) and will be a
hands on course.  The course will be held at the Eagle Crest Resort in
Ypsilanti, Michigan
>
> MORE INFORMATION
> For more detailed information in regards to the course and course
information, please visit the following link:
>
> http://www.tapinternet.com/lc/index/bcbc1e/html/training.html
>
> or call:
>
> Tap Internet, Inc.
> Keith Elder
> Phone: 734-482-1371
> Toll Free: 866-745-3660
> Email: [EMAIL PROTECTED]
> Web: http://www.tapinternet.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]
>






With 4.0.4pl1 and earlier, this did not occur, but with 4.0.5, there
are some files on our server that are not getting parsed as php, and
just showing up as the code itself.  The problem files are a mess, but 
I only mention them since they got parsed before.  They are php files 
that the designers here have created in HomeSite and saved as PC 
format, so they are basically 1 long line when I open them in vi, and 
have ^M's everywhere.  If they pull them back into HomeSite and save 
as UNIX format and upload, no problem.  What changed in PHP that would 
make this difference.  I would just tell them to do this with all the 
problem ones, but there are a lot.

This is on OpenBSD, btw.  Thanks.


-Ken




hi I have a question here.

This is what i want to do: I have a login/password form, in order to make
the password going through the network (from client's browse to the
server) secure, I need to run https server on the server side.

Here is my problem: How do I do the authentication? Originally, without
https, I just check the username/password POST from the client's browser
with the database, and session_register()/session_start().

But how do I approach this in https? The https/DB are running on the same
machine that hosts the login/password form. I understand I could use
curl libraries to do post. But what would the url required in curl
functions be?

Thanks in advance.

Wei






I've just tried to compile and install
php 4.0.5 with apache and when I try to
restart apache I get the following. I added
the location of libphp4.so to ld.so.conf and
ran ldconfig and then make clean and re-compiled
php etc... any ideas as to what is going on ?

<snip>
[root@localhost bin]# ./apachectl start
Syntax error on line 205 of /usr/local/apache/conf/httpd.conf:
Cannot load /usr/local/apache/libexec/libphp4.so into server: undefined
symbol:
uncompress
./apachectl start: httpd could not be started
</snip>

Jerry Lake            - [EMAIL PROTECTED]
Interface Engineering Technician
Europa Communications - http://www.europa.com
Pacifier Online     - http://www.pacifier.com





On Vie 04 May 2001 00:41, you wrote:
> I've just tried to compile and install
> php 4.0.5 with apache and when I try to
> restart apache I get the following. I added
> the location of libphp4.so to ld.so.conf and
> ran ldconfig and then make clean and re-compiled
> php etc... any ideas as to what is going on ?
>
> <snip>
> [root@localhost bin]# ./apachectl start
> Syntax error on line 205 of /usr/local/apache/conf/httpd.conf:
> Cannot load /usr/local/apache/libexec/libphp4.so into server: undefined
> symbol:
> uncompress
> ./apachectl start: httpd could not be started
> </snip>

I may fail on this, but could it be that php.so can't find libz.so? Just 
because it says undefined symbol: uncompress.

Saludos... :-)

-- 
El mejor sistema operativo es aquel que te da de comer.
Cuida tu dieta.
-----------------------------------------------------------------
Martin Marques                  |        [EMAIL PROTECTED]
Programador, Administrador      |       Centro de Telematica
                       Universidad Nacional
                            del Litoral
-----------------------------------------------------------------




rsort($array);
$nextNum = $array[0] + 1;

You may have to include the numerical flag, but I don't think so.
--
phill

"Mike Potter" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi all:
>   I'm hoping someone can help me out with this array problem.  I'm
> trying to find the lowest number which is not in the array.
>   For example:
> Given this array :            return this:
>
> (0, 0)                        1
> (1,0)                        2
> (1,2,0)                    3
> (3,0)                        1
> (1, 3)                        2
>
> Does anyone have any code, or any hints on how to go about this?  I've
> worked on it for a few hours, and am really stuck.
> Thanks,
> Mike
>
> Mike Potter
> OEone Corp.
> http://www.oeone.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]
>






I need to abrieviate a block of text at the first full stop after 100
characters, does anyone have a handy dandy way of doing it?

Chris Mason
Box 340, The Valley, Anguilla, British West Indies
Tel: 264 497 5670 Fax: 264 497 8463
USA Fax (561) 382-7771
Take a virtual tour of the island
http://net.ai/ The Anguilla Guide
Find out more about NetConcepts
www.netconcepts.ai
Talk to me in real time with Instant Messenger: [EMAIL PROTECTED]
Signature
F331 8AD1 36FB B3B0 DF9F  D95B 8024 D1EA 7450 D50C





"Chris Mason" <[EMAIL PROTECTED]> wrote:

 > I need to abrieviate a block of text at the first full stop after 100
 > characters, does anyone have a handy dandy way of doing it?

wordwrap()

-- 
Henrik Hansen





I am having an issue with 4.0.5 where the following code snippet:

            $orig = imagecreatefromjpeg($tmp);
            echo 'orig x: ' . imagesx($orig) . ' orig y: ' . imagesy($orig)
. '<br>';
            $orig_size = getimagesize($tmp);
            echo "orig x:  $orig_size[0] orig y: $orig_size[1] <br>";

produces:

orig x: 1200 orig y: 1600
orig x: orig y:

The test image was produced from my Canon S100 and the Canon image
downloading software.

Can anyone help?

Thanks,

Eric





I think that was the first thing I tried.
It might have something to do with the actual image itself.
Images created with th PHP/GD routines come up with acceptable results.

Thanks,

Eric

Quoting Dan Lowe <[EMAIL PROTECTED]>:

> Previously, Eric Knudstrup said:
> > I am having an issue with 4.0.5 where the following code snippet:
> > 
> >             $orig = imagecreatefromjpeg($tmp);
> >             echo 'orig x: ' . imagesx($orig) . ' orig y: ' .
> imagesy($orig)
> > . '<br>';
> >             $orig_size = getimagesize($tmp);
> >             echo "orig x:  $orig_size[0] orig y: $orig_size[1]
> <br>";
> 
> have you tried this as the last line instead?
> 
>     echo 'orig x: ' . $orig_size[0] . ' orig y: ' . $orig_size[1] .
> '<br>';
> 
>  -dan
> 
> > produces:
> > 
> > orig x: 1200 orig y: 1600
> > orig x: orig y:
> > 
> > The test image was produced from my Canon S100 and the Canon image
> > downloading software.
> > 
> > Can anyone help?
> > 
> > Thanks,
> > 
> > Eric
> > 
> > 
> > -- 
> > 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]
> 
> -- 
> All good technology should be used to piss off people's parents. -Neil
> Gaiman
> 




I upgraded from 4.0.4 to 4.0.5 and trans sid no longer works. Any ideas ?

DW

                   





hi all!

just a quick thing. i've got loads of info in mysql, which i extract
and then use a "while ($r = mysql_fetch_array($result)) {" to output
the result.

the only thing is, because its a loop, all results look the same,
whereas i want the first row to be displayed differently than the
next 4. 

any clues??

thanks!

/sunny

____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie




Clue = "Nested Loops"
--
phill

"Sandeep Hundal" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> hi all!
>
> just a quick thing. i've got loads of info in mysql, which i extract
> and then use a "while ($r = mysql_fetch_array($result)) {" to output
> the result.
>
> the only thing is, because its a loop, all results look the same,
> whereas i want the first row to be displayed differently than the
> next 4.
>
> any clues??
>
> thanks!
>
> /sunny
>
> ____________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
> or your free @yahoo.ie address at http://mail.yahoo.ie
>
> --
> 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]
>






You can keep a count of what row in the result you are and use that
accordingly to format your results...

-----Original Message-----
From: Sandeep Hundal [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 03, 2001 7:10 PM
To: php
Subject: [PHP] simple database extraction problem :(


hi all!

just a quick thing. i've got loads of info in mysql, which i extract
and then use a "while ($r = mysql_fetch_array($result)) {" to output
the result.

the only thing is, because its a loop, all results look the same,
whereas i want the first row to be displayed differently than the
next 4.

any clues??

thanks!

/sunny

____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie

--
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]






Is there any way to protect a php program. Like you can other software
were you can limit the amount of time they can use it. something like a
compiled c program that the php program would have to look of a cod
otherwise it will not work. Or am I just dreaming






Well, you could check & exit if it's passed a certain date. Also, using the
Zend tool that encrypts the source would be an idea (but that costs money!).
You could have a look at parsing the source code & writing an obfuscator,
anyone know if there's one already written?

Dave

----- Original Message -----
From: "Richard Kurth" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 04, 2001 12:31 AM
Subject: [PHP] Protecting programs


> Is there any way to protect a php program. Like you can other software
> were you can limit the amount of time they can use it. something like a
> compiled c program that the php program would have to look of a cod
> otherwise it will not work. Or am I just dreaming
>
>
>
> --
> 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]
>





also sprach Richard Kurth (on Thu, 03 May 2001 04:31:42PM -0700):
> Is there any way to protect a php program. Like you can other software
> were you can limit the amount of time they can use it. something like a
> compiled c program that the php program would have to look of a cod
> otherwise it will not work. Or am I just dreaming

uhm. open source. you can protect it against the dumbest, but other
than that... make some vital features of it dependend on a server that
operates only when it receives a unique serial (md5sum) in the
request, which you can check againsta a database of expiration
dates...

obfuscation/encryption may also work, but that's crackable. or you
provide a vital part as executable that you system() from the
script...

martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:"; net@madduck
-- 
"in the country of the blind,
 the one-eyed man is not king.
 he is taken to be a hallucinating lunatic."
                                                     -marshall mcluhan




Hello MaD,
what is obfuscation/encryption

Thursday, May 03, 2001, 5:01:34 PM, you wrote:

MaD> also sprach Richard Kurth (on Thu, 03 May 2001 04:31:42PM -0700):
>> Is there any way to protect a php program. Like you can other software
>> were you can limit the amount of time they can use it. something like a
>> compiled c program that the php program would have to look of a cod
>> otherwise it will not work. Or am I just dreaming

MaD> uhm. open source. you can protect it against the dumbest, but other
MaD> than that... make some vital features of it dependend on a server that
MaD> operates only when it receives a unique serial (md5sum) in the
MaD> request, which you can check againsta a database of expiration
MaD> dates...

MaD> obfuscation/encryption may also work, but that's crackable. or you
MaD> provide a vital part as executable that you system() from the
MaD> script...

MaD> martin;              (greetings from the heart of the sun.)
MaD>   \____ echo mailto: !#^."<*>"|tr "<*> mailto:"; net@madduck



-- 
Best regards,
 Richard                            mailto:[EMAIL PROTECTED]






"Richard Kurth" <[EMAIL PROTECTED]> wrote:
> what is obfuscation

Essentially, it means making the code hard to read, follow and locate.

> encryption

It's the coding or scrambling of data that requires decoding to be read.
MaD dUCK's other suggestions are better since he is correct in saying these
methods aren't the best.  An analogy is like leaving a bike unattended on a
crowded city street, but typing it up in string.  Anyone with time and half
a clue can ride the bike away.  The Zend compiler is worth looking at.

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





How can I get the modulus of an float by an integer?

$time=3.345345;
$time2=2.34234;
$time3=$time%$time2;
echo $time3;

this outputs 1.

$time=3.345345;
$time2=2
$time3=$time%$time2;
echo $time3;

this also outputs 1.

Of course... when dividing two floats, there is no remainder... but, there 
is an integer invovled... is automatically converted to float before 
dividing, so that's why no remainder?
____________________________
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer





 I know how to get last part of a string out of a string
 But how do I get the first part before the needle On the example
 below I just what domain

 $hostdomain= domain.com

$host = substr (strrchr ($hostdomain, "."), 1);
 echo $host;  com






I have a major problem could somebody take a seeress look at this

 mysql running on cobalt raq4
 I have looked through the archives and looked at the manual
 can not find anything to explain this
 nothing in the mysql log file
 I can not access the databases from the web browser I get empty
 databases

 Went in at telnet erased all the databases including mysql
 ran mysql_install_db
 logged back in with the web browser and the tables were there
 stopped mysql
 restarted mysql
 logged back in with the web browser databases were there but no tables
 I can see the tables if I telnet in and use mysql Command
 What is going on have done this about 6 times
 I really need to fix this
 Should I reinstall mysql?
 Should I shoot my server?






Hi,

The web directory of users is www_docs. How could I allow users to
access their php's using ~USER/MYphp.php

The config of my server:
        Platform: Sun Sparc Solaris 2.7
        WWW server: Apache 1.3.9 + mod_sll
        php: php4.0.3

Thanks.

Regards
Alan
-- 

Alan Kong
--------------------------------------------------------------------
Tel: +852 2609-8286             Department of Electronic Engineering
Fax: +852 2603-5558             Chinese University of Hong Kong
                                Shatin, N.T.
Email: [EMAIL PROTECTED]    Hong Kong




Does anyone have any experience setting up cybercash on a RaQ3 running Perl 
and PHP3 and name based hosting?

I have a client who wants to use cybercash for their ecommerce processing. 
 If someone has some experience setting up such a system, I'd be glad to 
pay to have them work with me on this project.

Tobe




Hello,

I need to find out what PHP stands for.

Also what is better,
ASP or PHP and who has the biggest market share.

Any help would be really great.

Thanks,

Chris






Parsed Hypertext Processing, AFAIK.

YoBro wrote:

> Hello,
>
> I need to find out what PHP stands for.
>
> Also what is better,
> ASP or PHP and who has the biggest market share.
>
> Any help would be really great.
>
> Thanks,
>
> Chris
>
> --
> 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]





maybe you could find some good info on PHP vs ASP here

http://php.resourceindex.com/Documentation/Reviews_and_Analysis/PHP_vs._ASP/

regards

Ankur Verma

-----Original Message-----
From: YoBro [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 04, 2001 8:50 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Need to know this


Hello,

I need to find out what PHP stands for.

Also what is better,
ASP or PHP and who has the biggest market share.

Any help would be really great.

Thanks,

Chris



--
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 3 May 2001 20:19:51 -0700, YoBro <[EMAIL PROTECTED]> wrote:
> ASP or PHP and who has the biggest market share.

Which is better is a subject of some debate. Suffice it to say that most of the
people on this list will say PHP. I personally consider ASP a good idea only if
you have a heavy Microsoft environment.

As far as market share goes, that depends on how you measure it. I see more
high traffic sites using ASP (although PHP is starting to show up all over the
place) but according to the most recent E-Soft survey, IIS ran 778,377 sites
and PHP was installed on 646,045 (39.78%) Apache installations. Since not all
of the sites with PHP installed may use it (think hosting companies with
default installs) and since IIS is often used to run other scripting tools
(e.g. JSP, Cold Fusion, even PHP), I'm not going to try to adjust those numbers
- it'll probably balance out.

If you assume that percentage of PHP usage carries over to Netcraft's results,
around 7 million domains use PHP, handily out-numbering the 5.9 million IIS
sites. 

(Disclaimer: all stats are for entertainment purposes only. Microsoft fans are
invited to pick a method which favors their choices.)




Hi, I need some help for displaying realtime clock on my page with PHP
script.
Any ideas how to do it ?






PHP is server side. If you want to continously display the real time on your
page, accurate to the second, you'd have to refresh every second...if you're
not concerned about to the second accuracy, you could just use the date
function with teh appropriate parameters to give you the current time whent
the script would have been accessed...but if you're looking for something
that updates itself, look at javascript, or write an applet...

-jack

-----Original Message-----
From: Budi [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 03, 2001 11:05 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Real Time


Hi, I need some help for displaying realtime clock on my page with PHP
script.
Any ideas how to do it ?



--
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 am experiencing this EXACT SAME PROBLEM after upgrading PHP from 4.0.4pl2
to 4.0.5.  It is ROYALLY TICKING ME OFF!!!  I can't complete my site until
this stupid functionality is FIXED!!!!  WTF!

""Johnson, Kirk"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Jennifer, there are at least two of us totally confused. I did a copy and
> paste of your code and got the expected results:
>
> session id is afb1f9e27afc752f7d9e96e096ca2209
> session_register worked.
> testing is a registered variable
>
> with the contents of /tmp/sess_afb1f9e27afc752f7d9e96e096ca2209 being:
>
> testing|s:24:"Let's see if this works.";
>
> I then tried your code with register_globals = off. Interestingly, I got
> "session_register worked" even though $testing was not registered (it
can't
> be registered with register_globals off).
>
> I see nothing wrong with your code, so... some thoughts:
>
> 1. What browser are you using? I, and others, have seen erratic results
with
> sessions using Netscape 4.x. If this is your browser, try your code with
> another browser, if possible.
>
> 2. This is a longshot, but who is PHP running as? By default, it is
nobody.
> In any case, check that whomever PHP is running as has write permission to
> /tmp.
>
> 3. I cannot think of any other configuration settings in php.ini that
might
> be the trouble, since turning register_globals off does not reproduce your
> results.
>
> I am stumped.
>
> Kirk
>
> > -----Original Message-----
> > From: Jennifer [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, May 02, 2001 11:55 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP] session_register()
> >
> >
> > "Johnson, Kirk" wrote:
> > >
> > > > -----Original Message-----
> > > > From: Jennifer [mailto:[EMAIL PROTECTED]]
> > > > Do you need to register a variable with the session before you
> > > > assign it a value?
> > >
> > > Not in my experience.
> > >
> > > > session_register should return true if the variable was
> > > > successfully registered?
> > >
> > > It returns "1".
> > >
> > > > The variable name and it's value should be written to the file
> > > > with the same name as session_id()?
> > >
> > > Yes, here's a sample from a session file: superUser|s:3:"Yes";
> > > Here's a sample session filename:
> > sess_01bc2e24aa5291300887948f0af74899
> >
> >
> > This is all what I thought, but I am still having problems and I
> > don't have a clue what I am missing. Here's an example that I
> > have been paying with for testing.
> >
> > page1.php contains
> > <?php
> > session_start();
> > echo "session id is ".session_id()."<br>\n";
> > if (session_register("testing")) {
> >     echo "session_register worked.<br>\n";
> > }
> > else {
> >     echo "session_register did not work<br>\n";
> > }
> > if (session_is_registered("testing")) {
> >     echo "testing is a registered variable<br>\n";
> > }
> > else {
> >     echo "testing is not a registered variable<br>\n";
> > }
> > $testing = "Let's see if this works.";
> > ?>
> > <a href="page2.php?<?=SID?>">Go to next page.</a>
> >
> >
> > The output of the above page, gives me
> > session id is e35c2893382e28a14fa0455302edb06e
> > session_register did not work
> > testing is a registered variable
> > Go to next page.
> >
> >
> > and page2.php contains
> > <?php
> > session_start();
> > echo "session id is ".session_id()."<br>\n";
> > echo "Testing: $testing<br>\n";
> > ?>
> >
> >
> > The output of page2 gives me
> > session id is e35c2893382e28a14fa0455302edb06e
> > Testing:
> >
> > I am totally confused.  First off, why isn't it registering the
> > variable? There is a file named e35c2893382e28a14fa0455302edb06e
> > in my /tmp directory, but it is empty.
> >
> > Second, if it isn't registering the variable then why is
> > session_is_registered("testing") returning true?
> >
> > Jennifer
> >
> > --
> > 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]
>






This is bad, bad, bad.  I tried using another browser as you
suggested (since I was using Netscape 4.7) and the
session_register worked.  I still got different results than you
though.

Read throughout for more comments.

"Johnson, Kirk" wrote:
> 
> Jennifer, there are at least two of us totally confused. I did a copy and
> paste of your code and got the expected results:
> 
> session id is afb1f9e27afc752f7d9e96e096ca2209
> session_register worked.
> testing is a registered variable

Using IE 5, I got the same results here as with NS4.7

session id is e49f9b5ddb39388ab48c45dd4f14b00c
session_register did not work
testing is a registered variable
Go to next page.

*But*  It did work. So why did session_register return false?

 
> with the contents of /tmp/sess_afb1f9e27afc752f7d9e96e096ca2209 being:
> 
> testing|s:24:"Let's see if this works.";

This is the contents of my session file too *when* I use IE for
my browser.



> 1. What browser are you using? I, and others, have seen erratic results with
> sessions using Netscape 4.x. If this is your browser, try your code with
> another browser, if possible.

This appears to be the problem.  Now what?  So I have to forget
about sessions or forget about the multitude of NS 4.x users that
still exist?



> 2. This is a longshot, but who is PHP running as? By default, it is nobody.
> In any case, check that whomever PHP is running as has write permission to
> /tmp.

I had thought of that one.  I increased the permissions to be
world writable and it had no effect.

Thank you for helping me find the problem, now I just wish there
was an easy solution.  Arggggggg.

Jennifer




What's the best way of finding out if a specific array key is in an array?
I have an associative array which *may* look like 
(car =>saab, house => mansion, countyW=> A) but can equally well look like 
(boat => daycruiser, house => flat, county => B).

I want to find out if the key "car" is in the array and do something if it 
is.

I found:

$os = array ("Mac", "NT", "Irix", "Linux");
if (in_array ("Irix", $os)){
    <do stuff>;
    }

But that only works on the values. But it is exactly what I want to do on 
keys instead.

Suggestions?


Reply via email to