OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general-digest-help_at_lists.php.net
Date: Fri Nov 29 2002 - 18:18:12 CST

  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    php-general Digest 30 Nov 2002 00:18:12 -0000 Issue 1734

    Topics (messages 126465 through 126505):

    OpenSSL Encryption to a browser.
            126465 by: Comunica2 s. coop.
            126468 by: Dan Hardiker

    Re: Multidimensional arrays (more and more...)
            126466 by: Ford, Mike [LSS]

    Re: File handling
            126467 by: Justin French
            126484 by: Maxim Maletsky

    array with session
            126469 by: Laurence
            126470 by: Craig
            126471 by: Craig
            126505 by: Justin French

    First PHP
            126472 by: heikkikk
            126473 by: Khalid El-Kary
            126494 by: John Nichel
            126496 by: CC Zona
            126503 by: Godzilla

    Upload wont work, OS X
            126474 by: magnus nilsson
            126479 by: Beth Gore
            126500 by: magnus nilsson

    Re: Logging out and session ids
            126475 by: Gerard Samuel
            126489 by: Tom Rogers

    Re: Werid problemswith mail() command: From address on sent messages
            126476 by: Chris Hewitt

    Re: how to use mssql_connect()?
            126477 by: Chris Hewitt

    Re: rewrite urls with preg_replace
            126478 by: Dieter Koch

    php and https
            126480 by: DUPUIS Grégoire BE/DGC
            126485 by: Marco Tabini
            126487 by: DUPUIS Grégoire BE/DGC

    Re: Help with login/redirect/insert to dbase
            126481 by: Maxim Maletsky

    Re: file creation date
            126482 by: Maxim Maletsky

    Re: Help with the PHP
            126483 by: Maxim Maletsky

    Multiuser System with Sessions
            126486 by: Anson LeClair

    Enable Quota function with php
            126488 by: EdwardSPL.ita.org.mo

    Convert dates
            126490 by: Sturle
            126491 by: John W. Holmes

    How to access properties of objects within objects
            126492 by: Randall Perry

    Re: Detecting email bounces sent by the mail function?
            126493 by: John Nichel

    Re: imap Server support Quota]
            126495 by: EdwardSPL.ita.org.mo

    Sessions not written to db on windows...
            126497 by: Gerard Samuel

    Re: Bad File Mode?
            126498 by: Steve Keller

    YATS on OS X
            126499 by: Adam Atlas

    Test links?
            126501 by: Rob Packer
            126502 by: Jason Reid

    Re: Is it possible to do this in PHP ? If it is then, how ?
            126504 by: Axis Computers

    Administrivia:

    To subscribe to the digest, e-mail:
            php-general-digest-subscribelists.php.net

    To unsubscribe from the digest, e-mail:
            php-general-digest-unsubscribelists.php.net

    To post to the list, e-mail:
            php-generallists.php.net

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

    attached mail follows:


    I would like to use OpenSSL to send encrypted information to a browser. The
    information would be encrypted to a public key that has its private
    counterpart installed in the browser. The idea is that the information would
    be decrypted automatically, but only when the destination browser has the
    right private key installed.

    Would it be possible to us header("Content-type: multipart/encrypted"),
    since it is originally meant for messages?

    --
    René
    

    attached mail follows:


    > I would like to use OpenSSL to send encrypted information to a browser. > The information would be encrypted to a public key that has its private > counterpart installed in the browser. The idea is that the information > would be decrypted automatically, but only when the destination browser > has the right private key installed.

    Most people would leave apache (usually with mod_ssl) to handle the encryption over https. Im not even sure if you could do what I think you are asking without controlling the whole http communication (as the whole thing is SSL wrapped, or none of it).

    > Would it be possible to us header("Content-type: multipart/encrypted"), > since it is originally meant for messages?

    I think you need to look into one of the following:

    - Handling the requests yourself by listening to port 80 (not advisable - php wasnt built for that sort of task, but its possible) - Using ssl certificate pairs and installing them in a custom manner on the apache installation - Alternative methods

    PS: if your not using apache, I cant help you at all. Others may.

    ---
    Dan Hardiker [dhardikerstaff.firstcreative.net]
    ADAM Software & Systems Engineer
    First Creative
    

    attached mail follows:


    > -----Original Message----- > From: Mako Shark [mailto:phpman2000yahoo.com] > Sent: 28 November 2002 18:20 > > A little more info on my count()ing. > I have $issue[0]["number"] to $issue[x]["number"] just > like any other multidimensional array (we'll call them > m-arrays for simplicity). > > If I try to count($issue), I'll get all instances of > my array (instances?) mltipled by the number of > elements

    Uh -- have you actually tried this? Without doing so myself, I'm 99% sure that count($issue) will give you the answer you're looking for -- i.e. the number of different subscripts in the first dimension. From your description of how you expect count() to work, I suspect you're labouring under a misapprehension about how PHP arrays are built: in this case, $issue is an array of (x+1) elements, indexed from 0 to x, each element of which just happens to contain an array itself; it's not a single array of (x+1)*(no. of "string" subscripts) elements. This means you can do something like

    $current = $issue[0]

    and $current will be the array of string-subscripted elements contained in $issue[0].

    > My problem is I need to loop through these.

    Well, you don't need to know how many there are to do this -- just use foreach:

    foreach ($issue as $n=>$elements): // in here, $elements['number']==$issue[$n]['number'], etc. endforeach;

    Cheers!

    Mike

    --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: m.fordlmu.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

    attached mail follows:


    on 29/11/02 7:06 PM, Jeff RingRose (JRingRoseatlasalu.ie) wrote:

    > Justin, > Option b. delete all AFTER "foo", I.E. truncate the file directly after > "foo". Leaving "foo" and all the data before "foo" untouched.

    And what happens if there are more than one occurrence of "foo"? I assume you mean the first occurrence.

    And what happens if "foo" is found within another word, like "aafooaa"... this example assumes this doesn't matter... it's looking for 'foo', not ' foo '.

    One of way is to read the file into a variable, split the var on "foo", and rewrite the file out.

    <? $split = 'foo'; $file = 'dummyfiles/01-04-29.php';

    // get file contents $fd = fopen ($file, "r"); $mytext = fread ($fd, filesize($file)); fclose ($fd);

    // split it on $split, append $split to first chunk list($prefix,$suffix) = split($split,$mytext); unset($suffix); $newtext = $prefix.$split;

    // write to file $fp = fopen($file, 'w'); fwrite($fp, $newtext); fclose($fp); ?>

    1. Totally untested code, but most of it was lifted out of the manual in some way or another.

    2. Permissions of the file to be read/written will need to be correct

    3. I've included no error reporting or correct checking... you'll need to add this yourself

    Season to taste...

    Justin French -------------------- http://Indent.com.au Web Development & Graphic Design --------------------

    attached mail follows:


    loop through the file line by line explode()ing every line with "TEXt" in it. Then, if retrning array count is bigger than one, unset() the key one and break the loop. All read OVERWRITE in the original file.

    Sorry, too lazy writing the code here :)

    --
    Maxim Maletsky
    maximphp.net
    

    "Jeff" <jringroseatlasalu.ie> wrote... :

    > Quick one, how do i read a file for a key word, say "TEXt", and the delete > the rest of the remaining file? > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    hello everyone,

    I'm trying to get some images value from a checkbox putting them in a session to preserve the data. The array works perfectly without the session_start() and session_register.

    can anyone help?

    html script

    <html> <head> <title></title> </head>

    <body> <form action="submit_information.php" method="post"> <input type="checkbox" name=Image[] value="Image_One"> <img src=".gif" name="Image_One"><br> <input type="checkbox" name=Image[] value="Image_Two"> <img src=".gif" name="Image_Two"><br> <input type="checkbox" name=Image[] value="Image_Three"> <img src=".gif" name="Image_Two"><br> <input type="checkbox" name=Image[] value="Image_four"> <img src=".gif" name="Image_One"><br> <input type="checkbox" name=Image[] value="Image_five"> <img src=".gif" name="Image_Two"><br> <input type="checkbox" name=Image[] value="Image_six"> <img src=".gif" name="Image_Two"><br> <input type="submit" value="submit"> </form> </body> </html>

    php script: submit_information.php

    <?php session_start(); session_register("Image");

    $count = count($Image); for ($i=0; $i<$count; $i++) { echo $Image[$i]; }

    //I also tried that /*foreach ($Image as $i=> $Img) { $Img == $Image[$i]; echo $Img; }*/

    ?>

    --------------------------------- With Yahoo! Mail you can get a bigger mailbox -- choose a size that fits your needs

    attached mail follows:


    You should have session_start(); on every page that you want to hold the session.

    The way I would do what you are trying to achieve is go the $_SUPERGLOBALS way..

    on the submit_information.php page:

    <?php session_start(); $_SESSION['image'] = $_POST['image'];

    foreach($_SESSION['image'] as $foo){ echo $foo . "<br>\n"; } ?>

    Also, another good way of debugging etc is to use the print_r() function (http://www.php.net/print_r)

    If you do :

    <pre><?php print_r($_SESSION);?></pre>

    This produces a nice formatted look at the the session arrays/structures - same goes for all arrays.

    Hope that helps,

    Craig

    "Laurence" <lt1115muyahoo.co.uk> wrote in message news:20021129125851.33325.qmailweb14505.mail.yahoo.com... > > hello everyone, > > I'm trying to get some images value from a checkbox putting them in a session to preserve the data. The array works perfectly without the session_start() and session_register. > > can anyone help? > > html script > > <html> > <head> > <title></title> > </head> > > <body> > <form action="submit_information.php" method="post"> > <input type="checkbox" name=Image[] value="Image_One"> > <img src=".gif" name="Image_One"><br> > <input type="checkbox" name=Image[] value="Image_Two"> > <img src=".gif" name="Image_Two"><br> > <input type="checkbox" name=Image[] value="Image_Three"> > <img src=".gif" name="Image_Two"><br> > <input type="checkbox" name=Image[] value="Image_four"> > <img src=".gif" name="Image_One"><br> > <input type="checkbox" name=Image[] value="Image_five"> > <img src=".gif" name="Image_Two"><br> > <input type="checkbox" name=Image[] value="Image_six"> > <img src=".gif" name="Image_Two"><br> > <input type="submit" value="submit"> > </form> > </body> > </html> > > php script: submit_information.php > > <?php > session_start(); > session_register("Image"); > > $count = count($Image); > for ($i=0; $i<$count; $i++) > { > echo $Image[$i]; > } > > //I also tried that > /*foreach ($Image as $i=> $Img) > { > $Img == $Image[$i]; > echo $Img; > }*/ > > ?> > > > > > --------------------------------- > With Yahoo! Mail you can get a bigger mailbox -- choose a size that fits your needs >

    attached mail follows:


    Files are attached..

    Craig

    "Craig" <craigphirus.com> wrote in message news:20021129133320.169.qmailpb1.pair.com... > You should have session_start(); on every page that you want to hold the > session. > > The way I would do what you are trying to achieve is go the $_SUPERGLOBALS > way.. > > on the submit_information.php page: > > <?php > session_start(); > $_SESSION['image'] = $_POST['image']; > > foreach($_SESSION['image'] as $foo){ > echo $foo . "<br>\n"; > } > ?> > > Also, another good way of debugging etc is to use the print_r() function > (http://www.php.net/print_r) > > If you do : > > <pre><?php print_r($_SESSION);?></pre> > > This produces a nice formatted look at the the session arrays/structures - > same goes for all arrays. > > Hope that helps, > > Craig > > > "Laurence" <lt1115muyahoo.co.uk> wrote in message > news:20021129125851.33325.qmailweb14505.mail.yahoo.com... > > > > hello everyone, > > > > I'm trying to get some images value from a checkbox putting them in a > session to preserve the data. The array works perfectly without the > session_start() and session_register. > > > > can anyone help? > > > > html script > > > > <html> > > <head> > > <title></title> > > </head> > > > > <body> > > <form action="submit_information.php" method="post"> > > <input type="checkbox" name=Image[] value="Image_One"> > > <img src=".gif" name="Image_One"><br> > > <input type="checkbox" name=Image[] value="Image_Two"> > > <img src=".gif" name="Image_Two"><br> > > <input type="checkbox" name=Image[] value="Image_Three"> > > <img src=".gif" name="Image_Two"><br> > > <input type="checkbox" name=Image[] value="Image_four"> > > <img src=".gif" name="Image_One"><br> > > <input type="checkbox" name=Image[] value="Image_five"> > > <img src=".gif" name="Image_Two"><br> > > <input type="checkbox" name=Image[] value="Image_six"> > > <img src=".gif" name="Image_Two"><br> > > <input type="submit" value="submit"> > > </form> > > </body> > > </html> > > > > php script: submit_information.php > > > > <?php > > session_start(); > > session_register("Image"); > > > > $count = count($Image); > > for ($i=0; $i<$count; $i++) > > { > > echo $Image[$i]; > > } > > > > //I also tried that > > /*foreach ($Image as $i=> $Img) > > { > > $Img == $Image[$i]; > > echo $Img; > > }*/ > > > > ?> > > > > > > > > > > --------------------------------- > > With Yahoo! Mail you can get a bigger mailbox -- choose a size that fits > your needs > > > >

    begin 666 submit_information.php M/#]P:' -"T*"7-E<W-I;VY?<W1A<G0H*3L-"T*"21?4T534TE/3ELG:6UA M9V4G72 ]("1?4$]35%LG26UA9V4G73L-"T*"69O<F5A8VH)%]315-324]. M6R=I;6%G92==(&%S("1F;V\I>PT*#0H)"65C:&\)&9O;R N("(\8G(^7&XB M.PT*#0H)?0T*#0H_/T*/'!R93X-"D\/W!H<"!P<FEN=%]R*"1?4T534TE/ .3BD[(#\^#0H\+W!R93X` ` end

    begin 666 index.html M/&AT;6P^#0H\:&5A9#X-"CQT:71L93X\+W1I=&QE/T*/"]H96%D/T*#0H\ M8F]D>3X-"D\9F]R;2!A8W1I;VX](G-U8FUI=%]I;F9O<FUA=&EO;BYP:' B M(&UE=&AO9#TB<&]S="(^#0H)"2!);6%G95]/;F4\:6YP=70='EP93TB8VAE M8VMB;WB(&YA;64]26UA9V5;72!V86QU93TB26UA9V5?3VYE(CX\8G(^#0H) M"2!);6%G95]4=V\\:6YP=70='EP93TB8VAE8VMB;WB(&YA;64]26UA9V5; M72!V86QU93TB26UA9V5?5'=O(CX\8G(^#0H)"2!);6%G95]4:')E93QI;G!U M="!T>7!E/2)C:&5C:V)O>"(;F%M93U);6%G95M=('9A;'5E/2));6%G95]4 M:')E92(^/&)R/T*"0D26UA9V5?9F]U<CQI;G!U="!T>7!E/2)C:&5C:V)O M>"(;F%M93U);6%G95M=('9A;'5E/2));6%G95]F;W5R(CX\8G(^#0H)"2!) M;6%G95]F:79E/&EN<'5T('1Y<&4](F-H96-K8F]X(B!N86UE/4EM86=E6UT M=F%L=64](DEM86=E7V9I=F4B/CQB<CX-"D)($EM86=E7W-I>#QI;G!U="!T M>7!E/2)C:&5C:V)O>"(;F%M93U);6%G95M=('9A;'5E/2));6%G95]S:7B M/CQB<CX-"D)(#QI;G!U="!T>7!E/2)S=6)M:70B('9A;'5E/2)S=6)M:70B ?/T*"3PO9F]R;3X-"CPO8F]D>3X-"CPO:'1M;#X-"`` ` end

    attached mail follows:


    Are you on PHP >= 4.1 ?

    Try this:

    <? session_start(); print_r($_POST['Image']); // should print out your //checkbox array

    $_SESSION['Image'] = $_POST['Image']; // instead of session register print_r($_SESSION['Image']); // should print out your // checkbox array from the session

    ?>

    This should test if a) $_POST['Image'] is being populated b) $_SESSION['Image'] is being populated

    Then, to do what you were trying to achieve:

    <? session_start(); $_SESSION['Image'] = $_POST['Image'];

    foreach($_SESSION['Image'] as $key => $val) { echo $val; }

    // OR //

    $i = 0; while($i < count($_SESSION['Image'])) { echo $Image[$i]; $i++; } ?>

    Justin

    on 29/11/02 11:58 PM, Laurence (lt1115muyahoo.co.uk) wrote:

    > > hello everyone, > > I'm trying to get some images value from a checkbox putting them in a session > to preserve the data. The array works perfectly without the session_start() > and session_register. > > can anyone help? > > html script > > <html> > <head> > <title></title> > </head> > > <body> > <form action="submit_information.php" method="post"> > <input type="checkbox" name=Image[] value="Image_One"> > <img src=".gif" name="Image_One"><br> > <input type="checkbox" name=Image[] value="Image_Two"> > <img src=".gif" name="Image_Two"><br> > <input type="checkbox" name=Image[] value="Image_Three"> > <img src=".gif" name="Image_Two"><br> > <input type="checkbox" name=Image[] value="Image_four"> > <img src=".gif" name="Image_One"><br> > <input type="checkbox" name=Image[] value="Image_five"> > <img src=".gif" name="Image_Two"><br> > <input type="checkbox" name=Image[] value="Image_six"> > <img src=".gif" name="Image_Two"><br> > <input type="submit" value="submit"> > </form> > </body> > </html> > > php script: submit_information.php > > <?php > session_start(); > session_register("Image"); > > $count = count($Image); > for ($i=0; $i<$count; $i++) > { > echo $Image[$i]; > } > > //I also tried that > /*foreach ($Image as $i=> $Img) > { > $Img == $Image[$i]; > echo $Img; > }*/ > > ?> > > > > > --------------------------------- > With Yahoo! Mail you can get a bigger mailbox -- choose a size that fits your > needs >

    Justin French -------------------- http://Indent.com.au Web Development & Graphic Design --------------------

    attached mail follows:


    Hello!

    I would like to know, Who made the first step to start programming PHP? So who is the father of PHP. Can anyone give me a link to proof it?

    --
    =|-------+-------|=
    Heikki Kniivilä
    heikkikkheikkikk.homelinux.com
    http://heikkikk.homelinux.com
    

    attached mail follows:


    hi, how about the manual?

    http://www.php.net/manual/en/history.php#history.php

    :)

    Regards, khalid

    _________________________________________________________________ Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail

    attached mail follows:


    Maybe if you're lucky, "the father of PHP" will reply to you. :)

    heikkikk wrote: > Hello! > > I would like to know, Who made the first step to start programming PHP? > So who is the father of PHP. > Can anyone give me a link to proof it? > > > > -- > =|-------+-------|= > Heikki Kniivilä > heikkikkheikkikk.homelinux.com > http://heikkikk.homelinux.com > > >

    -- 
    By-Tor.com
    It's all about the Rush
    http://www.by-tor.com
    

    attached mail follows:


    In article <F36LobkW2U49MQ19WSQ00027d95hotmail.com>, khalid_karyhotmail.com (Khalid El-Kary) wrote:

    > http://www.php.net/manual/en/history.php#history.php

    First public announcement of PHP by Rasmus: <http://groups.google.com/groups?selm=3r7pgp%24aa1%40ionews.io.org>

    -- 
    CC
    

    attached mail follows:


    Not to hard to find

    http://www.php.net/manual/en/history.php

    ~Tim

    "Heikkikk" <heikkikkheikkikk.homelinux.com> wrote in message news:20021129140758.13406.qmailpb1.pair.com... > Hello! > > I would like to know, Who made the first step to start programming PHP? > So who is the father of PHP. > Can anyone give me a link to proof it? > > > > -- > =|-------+-------|= > Heikki Kniivilä > heikkikkheikkikk.homelinux.com > http://heikkikk.homelinux.com > >

    attached mail follows:


    I have trouble using upload scripts - none of them work on my current config. I'vq got php 4.2.3 and global registerd = off. The problem is that the script doesnt send the variable $_FILES['my_file'] as it should. I can only upload if i hard code the filename into the script.

    OS: OS X 10.2 PHP: PHP 4.2.3 MYSQL: 3.23.51

    // the script i've tried, it works with older versions av php.

    <?php // Programmerer: Kim aka astrox // Mail: kimhtmlhjelp.no // Dato: 19.04.2002 // Hjemmeisde: www.htmlhjelp.no ?>

    <h3>Bilde upload</h3>

    Dette scriptet uploader bilder og bare bilder!<br> Dvs.. *.jpg, *.gif og *.png<br><br>

    <?php #Config

    $MAX_FILE_SIZE = $_POST['MAX_FILE_SIZE']; $bilde_fil = $_FILES['bilde_fil']; // HTTP_POST_FILES $nyttnavn = $_POST['nyttnavn']; $ending = $_POST['ending']; $Upload = $_POST['Upload'];

    echo is_array($HTTP_POST_FILES['bilde_fil']);

    print_r($bilde_fil);

    print $bilde_fil;

    $path="upload"; //Mappa som bildene skal havne i (husk den siste '/')

    #Ikke rediger under her hvis du ikke vet hva du driver med :) if ($bilde_fil && $nyttnavn){ $ok = 1;

    if (is_file($path.$nyttnavn.$ending)){ print "<b>Sorry</b>, fila eksisterer allerede, finn p et nytt navn.<br>"; $ok = 0; } if (preg_match("/^[\/\\\.]/", $nyttnavn)){ print "<b>Sorry</b>, filnavnet kan ikke begynne ned: '.', '/' eller '\'<br>"; $ok = 0; } if (!($ending == ".jpg" || $ending == ".gif" || $ending == ".png")){ print "<b>Sorry</b>, ingen triksing med filendingen ($ending) takk!<br>"; $ok = 0; } print "<br>"; }

    if ($ok){ $res = copy($bilde_fil, $path."/".$nyttnavn.$ending); print ($res)?"<b>Ferdig</b>, uploadet ".$nyttnavn.$ending."!<br>":"<b>Sorry</b>, Kunne ikke uploade.<br>"; print "<br>"; } ?>

    <form name="formen" action="upload.php" method="post" enctype="multipart/form-data"> <input type="hidden" name="MAX_FILE_SIZE" value="1000000">

    Bilde: <input type="file" name="bilde_fil"><br> Hva skal fila hete p servern: <input type="text" name="nyttnavn"> <select name="ending"> <option>.jpg</option> <option>.png</option> <option>.gif</option> </select> <br><br><input type="submit" value="Upload"> </form>

    attached mail follows:


    Hi Magnus,

    Your problem was you weren't using the correct part of the $_FILES array when using copy();

    Cut and Past This:

    if ($ok){ $res = copy($bilde_fil[tmp_name], $path."/".$nyttnavn.$ending); print ($res)?"<b>Ferdig</b>, uploadet ".$nyttnavn.$ending."!<br>":"<b>Sorry</b>, Kunne ikke uploade.<br>"; print "<br>"; } ?>

    The Important bit is the "$bilde_fil[tmp_name]" bit. This means it's copying the file from the temporary location on the server to your chosen location.

    Also, as a side note, replace this too:

    $MAX_FILE_SIZE = 1000000; $bilde_fil = $_FILES['bilde_fil']; // HTTP_POST_FILES $nyttnavn = $_POST['nyttnavn']; $ending = $_POST['ending'];

    if($bilde_fil[size] > $MAX_FILE_SIZE) { die("<b>Sorry</b>, Kunne ikke uploade.<br>"); }

    $path="upload"; //Mappa som bildene skal havne i (husk den siste '/')

    Don't set $MAX_FILE_SIZE using $_POST variables for security reasons - someone could very easily alter it in the HTML file!!!

    Beth Gore

    magnus nilsson wrote:

    > > > I have trouble using upload scripts - none of them work on my current > config. I'vq got php 4.2.3 and global registerd = off. The problem is > that the script doesnt send the variable $_FILES['my_file'] as it > should. I can only upload if i hard code the filename into the script.

    attached mail follows:


    It works, partially. I can upload the file, but it's named "array".

    On fredag, nov 29, 2002, at 16:28 Europe/Stockholm, Beth Gore wrote:

    > Hi Magnus, > > Your problem was you weren't using the correct part of the $_FILES > array when using copy(); > > > Cut and Past This: > > > if ($ok){ > $res = copy($bilde_fil[tmp_name], $path."/".$nyttnavn.$ending); > print ($res)?"<b>Ferdig</b>, uploadet > ".$nyttnavn.$ending."!<br>":"<b>Sorry</b>, Kunne ikke uploade.<br>"; > print "<br>"; > } > ?> > > > The Important bit is the "$bilde_fil[tmp_name]" bit. This means it's > copying the file from the temporary location on the server to your > chosen location. > > Also, as a side note, replace this too: > > > $MAX_FILE_SIZE = 1000000; > $bilde_fil = $_FILES['bilde_fil']; // HTTP_POST_FILES > $nyttnavn = $_POST['nyttnavn']; > $ending = $_POST['ending']; > > if($bilde_fil[size] > $MAX_FILE_SIZE) > { > die("<b>Sorry</b>, Kunne ikke uploade.<br>"); > } > > $path="upload"; //Mappa som bildene skal havne i (husk den siste '/') > > > Don't set $MAX_FILE_SIZE using $_POST variables for security reasons - > someone could very easily alter it in the HTML file!!! > > Beth Gore > > > magnus nilsson wrote: > >> >> >> I have trouble using upload scripts - none of them work on my current >> config. I'vq got php 4.2.3 and global registerd = off. The problem is >> that the script doesnt send the variable $_FILES['my_file'] as it >> should. I can only upload if i hard code the filename into the >> script. > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

    attached mail follows:


    Tom Rogers wrote:

    >Hi, > >Friday, November 29, 2002, 4:58:02 PM, you wrote: >GS> I was just going through the archive. Seems this comes up enough for me >GS> to think I have something wrong. >GS> A simplistic code flow of events... >GS> <?php >GS> session_start(); > >GS> // user successfully logs in, set a session variable >GS> $_SESSION['user_id']; > >GS> // when the user logs out, destroy session and redirect to top >GS> $_SESSION = array(); >GS> setcookie(session_name(), '', time() - 3600); >GS> session_destroy(); > >GS> header('location: back_to_top'); > >?>> > >GS> Ok, so when the user logs in, a session id is assigned to them. >GS> When they log out and are redirected to the beginning, the session id is >GS> the same (verified by the file name in /tmp and cookie manager in mozilla). >GS> My question is, even though the session contains no data after its >GS> destroyed, should the session id remain the same, after logging out, >GS> or should another be assigned when session_start() is called after the >GS> redirect??? > >The browser will send the old cookie and as the name is probably the same as the >the old session it will get used again, or at least I think that is what is >happening :) >This should not be a problem as the data associated with the old session is >gone. > If that is the case, then the setcookie() call to destroy the clien't cookie probably isn't neccessary.

    >If you close the browser and start a fresh one you will get a new session id. > > >

    -- 
    Gerard Samuel
    http://www.trini0.org:81/
    http://dev.trini0.org:81/
    

    attached mail follows:


    Hi,

    I have never bothered with the cookie, I only delete the server side info.

    -- 
    regards,
    Tom
    

    attached mail follows:


    C.F. Scheidecker Antunes wrote:

    >The problem is that I do not want and cannot have my message headers with a From: ApacheLocalHost as this copy bellow shows: > >I've changed the header variable and put a From in it so it does displays the right FROM: address as bellow. But as you can see, the Received: (from apachelocalhost) by servername, etc is there so the spam filters filter it. > >Return-Path: <apache> >Received: (from apachelocalhost) > by ns1.nando.net (8.11.2/8.11.2) id gASLtQM27458; > Thu, 28 Nov 2002 19:55:26 -0200 >Date: Thu, 28 Nov 2002 19:55:26 -0200 >Message-Id: <200211282155.gASLtQM27458ns1.dataware-bi.net> >To: nandoantunes.eti.br >Subject: Order # 603 (511066220021128194052) >Content-Type: text/html >From: nandoantunes.eti.br >Reply-To: nandoantunes.eti.br >X-Mailer: PHP/ > >My php.ini has an smtp entry but no sendmail is running on the local machine. Do I have to have one running? I wish I did not have to do it. Any other way to fix this issue? > I have not seen any replies to this, I don't think I can see exactly what is wrong but I may be able to provide some pointers for you. I only use the inbuilt mail() function where I do have sendmail running (I thought it was required). The "From:" that you set in the mail() function is coming out correctly. The "received" header showing "apachelocalhost" is the first in the list of computers that your email is going through.

    It is the webserver that is actually sending the email. On RH7.2 Apache runs as the user "apache" so that is correct. What I cannot understand is that the webserver/computer cannot find its own name (so it comes out as "localhost"). What have you set the hostname of your computer to? It sounds as though it is not set. Have you set the "ServerName" parameter in httpd.conf (leave it commented out)?

    What have you set the sendmail_path in php.ini to? I think that it is your computer hostname that is causing the problem.

    HTH Chris

    attached mail follows:


    Kim wrote:

    >when i using mssql_connect() function,that's show "Fatal error: Call to >undefined function: mssql_connect()" on php page,i don't know why that it >is! >php 4.2.3 >sql server 2000 >apache 1.3.19 >windows 2000 pro > >"php.ini" had configurated ok. > This error message means that the function is not compiled into your php. I suggest putting a phpinfo.php file in and looking at it to see whether mssql support is actually there. The file can be as simple as: <?php phpinfo(); ?> It could be that the php.ini you altered is not where php expects it to be. Phpinfo will show the location for php.ini as the "--with-config-file-path" configure command.

    HTH Chris

    attached mail follows:


    Hi Liljim,

    thanks very much, with the 'e' modifier and some quote-fixes it works well !

    Dieter

    "Liljim" <liljimliljim.co.uk> schrieb im Newsbeitrag news:20021128162237.12667.qmailpb1.pair.com... > Hi Dieter, > > You need to use the 'e' modifier as well as 'is' in your pattern. Have a > look in the manual, here: > > http://www.php.net/manual/en/pcre.pattern.modifiers.php > > "If this modifier is set, preg_replace() does normal substitution of > backreferences in the replacement string, evaluates it as PHP code, and uses > the result for replacing the search string." > > Also look here: > http://www.php.net/manual/en/function.preg-replace.php > > And check the "Example 2. Using /e modifier" part. > > Hope that helps ;) > > James > > > "Dieter Koch" <dieter.kochlhsystems.com> wrote in message > news:20021128122926.82026.qmailpb1.pair.com... > > Hi to all the PHP-Fans out there, > > > > i have a syntax-problem with the folowing preg_replace command: > > > > $returnString = preg_replace("/(href=\")(.+?)(\")/is", > > preg_quote("\\1".ebLinkEncode(."\\2".)."\\3"), $returnString); > > > > i'm trying to call my own function within a preg_replace function and it > > won't work. > > any ideas ? it seems to me, that the quoting is incorrect, but i'm not > > shure, why it is incorrect, > > especially because i use preg_quote() ... > > > > thanks in advance for some hints ! > > > > best regards > > dieter.kochlhsystems.com > > > > > > > > > > > >

    attached mail follows:


    Hi,

    I'm trying to connect to a https site to get a file.

    The target site replies to me: "Unable to service this URL without parent cache."

    Is there someone who knows what that means?

    Thanks,

    Greg.

    attached mail follows:


    Is this related to PHP? Or are you getting the error from your browser? In that case, are you using IE? If so, it might be a bug with IE--I've seen it discussed in a few mailing lists.

    Otherwise, it might indicate that the web server you're connecting to is not configured properly.

    Marco

    -- 
    ------------
    php|architect - The magazine for PHP Professionals
    The monthly worldwide magazine dedicated to PHP programmers
    

    Come visit us at http://www.phparch.com!

    attached mail follows:


    Hi,

    I'm trying to connect to a https site to get a file.

    The target site replies to me: "Unable to service this URL without parent cache."

    Is there someone who knows what that means?

    Thanks,

    Greg.

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

    attached mail follows:


    i'm using PHP to connect to the server. i need to get a file, parse it, include the datas in mysql and then display an html page with a report...

    -----Message d'origine----- De : Marco Tabini [mailto:marcotinicode.com] Envoyé : vendredi 29 novembre 2002 16:58 À : DUPUIS Grégoire BE/DGC Cc : PHP-General Objet : Re: [PHP] php and https

    Is this related to PHP? Or are you getting the error from your browser? In that case, are you using IE? If so, it might be a bug with IE--I've seen it discussed in a few mailing lists.

    Otherwise, it might indicate that the web server you're connecting to is not configured properly.

    Marco

    --
    ------------
    php|architect - The magazine for PHP Professionals
    The monthly worldwide magazine dedicated to PHP programmers
    

    Come visit us at http://www.phparch.com!

    attached mail follows:


    I think you better describe your question here and wait for the world to answer.

    --
    Maxim Maletsky
    maximphp.net
    

    "Karl James" <karl.jamesverizon.net> wrote... :

    > Hello guys > > Happy thanksgiving!!! > > My question is > I'm Trying to apply this code to what I have done already on my site > http://robouk.mchost.com/tuts/tutorial.php?tutorial=login1 > > > my site is this. > http://www.ultimatefootballleague.com > <http://www.ultimatefootballleague.com/> > > Im trying to do with login and if login is good > It takes you to the team page. > > But I have some questions on this and need to talk to someone online > If possible, I can meet via MSN and IRC > > Please email if interested in helping. > >

    attached mail follows:


    How would you know about a file on someone's system before it was implicitly sent you by user? Take a look at JavaScript, but I doubt there will be a "sure" solution for it. Nothing is "sure" with JavaScript except for it's cross-browser incompatibility :)

    --
    Maxim Maletsky
    maximphp.net
    

    Research and Development <randdealante.com> wrote... :

    > Is it possible to get the creation date of a file that is going to be > uploaded? I saw a function that returns the file creation date once on > the server, but is it possible to get that information from a file that > is not yet on the server? > > Thanks in advance. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Try this:

    http://www.sourceforge.net/projects/phptriad and dowload there "phptriad". It is a simplified distribution of PHP.

    Also, try reading the articles on the web. You might want to start from PHP Beginner (www.phpbeginner.com). There are also some installtion tutorials for you.

    --
    Maxim Maletsky
    maximphp.net
    

    "Ted Frank" <tedfrank24hotmail.com> wrote... :

    > Hello, > > I am trying to make my free home page and my friend told me to download the > php because it is for the web and i want to make a web page. so i downloaded > the php with the flash plugin and i put it on my desktop and nothing showed > up - i just want to make the free home page but the php does not work - i > double click and noting happens > > i have the windows 95 with internet exploerer with a pentium 100 drive > > what do i do? > > Ted > > _________________________________________________________________ > Add photos to your e-mail with MSN 8. Get 2 months FREE*. > http://join.msn.com/?page=features/featuredemail > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Hi,

    I'm building a multiuser system with PHP. It appears that session data is getting overwritten with the latest users information. The site is hosted remotly with a virtual host. The problem only seems to occur to people inside our building (i.e. two people here login to the system with seperate logins).

    Example:

    User 1 logs in, session data is:

    UserID = 1 DescriptionEntered = No QuestionsVisible = No QuestionsRanked = No

    User 2 logs in, session data is:

    UserID = 2 DescriptionEntered = No QuestionsVisible = No QuestionsRanked = No

    Once User 1 refreshes the page or goes to another page User 2's information shows up. So it appears that the last login is being set for the session.

    I've gotten my host to look into this. From their end they login with the 2 ids and the session data stays completly seperate.

    Our building accesses the internet through a DSL connection. Would that cause a problem?

    Any ideas are greatly appreciated.

    Anson

    attached mail follows:


    Hello,

    About the System of my company : Server A : imap server ( come from redhat 6.2 ) Server B : Web server ( redhat system 7.2 ) + IMP ( http://horde.org/imp )

    How can I enable the quota function with imap server by this php config ? if (!function_exists('imp_show_quota')) { function imp_show_quota ($imp) { $imap_admin = $imp['user']; $passwd_array = posix_getpwnam($imap_admin); $homedir = split("/", $passwd_array['dir']); $realname = split(",", $passwd_array['gecos']);

    $quota_html = '<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td class="item"><table border="0" cellspacing="0" cellpadding="0" width="100%"><tr>'; $quota_html .= '<td align="left" class="header">Login: ' . $realname[0] . " (" . $imap_admin . ")" . '</td>';

    $junk = exec("sudo /usr/bin/quota -u $imap_admin | grep /dev/md1", $quota_data,$return_code); if ($return_code == 0 && count($quota_data) == 1) { $splitted = split("[[:blank:]]+", trim($quota_data[0])); $taken = $splitted[1] / 1000 ; $total = $splitted[2] / 1000 ;

    $percent = $taken * 100 / $total ; if ($percent >= 90) { $color = '#FF0000'; } elseif ($percent >= 80) { $color = '#FCE30D'; } else { $color = '#339933'; } $quota_html .= '<td align="center" class="header">'; $quota_html .= sprintf("<font size=-2>Quota on /%s: %.1fMB/%.1fMB (%.1f%%)</font>", $homedir[1], $taken, $total, $percent); } else { $quota_html .= '<td align="center" class="header">'; $quota_html .= "Quota not available"; } $quota_html .= '</td><td width="30" class="header" align="right"><font size="-3">0%</font></td><td width="200" class="header">'; $quota_html .= '<table width="100%"><tr><td bgcolor="#ccccff"><div style="height:6px; width:'. sprintf("%.1f%%", $percent). '; font-size:3px; background-color:'.$color.'">'; $quota_html .= '</div></td></tr></table></td><td width="30" class="header" align="left"><font size="-3">100%</font></td></tr></table></td></tr></table>'; return $quota_html; } }

    And I want the result similar with http://www.ita.org.mo/~edward/imp/screenshot.gif

    Thank for your help !

    Edward.

    attached mail follows:


    Is there a way to convert a date 2002-11-29 00:00:00:000to 29 November 2002 .

    Sturle

    attached mail follows:


    > Is there a way to convert a date 2002-11-29 00:00:00:000to 29 November > 2002

    Yes. Try strtotime() and date() in PHP, or break the string apart. If this date is coming from MySQL, then look at the DATE_FORMAT() function that you can use in your query to format it.

    ---John Holmes...

    attached mail follows:


    Can't figure out how to get at the properties of an object which itself is a property of another object. In sample code below neither the assignment of $mystring produces an error.

    <?php

    class Obj1 { function Obj1 ($string) { $this->string = $string; } }

    class Obj2 { function Obj1 ($obj) { $this->obj = $obj; } var $mystring = $this->obj->string; }

    $o1 = New Obj1("hello"); $o2 = New Obj2($o1); print "\$o2->mystring = $o2->mystring<br>"

    ?>

    -- 
    Randall Perry
    sysTame
    

    Xserve Web Hosting/Co-location Website Development/Promotion Mac Consulting/Sales

    http://www.systame.com/

    attached mail follows:


    To the best of my knowledge, there is no way to do this with the mail function. However, I check for bounces using Perl and a cron. I don't see why you couldn't use php to do the same thing though.

    Ade Smith wrote: > Hello > > Is it possible to detect with PHP whether an email sent using the PHP > 'mail' function has bounced back or has not been delivered? > > I currently all ready check the email address using the 'ereg' function > before the mail function is called, but this only checks the format is > valid beforehand. > > Ade > >

    -- 
    By-Tor.com
    It's all about the Rush
    http://www.by-tor.com
    

    attached mail follows:


    attached mail follows:


    Hello,

    Does your imap server come from redhat ? If so, have you ever try IMP ( http://www.horde.org/imp ) and enable Quota function with imap server by using php code ?

    Would you mind to send me your solution ?

    Thank for your help !

    Edward.

    attached mail follows:


    I have a bit of code that uses sessions and stores session data in the database. Works flawlessly on FreeBSD 4.7/mySQL/PostgreSQL running php 4.2.3. When trying to run my code on Windows 2k with MSSQL and mySQL, its not working. The windows box is running php 4.1.2 (its a dev box). Here is the section on sessions from php.ini. Can anyone see anything wrong with this setup?? And also, can alternative means of storage be used under windows php??

    Thanks for any insight you may provide... -----------------------------------------------------

    [Session] ; Handler used to store/retrieve data. session.save_handler = files

    ; Argument passed to save_handler. In the case of files, this is the path ; where data files are stored. Note: Windows users have to change this ; variable in order to use PHP's session functions. session.save_path = c:\winnt\temp

    ; Whether to use cookies. session.use_cookies = 1

    ; Name of the session (used as cookie name). session.name = PHPSESSID

    ; Initialize session on request startup. session.auto_start = 0

    ; Lifetime in seconds of cookie or, if 0, until browser is restarted. session.cookie_lifetime = 0

    ; The path for which the cookie is valid. session.cookie_path = /

    ; The domain for which the cookie is valid. session.cookie_domain =

    ; Handler used to serialize data. php is the standard serializer of PHP. session.serialize_handler = php

    ; Percentual probability that the 'garbage collection' process is started ; on every session initialization. session.gc_probability = 1

    ; After this number of seconds, stored data will be seen as 'garbage' and ; cleaned up by the garbage collection process. session.gc_maxlifetime = 1440

    ; Check HTTP Referer to invalidate externally stored URLs containing ids. session.referer_check =

    ; How many bytes to read from the file. session.entropy_length = 0

    ; Specified here to create the session id. session.entropy_file =

    ;session.entropy_length = 16

    ;session.entropy_file = /dev/urandom

    ; Set to {nocache,private,public} to determine HTTP caching aspects. session.cache_limiter = nocache

    ; Document expires after n minutes. session.cache_expire = 180

    ; use transient sid support if enabled by compiling with --enable-trans-sid. session.use_trans_sid = 0

    url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"

    -- 
    Gerard Samuel
    http://www.trini0.org:81/
    http://dev.trini0.org:81/
    

    attached mail follows:


    At 11/28/2002 01:51 PM, Ernest E Vogelsinger wrote:

    > ><? > > $data = "mtype=XMLDOC&outfile=true"; > > $dataFile = > >"http://www.healthtvchannel.org/courses/pay/data/test.xml"; > > $fileSize = filesize($dataFile);

    Ah. It is a local file, I was just using an absolute reference for it.

    >However you do not need to know the size of the file to read it - simply >do it in chunks: > $dataFile = > "http://www.healthtvchannel.org/courses/pay/data/test.xml"; > $fp = fopen($dataFile, "rb"); > $strFile = null; > while ($chunk = fread($fp, 524288)) // 512 kB chunks modify as > needed > $strFile .= $chunk; > fclose($fp);

    Thanks. I'll definitely give that a try.

    --
    S. Keller
    UI Engineer
    The Health TV Channel, Inc.
    (a non - profit organization)
    3820 Lake Otis Pkwy.
    Anchorage, AK 99508
    907.770.6200 ext.220
    907.336.6205 (fax)
    Email: skellerhealthtvchannel.org
    Web: www.healthtvchannel.org
    

    attached mail follows:


    I'm trying to compile the YATS template system for PHP on Mac OS X. It compiles without problems (one warning actually, but that's not the problem I'm having), but it gives me a static library as an archive file, instead of a shared library which I can install into my PHP installation. I'm not a porting expert at all. Does anyone know how I should do this?

    My configuration: PHP 4.3 RC2, compiled from source Apache httpd 1.3.27, compiled from source Mac OS X 10.2.2

    Thanks, Adam Atlas

    attached mail follows:


    First, I'd like to say that I'm not asking for anyone to write a script... how would I go about checking a MySQL database of links to see if any are down?

    I've had some varying results with all the methods I've tried, so would like to see if anyone has a proven method for doing this.

    Thanks, Robert

    attached mail follows:


    fopen each link and see if it returns true or false (false meaning its down)

    Jason Reid jasonachost.ca

    --
    AC Host Canada
    www.achost.ca
    

    ----- Original Message ----- From: "Rob Packer" <robertnrc.net> To: <php-generallists.php.net> Sent: Friday, November 29, 2002 3:53 PM Subject: [PHP] Test links?

    > First, I'd like to say that I'm not asking for anyone to write a script... > how would I go about checking a MySQL database of links to see if any are > down? > > I've had some varying results with all the methods I've tried, so would like > to see if anyone has a proven method for doing this. > > Thanks, > Robert > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Marek,

    Thanks for your ideas, I was thinking in a complicated scheme using $fp = fopen ("php://stdin", $hexkeynumber) ... but I wasn't sure if that is better ...

    I think your solution is much neatier ... then I just have to compare the entered code with an id in the mysql database

    ----- Original Message ----- From: "Marek Kilimajer" <kilimajerwebglobe.sk> To: "PHP" <php-generallists.php.net> Sent: Friday, November 29, 2002 7:49 AM Subject: Re: [PHP] Is it possible to do this in PHP ? If it is then, how ?

    > In the browser it might look something like this: > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> > > <html> > <head> > <title>Pizza place</title> > <script> > function add(n) { > document.pizza.num.value=document.pizza.num.value + n; > if(document.pizza.num.value.length!=2) { > document.pizzaimage.src='blank.jpg'; > } else { > // alert("Pizza is " + document.pizza.num.value); > document.pizzaimage.src='show_image.php?img_id=' + > document.pizza.num.value; > } > } > > </script> > </head> > > <body> > <img src="blank.jpg" alt="" name="pizzaimage" id="pizzaimage" border="0"> > <form action="" name="pizza"> > <input type="text" name="num" onchange="checkimg(this.value)"> <input > type="button" value=" Clear " onclick="this.form.num.value=''; add('')"><br> > <input type="button" value=" 7 " accesskey="7" onclick="add('7')"> > <input type="button" value=" 8 " accesskey="8" onclick="add('8')"> > <input type="button" value=" 9 " accesskey="9" onclick="add('9')"> <br> > <input type="button" value=" 4 " accesskey="4" onclick="add('4')"> > <input type="button" value=" 5 " accesskey="5" onclick="add('5')"> > <input type="button" value=" 6 " accesskey="6" onclick="add('6')"> <br> > <input type="button" value=" 1 " accesskey="1" onclick="add('1')"> > <input type="button" value=" 2 " accesskey="2" onclick="add('2')"> > <input type="button" value=" 3 " accesskey="3" onclick="add('3')"> <br> > <input type="button" value=" 0 " accesskey="0" onclick="add('0')"> > <input type="submit" > value="&nbsp;&nbsp;&nbsp;&nbsp;Order&nbsp;&nbsp;&nbsp;&nbsp;"> <br> > </form> > > > </body> > </html> > > Additional information (size, weitht ...) can be provided in the image > Axis Computers wrote: > > >Thanks for replying, > > > >Now I know it's possible to do it, but I still don't know how can I develop > >such interface, I will do it in php and mysql, but I need a little guidance > >with the way to do it I just can't figure out how ... > > > >Thank you > > > >Ricardo Fitzgerald > > > > > >> > >> > > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >