OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
From: php-general-digest-helplists.php.net
Date: Mon Apr 08 2002 - 16:48:54 CDT

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

    php-general Digest 8 Apr 2002 21:48:54 -0000 Issue 1275

    Topics (messages 92016 through 92131):

    $php_self doesnt work in netscape like it should!
            92016 by: Maris Kalnins

    Expire Session Date Older than Me!
            92017 by: Anatole

    Question
            92018 by: Roman Duriancik
            92027 by: heinisch.creaction.de
            92031 by: Miguel Cruz
            92037 by: gaouzief
            92081 by: SHEETS,JASON (Non-HP-Boise,ex1)
            92083 by: Miguel Cruz
            92104 by: heinisch.creaction.de

    Re: some kind of "library loader"
            92019 by: Arpad Tamas

    Transfer Session Vars to different server
            92020 by: Chris
            92022 by: Markas
            92030 by: heinisch.creaction.de

    SELECT + PARSE ERROR
            92021 by: Jérome Moisy
            92023 by: Chris Kwasneski
            92024 by: RIVES Sergio
            92025 by: Nick Winfield
            92028 by: heinisch.creaction.de
            92029 by: Jérome Moisy

    Problems with libgd.so under linux
            92026 by: M Green
            92033 by: heinisch.creaction.de
            92070 by: M Green

    Re: sessions and passing variables
            92032 by: Michael Virnstein
            92051 by: rarmin

    Re: Adding "a" in "try.jpg"! Problems!
            92034 by: Michael Virnstein
            92036 by: Michael Virnstein
            92039 by: Michael Virnstein

    Re: MAC file upload
            92035 by: Erik Price
            92047 by: Rénald CASAGRAUDE
            92056 by: Rance Hall

    what's the best way to do redirect within PHP
            92038 by: Wo Chang
            92041 by: Jason Wong
            92042 by: Patrick Lynch
            92043 by: Rénald CASAGRAUDE
            92060 by: Wo Chang

    php and html image tag...
            92040 by: Jas
            92048 by: Michael Virnstein
            92052 by: Jas
            92062 by: JSheble

    Directory check
            92044 by: Hiroshi Ayukawa
            92050 by: Michael Virnstein
            92054 by: Rénald CASAGRAUDE
            92064 by: Maxim Maletsky
            92075 by: Jason Wong

    Re: Disabling bars on Browser
            92045 by: Erik Price

    site map function..
            92046 by: Kelly Meeks

    Re: newbie configuration question
            92049 by: Erik Price

    Re: nl2br returns <BR />? normality or a bug?
            92053 by: Brinkman, Theodore

    Re: Test for one bit set?
            92055 by: Brinkman, Theodore

    Array elements missing
            92057 by: Joshua E Minnie
            92105 by: Jason Wong

    Re: mod_php4
            92058 by: The Doctor

    Appending url to file name...
            92059 by: Jas
            92063 by: Erik Price
            92069 by: Jas
            92076 by: Erik Price
            92079 by: Jas
            92080 by: Miguel Cruz

    Adding Querystrings to links
            92061 by: mail.struempf.com
            92065 by: Rance Hall
            92066 by: Erik Price
            92082 by: Jordan K. Martin

    Besy way to "ban" a user?
            92067 by: Jeff Lewis
            92074 by: Miguel Cruz

    SSL needed for socket communication?
            92068 by: Erik Price
            92073 by: Miguel Cruz

    Re: difficulty in solving the unknown warning
            92071 by: Rick Emery

    Custom Error Handling
            92072 by: Adam Voigt

    how to check if e- mail sending did succeed?
            92077 by: andy
            92078 by: Miguel Cruz

    Re: Phone number validation
            92084 by: Jim Lucas [php]

    Re: counter for HIGH traffic site
            92085 by: Jim Lucas [php]
            92102 by: Adam Voigt
            92106 by: heinisch.creaction.de
            92113 by: SHEETS,JASON (Non-HP-Boise,ex1)

    Object Confusion
            92086 by: Robert J. Cissell
            92091 by: Rick Emery

    Assigning unique form names...
            92087 by: Jas
            92088 by: Kevin Stone
            92093 by: Erik Price
            92103 by: Jas
            92107 by: Erik Price
            92109 by: Jas
            92112 by: Kevin Stone
            92117 by: Jas
            92121 by: Rick Emery
            92123 by: Paul Roberts
            92124 by: Jas
            92126 by: Miguel Cruz
            92128 by: Jas

    Upload alert
            92089 by: Rodolfo Silva
            92090 by: Rick Emery
            92092 by: Miguel Cruz
            92095 by: Rance Hall
            92099 by: Miguel Cruz

    fwrite() - problems....
            92094 by: Phil Schwarzmann
            92096 by: Rick Emery
            92097 by: R'twick Niceorgaw
            92098 by: Miguel Cruz

    Build static with Apache 2.0.35
            92100 by: Marc Delisle

    Re: asking about exe file
            92101 by: bvr

    Re: Can I fopen() files in .htaccess protected directories?
            92108 by: Dalton Hunter

    getting the 'client' date and time for use in PHP scripts ??
            92110 by: David Eisenhart
            92111 by: Julio Nobrega Trabalhando
            92115 by: David Eisenhart

    HELP! Errors!
            92114 by: Georgie Casey
            92122 by: Kevin Stone

    mysql question
            92116 by: Julian
            92118 by: Rick Emery
            92119 by: Miguel Cruz
            92120 by: Jas
            92127 by: James E. Hicks III

    AS/400 data access
            92125 by: Rance Hall

    php_printer.dll
            92129 by: David Nash

    RE:[PHP] mysql question
            92130 by: Julian

    How can I persist a session ?
            92131 by: Mauricio Sthandier

    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:


    Hi guys!

    $php_self and $php_referrer doesnt work the same in IE and Netscape

    When opening a page with
    IE they return for example http://localhost/directroy/index.php
    but in Netscape Navigator - http://localhost/directory/

    Why?
    And how to solve this problem?

    Thanks

    attached mail follows:


    I'm having trouble with the Expire date - It's being set at sometime before
    I was born. Any idea on how to fix this?

    HTTP/1.1 200 OK
    Date: Mon, 08 Apr 2002 10:07:31 GMT
    Server: Apache/1.3.22 (Unix) PHP/4.1.2
    X-Powered-By: PHP/4.1.2
    Set-Cookie: sess=6fc0c08e2030124a8518aa5eeff034d3; path=/
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    Cache-Control: private, max-age=10800, pre-check=10800
    Last-Modified: Fri, 30 Nov 2001 04:33:06 GMT
    Connection: close
    Content-Type: text/html

    attached mail follows:


    How to convert or discover from IPadress country visitors on my web ?

    roman

    attached mail follows:


    At 08.04.2002 13:00, you wrote:
    >
    >How to convert or discover from IPadress country visitors on my web ?
    >
    >roman
    You have to make a DNSLOOKUP
    If you have a linux box (server setup) you can use
    system("nslookup -timeout=3 -retry=1 ".$value)
    where $value is the IP-Number. This gives you the
    "real" name of the server your client asked from.
    the you have to extract the national-code, and got your
    country, or org, mil, com

    HTH Oliver

    attached mail follows:


    On Mon, 8 Apr 2002, Roman Duriancik wrote:
    > How to convert or discover from IPadress country visitors on my web ?

    You need to use the 'whois' protocol. I am sure you can find sample code
    snippets around. First, look up the address at whois.arin.net. Then, if
    delegated to one of the regional registries (like RIPE or APNIC), look it
    up again there.

    While this is the most effective way, keep in mind that you still can't
    determine with 100% certainty what country an IP address is in.
    Multinational corporations, large ISPs with their own international
    backbones, etc., will in many cases give you false results.

    miguel

    attached mail follows:


    this class does just that:
    http://phpclasses.warmafrica.com/browse.html/package/514.html

    08/04/2002 13:49:44, heinischcreaction.de a écrit:

    >At 08.04.2002 13:00, you wrote:
    >>
    >>How to convert or discover from IPadress country visitors on my web ?
    >>
    >>roman
    >You have to make a DNSLOOKUP
    >If you have a linux box (server setup) you can use
    >system("nslookup -timeout=3 -retry=1 ".$value)
    >where $value is the IP-Number. This gives you the
    >"real" name of the server your client asked from.
    >the you have to extract the national-code, and got your
    >country, or org, mil, com
    >
    >HTH Oliver
    >
    >
    >--
    >PHP General Mailing List (http://www.php.net/)
    >To unsubscribe, visit: http://www.php.net/unsub.php
    >
    >
    >

    attached mail follows:


    Rather than executing a system utility you can just use the built in PHP
    functions.

    gethostbyaddr() - resolves an IP address into a hostname
    gethostbyname() - resolves hostname into an IP address

    More information is available in the PHP manual, you can access it online at
    http://www.php.net/manual

    Jason

    -----Original Message-----
    From: heinischcreaction.de [mailto:heinischcreaction.de]
    Sent: Monday, April 08, 2002 6:50 AM
    To: php-generallists.php.net
    Subject: Re: [PHP] Question

    At 08.04.2002 13:00, you wrote:
    >
    >How to convert or discover from IPadress country visitors on my web ?
    >
    >roman
    You have to make a DNSLOOKUP
    If you have a linux box (server setup) you can use
    system("nslookup -timeout=3 -retry=1 ".$value)
    where $value is the IP-Number. This gives you the
    "real" name of the server your client asked from.
    the you have to extract the national-code, and got your
    country, or org, mil, com

    HTH Oliver

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

    attached mail follows:


    How does that tell you where something is?

    Quick quiz, some obvious high-profile examples off the top of my head:

    netvigator.com ntlworld.com bigpond.net chello.com unicc.org

    miguel

    On Mon, 8 Apr 2002, SHEETS,JASON (Non-HP-Boise,ex1) wrote: > Rather than executing a system utility you can just use the built in PHP > functions. > > gethostbyaddr() - resolves an IP address into a hostname > gethostbyname() - resolves hostname into an IP address > > More information is available in the PHP manual, you can access it online at > http://www.php.net/manual > > Jason > > -----Original Message----- > From: heinischcreaction.de [mailto:heinischcreaction.de] > Sent: Monday, April 08, 2002 6:50 AM > To: php-generallists.php.net > Subject: Re: [PHP] Question > > > At 08.04.2002 13:00, you wrote: > > > >How to convert or discover from IPadress country visitors on my web ? > > > >roman > You have to make a DNSLOOKUP > If you have a linux box (server setup) you can use > system("nslookup -timeout=3 -retry=1 ".$value) > where $value is the IP-Number. This gives you the > "real" name of the server your client asked from. > the you have to extract the national-code, and got your > country, or org, mil, com > > HTH Oliver > > >

    attached mail follows:


    At 08.04.2002 11:33, you wrote: > >How does that tell you where something is? > >Quick quiz, some obvious high-profile examples off the top of my head: > > netvigator.com > ntlworld.com

    <snip> Ok, Ok I have to add more details to my mail. If you need more informations, after retrieving the IP you could visit the local NIC-database,(f.e. using snoopy (I like this tool ;-) ) ) and request detailed user informations. But then, you have to check out a lot of databases around the world, to get the location of the domains owner, and also have to do heavy programming, parsing the different informations. Also most of these databases limit the daily requests, so you´ll need some time to get these informations. Even if it is illegal to collect these informations automaticly (see according informations, onb these sites)

    But, maybe you could ask your clients from where they are?

    I hope NOW the question is solved to everyones satisfaction ;-) Oliver

    >On Mon, 8 Apr 2002, SHEETS,JASON (Non-HP-Boise,ex1) wrote: > > Rather than executing a system utility you can just use the built in PHP > > functions. > > > > gethostbyaddr() - resolves an IP address into a hostname > > gethostbyname() - resolves hostname into an IP address > > > > > > > >How to convert or discover from IPadress country visitors on my web ? > > > > > >roman > > You have to make a DNSLOOKUP > > If you have a linux box (server setup) you can use > > system("nslookup -timeout=3 -retry=1 ".$value) > > where $value is the IP-Number. This gives you the > > "real" name of the server your client asked from. > > the you have to extract the national-code, and got your > > country, or org, mil, com > > > > HTH Oliver > > > > > >

    attached mail follows:


    Hi Eric (and others who might help),

    Actually I haven't tried the custom error handler for "function or class definiton not found errors" because I read in the manual that the processing is continued after the "statement" where the error raised. I also thought of a little hacking in php's source, but I haven't got too much experience in c. Your idea looks fine to me, but I have one question. How do you determine in the precompiler that which functions or classes are really needed? On our system it highly depends on the actual run. The template parser parses the template file, finds our special tags, and creates the appropriate objects to get the data for the tags from them. These tags and classes are nested in each other. Now while I'm writing this I have a new idea. I don't know if it will suit your needs (nor mine yet), just a quick thought. Each template classes (which gives about 50% of the whole code) are derived from one main template class (it does the hard work). The main problem is that there are many object creations in all over the code, and they depend on the actual class or template tag. So I'm trying to find a common part of the code, where I can handle the missing class definition errors, or just start over some part of the processing when an error occurs. a template example might help to understand it better: <table ...> <xarticle> <tr><td ...> <xtitle><b>{xtext}<b></xtitle> </tr></td> </xarticle> </table> The tags starting with x are our template tags (<x...> and {x...}), and each container tag (<x..>...</x..>) has it's own handler class. In <xarticle>'s handler object <xtitle>'s handler is created, which will raise an error if there's no class definition yet. If catching the "class not found errors" would work I could set a "class not found" error signal in a global variable, load the needed class in the error handler. After the error handler finished, I could check if the error signal is set in the mentioned common code and if it is I could roll back all the processing of <xtitle> and start it over this time with the already included class definition. I can relatively easily find this common code, because of the ancestor main template class, what all other template classes extend.

    Because of the many roll backs this most likely wouldn't be faster than the original code was. To make things faster I could store some kind of cache for all the template files with the previously needed classes (I can get it with get_defined_classes()). This would work because the needed classes are mainly depend on the template in our system (especialy the template classes). Next time when a page is requested with the same template, I could just read the cache and include all the previously needed classes.

    So the sollution in general: find a common code where you can roll back to some point where the line that caused the error can be executed again. I know my example was a little complicated, but I hope you can understand it. Let me know if something isn't clear.

    But now I checked if I can catch the "Cannot instantiate non-existent class" error, and unfortunatelly not :((

    For the developers of php: Is it hard to make this feature to work? I would really appreciate it, and would be very very happy :))

    Thanks and greetings, Arpi

    > I have had a similar idea. I also tried the custom error handler > aproach and it didn't work here either. I have set the project > aside that I was thinking about it for but I do have some ideas > that would help and may be able to contribute. I wasn't even able > to get php to call my custom error handler for function not found > errors. How did you do that? Was there anything useful in the > context argument? My guess is that to get this aproach to work > would require hacking the code to php itself but the hack wouldn't > be very major. However I do have an alternate plan that has been > waiting for me to get around to building it is a simple parser that > will read a php file and get the required functions and classes and > then pre build a library file for just that page. The parsing > shouldn't be that dificult as all function calls begin with 'func(' > and for classes checking for 'new classname' or 'classname::' would > give me a list of all items that need to be checked for. Then > simply build (from the source) a list of all builtin php functions > and allow those and check for declarations of inline functions and > classes while parsing and remove those. That would leave a list of > functions and classes that are external. Then build a database of > classes and functions either as a real database or simple an index > of the files that contain each resource. I don't think it would be > too hard. The next step would be to make a publicly available > archive of functions and classes that fit into this index. Or to > build it into pear. > > Please keep in touch with me on this issue. Feel free to email me > off list if you want. > > Eric

    attached mail follows:


    Hi,

    I have two servers with Apache PHP - carrying out different tasks.

    However, I have got a task that requires one application to use both servers. One of the units holds a bunch of session vars - which I would like to transfer to the other unit, when scripts on this second unit are called.

    What is the best way to do this?

    Clearly, I don't want to do this as a list of vars in the URL - some of the vars are sensitive.

    I would appreciate any comments. Chris

    attached mail follows:


    If you store your session vars in database, there will be no problem with retrieving sessions vars... You even can use native php4 functions for handling sessions, storing them in DB... Look in php manual for session_set_save_handler() function, or write your completely own code for db sessions.

    P.S. By the way, anyone knows, is there possible to get access to other sessions' session variables, I mean to the variables, which are stored during other sessions, for instance, in order to find out, how many user are currently browsing my site. If I stored my sesss vars in DB, there wouldn't be any problem with this, but I store them using default php4 functions (in tmp dir in files and so on)...

    "Chris" <candrewoxspring.com> wrote in message news:20020408121305.262.qmailpb1.pair.com... > Hi, > > I have two servers with Apache PHP - carrying out different tasks. > > However, I have got a task that requires one application to use both > servers. One of the units holds a bunch of session vars - which I would like > to transfer to the other unit, when scripts on this second unit are called. > > What is the best way to do this? > > Clearly, I don't want to do this as a list of vars in the URL - some of the > vars are sensitive. > > I would appreciate any comments. > Chris > >

    attached mail follows:


    At 08.04.2002 13:12, you wrote: >Hi, > >I have two servers with Apache PHP - carrying out different tasks. > >However, I have got a task that requires one application to use both >servers. One of the units holds a bunch of session vars - which I would like >to transfer to the other unit, when scripts on this second unit are called. > >What is the best way to do this? > >Clearly, I don't want to do this as a list of vars in the URL - some of the >vars are sensitive. > >I would appreciate any comments. >Chris I hope both machines are linux, unix the scp-command (secure copy) will be your friend. So you save your vars in a file, scp this file from server1 to server2 and read the file, if it appears and is the correct one, read it in your script on the server2. To learn more about scp, see "man scp" HTH Oliver

    attached mail follows:


    Hy,

    I try to do a SELECT but when I test my code I Have a parse error. If someone can explain to me why.

    Code:

    $db = mysql_connect(newsmanga_db); $req = "SELECT * FROM dvds WHERE nomdvd='".$nom."".$i"' "; /// PARSE ERROR IN THIS LINE $res=mysql_query($req, $db); while ($ligne = mysql_fetch_object ($res)) { print "<font size='2' color='#FFFFFF'><p align='center'>"; print "$ligne->resume</p></font></td></tr>"; } mysql_free_result ($res);

    attached mail follows:


    At 02:23 PM 4/8/2002 +0200, you wrote: >Hy, > >I try to do a SELECT but when I test my code I Have a parse error. >If someone can explain to me why. > >Code: > >$db = mysql_connect(newsmanga_db); >$req = "SELECT * FROM dvds WHERE nomdvd='".$nom."".$i"' "; /// PARSE >ERROR IN THIS LINE

    Your missing a '.' after the $i .

    -Chris

    attached mail follows:


    Hi

    the error appears because of the comas erroned syntaxis. why don't u try something easire as that : $varalacon = $nom."".$i; (i don't know if there is a space or not...in bold) $req = "SELECT * FROM dvds WHERE nomdvd='$varalacon' ";

    Hope it helps

    SR

    Jérome Moisy a écrit :

    > Hy, I try to do a SELECT but when I test my code I Have a parse > error.If someone can explain to me why. Code: $db = > mysql_connect(newsmanga_db); > $req = "SELECT * FROM dvds WHERE nomdvd='".$nom."".$i"' "; /// PARSE > ERROR IN THIS LINE > $res=mysql_query($req, $db); > while ($ligne = mysql_fetch_object ($res)) { > print "<font size='2' color='#FFFFFF'><p align='center'>"; > print "$ligne->resume</p></font></td></tr>"; > } > mysql_free_result ($res); > > ---------------------------------------------------------------- > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    On Mon, 8 Apr 2002, [iso-8859-1] Jérome Moisy wrote:

    > Hy, > > I try to do a SELECT but when I test my code I Have a parse error. > If someone can explain to me why. > > Code: > > $db = mysql_connect(newsmanga_db); > $req = "SELECT * FROM dvds WHERE nomdvd='".$nom."".$i"' "; /// PARSE ERROR IN THIS LINE > $res=mysql_query($req, $db); > while ($ligne = mysql_fetch_object ($res)) { > print "<font size='2' color='#FFFFFF'><p align='center'>"; > print "$ligne->resume</p></font></td></tr>"; > } > mysql_free_result ($res); >

    First glance, put quotes around newsmanga_db.

    $db = mysql_connect("newsmanga_db");

    However, it doesn't look like you would establish a connection to the database even if you fixed the syntax error. Have a look at the PHP manual in order to see the correct usage of this function. The username/password parameters are optional, but I have a feeling that newsmanga_db is the name of your database, not the database server (usually localhost). You also need to select the database that you intend to query.

    http://www.php.net/manual/en/function.mysql-connect.php http://www.php.net/manual/en/function.mysql-select-db.php

    Personally, I'd use this code (going on what you have supplied and what I believe to be true):

    //---

    mysql_connect("localhost", "username", "password"); mysql_select_db("newsmanga_db");

    $req = "SELECT * FROM dvds WHERE nomdvd = '" . $nom . $i . "'"; $res = mysql_query($req);

    while ($ligne = mysql_fetch_object($res)) { print "<tr><td>"; print "<font size=\"2\" color=\"#FFFFFF\"><p align=\"center\">"; print $ligne->resume . "</p></font></td></tr>"; } mysql_free_result($res);

    //---

    Cheers,

    Nick Winfield.

    attached mail follows:


    At 08.04.2002 14:23, you wrote: >Hy, > >I try to do a SELECT but when I test my code I Have a parse error. >If someone can explain to me why. > >Code: > >$db = mysql_connect(newsmanga_db); >$req = "SELECT * FROM dvds WHERE nomdvd='".$nom."".$i"' "; /// PARSE >ERROR IN THIS LINE Try this : $req = "SELECT * FROM dvds WHERE nomdvd='".$nom.$i."' "; or if you want a space between $nom and $i, put it between the Quotes

    >$res=mysql_query($req, $db); >while ($ligne = mysql_fetch_object ($res)) { > print "<font size='2' color='#FFFFFF'><p align='center'>"; > print "$ligne->resume</p></font></td></tr>"; >} >mysql_free_result ($res); >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


    Thanks at All

    attached mail follows:


    Php works in general (phpinfo()). The gd-lib however will not work for some reason. I tried extension=libgd.so in php.ini without any result.

    Anyone familiar with this problem?

    /M Green

    attached mail follows:


    At 08.04.2002 14:56, you wrote: >Php works in general (phpinfo()). >The gd-lib however will not work for some reason. >I tried >extension=libgd.so >in php.ini without any result. > >Anyone familiar with this problem? > >/M Green Too few arguments ;-) Did you already compiled GD ? Did you compile php with gd support? Oliver

    attached mail follows:


    <heinischcreaction.de> skrev i meddelandet news:4.3.1.2.20020408150055.00c89220pop.compuserve.com... > At 08.04.2002 14:56, you wrote: > >Php works in general (phpinfo()). > >The gd-lib however will not work for some reason. > >I tried > >extension=libgd.so > >in php.ini without any result. > > > >Anyone familiar with this problem? > > > >/M Green > Too few arguments ;-) > Did you already compiled GD ? > Did you compile php with gd support? > Oliver >

    I just followed the instructions on php.net for apache servers and changed php.ini. http://www.php.net/manual/en/html/install.apache.html Is there any way to check php.ini for errors?

    Yeah, one more thing, i moved libphp.so to /etc/httpd/modules to get it to work. So phpinfo(); works fine.

    attached mail follows:


    sure. if all users should have access to this instance of your object, then you could store the serialized object in a file, everyone has access to and unserialize it if needed.But don't forget to include your object-surcecode before unserializing the object, or you'll lose your methods. If users should also have write access to the object, you also have to make sure, that only one user can access the file for writing at one time, or your data gets probably screwed. The easiest way would be storing the object not in a file but in a database, so you don't have to care about locking.

    But do you really need the same instance of the object? why not simply perform a $obj =& new Class();

    ---------------------------------------------------------------------------- ---------- Code for Storing: <?php

    $strData = serialize($data);

    $fp = fopen("globalObjectData.inc", "w"); fwrite($fp, $strData); fclose($fp);

    ?>

    Code for accessing:

    <?php

    // include object source before unserializing include "myObjectSrc.php";

    $fp = fopen("globalObjectData.inc", "w"); $strData = fread($fp, filesize("globalObjectData.inc")); fclose($fp);

    // so we have our object back $obj = unserialize($strData);

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

    "Rarmin" <rarminyahoo.com> schrieb im Newsbeitrag news:3CB15A28.1050401yahoo.com... > Is there a way to pass variables (objects) across the different > sessions. I thought of sharing one object for all users that access my > web site (it's an object that does some operations with files common to > all users, like reading and writing). Any ideas? > > Tnx in advance. > Armin >

    attached mail follows:


    Michael Virnstein wrote: > you also have to make sure, that only one user can access the file for > writing at one time, or your data gets probably > screwed. The easiest way would be storing the object not in a file but in a > database, so you don't have to care about locking.

    Tnx for the help, and one more question. If I would serialize object and store it in a file, I would need some way to implement object waiting at the locked file untill it's unlocked (some kind of semaphore or monitor). I can lock the file with flock, but I don't know how to put object "on hold" while the file it's requesting is locked. As for the database, I don't use database (it's an assignment that needs to be done using XML, so all data is in XML files) and I don't see much sence in using db for storing only one serialized object.

    > > But do you really need the same instance of the object? why not simply > perform a $obj =& new Class();

    If I figure out how to put "on hold" object while some other object performs it's operations on locked file, I wouldn't need to use the same instance.

    > > ---------------------------------------------------------------------------- > ---------- > Code for Storing: > <?php > > $strData = serialize($data); > > $fp = fopen("globalObjectData.inc", "w"); > fwrite($fp, $strData); > fclose($fp); > > ?> > > Code for accessing: > > <?php > > // include object source before unserializing > include "myObjectSrc.php"; > > $fp = fopen("globalObjectData.inc", "w"); > $strData = fread($fp, filesize("globalObjectData.inc")); > fclose($fp); > > // so we have our object back > $obj = unserialize($strData); > > > ----------------------------------------------------------------------------

    Does anyone know how to implement monitor or semaphore or waiting queue on file resource? I'm using PHP 4.1.2 and Apache 1.2.23 on Windows platform.

    Armin

    attached mail follows:


    $myrow[ilmage] = eregi_replace("(\.[^\.]+)$", "a\\1", $myrow[ilmage]);

    and if ilmage isn't a constant use $myrow["ilmage"].

    "Thomas Edison Jr." <thomasedisonjryahoo.com> schrieb im Newsbeitrag news:20020408081751.22226.qmailweb14104.mail.yahoo.com... > Hi, > > Thanks for your relies. There are a couple of > problems. Firstly, i'm picking the filename from the > database, so my code is something like this : > > if ($myrow = mysql_fetch_array($result)) { > do { > echo(" > <img src=\"images\\$myrow[ilmage]\" > "); > } while ($myrow = mysql_fetch_array($result)); > } > > > Now the filename is actually stored in $myrow[ilmage] > How do i perform the spliting & adding functions on > $myrow[ilmage] ?? > Secondly, all images are not ".JPG", some are jpg & > others are gif !!! > > Thank you.. > T. Edison Jr. > --- Miguel Cruz <mncstoic.net> wrote: > > (untested) > > > > $newname = eregi_replace('\.jpg$', 'a.jpg', > > $oldname); > > > > No point messing up your database; just use > > something like the above when > > you're outputting the image tags for the thumbnails. > > > > miguel > > > > On Mon, 8 Apr 2002, Thomas Edison Jr. wrote: > > > > > I have a new very intriguing problem at hand. > > > > > > I have the name of my Images stored in my mySQL > > > database in one column. Now when i pick the > > images, > > > they are displayed as it as. However, they are the > > big > > > images, and the thumbnails of those images are > > stored > > > with an "a" at the end of thier names. > > > That is, > > > If the image is "try.jpg" , the thumbnail of the > > image > > > is "trya.jpg" !! > > > Now i want to display the thumbnail and not the > > large > > > image. And unfortunately, my whole database > > contains > > > the name of Large images and NOt the Thumbnails. > > > > > > How can i : > > > 1. Insert "a" at the end of the name of the image, > > > before the ".extension" through PHP. > > > The problems are that the names are stored in the > > > database WITH the extesion. And the extensions > > also > > > vary, some are JPG and some are GIF. So in my > > datase i > > > have images as "try.jpg" or "something.gif"! How > > can i > > > insert an "a" at the end of the name before the > > "." ? > > > > > > 2. OR.. can i insert the "a" before the "." in the > > > image name in my mySQL database itself. > > > > > > Either of the two solutions can work for me. > > > > > > Thanks, > > > T. Edison Jr. > > > > > > __________________________________________________ > > > Do You Yahoo!? > > > Yahoo! Tax Center - online filing with TurboTax > > > http://taxes.yahoo.com/ > > > > > > > > > > > ===== > Rahul S. Johari (Director) > ****************************************** > Abraxas Technologies Inc. > Homepage : http://www.abraxastech.com > Email : abraxastechyahoo.com > Tel : 91-4546512/4522124 > ******************************************* > > __________________________________________________ > Do You Yahoo!? > Yahoo! Tax Center - online filing with TurboTax > http://taxes.yahoo.com/

    attached mail follows:


    but if $myrow["ilmage"] = "hallo.hmm.gif"; your code won't work.

    so better:

    while ($myrow = mysql_fetch_array($result)) { $img = explode('.',$myrow[ilmage]); $img[count($img) - 1] .= "a"; echo "<img src=\"images/".implode('.', $img)."\"><br />"; }

    "Richard Baskett" <rickbaskettcase.com> schrieb im Newsbeitrag news:B8D6A1A1.4ED7%rickbaskettcase.com... > Do the explode and implodes like that one fellow mentioned. > > So basically: > > while ($myrow = mysql_fetch_array($result)) { > $img = explode('.',$myrow[ilmage]); > echo "<img src=\"images/{$img[0]}a$img[1]\"><br />" > } > > What this will do is take your image split the image at the '.' then echo it > with the 'a'.. Hope it helps! > > Rick > > Be kind. Everyone you meet is fighting a hard battle - John Watson > > > From: "Thomas Edison Jr." <thomasedisonjryahoo.com> > > Date: Mon, 8 Apr 2002 01:17:51 -0700 (PDT) > > To: Miguel Cruz <mncstoic.net> > > Cc: php-generallists.php.net > > Subject: Re: [PHP] Adding "a" in "try.jpg"! Problems! > > > > Hi, > > > > Thanks for your relies. There are a couple of > > problems. Firstly, i'm picking the filename from the > > database, so my code is something like this : > > > > if ($myrow = mysql_fetch_array($result)) { > > do { > > echo(" > > <img src=\"images\\$myrow[ilmage]\" > > "); > > } while ($myrow = mysql_fetch_array($result)); > > } > > > > > > Now the filename is actually stored in $myrow[ilmage] > > How do i perform the spliting & adding functions on > > $myrow[ilmage] ?? > > Secondly, all images are not ".JPG", some are jpg & > > others are gif !!! > > > > Thank you.. > > T. Edison Jr. > > --- Miguel Cruz <mncstoic.net> wrote: > >> (untested) > >> > >> $newname = eregi_replace('\.jpg$', 'a.jpg', > >> $oldname); > >> > >> No point messing up your database; just use > >> something like the above when > >> you're outputting the image tags for the thumbnails. > >> > >> miguel > >> > >> On Mon, 8 Apr 2002, Thomas Edison Jr. wrote: > >> > >>> I have a new very intriguing problem at hand. > >>> > >>> I have the name of my Images stored in my mySQL > >>> database in one column. Now when i pick the > >> images, > >>> they are displayed as it as. However, they are the > >> big > >>> images, and the thumbnails of those images are > >> stored > >>> with an "a" at the end of thier names. > >>> That is, > >>> If the image is "try.jpg" , the thumbnail of the > >> image > >>> is "trya.jpg" !! > >>> Now i want to display the thumbnail and not the > >> large > >>> image. And unfortunately, my whole database > >> contains > >>> the name of Large images and NOt the Thumbnails. > >>> > >>> How can i : > >>> 1. Insert "a" at the end of the name of the image, > >>> before the ".extension" through PHP. > >>> The problems are that the names are stored in the > >>> database WITH the extesion. And the extensions > >> also > >>> vary, some are JPG and some are GIF. So in my > >> datase i > >>> have images as "try.jpg" or "something.gif"! How > >> can i > >>> insert an "a" at the end of the name before the > >> "." ? > >>> > >>> 2. OR.. can i insert the "a" before the "." in the > >>> image name in my mySQL database itself. > >>> > >>> Either of the two solutions can work for me. > >>> > >>> Thanks, > >>> T. Edison Jr. > >>> > >>> __________________________________________________ > >>> Do You Yahoo!? > >>> Yahoo! Tax Center - online filing with TurboTax > >>> http://taxes.yahoo.com/ > >>> > >>> > >> > > > > > > ===== > > Rahul S. Johari (Director) > > ****************************************** > > Abraxas Technologies Inc. > > Homepage : http://www.abraxastech.com > > Email : abraxastechyahoo.com > > Tel : 91-4546512/4522124 > > ******************************************* > > > > __________________________________________________ > > Do You Yahoo!? > > Yahoo! Tax Center - online filing with TurboTax > > http://taxes.yahoo.com/ > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > >

    attached mail follows:


    typo..this one's right :)

    while ($myrow = mysql_fetch_array($result)) { $img = explode('.',$myrow[ilmage]); $img[count($img) - 2] .= "a"; echo "<img src=\"images/".implode('.', $img)."\"><br />"; }

    "Michael Virnstein" <michael.virnsteinbrodos.de> schrieb im Newsbeitrag news:20020408134806.92104.qmailpb1.pair.com... > but if > $myrow["ilmage"] = "hallo.hmm.gif"; your code won't work. > > so better: > > while ($myrow = mysql_fetch_array($result)) { > $img = explode('.',$myrow[ilmage]); > $img[count($img) - 1] .= "a"; > echo "<img src=\"images/".implode('.', $img)."\"><br />"; > } > > > > "Richard Baskett" <rickbaskettcase.com> schrieb im Newsbeitrag > news:B8D6A1A1.4ED7%rickbaskettcase.com... > > Do the explode and implodes like that one fellow mentioned. > > > > So basically: > > > > while ($myrow = mysql_fetch_array($result)) { > > $img = explode('.',$myrow[ilmage]); > > echo "<img src=\"images/{$img[0]}a$img[1]\"><br />" > > } > > > > What this will do is take your image split the image at the '.' then echo > it > > with the 'a'.. Hope it helps! > > > > Rick > > > > Be kind. Everyone you meet is fighting a hard battle - John Watson > > > > > From: "Thomas Edison Jr." <thomasedisonjryahoo.com> > > > Date: Mon, 8 Apr 2002 01:17:51 -0700 (PDT) > > > To: Miguel Cruz <mncstoic.net> > > > Cc: php-generallists.php.net > > > Subject: Re: [PHP] Adding "a" in "try.jpg"! Problems! > > > > > > Hi, > > > > > > Thanks for your relies. There are a couple of > > > problems. Firstly, i'm picking the filename from the > > > database, so my code is something like this : > > > > > > if ($myrow = mysql_fetch_array($result)) { > > > do { > > > echo(" > > > <img src=\"images\\$myrow[ilmage]\" > > > "); > > > } while ($myrow = mysql_fetch_array($result)); > > > } > > > > > > > > > Now the filename is actually stored in $myrow[ilmage] > > > How do i perform the spliting & adding functions on > > > $myrow[ilmage] ?? > > > Secondly, all images are not ".JPG", some are jpg & > > > others are gif !!! > > > > > > Thank you.. > > > T. Edison Jr. > > > --- Miguel Cruz <mncstoic.net> wrote: > > >> (untested) > > >> > > >> $newname = eregi_replace('\.jpg$', 'a.jpg', > > >> $oldname); > > >> > > >> No point messing up your database; just use > > >> something like the above when > > >> you're outputting the image tags for the thumbnails. > > >> > > >> miguel > > >> > > >> On Mon, 8 Apr 2002, Thomas Edison Jr. wrote: > > >> > > >>> I have a new very intriguing problem at hand. > > >>> > > >>> I have the name of my Images stored in my mySQL > > >>> database in one column. Now when i pick the > > >> images, > > >>> they are displayed as it as. However, they are the > > >> big > > >>> images, and the thumbnails of those images are > > >> stored > > >>> with an "a" at the end of thier names. > > >>> That is, > > >>> If the image is "try.jpg" , the thumbnail of the > > >> image > > >>> is "trya.jpg" !! > > >>> Now i want to display the thumbnail and not the > > >> large > > >>> image. And unfortunately, my whole database > > >> contains > > >>> the name of Large images and NOt the Thumbnails. > > >>> > > >>> How can i : > > >>> 1. Insert "a" at the end of the name of the image, > > >>> before the ".extension" through PHP. > > >>> The problems are that the names are stored in the > > >>> database WITH the extesion. And the extensions > > >> also > > >>> vary, some are JPG and some are GIF. So in my > > >> datase i > > >>> have images as "try.jpg" or "something.gif"! How > > >> can i > > >>> insert an "a" at the end of the name before the > > >> "." ? > > >>> > > >>> 2. OR.. can i insert the "a" before the "." in the > > >>> image name in my mySQL database itself. > > >>> > > >>> Either of the two solutions can work for me. > > >>> > > >>> Thanks, > > >>> T. Edison Jr. > > >>> > > >>> __________________________________________________ > > >>> Do You Yahoo!? > > >>> Yahoo! Tax Center - online filing with TurboTax > > >>> http://taxes.yahoo.com/ > > >>> > > >>> > > >> > > > > > > > > > ===== > > > Rahul S. Johari (Director) > > > ****************************************** > > > Abraxas Technologies Inc. > > > Homepage : http://www.abraxastech.com > > > Email : abraxastechyahoo.com > > > Tel : 91-4546512/4522124 > > > ******************************************* > > > > > > __________________________________________________ > > > Do You Yahoo!? > > > Yahoo! Tax Center - online filing with TurboTax > > > http://taxes.yahoo.com/ > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > >

    attached mail follows:


    On Saturday, April 6, 2002, at 11:44 AM, Shane McBride wrote:

    > Hello, > > I am able to upload and download Macintosh files but they seem to lose > their > MIME type or extensions. I'm not sure what it is. I'm not a Mac dude. > > When you download the file It loses the file association. It's for a > company > I do work for that uses a lot of .ai and .psd files. > > > Any ideas on this?

    You're possibly losing the resource fork of the files you are uploading, because the server is not an HFS+ filesystem. To the best of my knowledge there is nothing you can do about this via PHP, but there are probably tricks (like AppleScript) that you could use as a workaround, such as encoding the files in some transport-friendly format before uploading and decoding them upon download.

    Erik

    ----
    

    Erik Price Web Developer Temp Media Lab, H.H. Brown priceehhbrown.com

    attached mail follows:


    Le lundi 8 avril 2002, à 03:45 PM, Erik Price a écrit :

    >> When you download the file It loses the file association. It's for a >> company >> I do work for that uses a lot of .ai and .psd files. > Hi !

    Have you tried with :

    $filesize = filesize($your_file);

    header("Content-type: ".$your_mime_type); fread($your_file, $filesize);

    exit();

    R.

    attached mail follows:


    Shane,

    Eric is absolutely right, you are losing the resource fork of your mac binaries when you upload them.

    (If you don't know, on a Mac, the binary file has to parts, the data, and the association with an application (or resource) that created the file. This is done so that Mac file names don't need an extension)

    Most server systems (except Mac of course) don't know how to handle a resource fork, so they drop it. The standard Mac work around is to convert the binary file to a text format called binhex (.hqx filename extension) upload the .hqx file to the server and then reconvert it back once downloaded to a Mac that knows what to do with the resource fork information.

    This process can be automated with apple script if you like, but, if you ever want another machead to help you diagnose problems, stick to this layout, that way they know what you are doing.

    Rance

    Rance Hall 308.238.2455 Internal Office Extensions: 2455 or 6655 PC Programmer, The Buckle, Inc. rance.hallbuckle.com

    -----Original Message----- From: Erik Price [mailto:priceehhbrown.com] Sent: Monday, April 08, 2002 8:46 AM To: Shane McBride Cc: php-generallists.php.net Subject: Re: [PHP] MAC file upload

    On Saturday, April 6, 2002, at 11:44 AM, Shane McBride wrote:

    > Hello, > > I am able to upload and download Macintosh files but they seem to lose > their > MIME type or extensions. I'm not sure what it is. I'm not a Mac dude. > > When you download the file It loses the file association. It's for a > company > I do work for that uses a lot of .ai and .psd files. > > > Any ideas on this?

    You're possibly losing the resource fork of the files you are uploading, because the server is not an HFS+ filesystem. To the best of my knowledge there is nothing you can do about this via PHP, but there are probably tricks (like AppleScript) that you could use as a workaround, such as encoding the files in some transport-friendly format before uploading and decoding them upon download.

    Erik

    ----
    

    Erik Price Web Developer Temp Media Lab, H.H. Brown priceehhbrown.com

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

    attached mail follows:


    Dear All,

    Another simple question:

    What is the best way to do redirect after a php file did some processing?

    Any helps would be greatly appreciated!

    --Wo

    attached mail follows:


    On Monday 08 April 2002 22:00, Wo Chang wrote: > Dear All, > > Another simple question: > > What is the best way to do redirect after a > php file did some processing? > > Any helps would be greatly appreciated!

    Use header() to set a location.

    -- 
    Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
    Open Source Software Systems Integrators
    * Web Design & Hosting * Internet & Intranet Applications Development *
    

    /* A diplomatic husband said to his wife, "How do you expect me to remember your birthday when you never look any older?" */

    attached mail follows:


    This is really simple: header("Location: XXXX.php");

    /Patrick www.optip.com

    -----Original Message----- From: Wo Chang [mailto:wchangnist.gov] Sent: 08 April 2002 15:00 To: php-generallists.php.net Subject: [PHP] what's the best way to do redirect within PHP

    Dear All,

    Another simple question:

    What is the best way to do redirect after a php file did some processing?

    Any helps would be greatly appreciated!

    --Wo

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

    attached mail follows:


    Le lundi 8 avril 2002, à 04:00 PM, Wo Chang a écrit :

    > What is the best way to do redirect after a > php file did some processing?

    Function header() ???

    R.

    attached mail follows:


    Dear All,

    Thanks for all the response, they all work!

    --Wo

    ----- Original Message ----- From: "Wo Chang" <wchangnist.gov> To: <php-generallists.php.net> Sent: Monday, April 08, 2002 10:00 AM Subject: what's the best way to do redirect within PHP

    > Dear All, > > Another simple question: > > What is the best way to do redirect after a > php file did some processing? > > Any helps would be greatly appreciated! > > --Wo

    attached mail follows:


    Ok here is my problem, I have a piece of code that queries the database pulls the results of a table into an array, on another file the results of that array are used with a require function and then each variable is echoed to the screen where I need it, I have a piece of javascript to open a pop up window and the code is as such... <a href='javascript:openPopWin("<?php echo $ad01; ?>", 420,545, "", 0, 0)'onmouseover="window.status='This weeks full page ad';return true"> As you can see I have placed the results of the array within my <a href=" tag and it works fine.. however the second part <img src="<?php echo $ad01_t; ?>" width="200" height="100" vspace="0" hspace="0" border="0"></a> Will not pull the results of the array into the page, I don't know if this is a valid piece or not, any help would be great. Thanks in advance. Jas

    attached mail follows:


    Please post more code. Can't help any further in the moment. "Jas" <jlgerfenhotmail.com> schrieb im Newsbeitrag news:20020408140756.18415.qmailpb1.pair.com... > Ok here is my problem, I have a piece of code that queries the database > pulls the results of a table into an array, on another file the results of > that array are used with a require function and then each variable is echoed > to the screen where I need it, I have a piece of javascript to open a pop up > window and the code is as such... > <a href='javascript:openPopWin("<?php echo $ad01; ?>", 420,545, "", 0, > 0)'onmouseover="window.status='This weeks full page ad';return true"> > As you can see I have placed the results of the array within my <a href=" > tag and it works fine.. however the second part <img src="<?php echo > $ad01_t; ?>" width="200" height="100" vspace="0" hspace="0" border="0"></a> > Will not pull the results of the array into the page, I don't know if this > is a valid piece or not, any help would be great. Thanks in advance. > Jas > >

    attached mail follows:


    Nevermind I got it fixed... I forgot to include a couple of fields from my database into my array. =). If you would like to use the code I am putting it here... <?php $table = "cm_dev_ads"; $dbh = mysql_connect('localhost','user_name','password') or die('Could not connect to database, please try again later'); mysql_select_db('bignicke') or die('Could not select database, please try again later'); $record = mysql_query("SELECT wel_area, ad01, ad02, ad03, ad04, ad05, ad06, ad01_t, ad02_t, ad03_t, ad04_t, ad05_t, ad06_t FROM $table",$dbh); while ($row = mysql_fetch_array($record)) { $wel_area = $row['wel_area']; $ad01 = $row['ad01']; $ad02 = $row['ad02']; $ad03 = $row['ad03']; $ad04 = $row['ad04']; $ad05 = $row['ad05']; $ad06 = $row['ad06']; $ad01_t = $row['ad01_t']; $ad02_t = $row['ad02_t']; $ad03_t = $row['ad03_t']; $ad04_t = $row['ad04_t']; $ad05_t = $row['ad05_t']; $ad05_t = $row['ad05_t']; $ad06_t = $row['ad06_t']; } ?> That is the db connection and the results put into an array... <?php require 'db_index.php'; ?> This calls to the array script, now to echo them into my java-script it is as follows... <a href='javascript:openPopWin("<?php echo $ad01; ?>", 420,545, "", 0, 0)'onmouseover="window.status='This weeks full page ad';return true"><img src="<?php echo $ad01_t; ?>" width="200" height="100" vspace="0" hspace="0" border="0"></a> Hope this helps some other people that might want to do the same type of thing... Jas

    attached mail follows:


    I don't know if anybody else sent you an email about this or not, but there's a much easier way to do what you're doing in this snippet of code...

    $record = mysql_query("SELECT wel_area, ad01, ad02, ad03, ad04, ad05, ad06, ad01_t, ad02_t, ad03_t, ad04_t, ad05_t, ad06_t FROM $table",$dbh);

    while ($row = mysql_fetch_array($record)) { // this should print no print( "wel_areas set: " . ( isset( $wel_areas ) ? "Yes" : "No" )); extract( $row ); // this should print yes print( "wel_areas set: " . ( isset( $wel_areas ) ? "Yes" : "No" )); }

    this will create variables into the local scope of each element in this associative array. It's a lot easier than typing each assignment out, and it also means if you include a new field in your query, your code will not have to create a new variable, it'll be automatic...

    At 08:29 AM 4/8/2002 -0600, Jas wrote: >Nevermind I got it fixed... I forgot to include a couple of fields from my >database into my array. =). If you would like to use the code I am putting >it here... ><?php >$table = "cm_dev_ads"; >$dbh = mysql_connect('localhost','user_name','password') or die('Could not >connect to database, please try again later'); >mysql_select_db('bignicke') or die('Could not select database, please try >again later'); >$record = mysql_query("SELECT wel_area, ad01, ad02, ad03, ad04, ad05, ad06, >ad01_t, ad02_t, ad03_t, ad04_t, ad05_t, ad06_t FROM $table",$dbh); >while ($row = mysql_fetch_array($record)) { > $wel_area = $row['wel_area']; > $ad01 = $row['ad01']; > $ad02 = $row['ad02']; > $ad03 = $row['ad03']; > $ad04 = $row['ad04']; > $ad05 = $row['ad05']; > $ad06 = $row['ad06']; > $ad01_t = $row['ad01_t']; > $ad02_t = $row['ad02_t']; > $ad03_t = $row['ad03_t']; > $ad04_t = $row['ad04_t']; > $ad05_t = $row['ad05_t']; > $ad05_t = $row['ad05_t']; > $ad06_t = $row['ad06_t']; > } >?> >That is the db connection and the results put into an array... ><?php >require 'db_index.php'; >?> >This calls to the array script, now to echo them into my java-script it is >as follows... ><a href='javascript:openPopWin("<?php echo $ad01; ?>", 420,545, "", 0, >0)'onmouseover="window.status='This weeks full page ad';return true"><img >src="<?php echo $ad01_t; ?>" width="200" height="100" vspace="0" hspace="0" >border="0"></a> >Hope this helps some other people that might want to do the same type of >thing... >Jas > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


    Does anyone know how to check a directory exiasts?

    Thanks in advance, Hiroshi Ayukawa http://hoover.ktplan.ne.jp/kaihatsu/php_en/index.php?type=top

    attached mail follows:


    file_exists will perform a check if the file, no matter if it's a directory, a regular file or a symlink. if you want to know if it is a directory use is_dir($file)

    or refer to the php manual"Hiroshi Ayukawa" <ayue-fukuoka.co.jp> schrieb im Newsbeitrag news:80C1DF07CB9529.ayue-fukuoka.co.jp... > Does anyone know how to check a directory exiasts? > > Thanks in advance, > Hiroshi Ayukawa > http://hoover.ktplan.ne.jp/kaihatsu/php_en/index.php?type=top >

    attached mail follows:


    Le lundi 8 avril 2002, à 04:15 PM, Hiroshi Ayukawa a écrit :

    > Does anyone know how to check a directory exiasts?

    RTFM !!

    try this :

    if (file_exists($dir) && is_dir($dir)) { echo $dir.' is a directory !'; }

    attached mail follows:


    try:

    if(is_dir($dir)) { echo 'directory was found'; }

    Yoroshiku,

    Maxim Maletsky PHPBeginner.com

    Hiroshi Ayukawa writes:

    > Does anyone know how to check a directory exiasts? > > Thanks in advance, > Hiroshi Ayukawa > http://hoover.ktplan.ne.jp/kaihatsu/php_en/index.php?type=top > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    Maxim Maletsky

    Founder, Chief Developer PHPBeginner.com (Where PHP Begins)

    www.PHPBeginner.com maximphpbeginner.com

    attached mail follows:


    On Monday 08 April 2002 22:15, Hiroshi Ayukawa wrote: > Does anyone know how to check a directory exiasts? > > Thanks in advance, > Hiroshi Ayukawa > http://hoover.ktplan.ne.jp/kaihatsu/php_en/index.php?type=top

    Manual > Filesystem functions

    -- 
    Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
    Open Source Software Systems Integrators
    * Web Design & Hosting * Internet & Intranet Applications Development *
    

    /* When the revolution comes, count your change. */

    attached mail follows:


    Bob/pickle,

    I disagree -- Justin French has contributed a large number of helpful posts to this list. Just the other day, he responded to my query for advice -- http://marc.theaimsgroup.com/?l=php- general&m=101779873317529&w=2 It is foolish to look the gift horse of free coding advice in the mouth (something that many companies will be happy to charge you for).

    I'm guilty too of making offtopic posts, but when someone reminds me of this I try not to take it personally, even when it makes me feel like an idiot in this public forum. I try to remember that a friendly tone of voice doesn't carry very well via email.

    There's plenty of other groups which will answer JavaScript-related questions, but it is your responsibility to find them.

    Erik

    On Sunday, April 7, 2002, at 10:09 PM, <phplistswoodenpickle.com> wrote:

    > Wow, you really feel like your better than everyone here don't you.. You > rarely even give an answer that isn't blatent criticism of what someone > posted or their ability to find information. You really need to stop. > > Bob > > "Justin French" <justinindent.com.au> wrote in message > news:B8D7301B.39A9%justinindent.com.au... >> This is the wrong group/list for this post. >> >> The disabling of bars, or any sort of browser feature/appearance is NOT > PHP. >> >> PHP is a server side langauge. Commonly, you would use JavaScript for > such >> stuff, so I recommend you check out the millions of JavaScript sites >> and >> newsgroups on the web. >>

    ----
    

    Erik Price Web Developer Temp Media Lab, H.H. Brown priceehhbrown.com

    attached mail follows:


    I'm trying to write some code that will look at a table of records, and output a 'tree' of those records, based on a parent/child relationship betweent their respective record id numbers.

    Anyone written anything like this they would be willing to share? I'm up against a deadline, and I'm having a brain cramp trying to get my brain around the recursive aspect of doing it.

    Thanks in advance,

    Kelly

    attached mail follows:


    On Friday, April 5, 2002, at 10:12 PM, Eric Kilgore wrote:

    > I'm a newbie to Linux and Apache, not so new to php itself. I'm using > Red > Hat 7.2. The RPM installs apache with php, etc. as part of the standard > install but --without-mysql in the configuration. I've read quit a bit > on > how you are supposed to be able to update the configuration etc. > ./configure --with-mysql=/usr/bin/mysql etc. The trouble is I have no > clue > as to what directory I'm suppose to be running this in. I'm tempted to > install a newer version of PHP (Red Hat 7.2 comes with 4.0.6) as the > documentation on installing from source code seems to be a bit clearer. > Can > I install over the top of the existing module or would I have to > uninstall > that package first?

    If you are still having trouble with this, I have a log of a PHP upgrade that will show you how I went about it. But you've probably solved your problem by now.

    Needless to say, the source install is highly configurable and not very difficult, I recommend it over the RPM in almost any situation.

    Erik

    ----
    

    Erik Price Web Developer Temp Media Lab, H.H. Brown priceehhbrown.com

    attached mail follows:


    For the record <br/> (which would be the 'normal' xhtml style) is unrecognized (and therefor ignored) by Netscape 4.x. However, it recognizes and properly handles <br />, which I'm sure is why it is output in that format. If anybody has seen <br/> misbehave, try going back and testing with <br />.

    - Theo

    -----Original Message----- From: Miguel Cruz [mailto:mncstoic.net] Sent: Saturday, April 06, 2002 1:57 AM To: Justin French Cc: php Subject: Re: [PHP] nl2br returns <BR />? normality or a bug?

    On Sat, 6 Apr 2002, Justin French wrote: > on 06/04/02 11:05 AM, Maxim Maletsky (subscriptionsphpbeginner.com) wrote: >> It DOES NOT work fine in every browser. I'd love to give you a prov, but >> because I am lazy I will just tell you this formula: > > Again. I was only stating MY experience. "Every browser I can get my hands > on". I do extensive testing, and have never seen a <BR> or <BR/> or <BR /> > misbehave. > > If you have seen it perform unexpectedly, I'm keen to hear about.

    For what it's worth, I just tried on the following browsers (all I have at my disposal at home) and it works fine:

    links 0.96 lynx 2.8.3 Opera 5.0.498 (Mac) IE 5.1.3 (Mac) Mozilla 0.9.9 (Mac) Netscape 6.1 (Mac)

    miguel

    attached mail follows:


    Try a bitwise and (I think the operator is '&')... <?php $bitMask = 16; $value1 = 24; $value2 = 36;

    ?>$value1 has bit 5 set? <?php if($bitMask & $value1) { //should get here echo 'true\r\n'; } else { echo 'false\r\n'; }

    ?>$value2 has bit 5 set? <?php if($bitMask & $value1) { echo 'true\r\n'; } else { //should get here echo 'false\r\n'; } ?> - Theo -----Original Message----- From: Miguel Cruz [mailto:mncstoic.net] Sent: Sunday, April 07, 2002 5:04 PM To: Charlie Killian Cc: php-generallists.php.net Subject: Re: [PHP] Test for one bit set?

    On Sun, 7 Apr 2002, Charlie Killian wrote: > How can I test if a number only has on bit set? > > So testing different numbers will return TRUE or FALSE: > > testing 00010000 would return TRUE. > testing 00000011 would return FALSE.

    Think back to math class when you were 14!

    function isOneBitSet($n) { $x = log($n)/log(2); return ($x == intval($x)); }

    Cheesy alternative:

    function isOneBitSet($n) { return (1 == substr_count(base_convert($n, 10, 2), '1')); }

    miguel

    attached mail follows:


    Can anyone tell me why when the first element in my array would disappear with the following code:

    <? //remove the unwanted item from the array for($i=0;$i<count($stores);$i++) { $delete=0; //checking to see if it has been requested for delete foreach($HTTP_POST_VARS as $val) { if(is_numeric($val)) { if($val==$i) $delete = 1; else continue; } else continue; } //if not requested for delete, push on to temp array if($delete == 0) { array_push($temp, $stores[$i]); } } $stores = $temp; print_r($stores); print_r($HTTP_POST_VARS); ?>

    Here is the output of the print_r's:

    Array ( [0] => [1] => Array ( [0] => AR [1] => 1 [2] => 1059 11th St. [3] => Grand Rapids [4] => (233) 457-2394 [5] => (233) 457-4982 [6] => [7] => [8] => )

    [2] => Array ( [0] => AR [1] => 2 [2] => 1059 11th St. [3] => Grand Rapids [4] => (233) 457-2394 [5] => (233) 457-4982 [6] => [7] => [8] => )

    [3] => Array ( [0] => LA [1] => 3 [2] => 1174 Gernaat Ct. [3] => Delton [4] => (233) 457-2394 [5] => (233) 457-4982 [6] => [7] => [8] => )

    [4] => Array ( [0] => ME [1] => 4 [2] => 1059 11th St. [3] => Delton [4] => (233) 457-2394 [5] => (233) 457-4982 [6] => [7] => [8] => )

    [5] => Array ( [0] => MI [1] => 6 [2] => 437 4th Ave. [3] => Yet Another City [4] => (123) 283-4839 [5] => (123) 458-4843 [6] => [7] => [8] => )

    ) Array ( [chk5] => 5 [Submit] => Delete Store(s) )

    The script deletes the element that was requested deleted, but for some reason the first element in the array never gets copied. Any help that you can provide would be greatly appreciated.

    --
    Joshua E Minnie
    CIO
    joshacsurf.net
    

    "Don't work for recognition, but always do work worthy of recognition."

    attached mail follows:


    On Monday 08 April 2002 23:03, Joshua E Minnie wrote: > Can anyone tell me why when the first element in my array would disappear > with the following code: > > <? > //remove the unwanted item from the array > for($i=0;$i<count($stores);$i++) { > $delete=0; > //checking to see if it has been requested for delete > foreach($HTTP_POST_VARS as $val) { > if(is_numeric($val)) { > if($val==$i) $delete = 1; > else continue; > } > else continue; > } > //if not requested for delete, push on to temp array > if($delete == 0) { > array_push($temp, $stores[$i]); > } > } > $stores = $temp; > print_r($stores); > print_r($HTTP_POST_VARS); > ?>

    I would rewrite the above as:

    foreach ($HTTP_POST_VARS as $val) { if(is_numeric($val)) { unset($stores[$val]); } }

    -- 
    Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
    Open Source Software Systems Integrators
    * Web Design & Hosting * Internet & Intranet Applications Development *
    

    /* Don't smoke the next cigarette. Repeat. */

    attached mail follows:


    Here is what I get when I try to make a DSO with apache 2.0.35 and php 4.1.2:

    Script started on Sun Apr 7 13:39:30 2002 doctor.nl2k.ab.ca//usr/source/php-4.1.2$ make Making all in Zend Making all in main Making all in ext Making all in zlib Making all in ftp Making all in gd Making all in mysql Making all in openssl Making all in pcre Making all in pcrelib Making all in posix Making all in session Making all in standard Making all in xml Making all in expat Making all in sapi Making all in apache2filter /bin/sh /usr2/source/php-4.1.2/libtool --silent --mode=compile gcc -I. -I/usr2/source/php-4.1.2/sapi/apache2filter -I/usr2/source/php-4.1.2/main -I/usr2/source/php-4.1.2 -I/var/www/include/ -I/usr2/source/php-4.1.2/Zend -I/usr/contrib/include -I/usr2/source/gd-1.8.3 -I/usr/contrib/include/mysql -I/usr2/source/php-4.1.2/ext/xml/expat -I/usr2/source/php-4.1.2/TSRM -g -O2 -DZTS -prefer-pic -c sapi_apache2.c sapi_apache2.c: In function `php_apache_sapi_ub_write': sapi_apache2.c:58: too few arguments to function `apr_brigade_create' sapi_apache2.c:61: too few arguments to function `apr_bucket_transient_create' sapi_apache2.c: In function `php_apache_sapi_register_variables': sapi_apache2.c:148: warning: initialization discards qualifiers from pointer target type sapi_apache2.c: In function `php_apache_sapi_flush': sapi_apache2.c:171: too few arguments to function `apr_brigade_create' sapi_apache2.c:172: too few arguments to function `apr_bucket_flush_create' sapi_apache2.c: In function `php_input_filter': sapi_apache2.c:245: too few arguments to function `apr_brigade_create' sapi_apache2.c:247: incompatible type for argument 4 of `ap_get_brigade' sapi_apache2.c:247: too few arguments to function `ap_get_brigade' sapi_apache2.c: In function `php_output_filter': sapi_apache2.c:311: too few arguments to function `apr_brigade_create' sapi_apache2.c:366: too few arguments to function `apr_bucket_transient_create' sapi_apache2.c:375: too few arguments to function `apr_bucket_eos_create' sapi_apache2.c: In function `php_register_hook': sapi_apache2.c:407: `AP_FTYPE_CONTENT' undeclared (first use in this function) sapi_apache2.c:407: (Each undeclared identifier is reported only once sapi_apache2.c:407: for each function it appears in.) sapi_apache2.c:408: warning: passing arg 2 of `ap_register_input_filter' from incompatible pointer type *** Error code 1

    Stop. *** Error code 1

    Stop. *** Error code 1

    Stop. *** Error code 1

    Stop. doctor.nl2k.ab.ca//usr/source/php-4.1.2$ exit exit

    Script done on Sun Apr 7 13:39:58 2002

    -- 
    Member - Liberal International	On 11 Sept 2001 the WORLD was violated.
    This is doctornl2k.ab.ca	Ici doctornl2k.ab.ca
    Society MUST be saved! Extremists must dissolve.  
    Beware of defining as intelligent only those who share your opinions
    

    attached mail follows:


    Ok this is an unusual problem, at least to a newbie like myself... I am trying to develop a user form to select an image from a directory by use of a select box that once the item is selected it will put that selection into a db field and this part I have working fine, however now I will need to be able to do something which I am not entirely clear on where to start... 1- I need to have the selection append the file path to the selected file... i.e. http://localhost/images/file_name.jpg, so far it only puts file_name.jpg into the database table. My code is as follows: Page 1- index.php (queries database to display current db contents and also queries directory and places results into an array that is displayed in a select box)

    <?php $dir_name = "/path/to/images/directory/on/server/"; $dir = opendir($dir_name); $file_list .= "<p><FORM METHOD=\"post\" ACTION=\"index_done.php3\"> <SELECT NAME=\"files\">"; while ($file_name = readdir($dir)) { if (($file_name != ".") && ($file_name !="..")) { $file_list .= "<OPTION VALUE=\"$file_name\" NAME=\"$file_name\">$file_name</OPTION>"; } } $file_list .= "</SELECT><br><br><INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"select\"></FORM></p>"; closedir($dir); $table = "table_nae"; $dbh = mysql_connect('localhost','user_name','password') or die('Could not connect to database, please try again later'); mysql_select_db('db_name') or die('Could not select database, please try again later'); $record = mysql_query("SELECT wel_area, ad01_t, ad01, ad02_t, ad02, ad03_t, ad03, ad04_t, ad04, ad05_t, ad05, ad06_t, ad06 FROM $table",$dbh); while ($row = mysql_fetch_array($record)) { list($wel_area, $ad01_t, $ad01, $ad02_t, $ad02, $ad03_t, $ad03, $ad04_t, $ad04, $ad05_t, $ad05, $ad06_t, $ad06) = $row; }?>

    This echoes the resulting directory into my select box... <? echo "$file_list"; ?>

    And this will echo the existing db entry... <img src="<?php echo $ad01_t; ?>" width="200" height="100" vspace="0" hspace="0" border="0">

    Ok so far so good, now the items that are selected from the drop box need to somehow (this is where I am stuck append the file path, i.e. the complete url to the db entry and I am not quite sure how to accomplish this, if anyone has a tutorial or even an example to show me I can figure it out from there... this is the piece of code I am using on the "index_done.php3" file.

    <?php $db_name = "db_name"; $table_name = "table_name"; $connection = mysql_connect("localhost", "user_name", "password") or die ("Could not connect to database. Please try again later."); $db = mysql_select_db("$db_name",$connection) or die ("Could not select database table. Please try again later."); $sql = "UPDATE $table_name SET ad01_t=\"$files""; print $sql; $result = mysql_query($sql, $connection) or die ("Could not execute query. Please try again later."); ?> Any help would be great... Jas

    attached mail follows:


    On Monday, April 8, 2002, at 11:09 AM, Jas wrote:

    > Ok this is an unusual problem, at least to a newbie like myself... I am > trying to develop a user form to select an image from a directory by > use of > a select box that once the item is selected it will put that selection > into > a db field and this part I have working fine, however now I will need > to be > able to do something which I am not entirely clear on where to start... > 1- I need to have the selection append the file path to the selected > file... > i.e. http://localhost/images/file_name.jpg, so far it only puts > file_name.jpg into the database table.

    If you already know that the file will always be in the same directory, you could just prepend the string "http://localhost/images/" to the query result in your query --

    SELECT CONCAT('http://localhost/images/', tablename.image_name) AS image_name FROM tablename

    Or, if each file may have a different path, check out the dirname() function -- http://www.php.net/manual/en/function.dirname.php

    I think that you will have to add "http://virtualhost" in any case, as this is a component of a URI and not a part of the file's path (and will not be automatically generated by dirname() or any other function that I know of).

    Erik

    ----
    

    Erik Price Web Developer Temp Media Lab, H.H. Brown priceehhbrown.com

    attached mail follows:


    So putting it into an UPDATE statement it would be something like this right? UPDATE CONCAT $table_name SET ('http://localhost/images') ad01="\$ad01\"";

    attached mail follows:


    On Monday, April 8, 2002, at 11:35 AM, Jas wrote:

    > So putting it into an UPDATE statement it would be something like this > right? > UPDATE CONCAT $table_name SET ('http://localhost/images') > ad01="\$ad01\"";

    No, like this:

    The table is named "test_table" The column you want to add this to is named "test_column"

    You are taking the data that test_column contains, and prepending "http://localhost/images" to the beginning of that data:

    UPDATE test_table SET test_column = CONCAT('http://localhost/images', test_table.test_column)

    Warning: This command will change every single row in your table so that 'http://localhost/images' will be prepended before whatever data is already in that row. You probably want to make ABSOLUTELY SURE that this is what you want (are you sure you don't want a trailing slash in that CONCAT function?). If you want to just test this out, or don't want to apply this change to EVERY row, you can add a WHERE clause to choose certain rows to update.

    Keep in mind that test_column must be able to accommodate the new string (so you might need to make it a bigger VARCHAR or something).

    Good luck,

    Erik

    ----
    

    Erik Price Web Developer Temp Media Lab, H.H. Brown priceehhbrown.com

    attached mail follows:


    Actually, I tried it a different way and I got the results I needed... this is what I did, $file_var = "http://www.bignickel.net/full_ad/"; $db_name = "db_name"; $table_name = "table_name"; $connection = mysql_connect("localhost", "user_name", "password") or die ("Could not connect to database. Please try again later."); $db = mysql_select_db("$db_name",$connection) or die ("Could not select database table. Please try again later."); $sql = "UPDATE $table_name SET ad01_t=\"$file_var$files\""; //this gave me the results, as you can see I just created a new variable with the path in it print $sql; $result = mysql_query($sql, $connection) or die ("Could not execute query. Please try again later."); ?>

    attached mail follows:


    On Mon, 8 Apr 2002, Jas wrote: > $sql = "UPDATE $table_name SET ad01_t=\"$file_var$files\"";

    Is this really what you wanted? It would set ad01_t to the same thing for every single row in your table.

    If that is what you wanted, then I think your database design is a little weird.

    miguel

    attached mail follows:


    Hi all!

    I have a problem with the querystring.I want to add to every Link on my Homepage a querystring, but i should have the possibility to change some details in the Querystring. How should i solve this problem ?

    Example :

    http://domain.com/index.php?dest=12&item=2 The variables "?dest=" and "&item=" should be in every Link on my site.But only the values "12" and "2" should be alterable.

    Thank you,and sorry for my bad english Chris

    attached mail follows:


    you want to try a code line like this

    print "<a href=\"yourpagehere.phtml?dest=$line[index]&item=$line[index2]\">LinkName</a>";

    it will only work of course if you are in the middle of a loop that processes the results of an appropriate select statement that pulls the needed values for your dest and item variables.

    for a similar project I wrote this:

    for ($i=0; $i < $rowcount; $i++) { $line = mysql_fetch_array($results); if ($i % 2) { print "<tr bgcolor=\"white\">\n"; } else { print "<tr bgcolor=\"#e0e0e0\">\n"; } print "<td><a href=\"project_details.phtml?project=$line[pk]\">$line[projectname]</a></td>\n"; print "<td>$line[projectcustomer]</td>\n"; print "<td>$line[projectstatus]</td>\n"; print "<td>$line[projectcompletion]%</td>\n"; print "</tr>\n"; }

    Hope it helps

    Rance Hall 308.238.2455 Internal Office Extensions: 2455 or 6655 PC Programmer, The Buckle, Inc. rance.hallbuckle.com

    -----Original Message----- From: mailstruempf.com [mailto:mailstruempf.com] Sent: Monday, April 08, 2002 10:12 AM To: php-generallists.php.net Subject: [PHP] Adding Querystrings to links

    Hi all!

    I have a problem with the querystring.I want to add to every Link on my Homepage a querystring, but i should have the possibility to change some details in the Querystring. How should i solve this problem ?

    Example :

    http://domain.com/index.php?dest=12&item=2 The variables "?dest=" and "&item=" should be in every Link on my site.But only the values "12" and "2" should be alterable.

    Thank you,and sorry for my bad english Chris

    attached mail follows:


    On Monday, April 8, 2002, at 11:12 AM, <mailstruempf.com> wrote:

    > I have a problem with the querystring.I want to add to every Link on my > Homepage a querystring, but i should have the possibility to change some > details in the Querystring. > How should i solve this problem ? > > Example : > > http://domain.com/index.php?dest=12&item=2 > The variables "?dest=" and "&item=" should be in every Link on my > site.But only the values "12" and "2" should be alterable.

    Here is an example:

    $destination = 12; $item = 12;

    // later in the script

    print("<a href=\"http://domain.com/index.php?dest=$destination&item=$item\">Link</a> ");

    Erik

    ----
    

    Erik Price Web Developer Temp Media Lab, H.H. Brown priceehhbrown.com

    attached mail follows:


    Chris,

    What really matters is where the variables are coming from.

    print ("http://domain.com/index.php?dest=" . $var1 . "&item=" . $var2 ."<br>\n");

    that's how I usually do it. I'm assuming that both "dest" and "item" are variables on the referring page. Reply and let me know if this is what you're looking for.

    -Jordan K. Martin --New Image Design ---http://www.newimagedesign.com

    <mailstruempf.com> wrote in message news:002f01c1df0f$cb2ef400$0100a8c0pent333... Hi all!

    I have a problem with the querystring.I want to add to every Link on my Homepage a querystring, but i should have the possibility to change some details in the Querystring. How should i solve this problem ?

    Example :

    http://domain.com/index.php?dest=12&item=2 The variables "?dest=" and "&item=" should be in every Link on my site.But only the values "12" and "2" should be alterable.

    Thank you,and sorry for my bad english Chris

    attached mail follows:


    We've used email ban and IP ban but there are easy ways around this as you all know. I am wondering if there is anything a little more hardcore to do as far as banning goes. I had read somewhere about grabbing a MAC address or something similar from a network card. Has anyone heard of this method or does anyone already use a pretty solid method?

    Jeff

    attached mail follows:


    On Mon, 8 Apr 2002, Jeff Lewis wrote: > We've used email ban and IP ban but there are easy ways around this as > you all know. I am wondering if there is anything a little more > hardcore to do as far as banning goes. I had read somewhere about > grabbing a MAC address or something similar from a network card. Has > anyone heard of this method or does anyone already use a pretty solid > method?

    You shouldn't be able to get the MAC address off someone's card via their web browser (maybe if they allow ActiveX and use Windows then there's some security hole you could exploit). In any case, MACs can be changed, and they still identify a piece of hardware rather than a human.

    It is a fact of life that things uniquely identifying humans are fairly difficult to validate on the internet. The easier it is to verify, the easier it is to fake. This sometimes-annoying reality is what preserves whatever lingering privacy we still enjoy.

    Maybe you can cook up a cocktail of cookies, IP, $HTTP_USER_AGENT, and JavaScript-reported browser characteristics. But ultimately you're not going to keep out the determined prankster unless you rely on something that has significance in the Real World, such as credit cards, phone numbers, personal referrals, reputation-based credentials, and so on.

    miguel

    attached mail follows:


    My Apache server is currently not configured to use SSL, and I do not have a certificate. There is a possibility that I will be creating a script to send POST data to another company's web service, and that company requires the connection to be via SSL. The logical way for me to do this seems to be to use a socket to fire off the POST data at the other server, but I am not sure what is required to connect via SSL. Since browsers can do it without certificates, I would assume that I don't need a certificate to do this (only for if I want to use SSL with clients connecting to my server), but if someone could confirm this and/or point me in the direction of the functions that allow me to use SSL that would be greatly appreciated.

    Erik

    ----
    

    Erik Price Web Developer Temp Media Lab, H.H. Brown priceehhbrown.com

    attached mail follows:


    On Mon, 8 Apr 2002, Erik Price wrote: > My Apache server is currently not configured to use SSL, and I do not > have a certificate. There is a possibility that I will be creating a > script to send POST data to another company's web service, and that > company requires the connection to be via SSL. The logical way for me > to do this seems to be to use a socket to fire off the POST data at the > other server, but I am not sure what is required to connect via SSL. > Since browsers can do it without certificates, I would assume that I > don't need a certificate to do this (only for if I want to use SSL with > clients connecting to my server), but if someone could confirm this > and/or point me in the direction of the functions that allow me to use > SSL that would be greatly appreciated.

    While it's possible that the HTTPS server is configured to require client certificates, generally that's not the case.

    Configuring Apache for SSL has nothing to do with the ability of PHP on that server to make outgoing HTTPS connections to other servers.

    In my experience the best way to make HTTPS connections from PHP is using cURL.

    miguel

    attached mail follows:


    so what does line 111 look like?

    we can't read your mind...

    -----Original Message----- From: erich [mailto:erichlinetvigator.com] Sent: Monday, April 08, 2002 3:35 AM To: php-generallists.php.net Subject: [PHP] difficulty in solving the unknown warning

    i am a php programmer whose learning expr. is about 2 months. whatever > running script of php that written by other php programmer or me, i > always see the warning below shown, why this occurs? how to avoid? > > Warning: Undefined variable: HTTP_VIA in > g:\wwwroot\phpformmail\formmail.php on line 111

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

    attached mail follows:


    Is there any reason the following code should not work? I define the error function, then tell PHP to use it, then call a function which doesn't exist (test), and it will print the error on screen that that function doesn't exist, but it won't alert me, so it's obviously not entering the catchError function, why?

    <?php

    function catchError($num, $string, $file, $line) { echo "<script language=\"javascript\">alert('$num:$string:$file:$line');</script>"; }

    set_error_handler("catchError");

    test();

    ?>

    Thanks for your help,

    Adam Voigt adam.voigtcryptocomm.com

    attached mail follows:


    Hi there,

    I use the function mail to e-mail . This workes fine with most adresses. Unfortunatelly there is one e-mail provider (gmx.de) which does not get anny of those e-mails. Workes fine with all other services. I doubble checked it with 2 other gmx accounts.

    How can I find out what went wrong?

    Thanx for any help,

    Andy

    attached mail follows:


    On Mon, 8 Apr 2002, andy wrote: > I use the function mail to e-mail . This workes fine with most adresses. > Unfortunatelly there is one e-mail provider (gmx.de) which does not get anny > of those e-mails. Workes fine with all other services. I doubble checked it > with 2 other gmx accounts. > > How can I find out what went wrong?

    Check /var/log/maillog on the server?

    miguel

    attached mail follows:


    try this

    preg_match("/[a-zA-Z]+/i", $str);

    and if you want to go the other route.

    do this

    preg_match("/[^0-9\(\)\-\.\ ]+/i", $str); this will return true if it is anything other then what is listed. numbers 0-9 "(" ")" "-" "." " "

    Jim Lucas

    ----- Original Message ----- From: "Gary" <garyb10earthlink.net> To: <php-generallists.php.net> Sent: Saturday, April 06, 2002 6:52 PM Subject: [PHP] Phone number validation

    > Hi All, > I tried to cut a corner and use an alphabetic validation I am using > elsewhere > $stuff = "/^[a-zA-Z]+$/"; > if(preg_match($stuff, $value)) > > looks like I forgot about +( )- being in phone number. What is the > easiest way to allow these 4 characters? Are there any other characters > that people use? > > TIA > Gary > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

    attached mail follows:


    as long as you are only inserting information into the mysql db on each page load, then you shouldn't have a problem. make sure you keep you indecies down to a minimum.

    Jim Lucas

    ----- Original Message ----- From: "Craig Westerman" <westermanchanuteks.com> To: "php-general-list" <php-generallists.php.net> Sent: Saturday, April 06, 2002 11:57 PM Subject: [PHP] counter for HIGH traffic site

    > I'm needing counter for site that receives 60 to 80 hits a minute. Many I > have tried cause excessive server load and need to be deactivated or they > lose data and return to zero without warning. All tried so far have been > written in Perl. > > Anyone here know of a PHP counter that would handle HIGH traffic with little > added server load? Would using MySQL to store count be of any benifit? > > Thanks > > Craig ><> > westermanchanuteks.com >

    attached mail follows:


    You might also want to setup the table your updating the hits in as a HASH type table which runs completely in RAM, and as a result is extremely fast. The only obvious downside, is the data (or hits in this case) are lost on reboot.

    Adam Voigt adam.voigtcryptocomm.com

    On Mon, 8 Apr 2002 09:41:39 -0700, Jim Lucas [php] <jimphpbend.com> wrote: > as long as you are only inserting information into the mysql db on each page > load, then you shouldn't have a problem. make sure you keep you indecies > down to a minimum. > > Jim Lucas > > ----- Original Message ----- > From: "Craig Westerman" <westermanchanuteks.com> > To: "php-general-list" <php-generallists.php.net> > Sent: Saturday, April 06, 2002 11:57 PM > Subject: [PHP] counter for HIGH traffic site > > > > I'm needing counter for site that receives 60 to 80 hits a minute. Many I > > have tried cause excessive server load and need to be deactivated or they > > lose data and return to zero without warning. All tried so far have been > > written in Perl. > > > > Anyone here know of a PHP counter that would handle HIGH traffic with > little > > added server load? Would using MySQL to store count be of any benifit? > > > > Thanks > > > > Craig ><> > > westermanchanuteks.com > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    If it should be fast, avoid using mysql, just write a file with your number, if there´s a new request, get your number, add one and write it back. So you avoid mysql-"SQL parsing", opening Database, searching data, send to process, php putting in var....... just open, read, add, write, close HTH Oliver At 08.04.2002 14:32, you wrote: > >You might also want to setup the table your updating the hits in >as a HASH type table which runs completely in RAM, and as a result >is extremely fast. The only obvious downside, is the data (or hits in this >case) >are lost on reboot. > >Adam Voigt >adam.voigtcryptocomm.com > >On Mon, 8 Apr 2002 09:41:39 -0700, Jim Lucas [php] <jimphpbend.com> wrote: > > as long as you are only inserting information into the mysql db on each > page > > load, then you shouldn't have a problem. make sure you keep you indecies > > down to a minimum. > > > > Jim Lucas > > > > ----- Original Message ----- > > From: "Craig Westerman" <westermanchanuteks.com> > > To: "php-general-list" <php-generallists.php.net> > > Sent: Saturday, April 06, 2002 11:57 PM > > Subject: [PHP] counter for HIGH traffic site > > > > > > > I'm needing counter for site that receives 60 to 80 hits a minute. Many I > > > have tried cause excessive server load and need to be deactivated or they > > > lose data and return to zero without warning. All tried so far have been > > > written in Perl. > > > > > > Anyone here know of a PHP counter that would handle HIGH traffic with > > little > > > added server load? Would using MySQL to store count be of any benifit? > > > > > > Thanks > > > > > > Craig ><> > > > westermanchanuteks.com > > > > > > > > > -- > > 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

    attached mail follows:


    Make sure you are locking the file if you do this,

    With a high amount of traffic text based counters don't usually work too well because you have to deal with contention, what if two users view a page at the same time, you will run into a corrupt or inaccurate number.

    If you do file locking do you display an error asking them to refresh or do you handle it some other way? This becomes apparent especially with higher traffic sites like he was talking about.

    You may well be best off using a database, either that or invest some serious thought into how you are going to handle multiple clients loading pages.

    Jason

    -----Original Message----- From: heinischcreaction.de [mailto:heinischcreaction.de] Sent: Monday, April 08, 2002 12:56 PM To: php-generallists.php.net Subject: Re: [PHP] counter for HIGH traffic site

    If it should be fast, avoid using mysql, just write a file with your number, if there´s a new request, get your number, add one and write it back. So you avoid mysql-"SQL parsing", opening Database, searching data, send to process, php putting in var....... just open, read, add, write, close HTH Oliver At 08.04.2002 14:32, you wrote: > >You might also want to setup the table your updating the hits in >as a HASH type table which runs completely in RAM, and as a result >is extremely fast. The only obvious downside, is the data (or hits in this >case) >are lost on reboot. > >Adam Voigt >adam.voigtcryptocomm.com > >On Mon, 8 Apr 2002 09:41:39 -0700, Jim Lucas [php] <jimphpbend.com> wrote: > > as long as you are only inserting information into the mysql db on each > page > > load, then you shouldn't have a problem. make sure you keep you indecies > > down to a minimum. > > > > Jim Lucas > > > > ----- Original Message ----- > > From: "Craig Westerman" <westermanchanuteks.com> > > To: "php-general-list" <php-generallists.php.net> > > Sent: Saturday, April 06, 2002 11:57 PM > > Subject: [PHP] counter for HIGH traffic site > > > > > > > I'm needing counter for site that receives 60 to 80 hits a minute. Many I > > > have tried cause excessive server load and need to be deactivated or they > > > lose data and return to zero without warning. All tried so far have been > > > written in Perl. > > > > > > Anyone here know of a PHP counter that would handle HIGH traffic with > > little > > > added server load? Would using MySQL to store count be of any benifit? > > > > > > Thanks > > > > > > Craig ><> > > > westermanchanuteks.com > > > > > > > > > -- > > 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

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

    attached mail follows:


    If object of type A ($A) contains a variable $B which is an object of type B, how does a function within $B reference another variable in $A? Thanks.

    attached mail follows:


    $A->variable

    Rather than having us all guess, show your code...

    -----Original Message----- From: Robert J. Cissell [mailto:robertcissell.net] Sent: Monday, April 08, 2002 11:42 AM To: php-generallists.php.net Subject: [PHP] Object Confusion

    If object of type A ($A) contains a variable $B which is an object of type B, how does a function within $B reference another variable in $A? Thanks.

    attached mail follows:


    Here is what I need some information about, the script below opens a directory on the server, reads the files and places them into select boxes within a form, now I have this echoed multiple times on the page like so...<? echo "$file_list"; ?> Now I have tried to assign a form name based on the $file_name varibable but because the $file_name variable is created after the form has been created I cannot assign a unique form name each time I call <? echo "$file_list"; ?>. If someone could point out another way to do this or point out a good function for this I would greatly appreciate it. <?php $dir_name = "/path/to/images/directory/"; $dir = opendir($dir_name); $file_list .= "<p><FORM METHOD=\"post\" ACTION=\"index_done.php3\"> <SELECT NAME=\"files\">"; while ($file_name = readdir($dir)) { if (($file_name != ".") && ($file_name !="..")) { $file_list .= "<OPTION VALUE=\"$file_name\" NAME=\"$file_name\">$file_name</OPTION>"; } } $file_list .= "</SELECT><br><br><INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"select\"></FORM></p>"; closedir($dir); ?> Thanks in advance, Jas

    attached mail follows:


    Try <select name="files[]"> The square brackets will allow you to capture selections from multiple lists in an indexed array, $files. Hope that does what you need. -Kevin

    The square brackets will allow you to capture the variable $file_name

    -----Original Message----- From: Jas [mailto:jlgerfenhotmail.com] Sent: Monday, April 08, 2002 10:59 AM To: php-generallists.php.net Subject: [PHP] Assigning unique form names...

    Here is what I need some information about, the script below opens a directory on the server, reads the files and places them into select boxes within a form, now I have this echoed multiple times on the page like so...<? echo "$file_list"; ?> Now I have tried to assign a form name based on the $file_name varibable but because the $file_name variable is created after the form has been created I cannot assign a unique form name each time I call <? echo "$file_list"; ?>. If someone could point out another way to do this or point out a good function for this I would greatly appreciate it. <?php $dir_name = "/path/to/images/directory/"; $dir = opendir($dir_name); $file_list .= "<p><FORM METHOD=\"post\" ACTION=\"index_done.php3\"> <SELECT NAME=\"files\">"; while ($file_name = readdir($dir)) { if (($file_name != ".") && ($file_name !="..")) { $file_list .= "<OPTION VALUE=\"$file_name\" NAME=\"$file_name\">$file_name</OPTION>"; } } $file_list .= "</SELECT><br><br><INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"select\"></FORM></p>"; closedir($dir); ?> Thanks in advance, Jas

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

    attached mail follows:


    I understand what you're saying. You like the convenience of having the entire thing kept in a neat variable called $file_list, which you can add to your page in any place that you like, but you need a unique name for each <select> input tag so that on the "receiving" PHP script, you can access the contents of each time that you use $file_list.

    Unfortunately, I can't think of a good way for you to make these input names unique. The best thing I can suggest is that you turn this into a function/subroutine, and pass the string you wish to use as a unique name to the function as its argument (and you can make this a reuaseable function by also passing the $dir_name as an argument, and the target of the form tag). Like this:

    // $dir_name = name of directory to list // $form_target_page = name of page to receive this form's input // $input_name = unique name for this <select> input function file_list($dir_name, $form_target_page, $input_name) { if (!$dir = opendir($dir_name)) { return "Could not open directory $dir_name"; } else { $file_start = "<p><form method=\"post\" action=\"$form_target_page\"> <select name=\"$input_name\">\n";

    while ($file_name = readdir($dir)) { if ($file_name != '.' && $file_name != '..') { $file_list .= "<option value=\"$file_name\">$file_name</option>\n"; } } closedir($dir);

    $file_finish = "</select><br /><br /> <input type=\"submit\" name=\"submit\" value=\"select\"> </form></p>\n";

    // this function prints the form as its return value return $file_start . $file_list . $file_finish; } }

    On Monday, April 8, 2002, at 12:58 PM, Jas wrote:

    > Here is what I need some information about, the script below opens a > directory on the server, reads the files and places them into select > boxes > within a form, now I have this echoed multiple times on the page like > so...<? echo "$file_list"; ?> Now I have tried to assign a form name > based > on the $file_name varibable but because the $file_name variable is > created > after the form has been created I cannot assign a unique form name each > time > I call <? echo "$file_list"; ?>. If someone could point out another > way to > do this or point out a good function for this I would greatly > appreciate it. > <?php > $dir_name = "/path/to/images/directory/"; > $dir = opendir($dir_name); > $file_list .= "<p><FORM METHOD=\"post\" ACTION=\"index_done.php3\"> > <SELECT NAME=\"files\"&