php-general Digest 25 Mar 2003 14:41:21 -0000 Issue 1959

Topics (messages 140912 through 140962):

Secure coockie is not available as variable
        140912 by: Alexander Weber
        140924 by: Ernest E Vogelsinger

Charset problem with DBF database
        140913 by: Alexander Weber

ho to remove an empty space
        140914 by: WebDev

openssl php 4.3.1
        140915 by: Kalin Mintchev
        140917 by: Kalin Mintchev
        140959 by: The Doctor

counting ..
        140916 by: Sebastian
        140918 by: Nikunj Virani
        140920 by: Sebastian
        140922 by: Justin French

SetUID Scripts with PHP.
        140919 by: Nikunj Virani

foreach() or for()
        140921 by: Richard Whitney
        140923 by: Tom Rogers

php regexp question
        140925 by: cpaul

installing cUrl
        140926 by: Diana Castillo

array into another site
        140927 by: Fredrik
        140928 by: Justin French
        140932 by: Ernest E Vogelsinger

problems with rename() - permission denied
        140929 by: Christian Rosentreter
        140931 by: liljim

Spooky numbers
        140930 by: Chris Blake

NewB Q on Arrays.
        140933 by: inpho

Re: count up from 7
        140934 by: David T-G

timout in mail script
        140935 by: Wilbert Enserink
        140937 by: Ernest E Vogelsinger
        140938 by: W. Enserink
        140941 by: Ernest E Vogelsinger

Re: mail() Bcc:
        140936 by: David T-G

Re: Viewing PHP pages
        140939 by: J.Veenhuijsen

Re: Finding out which file is retrieved over HTTP
        140940 by: Jens Lehmann
        140949 by: Ernest E Vogelsinger

php4isapi.dll
        140942 by: Robin
        140943 by: Nikunj Virani
        140945 by: Robin
        140947 by: Nikunj Virani

PHP & grep
        140944 by: Chris Blake

curl
        140946 by: Diana Castillo
        140948 by: Nikunj Virani

substr() on part an ereg() capture
        140950 by: Justin French
        140951 by: skate

Benchmarking
        140952 by: reven

connecting to mysql db
        140953 by: Iggy
        140954 by: Rankin, Randy
        140955 by: Iggy
        140956 by: Mirco Ellis
        140957 by: Jon Haworth
        140958 by: Mirco Ellis
        140960 by: skate
        140962 by: Chris Hayes

session id
        140961 by: Iggy

Administrivia:

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

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

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


----------------------------------------------------------------------
--- Begin Message ---
hello,

I send a secure cookie an it should be available as varible

setcookie("pbas_usr", $row[usr], time()+600, "", "", 1);

but the varable is empty. If it send the header without secure flag the
cookie works well

setcookie("pbas_usr", $row[usr], time()+600);

Is there a special way to read out secure cookies?


THX,

Alex



--- End Message ---
--- Begin Message ---
At 03:55 25.03.2003, Alexander Weber said:
--------------------[snip]--------------------
>I send a secure cookie an it should be available as varible
>
>setcookie("pbas_usr", $row[usr], time()+600, "", "", 1);
>
>but the varable is empty. If it send the header without secure flag the
>cookie works well
>
>setcookie("pbas_usr", $row[usr], time()+600);
>
>Is there a special way to read out secure cookies?
--------------------[snip]-------------------- 

Is your script running under https?

 From the docs (http://www.php.net/manual/en/function.setcookie.php):
"secure" indicates that the cookie should only be transmitted over a secure
HTTPS connection. When set to 1, the cookie will only be set if a secure
connection exists. The default is 0. 

Sorry if I'm OT here but you didn't mention https in your posting.

-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/



--- End Message ---
--- Begin Message ---
Hello,

I have a DBF database with some ASCII characters like ALT+154 (Ü) etc.
I read out the database but instead of an Ü i get an s.
Tried out charsetconverting from/to ASCII, UTF-8/7 and ISO, but nothing gave
me the rigth letter.

Anybody an idea?

THX

Alex




--- End Message ---
--- Begin Message ---
somehow when I have try to develop an application where I read five or six
values into an individual arrays the array who carries the emails has the
email and     an additional empty field after the email somehow complex well
they way the information has been stored is that the email was the last
value in the line of arrays and somehow carries always an empty field or the
tab field I can see when I upload the data in binary mode however I tried
around for some time


how do remove an empty space in an erray I tried arround with

$E2= str_replace(" ", "", $Email);

and I tried as well
$E2= str_replace(" ", "", $Email); with no success it totally ignored
the empty space in the email  what is stored in this
way:|data1|data2|[EMAIL PROTECTED] |data3|etc...|||||||. when I phrased
the data file
 any help and advice would be appreciated...






--- End Message ---
--- Begin Message ---
hi all,

i have problems getting fopen() and fsockopen() to work over https..

here is the problem..

from the phpinfo:

OpenSSL support         enabled
OpenSSL Version         OpenSSL 0.9.6h 5 Dec 2002

from php -m

# php -m
[PHP Modules]
ctype
mysql
openssl
overload
pcre
posix
session
standard
tokenizer
xml

[Zend Modules]


from the Appendix I regarding fopen() on php.net:

Note: HTTPS is supported starting from PHP 4.3, if you have compiled in
support for OpenSSL.

and from the documentation on fsockopen() on php.net:
As of PHP 4.3.0, if you have compiled in OpenSSL support, you may prefix
the hostname with either 'ssl://' or 'tls://' to use an SSL or TLS client
connection over TCP/IP to connect to the remote host.

in a test file i have two lines of code like this:

$file = "https://someurl.com";;
if (!($fp = fopen($file, "r")))

this produces an error but it doesn't point to any problem - like this:
Warning: fopen(https://someurl.com..........  in /path/to/file.php on line
45

if i change $file to "http://someurl.com"; it works fine...

with fsockopen() the situation is kinda the same. code:
$fp=fsockopen("ssl://www.foo.com", 443);

error:
Warning: fsockopen() [function.fsockopen]: no SSL support in this build in
/path/to/file/...

if i pul out the ssl:// part it works fine...

now, i did read the posts on this list about curl. why curl isn't
mentioned anywhere in the documentation for fopen() and fsockopen() if
it's needed for those functions?
why would i need curl compiled in php if i already have openssl compiled with
it?

the machine i'm using is a freeBSD 4.6 box with apache 1.3.27 and OpenSSL
0.9.6h, php is 4.3.1...

i did similar posts on other php lists but everybody's quite..

thanks




--- End Message ---
--- Begin Message ---
part 2:
-----------

got curl 7.10.3 (latest version)...
recompiled php 4.3.1 with curl. no errors. shows up fine on phpinfo...
testing with:

$ch = curl_init ("http://moo.org";);
$fp = fopen("http://moo.org/index.html";, "r");

curl_setopt ($ch, CURLOPT_FILE, $fp);

curl_setopt ($ch, CURLOPT_HEADER, 0);

curl_exec ($ch);
curl_close ($ch);

 while (!feof($fp)) {
        echo fgets ($fp,128);
    }

fclose ($fp);

the file i get back is not the whole file. it comes from the middle or so
down. i need this to retrieve xml files through https. tried one of those
files without https - just http - got the last part of the file back. it
cuts off somewhere......

i was really happy with fopen() and fsockopen() until the https came up...

i've been stuck on this for the last 2 days and i really need some kind of
solution... it's very frustrating that neither of those 3 options in php
work as expected or documented with the openssl options.....

i tested curl on the command line and it works fine. no cut offs of
documents anywhere....

please help!!!!!!!!...

is there any bugs known anywhere between curl 7.10.3 + php 4.3.1 on
freeBSD 4.6?


>
> hi all,
>
> i have problems getting fopen() and fsockopen() to work over https..
>
> here is the problem..
>
> from the phpinfo:
>
> OpenSSL support       enabled
> OpenSSL Version       OpenSSL 0.9.6h 5 Dec 2002
>
> from php -m
>
> # php -m
> [PHP Modules]
> ctype
> mysql
> openssl
> overload
> pcre
> posix
> session
> standard
> tokenizer
> xml
>
> [Zend Modules]
>
>
> from the Appendix I regarding fopen() on php.net:
>
> Note: HTTPS is supported starting from PHP 4.3, if you have compiled in
> support for OpenSSL.
>
> and from the documentation on fsockopen() on php.net:
> As of PHP 4.3.0, if you have compiled in OpenSSL support, you may prefix
> the hostname with either 'ssl://' or 'tls://' to use an SSL or TLS client
> connection over TCP/IP to connect to the remote host.
>
> in a test file i have two lines of code like this:
>
> $file = "https://someurl.com";;
> if (!($fp = fopen($file, "r")))
>
> this produces an error but it doesn't point to any problem - like this:
> Warning: fopen(https://someurl.com..........  in /path/to/file.php on line
> 45
>
> if i change $file to "http://someurl.com"; it works fine...
>
> with fsockopen() the situation is kinda the same. code:
> $fp=fsockopen("ssl://www.foo.com", 443);
>
> error:
> Warning: fsockopen() [function.fsockopen]: no SSL support in this build in
> /path/to/file/...
>
> if i pul out the ssl:// part it works fine...
>
> now, i did read the posts on this list about curl. why curl isn't
> mentioned anywhere in the documentation for fopen() and fsockopen() if
> it's needed for those functions?
> why would i need curl compiled in php if i already have openssl compiled with
> it?
>
> the machine i'm using is a freeBSD 4.6 box with apache 1.3.27 and OpenSSL
> 0.9.6h, php is 4.3.1...
>
> i did similar posts on other php lists but everybody's quite..
>
> thanks
>
>
>
>
>


--- End Message ---
--- Begin Message ---
On Mon, Mar 24, 2003 at 11:15:05PM -0500, Kalin Mintchev wrote:
> 
> hi all,
> 
> i have problems getting fopen() and fsockopen() to work over https..
> 
> here is the problem..
> 
> from the phpinfo:
> 
> OpenSSL support       enabled
> OpenSSL Version       OpenSSL 0.9.6h 5 Dec 2002

OpenSSL 0.9.6h has a security vulnerability.

PLEASe check http://www.openssl.org

> 
> from php -m
> 
> # php -m
> [PHP Modules]
> ctype
> mysql
> openssl
> overload
> pcre
> posix
> session
> standard
> tokenizer
> xml
> 
> [Zend Modules]
> 
> 
> from the Appendix I regarding fopen() on php.net:
> 
> Note: HTTPS is supported starting from PHP 4.3, if you have compiled in
> support for OpenSSL.
> 
> and from the documentation on fsockopen() on php.net:
> As of PHP 4.3.0, if you have compiled in OpenSSL support, you may prefix
> the hostname with either 'ssl://' or 'tls://' to use an SSL or TLS client
> connection over TCP/IP to connect to the remote host.
> 
> in a test file i have two lines of code like this:
> 
> $file = "https://someurl.com";;
> if (!($fp = fopen($file, "r")))
> 
> this produces an error but it doesn't point to any problem - like this:
> Warning: fopen(https://someurl.com..........  in /path/to/file.php on line
> 45
> 
> if i change $file to "http://someurl.com"; it works fine...
> 
> with fsockopen() the situation is kinda the same. code:
> $fp=fsockopen("ssl://www.foo.com", 443);
> 
> error:
> Warning: fsockopen() [function.fsockopen]: no SSL support in this build in
> /path/to/file/...
> 
> if i pul out the ssl:// part it works fine...
> 
> now, i did read the posts on this list about curl. why curl isn't
> mentioned anywhere in the documentation for fopen() and fsockopen() if
> it's needed for those functions?
> why would i need curl compiled in php if i already have openssl compiled with
> it?
> 
> the machine i'm using is a freeBSD 4.6 box with apache 1.3.27 and OpenSSL
> 0.9.6h, php is 4.3.1...
> 
> i did similar posts on other php lists but everybody's quite..
> 
> thanks
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
Member - Liberal International  On 11 Sept 2001 the WORLD was violated.
This is [EMAIL PROTECTED]       Ici [EMAIL PROTECTED]
Society MUST be saved! Extremists must dissolve.  
Quebec - elir les gagnant qui peut deplacer le PQ la plus  vite

--- End Message ---
--- Begin Message ---
Hello all.

rather dumb question.

I have a pagination system, 25 results per page, which are user comments, I
want to put a number on each comment so i am doing something like:

$num=$num + 1;
$number = $num;
echo $number;

But when i switch to the next 25 results it starts counting from 1 again,
LoL.

So i have to use $_GET right? If so can someone give me an example.

Thanks in advanced.


cheers,
- Sebastian

--- End Message ---
--- Begin Message ---
Check out:
http://phpbuilder.com/columns/rod20000221.php3

Hope that helps!


Regards,
Nikunj Virani
----- Original Message -----
From: "Sebastian" <[EMAIL PROTECTED]>
To: "php list" <[EMAIL PROTECTED]>
Sent: Tuesday, March 25, 2003 11:39 AM
Subject: [PHP] counting ..


> Hello all.
>
> rather dumb question.
>
> I have a pagination system, 25 results per page, which are user comments,
I
> want to put a number on each comment so i am doing something like:
>
> $num=$num + 1;
> $number = $num;
> echo $number;
>
> But when i switch to the next 25 results it starts counting from 1 again,
> LoL.
>
> So i have to use $_GET right? If so can someone give me an example.
>
> Thanks in advanced.
>
>
> cheers,
> - Sebastian
>



--- End Message ---
--- Begin Message ---
I Have made my own pagination script, but i am trying give each comment
isn't own number. Which i already did, but when i view the next results it
starts counting from 1 again.

cheers,
Sebastian

----- Original Message -----
From: "Nikunj Virani" <[EMAIL PROTECTED]>


| Check out:
| http://phpbuilder.com/columns/rod20000221.php3
|
| Hope that helps!
|
| ----- Original Message -----
| From: "Sebastian" <[EMAIL PROTECTED]>
|
|
| > Hello all.
| >
| > rather dumb question.
| >
| > I have a pagination system, 25 results per page, which are user
comments,
| I
| > want to put a number on each comment so i am doing something like:
| >
| > $num=$num + 1;
| > $number = $num;
| > echo $number;
| >
| > But when i switch to the next 25 results it starts counting from 1
again,
| > LoL.
| >
| > So i have to use $_GET right? If so can someone give me an example.
| >
| > Thanks in advanced.
| >
| >
| > cheers,
| > - Sebastian


--- End Message ---
--- Begin Message ---
Use $num as a global value across all pages, through GET, and use $i for a
per-script counter.  Increase both in a loop, add some navigation, and
you're all set...

This should be a starting point...

<?
$total_num = 137;
$per_page = 25;

// find value of $num, or start from zero
if(isset($_GET['num'])) { $num = $_GET['num']; } else { $num = 0; }

$i = 0;

while( ($i < $per_page) && ($num < 137) )
    {
    // increase "global" counter
    $num++;
    
    // increase "local" counter
    $i++;
    
    // do something here 25 times
    echo "{$i} - {$num} <br />";
    }

$last = $_GET['num'] - $per_page;

if($num > $per_page) {
  echo "<a href='{$_SERVER['PHP_SELF']}?num={$last}'>last {$per_page}</a>";
  echo " | ";
}

if($num < $total_num) {
  echo "<a href='{$_SERVER['PHP_SELF']}?num={$num}'>next {$per_page}</a>";
}
?>


Cheers,
Justin French



on 25/03/03 5:09 PM, Sebastian ([EMAIL PROTECTED]) wrote:

> Hello all.
> 
> rather dumb question.
> 
> I have a pagination system, 25 results per page, which are user comments, I
> want to put a number on each comment so i am doing something like:
> 
> $num=$num + 1;
> $number = $num;
> echo $number;
> 
> But when i switch to the next 25 results it starts counting from 1 again,
> LoL.
> 
> So i have to use $_GET right? If so can someone give me an example.
> 
> Thanks in advanced.
> 
> 
> cheers,
> - Sebastian
> 


--- End Message ---
--- Begin Message ---
I need to make some PHP Executables which needs root permissions to run. I currently 
use SetUID Perl scripts for the purpose and they works fine. But now i feel PHP would 
be better language for the purpose so i want to switch it to PHP. Can any one tell me 
how can i make setUID PHP scripts ?

Thanks and Regards,
Nikunj Virani

--- End Message ---
--- Begin Message ---
How Do, All?

Here's one unsuccessful attempt to add each $val during a for:
<?
for ($z = 0;$z < count($val);$z++)
                                                                                       
         {
                $v = $val + $val;                                                      
                 }
                                                                                       
         print 'Total?: '.$v.'<br>';
?>
Conversely I need to isolate certain elements oof a foreach:
<?
    foreach($var as $v){
        if ($v != 'argument')
        {
        //add all the $v's for a total
    }
?>

Thank you!


-- 
Richard Whitney   *
Transcend Development
Producing the next phase of your internet presence.
[EMAIL PROTECTED]   *
http://xend.net    *
602-971-2791
  *     *       *
*  *      *__    *    *
         _/  \___  *
     *  /   *    \*    *
      */     * *  \
*    */\_         |\
     /   \_      /  \
    /      \____/    \
   /                  \ 
  /                    \
 /                      \


--- End Message ---
--- Begin Message ---
Hi,

Tuesday, March 25, 2003, 4:41:02 PM, you wrote:
RW> How Do, All?

RW> Here's one unsuccessful attempt to add each $val during a for:
RW> <?
RW> for ($z = 0;$z < count($val);$z++)
RW>                                                                                    
             {
RW>                 $v = $val + $val;                                                  
                     }
RW>                                                                                    
             print 'Total?: '.$v.'<br>';
?>>
RW> Conversely I need to isolate certain elements oof a foreach:
RW> <?
RW>     foreach($var as $v){
RW>         if ($v != 'argument')
RW>         {
RW>         //add all the $v's for a total
RW>     }
?>>

RW> Thank you!


RW> -- 

I assume $val is an array of numbers?:
<?
$v = 0;
for ($z = 0;$z < count($val);$z++){
        $v += $val[$z];
}
print 'Total?: '.$v.'<br>';
?>
Conversely I need to isolate certain elements oof a foreach:
$total = 0;
<?
    foreach($var as $v){
        if ($v != 'argument')
        {
        $total += $v;
        }
    }
?>




-- 
regards,
Tom


--- End Message ---
--- Begin Message ---


hi

i've made a small php site that is searching against french documents stored
in a mysql database.

when it comes to rendering search results, the client has asked if the words 
that were searched for can be highlighted.  

"no problem!" i thought.  just do a regexp replace and wrap a <b> tag around
the matching terms.  then i realised that the following would not produce
a match:

  $string = "Françoise";
  echo preg_match("/francoise/i",$string);

so my question.... since mysql managed to produce a match here, is there
perhaps a php regexp modifier that (maybe) knows how to make this match?



thanks

--- End Message ---
--- Begin Message ---
Hi, I am running windows XP and I am looking for a way to install Curl, cant
seem to find a version that I can easily install just by clicking on
Setup.exe , does anyone know how to install it on XP?



--- End Message ---
--- Begin Message ---
Hi

I have an PHP array and  want to send it into another PHP site.

  $arr =
array(251,1,23,54,15,135,1651,156,13,123,321,123,32,54,654,456,32,1);

  ?>
  <script language="JavaScript" type="text/javascript">
      <a href=\"javascript: void(vindu2 =
window.open('view.php?arr=<?$arr;?>','windowname','toolbar=no, location=no,
directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes,
width=850, height=700')); vindu2.focus();\">View</a>
  </script>


Anybody knows how to do this?

Fred



--- End Message ---
--- Begin Message ---
1. Missing an equal sign: <?=$ not <?$
window.open('view.php?arr=<?=$arr;?>','windo...


2. Check out serialize()
http://www.php.net/manual/en/function.serialize.php

window.open('view.php?arr=<?=serialize($arr)?>','windo...


3. However, this creates a URL which isn't particularly URL friendly (not
sure, but perhaps maybe not even valid -- I don't know), so....


4. based on your array's size, I'd just implode() it, and then explode() it
back out on the new site:

window.open('view.php?arr=<?=implode('-',$arr)?>','windo...



Justin French




on 25/03/03 8:50 PM, Fredrik ([EMAIL PROTECTED]) wrote:

> Hi
> 
> I have an PHP array and  want to send it into another PHP site.
> 
> $arr =
> array(251,1,23,54,15,135,1651,156,13,123,321,123,32,54,654,456,32,1);
> 
> ?>
> <script language="JavaScript" type="text/javascript">
> <a href=\"javascript: void(vindu2 =
> window.open('view.php?arr=<?$arr;?>','windowname','toolbar=no, location=no,
> directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes,
> width=850, height=700')); vindu2.focus();\">View</a>
> </script>
> 
> 
> Anybody knows how to do this?
> 
> Fred
> 
> 


--- End Message ---
--- Begin Message ---
At 11:21 25.03.2003, Justin French said:
--------------------[snip]--------------------
>1. Missing an equal sign: <?=$ not <?$
>window.open('view.php?arr=<?=$arr;?>','windo...
>
>
>2. Check out serialize()
>http://www.php.net/manual/en/function.serialize.php
>
>window.open('view.php?arr=<?=serialize($arr)?>','windo...
>
>
>3. However, this creates a URL which isn't particularly URL friendly (not
>sure, but perhaps maybe not even valid -- I don't know), so....
>
>
>4. based on your array's size, I'd just implode() it, and then explode() it
>back out on the new site:
>
>window.open('view.php?arr=<?=implode('-',$arr)?>','windo...
--------------------[snip]-------------------- 

In both cases (serialize, and implode) you should urlencode the results:

window.open('view.php?arr=<?=urlencode(serialize($arr))?>','windo...
window.open('view.php?arr=<?=urlencode(implode('-',$arr))?>','windo...

Should make for a valid URL then. However don't forget that passing
application data via URL could pose a security risk to your application,
depending on what the data actually represents, and how it is worked on.
Consider also that URLs have some size limit (don't have the number at hand).


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/



--- End Message ---
--- Begin Message ---
Hello,

I've a small problem, which mades me crazy... :\

I'm trying to rename() a swapfile to real destination file (atomic update).
It works on differnt environments very well. Sadly not on my ISP-server
I've added an "chmod($swapfile,0777)", but this has not solve the problem.
The directories have all FULL access (read, write, etc.). The destiniation file
too. I don't want 2 use the copy/unlink solution.... Do anyone have an idea? 

--- 8< ---

if ( $file = fopen($swapfile,"w") )
{
    fwrite($file,$out);
    fclose($file);
    chmod($swapfile, 0777);

    /* this fails with "Permission denied" */
    rename($swapfile,$filename);
    
    /* ... but this works */
    copy($swapfile,$filename);
    unlink($swapfile);
}

--- 8< ----


Thanks 4 help...
--
christian rosentreter


--- End Message ---
--- Begin Message ---
"Christian Rosentreter" wrote:

Hi Christian,

> I've a small problem, which mades me crazy... :\
>
> I'm trying to rename() a swapfile to real destination file (atomic
update).
> It works on differnt environments very well. Sadly not on my ISP-server
> I've added an "chmod($swapfile,0777)", but this has not solve the problem.
> The directories have all FULL access (read, write, etc.). The destiniation
file
too. I don't want 2 use the copy/unlink solution.... Do anyone have an idea?
>
>    /* this fails with "Permission denied" */
>    rename($swapfile,$filename);
>
>    /* ... but this works */
>    copy($swapfile,$filename);
>    unlink($swapfile);

I'm just speculating, but it's possible that your ISP is running from
multiple machines: i.e. several webservers feeding off one fileserver. I had
a similar problem with one of the sites that I work on, and that was the
case. Might be worth asking your ISP if this is the case. The only solution
in my case was to go the copy() unlink() way. It's not as if it's a huge
workaround. ;)

James



--- End Message ---
--- Begin Message ---
Greetings learned PHP(eople),

This is what my lines look like in my text file :

=======================================================
   Source : D:\
     Dest : E:\
    Files : *.*
  Options : *.* /S /E /V /R:5 /W:5
========================================================

When I run the following code it takes the lines above and places them
in an HTML table :

========================================================
$source = `grep "Source :" logs/$file`;
$dest = `grep "Dest :" logs/$file`;
$criteria = `grep "Files :" logs/$file`;
$options = `grep "Options :" logs/$file`;
========================================================

This is the output on the HTML file :

Source : F:\INETPUB\
Dest : D:\BACKUP\INETPUB\
Files : *.* Files : 12911 0 12911 0 0 0
Options : *.* /S /E /V /R:5 /W:5
========================================================

Question is :

What are those numbers  that are inserted after the "Files" entry...and
how do I get rid of `em...?

Thanks for any assistance....

-- 
Chris Blake
Office : (011) 782-0840
Cell : 083 985 0379
A chicken is the eggs way of producing more eggs.


--- End Message ---
--- Begin Message ---
Hey All,

I'm still a newB in php and mysql so I'm asking for your patience up front.

i want to get a list of results from an array, which I can do with:

$result=mysql_query("select * from mvlogtbl",$db);
while ($row=mysql_fetch_array($result)){
echo "$row[uid] $row[mvid]";
}

basically what I have is a database of movies linked to .avi files that are
setup for streaming, the table mvlogtbl keeps a log of who has watched what.

What i want to be able to do is determine if a certain user has watched a
movie. But there are multiple entries for each user, a user may have watched
the movie more than once, I don't really care, I just want to be able to
tell if they have watched it or not...

any help?

Thanls

- paul -



--- End Message ---
--- Begin Message ---
Richard --

...and then Richard Whitney said...
% 
% Braindead!

Hey, who are you callin' names?!?


% 
% I need to evaluate a number if greater than 7 and add a value per increment.

Greater than seven is easy.  Adding a value is easy.  Per increment can
be a little tricky but we'll assume for the moment that the window is 1.
The code

  $sum = 67 ;   # starting value
  $trg = 7 ;    # trigger value
  $add = 6 ;    # what we add each time

  $num = 10 ;   # what we're evaluating (hardcoded here!)

  for ( $num ; $trg < $num ; $trg++ )
    { $sum += $add ; }

  print "when num = $num, sum = $sum\n" ;

should do for a starting point, though, and produces

  bash-2.05a$ php -q /tmp/inc.php
  when num = 10, sum = 85
  bash-2.05a$ php -q /tmp/inc.php
  when num = 20, sum = 145
  bash-2.05a$ php -q /tmp/inc.php
  when num = 7, sum = 67
  bash-2.05a$ php -q /tmp/inc.php
  when num = 1, sum = 67

when run.

Extra credit if you write it as a recursive function :-)


% I'm frazzled and can't think straight.

You can't ask straight, either :-)  Give us more details!


% 
% Thanks Guys!


HTH & HAND

:-D
-- 
David T-G                      * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: pgp00000.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
Hi all,


I have this script sending 1000 personalized emails. 
However when I press the start button in my browser so the script starts mailing I get 
no response for a long time from the script. Most of the time I don't get any 
response. When I retrieve all the emails I just sent (to myself, using 1000 aliases), 
I retrieve e.g. 1396 emails.

Anybody knows how this is possible? Is it possible that the script is adressed again 
by the browser, so the whole mailing process starts again?



regards Wilbert


-------------------------
Pas de Deux
Van Mierisstraat 25
2526 NM Den Haag
tel 070 4450855
fax 070 4450852
http://www.pdd.nl
[EMAIL PROTECTED]
-------------------------

--- End Message ---
--- Begin Message ---
At 12:24 25.03.2003, Wilbert Enserink spoke out and said:
--------------------[snip]--------------------
>I have this script sending 1000 personalized emails. 
>However when I press the start button in my browser so the script starts 
>mailing I get no response for a long time from the script. Most of the time 
>I don't get any response. When I retrieve all the emails I just sent (to 
>myself, using 1000 aliases), I retrieve e.g. 1396 emails.
>
>Anybody knows how this is possible? Is it possible that the script is 
>adressed again by the browser, so the whole mailing process starts again?
--------------------[snip]-------------------- 

 From what you've said it looks as if your script is running in an endless
loop. You may debug it by _not_ actually sending the mail, but echoing the
mail() command to the browser, together with the vital variables you need.


-- 
   >O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
    ^ http://www.vogelsinger.at/


--- End Message ---
--- Begin Message ---
Hi ernest,


I don't think it is looping, cause I also tried it with 10 and 100 and 250
emails. No problems there...!

regards Wilbert

----- Original Message -----
From: "Ernest E Vogelsinger" <[EMAIL PROTECTED]>
To: "Wilbert Enserink" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, March 25, 2003 12:30 PM
Subject: Re: [PHP] timout in mail script


> At 12:24 25.03.2003, Wilbert Enserink spoke out and said:
> --------------------[snip]--------------------
> >I have this script sending 1000 personalized emails.
> >However when I press the start button in my browser so the script starts
> >mailing I get no response for a long time from the script. Most of the
time
> >I don't get any response. When I retrieve all the emails I just sent (to
> >myself, using 1000 aliases), I retrieve e.g. 1396 emails.
> >
> >Anybody knows how this is possible? Is it possible that the script is
> >adressed again by the browser, so the whole mailing process starts again?
> --------------------[snip]--------------------
>
>  From what you've said it looks as if your script is running in an endless
> loop. You may debug it by _not_ actually sending the mail, but echoing the
> mail() command to the browser, together with the vital variables you need.
>
>
> --
>    >O Ernest E. Vogelsinger
>    (\) ICQ #13394035
>     ^ http://www.vogelsinger.at/

------------------------- 
Pas de Deux 
Van Mierisstraat 25 
2526 NM Den Haag 
tel 070 4450855 
fax 070 4450852 
http://www.pdd.nl 
[EMAIL PROTECTED] 
-------------------------

--- End Message ---
--- Begin Message ---
At 12:53 25.03.2003, W. Enserink spoke out and said:
--------------------[snip]--------------------
>I don't think it is looping, cause I also tried it with 10 and 100 and 250
>emails. No problems there...!
--------------------[snip]-------------------- 

Well if you report receiving 1300+ mails when the script is supposed to
send 1000 there's certainly something wrong ;-)

Try to mark the first message so you can possibly see where it's about to
start over again. Then hook in here with your debug efforts to see as to
why it starts over.


-- 
   >O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
    ^ http://www.vogelsinger.at/


--- End Message ---
--- Begin Message ---
John, et al --

One more nit to add to this...

...and then CPT John W. Holmes said...
% 
...
% 
% You can do it like this:
% 
% $headers = "From: [EMAIL PROTECTED]: [EMAIL PROTECTED]:
% [EMAIL PROTECTED]";

Yes, figuring that the added line break is just because of a dumb mail
program :-0


% 
% or
% 
% $headers = "From: [EMAIL PROTECTED]
% CC: [EMAIL PROTECTED]
% BCC: [EMAIL PROTECTED]";

This can get you into trouble because it isn't portable.  Mail headers
are supposed to end in return (\r) *and* newline (\n) but all you're
doing here is saying to "insert the end-of-line sequence for this
operating system".  If you're on a windows box you're fine (though you
have a myriad of other problems ;-) but if you're on a *NIX box you're
only sending newline and if you're on a Mac you're only sending return (I
don't know enough Mac to know if an OS X Mac has newlines like a classic
Mac or like a *NIX box).

Use the all-run-together format or a .= buildup and manually specify the
needed \r\n to avoid the headache.


HTH & HAND

:-D
-- 
David T-G                      * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: pgp00001.pgp
Description: PGP signature


--- End Message ---
--- Begin Message --- What about naming your scripts .php4 that should work.

Jochem

Andy wrote:
Hi Ben
They say that the server is set up for PHP4, and they say it is something to
do with my scripts.
Not sure I believe them.
My pages have the extension .php

Andy

"Ben Edwards" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

Server is probably set up wrong or your extensions are wrong.  Check with
the ISP wether you have PHP facilities, the extension is .php normally but
sometimes .php3.

At 03:55 24/03/2003 +0000, Andy wrote:


Can someone help?

I have uploaded my PHP pages, created in Dreamweaver MX to my hosting

server

but when I try to access the page the only option I get is to download

it.

What am I doing wrong?

I have created the forms and guestbooks that mail information to me but
these do not work, they are OK when I test them locally but not when they
are uploaded.

Thank you

Andy



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003

**************************************************************** * Ben Edwards +44 (0)117 968 2602 * * Critical Site Builder http://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Smashing the Corporate image http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * ****************************************************************




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



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003






--- End Message ---
--- Begin Message --- David Otton wrote:
On Sun, 23 Mar 2003 21:21:39 +0100, you wrote:


The following short script retrieves a file over HTTP:

$url = 'http://www.example.com/';
implode('',file($url)); // or file_get_contents()

Now I'd like to find out which file was really retrieved, for instance http://www.example.com/index.html. Is this possible and how?

[...]
I need to write a small link-checker (Intranet), which reads in all links within a file and then looks if they're broken and collects some information. Unfortunately I didn't find a simple, free link-checker that's why I write my own. It would be good to find out the "complete" url, because I want to collect the file-endings (.php,.html, ...).


I really think this already exists. You should probably search a bit
harder.

Maybe there are good standalone-link-checkers, but I need to integrate it in an application and my customer has some special wishes. Anyways I finished writing the link-checker.

A thing which seemed a bit confusing to me is that if I open a non-existing website (fopen('http://www.amazon.de/nonsensestuff')) I always get an error message "Success". It's the same thing if I use file(). The manual explains that fopen() returns false if the website could not be opened, that's why I don't know why this error message appears? Besides this "Success"-message is surely a very bad error message. I use PHP 4.2.3.

Jens




--- End Message ---
--- Begin Message ---
At 13:08 25.03.2003, Jens Lehmann spoke out and said:
--------------------[snip]--------------------
>A thing which seemed a bit confusing to me is that if I open a 
>non-existing website (fopen('http://www.amazon.de/nonsensestuff')) I 
>always get an error message "Success". It's the same thing if I use 
>file(). The manual explains that fopen() returns false if the website 
>could not be opened, that's why I don't know why this error message 
>appears? Besides this "Success"-message is surely a very bad error 
>message. I use PHP 4.2.3.
--------------------[snip]-------------------- 

If the website doesn't exist, but the web SERVER does, it will return
something, usually a 404-message. fopen() doesn't check for HTTP result
codes, it just opens the stream and retuirns whatever gets sent (with the
single exception of omitting the headers, but without looking).

So in fact an fopen() to a non-existing page will be seen as successful by
fopen(). This is by design and afaik documented somewhere.

To actually check on the HTTP status codes you need to run your own, either
using cURL, or by doing your own stuff using fsockopen().


-- 
   >O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
    ^ http://www.vogelsinger.at/


--- End Message ---
--- Begin Message ---
Hello

I am trying to install Cacti and it requires PHP.I have followed the
instructions which require me to add the above dll and php extension into
IIS.

However, i have searched my entire hardrive, but can not find this dll so i
cant continue.

Please can somebody help?

Thanks


Robin



--- End Message ---
--- Begin Message ---
Download PHP from http://www.php.net/downloads.php. You will find
php4isapi.dll with it.

Regards,
Nikunj Virani
----- Original Message -----
From: "Robin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 25, 2003 5:51 PM
Subject: [PHP] php4isapi.dll


> Hello
>
> I am trying to install Cacti and it requires PHP.I have followed the
> instructions which require me to add the above dll and php extension into
> IIS.
>
> However, i have searched my entire hardrive, but can not find this dll so
i
> cant continue.
>
> Please can somebody help?
>
> Thanks
>
>
> Robin
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>



--- End Message ---
--- Begin Message ---
Thanks Nikunj

Which actual download is it? The zip or the installer?

Robin
"Nikunj Virani" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Download PHP from http://www.php.net/downloads.php. You will find
> php4isapi.dll with it.
>
> Regards,
> Nikunj Virani
> ----- Original Message -----
> From: "Robin" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, March 25, 2003 5:51 PM
> Subject: [PHP] php4isapi.dll
>
>
> > Hello
> >
> > I am trying to install Cacti and it requires PHP.I have followed the
> > instructions which require me to add the above dll and php extension
into
> > IIS.
> >
> > However, i have searched my entire hardrive, but can not find this dll
so
> i
> > cant continue.
> >
> > Please can somebody help?
> >
> > Thanks
> >
> >
> > Robin
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
>
>



--- End Message ---
--- Begin Message ---
I prefer and use Zip file.

Regards,
Nikunj
----- Original Message -----
From: "Robin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 25, 2003 6:06 PM
Subject: Re: [PHP] php4isapi.dll


> Thanks Nikunj
>
> Which actual download is it? The zip or the installer?
>
> Robin
> "Nikunj Virani" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Download PHP from http://www.php.net/downloads.php. You will find
> > php4isapi.dll with it.
> >
> > Regards,
> > Nikunj Virani
> > ----- Original Message -----
> > From: "Robin" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Tuesday, March 25, 2003 5:51 PM
> > Subject: [PHP] php4isapi.dll
> >
> >
> > > Hello
> > >
> > > I am trying to install Cacti and it requires PHP.I have followed the
> > > instructions which require me to add the above dll and php extension
> into
> > > IIS.
> > >
> > > However, i have searched my entire hardrive, but can not find this dll
> so
> > i
> > > cant continue.
> > >
> > > Please can somebody help?
> > >
> > > Thanks
> > >
> > >
> > > Robin
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> > >
> >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>



--- End Message ---
--- Begin Message ---
Greetings learned PHP(eople)

I`m using the following to strip values out of a file, however, the file
I`m accessing contains multiple instance of the search criteria, and I
only wanna return the first instance....
I`m just getting an empty variable and can`t figure it out...

$criteria = `grep "Files :" logs/$file`;

I`ve tried other things like 'grep --max-count=1 "Files :"...etc etc,
and that don`t work

Also tried shellexecarg (`grep blah blah blah);......still not working

Any ideas
-- 
Chris Blake
Office : (011) 782-0840
Cell : 083 985 0379
A chicken is the eggs way of producing more eggs.


--- End Message ---
--- Begin Message ---
How can I tell if I have successfully installed curl on my windows XP
machine?
What is the syntax for sending a test curl command?
I tried this and got a syntax error:
curl http://www.netscape.com/;




--- End Message ---
--- Begin Message ---
What does phpinfo() function says ? It should show you the curl module
enabled.

Regards,
Nikunj Virani
----- Original Message -----
From: "Diana Castillo" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 25, 2003 6:06 PM
Subject: [PHP] curl


> How can I tell if I have successfully installed curl on my windows XP
> machine?
> What is the syntax for sending a test curl command?
> I tried this and got a syntax error:
> curl http://www.netscape.com/;
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>



--- End Message ---
--- Begin Message ---
Hi, I have this ereg to turn URLs into links:

eregi_replace("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", "<a
href=\"\\1://\\2\\3\" {$t}\">\\1://\\2\\3</a>", $str);

... found it in the manual i think, or maybe on weberdev.com examples


Anyhoo, it places the whole link in between the <a...> and </a>, which is
fine for short links, but on longer links (in my case, around 60+ chars), it
messes with my table or CSS layout.

So, I'd like to subtr() the 2nd capture part down to 55 chars or something
IF it's longer than 60, and append a ... to it.

ANY ideas on how this is done?  Or is this beyond regexp??


TIA

Justin


--- End Message ---
--- Begin Message ---
couldn't you just do substr( $blah, 0, 55)

or something similar?

(i'm crap with syntax, so that's just off my head...)


-skate-
fatcuban.com


----- Original Message -----
From: "Justin French" <[EMAIL PROTECTED]>
To: "php" <[EMAIL PROTECTED]>
Sent: Tuesday, March 25, 2003 1:24 PM
Subject: [PHP] substr() on part an ereg() capture


> Hi, I have this ereg to turn URLs into links:
>
> eregi_replace("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", "<a
> href=\"\\1://\\2\\3\" {$t}\">\\1://\\2\\3</a>", $str);
>
> ... found it in the manual i think, or maybe on weberdev.com examples
>
>
> Anyhoo, it places the whole link in between the <a...> and </a>, which is
> fine for short links, but on longer links (in my case, around 60+ chars),
it
> messes with my table or CSS layout.
>
> So, I'd like to subtr() the 2nd capture part down to 55 chars or something
> IF it's longer than 60, and append a ... to it.
>
> ANY ideas on how this is done?  Or is this beyond regexp??
>
>
> TIA
>
> Justin
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>



--- End Message ---
--- Begin Message ---
Hi,

I've been making a web ap PHP based, but I fear the number of arrays it has
is too big. Is there any way to benchmark a script, or are there any
recomendations or standards about how much time execution takes and how many
resources it takes?

Thanks,

Reven



--- End Message ---
--- Begin Message ---
hi,
I am trying to play and learn php along with mysql and I have a question
about connecting to a db.
Is the following code necessary on every php page where I am retrieving some
data from a db or is there any way to connect once (something like
index.php) and have that connection open through subsequent pages?
the code
<?php
$link = mysql_connect("localhost", "", "")
        or die("Could not connect: " . mysql_error());
    print ("Connected successfully");

mysql_select_db("test")
        or die("Could not select database: " . mysql_error());
?>

thanx
iggy



--- End Message ---
--- Begin Message ---
Place the code in a file ( ie; dbcon.php ) and include that file in any page
which may need it using an include statement: include("dbcon.php"); 

Randy

-----Original Message-----
From: Iggy [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 25, 2003 7:50 AM
To: [EMAIL PROTECTED]
Subject: [PHP] connecting to mysql db


hi,
I am trying to play and learn php along with mysql and I have a question
about connecting to a db.
Is the following code necessary on every php page where I am retrieving some
data from a db or is there any way to connect once (something like
index.php) and have that connection open through subsequent pages?
the code
<?php
$link = mysql_connect("localhost", "", "")
        or die("Could not connect: " . mysql_error());
    print ("Connected successfully");

mysql_select_db("test")
        or die("Could not select database: " . mysql_error());
?>

thanx
iggy



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
This really doesn't explain me much. I mean the difference between having
that code on every page or calling it from an external page doesn't tell me
if it is realy necessary to do it all the time. I guess I am looking for
more generic explanation of the whole process rather than what you said.

However I appreciate it much, since it seems to be much better coding
practice

Iggy



"Randy Rankin" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Place the code in a file ( ie; dbcon.php ) and include that file in any
page
> which may need it using an include statement: include("dbcon.php");
>
> Randy
>
> -----Original Message-----
> From: Iggy [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 25, 2003 7:50 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] connecting to mysql db
>
>
> hi,
> I am trying to play and learn php along with mysql and I have a question
> about connecting to a db.
> Is the following code necessary on every php page where I am retrieving
some
> data from a db or is there any way to connect once (something like
> index.php) and have that connection open through subsequent pages?
> the code
> <?php
> $link = mysql_connect("localhost", "", "")
>         or die("Could not connect: " . mysql_error());
>     print ("Connected successfully");
>
> mysql_select_db("test")
>         or die("Could not select database: " . mysql_error());
> ?>
>
> thanx
> iggy
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>



--- End Message ---
--- Begin Message ---
No dude. Create a file called whatever.inc that includes the code that you
are using to connect to the db. In every php script ,that needs this
connection to the db, you simply put:

<?php
include("whatever.inc");
?>

Mirco Ellis
I-Soft Solutions
e-mail: [EMAIL PROTECTED]
Tel: +27414847161


-----Original Message-----
From: Iggy [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 25, 2003 15:50
To: [EMAIL PROTECTED]
Subject: [PHP] connecting to mysql db


hi,
I am trying to play and learn php along with mysql and I have a question
about connecting to a db.
Is the following code necessary on every php page where I am retrieving some
data from a db or is there any way to connect once (something like
index.php) and have that connection open through subsequent pages?
the code
<?php
$link = mysql_connect("localhost", "", "")
        or die("Could not connect: " . mysql_error());
    print ("Connected successfully");

mysql_select_db("test")
        or die("Could not select database: " . mysql_error());
?>

thanx
iggy



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
Hi Iggy,

> I mean the difference between having that code on 
> every page or calling it from an external page 
> doesn't tell me if it is realy necessary to do it 
> all the time. 

Yes, you do have to connect to the database in every script that needs to
access it. Usually this is done at the start of the script, along with any
calls to session_start() and other "global" stuff.

For convenience and ease of maintenance, however, it makes good sense to
write a separate file that does nothing but connect to the database. This
separate file then needs to be attached to the running script via include(),
at any point before the first call to the database.

HTH
Jon

--- End Message ---
--- Begin Message ---
This is the only way I know and probably the safest. This way you know there
is connectivity because it is loaded rigth at the beginning.

Mirco Ellis
I-Soft Solutions
e-mail: [EMAIL PROTECTED]
Tel: +27414847161


-----Original Message-----
From: Igor Frankovic [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 25, 2003 16:03
To: [EMAIL PROTECTED]
Subject: RE: [PHP] connecting to mysql db


But is it always necessary to do this or can you open this connection once
and have it open throughout the next few pages (or as needed) and then close
it?

> -----Original Message-----
> From: Mirco Ellis [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 25, 2003 8:00 AM
> To: 'Iggy'
> Cc: Php-General (E-mail)
> Subject: RE: [PHP] connecting to mysql db
>
>
> No dude. Create a file called whatever.inc that includes the
> code that you are using to connect to the db. In every php
> script ,that needs this connection to the db, you simply put:
>
> <?php
> include("whatever.inc");
> ?>
>
> Mirco Ellis
> I-Soft Solutions
> e-mail: [EMAIL PROTECTED]
> Tel: +27414847161
>
>
> -----Original Message-----
> From: Iggy [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 25, 2003 15:50
> To: [EMAIL PROTECTED]
> Subject: [PHP] connecting to mysql db
>
>
> hi,
> I am trying to play and learn php along with mysql and I have
> a question about connecting to a db. Is the following code
> necessary on every php page where I am retrieving some data
> from a db or is there any way to connect once (something like
> index.php) and have that connection open through subsequent
> pages? the code <?php $link = mysql_connect("localhost", "", "")
>         or die("Could not connect: " . mysql_error());
>     print ("Connected successfully");
>
> mysql_select_db("test")
>         or die("Could not select database: " . mysql_error()); ?>
>
> thanx
> iggy
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


--- End Message ---
--- Begin Message ---
leaving the connection open creates security questions, and also leaves resources 
open, what if a user closes his browser window, how do you know to close the 
connection?

if you really want to make it simple, you can edit your php.ini to have the username 
and password as default in there, but again, this can be a security risk.

i'm afraid the best way is to include connection code on every page...

-- 
skate - fatcuban.com
"Iggy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> This really doesn't explain me much. I mean the difference between having
> that code on every page or calling it from an external page doesn't tell me
> if it is realy necessary to do it all the time. I guess I am looking for
> more generic explanation of the whole process rather than what you said.
> 
> However I appreciate it much, since it seems to be much better coding
> practice
> 
> Iggy
> 
> 
> 
> "Randy Rankin" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Place the code in a file ( ie; dbcon.php ) and include that file in any
> page
> > which may need it using an include statement: include("dbcon.php");
> >
> > Randy
> >
> > -----Original Message-----
> > From: Iggy [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, March 25, 2003 7:50 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] connecting to mysql db
> >
> >
> > hi,
> > I am trying to play and learn php along with mysql and I have a question
> > about connecting to a db.
> > Is the following code necessary on every php page where I am retrieving
> some
> > data from a db or is there any way to connect once (something like
> > index.php) and have that connection open through subsequent pages?
> > the code
> > <?php
> > $link = mysql_connect("localhost", "", "")
> >         or die("Could not connect: " . mysql_error());
> >     print ("Connected successfully");
> >
> > mysql_select_db("test")
> >         or die("Could not select database: " . mysql_error());
> > ?>
> >
> > thanx
> > iggy
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

--- End Message ---
--- Begin Message --- At 14:49 25-3-2003, you wrote:
hi,
I am trying to play and learn php along with mysql and I have a question
about connecting to a db.
Is the following code necessary on every php page where I am retrieving some
data from a db or is there any way to connect once (something like
index.php) and have that connection open through subsequent pages?
the code
<?php
$link = mysql_connect("localhost", "", "")
        or die("Could not connect: " . mysql_error());
    print ("Connected successfully");

mysql_select_db("test")
        or die("Could not select database: " . mysql_error());
?>
maybe you are looking for: http://www.php.net/manual/en/function.mysql-pconnect.php


--- End Message ---
--- Begin Message ---
can somebody tell me why I am getting this:
Warning: session_start() [function.session-start]: Cannot send session
cookie - headers already sent by (output started at
c:\inetpub\wwwroot\search.php:8) in c:\inetpub\wwwroot\search.php on line 21

Warning: session_start() [function.session-start]: Cannot send session cache
limiter - headers already sent (output started at
c:\inetpub\wwwroot\search.php:8) in c:\inetpub\wwwroot\search.php on line 21


when I use this code:

session_start();
if (!isset($_SESSION['count'])) {
    $_SESSION['count'] = 0;
}


PHP is version 4.3.1

thanx



--- End Message ---

Reply via email to