OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general-digest-help_at_lists.php.net
Date: Fri Sep 20 2002 - 06:06:53 CDT

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

    php-general Digest 20 Sep 2002 11:06:53 -0000 Issue 1596

    Topics (messages 116944 through 116992):

    Re: pass var through URL String
            116944 by: Gary

    Re: PHP Execution Timer
            116945 by: Beau Hartshorne

    Re: Stripping specific tags
            116946 by: John Holmes
            116965 by: John Holmes
            116966 by: Justin French

    Re: Loop through POST-result
            116947 by: John Holmes

    php_mcrypt library
            116948 by: [-^-!-%-

    fopen()
            116949 by: Donahue Ben
            116951 by: Brad Bonkoski
            116957 by: Jason Morehouse

    Re: Encrypting/Decrypting Data
            116950 by: Evan Nemerson

    java in php4 on debian testing distribution?
            116952 by: Monique Y. Herman

    MUST READ: ALL MySQL Newbies!
            116953 by: Shane

    custom user login
            116954 by: Daniel Negron/KBE
            116973 by: Ivo

    Re: adding unix account via system command
            116955 by: tim tom

    Re: Good OO PHP resources? Open Source APIs?
            116956 by: Michael Sims

    MySQL errors in newer PHP 4.2.3
            116958 by: Steven Roussey
            116959 by: Steven Roussey
            116960 by: Jocelyn Fournier
            116972 by: Zak Greant
            116975 by: Jocelyn Fournier

    Re: session & cookies
            116961 by: Jeff Bluemel

    Access > MySQL
            116962 by: Liam MacKenzie
            116963 by: Peter Houchin

    syntax question - eregi()
            116964 by: Anthony Ritter
            116967 by: Philip Hallstrom

    Script Modificaton question
            116968 by: Tom Ray
            116969 by: John Holmes
            116970 by: Tom Ray

    Re: Need some help please.
            116971 by: Simon Angell

    Re: Apache not parsing without .php on url?
            116974 by: Ivo

    MySQL > Access
            116976 by: Christian Calloway
            116977 by: Erwin
            116985 by: David Robley

    Re: redefining a function
            116978 by: Tim Ward

    Re: PHP source code
            116979 by: Tim Ward

    Re: Unserialize stopped working after php & db upgrade
            116980 by: Geoff Caplan

    Almost done with install under Linux
            116981 by: César Aracena

    Sessions
            116982 by: Erwin

    Changing the saturation of an image
            116983 by: Jean-Christian Imbeault

    HTML 2 TEXT
            116984 by: Tim Haynes
            116987 by: SiTA WebMaster - VST
            116988 by: nicos.php.net

    Re: Is php even right for this design?
            116986 by: Marek Kilimajer

    Re: Click....download and update
            116989 by: Marek Kilimajer

    Search system
            116990 by: nicos.php.net
            116991 by: nicos.php.net

    Re: FPDF and MySQL
            116992 by: Marek Kilimajer

    Administrivia:

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

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

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

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

    attached mail follows:


    I was wrong, it is passing $bname. I have got it down to a syntax error
    by using.
    $sql = "SELECT * FROM bugs WHERE bname = {$_GET['bname']}";

    gary

    Gary wrote:
    > I don't think it is being passed. I think I am going to have to figure
    > out how to pass bname in the link using pear.With pear bnname=0
    >
    > while ($row = $res->fetchRow()){
    > $bname = $row[0];
    > $owner = $row[1];
    > echo "
    > <li><a href=\"temp_page.php?bname=$bname\">$bname</a> by
    > $owner<li>
    > ";
    > }
    >
    > Gary
    >
    > Kevin Stone wrote:
    >
    >> There's obviously something wrong with the way you're handeling the new
    >> variable. Do extract($_GET); and go back to the way you were
    >> handeling it
    >> before.
    >>
    >> echo $bname;
    >>
    >> -Kevin
    >>
    >

    attached mail follows:


    This function:

    function getmicrotime()
    {
        list($usec, $sec) = explode(" ",microtime());
        return ((float)$usec + (float)$sec);
    }

    is provided on this page:

    http://www.php.net/manual/en/function.microtime.php

    and is needed for the code below to work properly.

    Beau

    > <?
    > $timerOn = 1; // set to 0 if you want to turn it off $timestart =
    > getmicrotime(); ?>
    >
    >
    > Bottom:
    >
    > <?
    > if($timerOn)
    > {
    > $timeend = getmicrotime();
    > $timer = $timeend - $timestart;
    > echo "timer: $timer";
    > }
    > ?>
    >
    > Similar things could be done with MySQL quereies, but I haven't looked

    > into it.
    >
    >
    > Justin French
    >
    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


    > I was wondering is there a way to strip ONLY the tags that you specify
    > from
    > a page, rather than having to include all the tags you do want (using
    > strip_tags() )

    A regular expression or str_replace() would be best for this.

    Realize this isn't a good method, though. What if you're trying to strip
    images with an <img> tag, but a new spec comes out that allows <image>
    tags. Now you're not protected against it. That's a simple example, but
    it's a better policy to say X is good and allow it through, rather than
    to say, I know Y is bad, but I'll let everything else through and assume
    it's good.

    ---John Holmes...

    attached mail follows:


    > That's what I thought the answer would be. I guess I will have to see
    if I
    > can create a function to add to the next release of PHP to do this, as
    > there
    > certainly seems to be quite a demand for it, according to the archives
    > anyway.

    I hope not. That would be a worthless function to have. Did you read my
    post? The basic idea is validation is to allow what you _know_ is good,
    and kill the rest. You don't kill a couple things you know are bad, then
    assume the rest is good and let it in.

    ---John Holmes...

    attached mail follows:


    on 20/09/02 1:14 PM, John Holmes (holmes072000charter.net) wrote:

    > I hope not. That would be a worthless function to have. Did you read my
    > post? The basic idea is validation is to allow what you _know_ is good,
    > and kill the rest. You don't kill a couple things you know are bad, then
    > assume the rest is good and let it in.

    I'm with John on this one for sure... To pretend you know every possible
    "bad" thing that can happen is plain stoopid. Develop a list of things you
    accept (commonly <p><b><i><br>), and turf the rest.

    What I WOULD like to see in a future PHP release is a strip attributes
    feature. Not sure of how to implement it, but even if you only let a few
    tags through, there are still BIG problems with the tags:

    <B onclick="javascript: window.close()"> (not sure of the exact syntax) is
    pretty evil.

    Perhaps if strip tags could be extended so that you can list ALLOWED
    attributes:

    $string = striptags2('<P class id style><B><I><BR><A href target>', $string)

    Essentially, this would kill off any one doing an onclick/onmouseover/etc on
    the allowed tags

    This still leaves a few problems, the biggest of which is
    href="javascript:..." in <a> tags.

    A further extension might be to list the allowed protocols of href?? There
    could be an allowance for http, ftp, ext (external), rel (relative links),
    javascript, and others I'm not thinking about.

    striptags2('<b><A href[rel] target>', $string)
    would only allow relative links

    striptags2('<b><A href[http|ftp|rel] target>', $string)
    would only allow relative, http and ftp links... NOT javascript for example

    This would make striptags() a HIGHLY powerful tool for validating user input
    which contains HTML. yes, it can all be done with regexp if you've got
    enough time and skills, but I don't :)

    Sorry for getting off topic!!

    Regards,

    Justin French

    attached mail follows:


    > I would like to get all the data from a POST-result into an array.
    >
    > Is there a function like that adds all the vars from the post into an
    > array
    > where Key is the name of the form-field and Value is the value entered
    in
    > this field.
    >
    > Like this:
    > array('firstname' => 'fname', 'lastname' => 'lname');

    Are you serious?

    Take a look at the $HTTP_POST_VAR or $_POST array, which, amazingly, is
    an array that holds your form data, with the key is the name of the form
    field and the value is the value of the form element....

    ---John Holmes...

    attached mail follows:


    I've looking for pre-built php_mcrypt library. Does anyone know where I
    can get one. I'm basically looking for something that would not require
    me to reload or recompile php [shared hosting issues...].

    The environment is : PHP 4.1.2/Linux /Apache 1.3.26.

    Any help would be greatly appreciated.

    =P e p i e D e s i g n s
     www.pepiedesigns.com
     Providing Solutions That Increase Productivity

     Web Developement. Database. Hosting. Multimedia.

    attached mail follows:


    I have a php script that tries to write files in a
    particular directory. When the script writes files
    the ownership is "apache". The problem I have is the
    particular directory that the script is trying to
    create files in, it cannot, because it does not own
    that directory and it is not part of the group. So is
    the only way to get around this problem is by changing
    the ownership of the directory to "apache"?

    Ben

    __________________________________________________
    Do you Yahoo!?
    New DSL Internet Access from SBC & Yahoo!
    http://sbc.yahoo.com

    attached mail follows:


    I would say that is the best way, or if you have other information
    there, write to abother directory that is owned by "apache"

    -Brad

    Donahue Ben wrote:

    > I have a php script that tries to write files in a
    > particular directory. When the script writes files
    > the ownership is "apache". The problem I have is the
    > particular directory that the script is trying to
    > create files in, it cannot, because it does not own
    > that directory and it is not part of the group. So is
    > the only way to get around this problem is by changing
    > the ownership of the directory to "apache"?
    >
    > Ben
    >
    > __________________________________________________
    > Do you Yahoo!?
    > New DSL Internet Access from SBC & Yahoo!
    > http://sbc.yahoo.com
    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


    Yup!

    On Thu, 19 Sep 2002 16:43:48 -0700, Donahue Ben wrote:

    > I have a php script that tries to write files in a
    > particular directory. When the script writes files
    > the ownership is "apache". The problem I have is the
    > particular directory that the script is trying to
    > create files in, it cannot, because it does not own
    > that directory and it is not part of the group. So is
    > the only way to get around this problem is by changing
    > the ownership of the directory to "apache"?
    >
    > Ben
    >
    > __________________________________________________
    > Do you Yahoo!?
    > New DSL Internet Access from SBC & Yahoo!
    > http://sbc.yahoo.com

    -- 
     Jason Morehouse (jm[]netconcepts[.]com)
     Netconcepts - http://www.netconcepts.com
     Auckland, New Zealand
     Linux: Because rebooting is for adding hardware.
    

    attached mail follows:


    If memory serves, $td is returned by mcrypt_module_open()

    http://www.php.net/mcrypt-module-open

    On Thursday 19 September 2002 00:54, [-^-!-%- wrote: > Hello. > > How do you decrypt a data that's encrypted with crypt($data). > > Now, the php documents says crypt() is a one-way crypting function, so > there is no decrypt() function. I was wondering if someone could shed some > light on alternative ways to encrypt & decrypt data. > > I've looked at mcrypt_generic and mdecrypt_generic, but am confused by the > 'resource td' parameter. Perhaps, someone can explain that as well. > > Any help is greatly apprciated. > > -john > > =P e p i e D e s i g n s= > www.pepiedesigns.com > Providing Solutions That Increase Productivity > > Web Developement. Database. Hosting. Multimedia.

    attached mail follows:


    I'd like to play with using java classes from within php, as is described in http://www.php.net/manual/en/ref.java.php ... I'm using the apache and php4 packages from the debian testing distribution.

    All of the documentation I've found on the web about installing the java extension seems to be oriented toward windows, making me think that maybe I don't need to specify an extension library on linux?

    I tried simply using

    ini_set ("java.home", "/usr/local/sun-j2sdk1.4.1"); $systemInfo = new Java("java.lang.System");

    and got the following:

    Fatal error: Cannot instantiate non-existent class: java

    That seems fairly straightforward: My php doesn't know java from adam.

    So my questions are: Do I need to get an extension library for this functionality on linux? If not, does anyone know of a debian package of php4 that will give me this capability? I rather like being able to use packages wherever possible.

    Thanks in advance for any insight!

    -- monique

    attached mail follows:


    If you are a MySQL newbie you need to read this!

    I just screwed up big time and lost about 1 hour of data in a time sensitive application by using TINYINT as my ID field.

    TINYINT will only allow up to 255 records in a MySQL DB. Please, if you don't know the EXACT differences between all the different INTEGER types, please stop what you are doing and go to mysql.com and read up. You may be surprised that the number you enter after your "INT(10)" has nothing to do with what you think it means.

    Ever wish someone could let you know ahead of time that you are about to screw up? Well this could be it. Please learn from my mistake, fully understand INTEGER types if you ever plan on having a DB grow above 200+ records.

    Thanks crew. - name withheld... too embarrassed right now.

    attached mail follows:


    Hi all,

    I used a script posted in here awhile ago from http://www.devshed.com/Server_Side/PHP/UserAuth/page1.html

    basic tutorial on how to make php session logins.

    How can I customize this script so that it is specific to each user.

    can I add $f_user.php from the header, or will that output the url as $f_user.php and fail ? I figure I would also have to name each file as the username.php also, right ?

    <?

    // login.php - performs validation

    // authenticate using form variables $status = authenticate($f_user, $f_pass);

    // if user/pass combination is correct if ($status == 1) { // initiate a session session_start();

    // register some session variables session_register("SESSION");

    // including the username session_register("SESSION_UNAME"); $SESSION_UNAME = $f_user;

    // redirect to protected page header("Location: /example.php"); exit(); } else // user/pass check failed { // redirect to error page header("Location: /error.php?e=$status"); exit(); }

    // authenticate username/password against a database // returns: 0 if username and password is incorrect // 1 if username and password are correct function authenticate($user, $pass) { // configuration variables // normally these should be sourced from an external file // for example: include("dbconfig.php"); // variables explicitly set here for illustrative purposes $db_host = "localhost"; $db_user = "user"; $db_pass = "pass"; $db_name = "mydb";

    // check login and password // connect and execute query $connection = mysql_connect($db_host, $db_user, $db_pass) or die ("Unable to connect!"); $query = "SELECT uname from users WHERE uname = '$user' AND pswd = PASSWORD('$pass')"; mysql_select_db($db_name); $result = mysql_query($query, $connection) or die ("Error in query: $query. " . mysql_error());

    // if row exists -> user/pass combination is correct if (mysql_num_rows($result) == 1) { return 1; } // user/pass combination is wrong else { return 0; } }

    ?>

    attached mail follows:


    You could use $_SESSION['myvar'] to register your session instead of session_register()/session_unregister()/session_is_registered() functions. Then you could use it as a normal variable.

    Do not use glodal $_SESSION declaration in your code.

    You could find more info at http://www.php.net/manual/en/reserved.variables.php#reserved.variables.sessi on http://www.php.net/manual/en/ref.session.php

    regards

    Ivo

    "Daniel Negron/Kbe" <danegronkbelectronics.net> wrote in message news:OFE2B08725.ADE9A81B-ON85256C39.0082F638KBELECTRONICS.NET... > Hi all, > > I used a script posted in here awhile ago from > http://www.devshed.com/Server_Side/PHP/UserAuth/page1.html > > basic tutorial on how to make php session logins. > > How can I customize this script so that it is specific to each user. > > can I add $f_user.php from the header, or will that output the url as > $f_user.php and fail ? > I figure I would also have to name each file as the username.php also, > right ? > > <? > > // login.php - performs validation > > // authenticate using form variables > $status = authenticate($f_user, $f_pass); > > // if user/pass combination is correct > if ($status == 1) > { > // initiate a session > session_start(); > > // register some session variables > session_register("SESSION"); > > // including the username > session_register("SESSION_UNAME"); > $SESSION_UNAME = $f_user; > > // redirect to protected page > header("Location: /example.php"); > exit(); > } > else > // user/pass check failed > { > // redirect to error page > header("Location: /error.php?e=$status"); > exit(); > } > > // authenticate username/password against a database > // returns: 0 if username and password is incorrect > // 1 if username and password are correct > function authenticate($user, $pass) > { > // configuration variables > // normally these should be sourced from an external file > // for example: include("dbconfig.php"); > // variables explicitly set here for illustrative purposes > $db_host = "localhost"; > $db_user = "user"; > $db_pass = "pass"; > $db_name = "mydb"; > > // check login and password > // connect and execute query > $connection = mysql_connect($db_host, $db_user, $db_pass) or die > ("Unable to connect!"); > $query = "SELECT uname from users WHERE uname = '$user' AND > pswd = PASSWORD('$pass')"; > mysql_select_db($db_name); > $result = mysql_query($query, $connection) or die ("Error in > query: $query. " . mysql_error()); > > // if row exists -> user/pass combination is correct > if (mysql_num_rows($result) == 1) > { > return 1; > } > // user/pass combination is wrong > else > { > return 0; > } > } > > ?> > >

    attached mail follows:


    Dear Marek, Where do find that? I am no C programmer.

    --
    tim
    

    --- Marek Kilimajer <kilimajerwebglobe.sk> wrote: > It's a shell script, and your shell drops root privileges. Use a shell > that doesn't or use a C-wraper. > > tim tom wrote: > > >Dear Pete, > >Yes, apache runs as nobody. But I have setuid add.sh. Wouldn't that be sufficient ? > > > >-- > >tim > > > >--- Peter Houchin <phpvfsa.com.au> wrote: > > > > > >>you need to make sure that the web has permission to use that file .. my > >>guess is it don't have permission hence why you can run add.sh from the > >>command line (where your not your web user I'm assuming). > >> > >> > >> > > > > > >__________________________________________________ > >Do You Yahoo!? > >Yahoo! Autos - Get free new car price quotes > >http://autos.yahoo.com > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    __________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com

    attached mail follows:


    On Thu, 19 Sep 2002 00:50:56 -0400, you wrote:

    >By doing so I want more and more of my PHP to be purely OO. I'm fairly >aware of how to write my own classes for data but are their any frameworks >out there to do the foundation stuff already?

    Have you looked at PEAR? It comes with the PHP distribution and has quite a few foundation-like classes, including PEAR DB, a database abstraction layer. If you build PHP from source it gets installed in /usr/local/lib/php (assuming you're on a unix variant). Documentation is at

    http://pear.php.net

    Also take a look at Horde. Horde is a suite of PHP applications, including a popular web-based mail client called Imp and a really nifty web-based CVS browser called Chora. But Horde is also a group of common libraries that handle a lot of base things like retrieving form data and storing user preferences in a OO-way. I just recently started looking at it because I wanted to use Chora, but I'm having fun just looking through their base classes to see how they implemented things. It looks like really clean, nicely separated code, and I personally plan to learn a lot from looking through it.

    http://www.horde.org

    You can browse their source code directly from:

    http://cvs.horde.org

    HTH

    attached mail follows:


    Since updating to 4.2.3, we have been getting intermittent errors of "Commands out of sync". Anyone else see this?

    Sincerely, Steven Roussey http://Network54.com/?pp=e

    php,sql,query

    attached mail follows:


    Hmm, do you use pconnect or connect?

    I noticed someone changed our PHP script to use persistent connections (likely why the server is running slower). I am wondering if a cancelled connection is being reused or if it just is a more general bug in the mysql client code in PHP....

    Sincerely, Steven Roussey http://Network54.com/?pp=e

    > -----Original Message----- > From: Jocelyn Fournier [mailto:jocpresence-pc.com] > > Hi, > > Same problem for me, although it was already here with 4.2.0 for me (well > it > seems to be also a high QPS problem...). The problem seems to disappear > with > an apache restart, but sometimes appear again randomly. > > Regards, > Jocelyn > > ----- Original Message ----- > From: "Steven Roussey" <srousseynetwork54.com> > To: <generallists.php.net> > Cc: "Mysql" <mysqllists.mysql.com> > Sent: Friday, September 20, 2002 2:14 AM > Subject: MySQL errors in newer PHP 4.2.3 > > > > Since updating to 4.2.3, we have been getting intermittent errors of > > "Commands out of sync". Anyone else see this? > > > > Sincerely, > > Steven Roussey > > http://Network54.com/?pp=e > > > > php,sql,query > > > > > > --------------------------------------------------------------------- > > Before posting, please check: > > http://www.mysql.com/manual.php (the manual) > > http://lists.mysql.com/ (the list archive) > > > > To request this thread, e-mail <mysql-thread120087lists.mysql.com> > > To unsubscribe, e-mail > <mysql-unsubscribe-joc=presence-pc.comlists.mysql.com> > > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > > > > > > >

    attached mail follows:


    I've always used pconnect. ----- Original Message ----- From: "Steven Roussey" <srousseynetwork54.com> To: "'Jocelyn Fournier'" <jocpresence-pc.com>; <php-generallists.php.net> Cc: "'Mysql'" <mysqllists.mysql.com> Sent: Friday, September 20, 2002 2:38 AM Subject: RE: MySQL errors in newer PHP 4.2.3

    > Hmm, do you use pconnect or connect? > > I noticed someone changed our PHP script to use persistent connections > (likely why the server is running slower). I am wondering if a cancelled > connection is being reused or if it just is a more general bug in the > mysql client code in PHP.... > > Sincerely, > Steven Roussey > http://Network54.com/?pp=e > > > -----Original Message----- > > From: Jocelyn Fournier [mailto:jocpresence-pc.com] > > > > Hi, > > > > Same problem for me, although it was already here with 4.2.0 for me > (well > > it > > seems to be also a high QPS problem...). The problem seems to > disappear > > with > > an apache restart, but sometimes appear again randomly. > > > > Regards, > > Jocelyn > > > > ----- Original Message ----- > > From: "Steven Roussey" <srousseynetwork54.com> > > To: <generallists.php.net> > > Cc: "Mysql" <mysqllists.mysql.com> > > Sent: Friday, September 20, 2002 2:14 AM > > Subject: MySQL errors in newer PHP 4.2.3 > > > > > > > Since updating to 4.2.3, we have been getting intermittent errors of > > > "Commands out of sync". Anyone else see this? > > > > > > Sincerely, > > > Steven Roussey > > > http://Network54.com/?pp=e > > > > > > php,sql,query > > > > > > > > > > --------------------------------------------------------------------- > > > Before posting, please check: > > > http://www.mysql.com/manual.php (the manual) > > > http://lists.mysql.com/ (the list archive) > > > > > > To request this thread, e-mail <mysql-thread120087lists.mysql.com> > > > To unsubscribe, e-mail > > <mysql-unsubscribe-joc=presence-pc.comlists.mysql.com> > > > Trouble unsubscribing? Try: > http://lists.mysql.com/php/unsubscribe.php > > > > > > > > > > > > > > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <mysql-thread120089lists.mysql.com> > To unsubscribe, e-mail <mysql-unsubscribe-joc=presence-pc.comlists.mysql.com> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > > >

    attached mail follows:


    Hello Jocelyn and Steven,

    Could either or both of you submit a bug report at http://bugs.php.net/? If you follow the instructions there, it will greatly help us in tracking down the issue!

    Cheers!

    Zak Greant PHP QA Team

    attached mail follows:


    Hi Steven,

    Some precisions : after taking a look at my mail, I noticed the very first time I saw this error was with PHP 4.2.1 and MySQL 4.0.2 (reported on this list on 27 june 2002).

    Regards, Jocelyn ----- Original Message ----- From: "Steven Roussey" <srousseynetwork54.com> To: "'Jocelyn Fournier'" <jocpresence-pc.com>; <php-generallists.php.net> Cc: "'Mysql'" <mysqllists.mysql.com> Sent: Friday, September 20, 2002 2:38 AM Subject: RE: MySQL errors in newer PHP 4.2.3

    > Hmm, do you use pconnect or connect? > > I noticed someone changed our PHP script to use persistent connections > (likely why the server is running slower). I am wondering if a cancelled > connection is being reused or if it just is a more general bug in the > mysql client code in PHP.... > > Sincerely, > Steven Roussey > http://Network54.com/?pp=e > > > -----Original Message----- > > From: Jocelyn Fournier [mailto:jocpresence-pc.com] > > > > Hi, > > > > Same problem for me, although it was already here with 4.2.0 for me > (well > > it > > seems to be also a high QPS problem...). The problem seems to > disappear > > with > > an apache restart, but sometimes appear again randomly. > > > > Regards, > > Jocelyn > > > > ----- Original Message ----- > > From: "Steven Roussey" <srousseynetwork54.com> > > To: <generallists.php.net> > > Cc: "Mysql" <mysqllists.mysql.com> > > Sent: Friday, September 20, 2002 2:14 AM > > Subject: MySQL errors in newer PHP 4.2.3 > > > > > > > Since updating to 4.2.3, we have been getting intermittent errors of > > > "Commands out of sync". Anyone else see this? > > > > > > Sincerely, > > > Steven Roussey > > > http://Network54.com/?pp=e > > > > > > php,sql,query > > > > > > > > > > --------------------------------------------------------------------- > > > Before posting, please check: > > > http://www.mysql.com/manual.php (the manual) > > > http://lists.mysql.com/ (the list archive) > > > > > > To request this thread, e-mail <mysql-thread120087lists.mysql.com> > > > To unsubscribe, e-mail > > <mysql-unsubscribe-joc=presence-pc.comlists.mysql.com> > > > Trouble unsubscribing? Try: > http://lists.mysql.com/php/unsubscribe.php > > > > > > > > > > > > > > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <mysql-thread120089lists.mysql.com> > To unsubscribe, e-mail <mysql-unsubscribe-joc=presence-pc.comlists.mysql.com> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > > >

    attached mail follows:


    > Jeff Bluemel wrote: > > >I want to force it to use a cookie that points to a transparent SID on > >my system. > > > > Can you elaborate on this? I have no idea what you mean.

    for some reason when I was reading the documentation on sessions on php.net I thought it stated that it was possible to have a cookie point at a transaprent ID. I guess one of my biggest concerns is security. I don't want somebody to be able to open a session with an ID, and I want them to login everytime. this all happens behind ssl too.

    I check my browser cookies, and I never see a cookieis, and my pages always pass a session ID number with them. what is the best, secure way, to have sessions ID's that the browser never see's?

    > >I've got the following options in my php.ini, but the system doesn't seem to > >ever use a cookie, and the sessions don't die. (that's my biggest concern > >is that the user has to login to the system EVERY time he visits the site.) > > > >session.use_cookies = 1 > >session.use_only_cookies = 1 > >session.use_trans_sid = 1 > > > > With use_trans_sid set, PHP is going to append the session ID to the URL > of links, etc., on: > > 1) The client's first visit, determined by the fact that the client sent > no session ID > 2) Any other visit where the client sent a session ID on the URL but not > in a cookie

    I set session.use_trans_sid = 0, but I still see the SID in the URL passing from session to session.

    > It sounds to me like either you're only noticing the first case there, > or your browser is not supplying the cookie on subsequent requests. > Maybe this bit of information will help you. > > Happy hacking. > > Chris > >

    attached mail follows:


    Yeah, I know this doesn't have much to do with PHP...

    does anyone know of a tool that automatically converts an access database to MySQL readable data?

    Thanks a heap! Liam

    attached mail follows:


    yeah there is tis called

    Access-to-MySQL (http://www.convert-in.com/acc2sql.htm ) ...here's some specs on it

    Features

    All MS Access data types and attributes are supported Works with all versions of Unix and Windows MySQL servers Stores MS Access database into a dump file (see Customize Conversion article for related information) Special approach for VServer users (see VServer User Notes article for related information.) Converts indexes with all necessary attributes

    Converts password protected MS Access databases Easy-to-use wizard-style interface Full install/uninstall support

    Requirements

    Windows 95 or later or Windows NT 3.51 or later At least 32 MB of available memory MS Access 7.0 or higher (ODBC is not required) Necessary privileges to write into database on the target MySQL server

    Limitations

    Converts MS Access tables only (forms, queries, reports are not supported) Does not convert system (hidden) tables Does not convert relationships between tables Does not convert databases protected with User-Level security

    > -----Original Message----- > From: Liam MacKenzie [mailto:phplistoperationenigma.com] > Sent: Friday, 20 September 2002 12:07 PM > To: php > Subject: [PHP] Access > MySQL > > > Yeah, I know this doesn't have much to do with PHP... > > does anyone know of a tool that automatically converts an access > database to > MySQL readable data? > > > Thanks a heap! > Liam > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

    attached mail follows:


    I'm having difficulty understanding what the array does or refers to in the eregi() function using php.

    Listing below are returned strings with [0] [1] [2] ..............................................

    <? $fp =fopen("C:\\TextFiles\\Test.htm","r"); $content = fread($fp,100000); eregi("<b>(.*)<hr width",$content,$match); $FinalLine=$match[2]; echo "$FinalLine"; ?> ...........................

    quick brown fox jumped over the lazy dog // output with $match[1] .................................

    quick brown fox jumped over the lazy dog. <hr width // output with $match[0] ..................................

    file://output is nothing with $match[2] ...................................

    Description: int eregi ( string pattern, string string [, array regs]) ........................

    Thank you. Tony Ritter

    attached mail follows:


    If memory serves, $match will contain an array whose 0th element is the entire string and whose 1st element contains whatever is matched in the first (), 2nd element matches the second () and so on.

    Check the manpage for more...

    and when testing things like this out try adding the following for debugging reasons:

    print("<pre>"); print_r($match); print("</pre>");

    that will let you see what $match looks like in its entirety.

    good luck

    On Thu, 19 Sep 2002, Anthony Ritter wrote:

    > I'm having difficulty understanding what the array does or refers to in the > eregi() function using php. > > Listing below are returned strings with > [0] > [1] > [2] > .............................................. > > <? > $fp =fopen("C:\\TextFiles\\Test.htm","r"); > $content = fread($fp,100000); > eregi("<b>(.*)<hr width",$content,$match); > $FinalLine=$match[2]; > echo "$FinalLine"; > ?> > ........................... > > quick brown fox jumped over the lazy dog // output with $match[1] > ................................. > > quick brown fox jumped over the lazy dog. > <hr width // output with $match[0] > .................................. > > file://output is nothing with $match[2] > ................................... > > Description: > int eregi ( string pattern, string string [, array regs]) > ........................ > > Thank you. > Tony Ritter > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    I have a chat script that I downloaded and according to the license I can modify it as much as I want, and I'm a little stuck on a simple modification I want to make. When you type in a message it stores in in a file called text.php and then the chat page does an include call for the text.php file. Currently, the writer of this script has it setup so all new text added is placed at the begining of the file using the "w+" command, according to php.net with fopen if I switch the "w+" to "a+" it shoudl place the new data at the end of the file. However, when I make this switch, the data is still being placed at the begining of the text.php file. I've including the portion of the script that writes to text.php can someone help me find what I'm not seeing?

    $filename = "text.php"; $fileAr= file($filename); exec("cat /dev/null > '$filename'"); $fd = fopen( $filename, "w+" ); $filemessage = "<a href=\"javascript:launcher('profile.php?username=$username');\"><B>$username</B></a>: "; $filemessage .="<font color=\"$fcolor\">$chat</font><BR>\n"; fputs($fd,$filemessage); $numLines = 20; for ($i=0;$i<$numLines;$i++) { fputs($fd,$fileAr[$i]); } fclose( $fd );

    TIA!

    attached mail follows:


    > I have a chat script that I downloaded and according to the license I > can modify it as much as I want, and I'm a little stuck on a simple > modification I want to make. When you type in a message it stores in in > a file called text.php and then the chat page does an include call for > the text.php file. Currently, the writer of this script has it setup so > all new text added is placed at the begining of the file using the "w+" > command, according to php.net with fopen if I switch the "w+" to "a+" it > shoudl place the new data at the end of the file. However, when I make > this switch, the data is still being placed at the begining of the > text.php file. I've including the portion of the script that writes to > text.php can someone help me find what I'm not seeing? > > $filename = "text.php"; > $fileAr= file($filename);

    It's reading the whole file into an array here. The newest lines will still be first.

    > exec("cat /dev/null > '$filename'"); > $fd = fopen( $filename, "w+" );

    This opens the file and truncates it to zero length.

    > $filemessage = "<a > > href=\"javascript:launcher('profile.php?username=$username');\"><B>$user na > me</B></a>: > "; > $filemessage .="<font > color=\"$fcolor\">$chat</font><BR>\n"; > fputs($fd,$filemessage);

    This write the new, formatted message. > $numLines = 20; > for ($i=0;$i<$numLines;$i++) { > fputs($fd,$fileAr[$i]);

    And then write the first 20 lines of the file.

    > } > fclose( $fd );

    So, if you want it in the new format of newest chat last in the file, then use the same script, but fputs() the 20 old lines first, then the new line. Just change the order.

    This would work for you:

    $numLines = 20; $filename = "text.php"; //read whole file $fileArr = file($filename); //open file and truncate to zero $fp = fopen($filename,"w+"); //write 20 lines of old file to new file fputs($fp,array_slice($fileArr,0,$numLines); //format $message //write message to file fputs($fp,$message); //close file fclose($fp);

    Adapt to your needs...

    ---John Holmes...

    attached mail follows:


    Ahah! That's what I was thinking, thatnks for helping me clear that up!

    John Holmes wrote:

    >>I have a chat script that I downloaded and according to the license I >>can modify it as much as I want, and I'm a little stuck on a simple >>modification I want to make. When you type in a message it stores in >> >> >in > > >>a file called text.php and then the chat page does an include call for >>the text.php file. Currently, the writer of this script has it setup >> >> >so > > >>all new text added is placed at the begining of the file using the >> >> >"w+" > > >>command, according to php.net with fopen if I switch the "w+" to "a+" >> >> >it > > >>shoudl place the new data at the end of the file. However, when I make >>this switch, the data is still being placed at the begining of the >>text.php file. I've including the portion of the script that writes to >>text.php can someone help me find what I'm not seeing? >> >>$filename = "text.php"; >> $fileAr= file($filename); >> >> > >It's reading the whole file into an array here. The newest lines will >still be first. > > > >> exec("cat /dev/null > '$filename'"); >> $fd = fopen( $filename, "w+" ); >> >> > >This opens the file and truncates it to zero length. > > > >> $filemessage = "<a >> >> >> >> >href=\"javascript:launcher('profile.php?username=$username');\"><B>$user >na > > >>me</B></a>: >>"; >> $filemessage .="<font >>color=\"$fcolor\">$chat</font><BR>\n"; >> fputs($fd,$filemessage); >> >> > >This write the new, formatted message. > > > >> $numLines = 20; >> for ($i=0;$i<$numLines;$i++) { >> fputs($fd,$fileAr[$i]); >> >> > >And then write the first 20 lines of the file. > > > >> } >> fclose( $fd ); >> >> > >So, if you want it in the new format of newest chat last in the file, >then use the same script, but fputs() the 20 old lines first, then the >new line. Just change the order. > >This would work for you: > >$numLines = 20; >$filename = "text.php"; >//read whole file >$fileArr = file($filename); >//open file and truncate to zero >$fp = fopen($filename,"w+"); >//write 20 lines of old file to new file >fputs($fp,array_slice($fileArr,0,$numLines); >//format $message >//write message to file >fputs($fp,$message); >//close file >fclose($fp); > >Adapt to your needs... > >---John Holmes... > > > >

    attached mail follows:


    With my limited knowledge (i.e none, lol) i was wondering if you are able to give me the code you use to do it. i will then play around with it t get Canberra, is that ok? doesn't matter if not.

    --
    Cheers
    ---------------------------------------------------------
    Simon Angell
    Canberra ACT
    www.canberra-wx.com
    ---------------------------------------------------------
    Member of:
    Australian Severe Weather Association.
    www.severeweather.asn.au
    ---------------------------------------------------------
    This email is virus free.
    Scanned before leaving my mailbox
    using Norton Antivirus 2002 for Win2k
    Scanned with the latest definition File.
    

    "David Freeman" <dfreemanoutbackqld.net.au> wrote in message news:009901c25fa1$ba8fb9f0$3f0a0a0askink... > > > Thats a Nice feaure you have, How do you do that? > > I have a cron event on my server that grabs the relevant page from the > web site soon after it is updated (around 20 past each hour) using "lynx > -dump url" which then pipes the resulting page dump through grep to grab > just the line of data that includes my town and dumps that output to a > file. > > The file contains a single line of data that includes all of the > information I display plus some other stuff on the page that I don't > use. > > Within my php page I open that small file and load it into an array for > display on the page. > > Obviously there's some error checking in there for various fail > conditions and some other stuff too but that's the basics of it. > > I've looked at doing something similar for forecasts but as I don't > (yet) have a need to display them I haven't got around to it. > > The main advantage of this method is that you're not grabbing the data > on every page load but, instead, only when the data on the source web > site can reasonably be expected to have changed. > > <delurk>As well as running a business with my wife I work for the BoM > and have done for about 18 years now</delurk> > > CYA, Dave > > >

    attached mail follows:


    It seems to me that the answer is in your own posting > AddType application/x-httpd-php .php .php the only type that will be served by php if you add AddType application/x-httpd-php .txt then txt will be also served

    regards

    Ivo

    "Stefan" <skarpposthotmail.com> wrote in message news:20020919172310.22894.qmailpb1.pair.com... > Hello, > I have a new Apache 2.0.40 with PHP 4.2.3 installation on a Solaris x86 box. > > Configered in httpd.conf with: > AddType application/x-httpd-php .php > and > LoadModule .... > > Parsing url´s with "xxxx .php" works fine, but i can´t figure out why it > dosen´t > work if i leave out the ".php"extension in the url? This works in my old > apache 1 installation.! > > The file is named "test.php" in the "abc" directory. > "http://my.server.se/abc/test.php" works, but not > "http://my.server.se/abc/test" > > Any tips in what i missed out in configuration or how to fix this would be > appreciated. > > best regards, > Stefan > > >

    attached mail follows:


    Can anyone suggest a strategy for importing data from MySQL to Access (it sucks I know, but I have to do it for my work). I was thinking of using a text-delimited file as an intermediate, but I am not quite sure on the logistics.

    attached mail follows:


    Christian Calloway wrote: > Can anyone suggest a strategy for importing data from MySQL to Access > (it sucks I know, but I have to do it for my work). I was thinking of > using a text-delimited file as an intermediate, but I am not quite > sure on the logistics.

    You can use the Mysql-ODBC driver, which can be downloaded from www.mysql.com, and then import the tables with access

    Grtz Erwin

    attached mail follows:


    In article <20020920073910.18666.qmailpb1.pair.com>, dcmindsyahoo.com says... > Can anyone suggest a strategy for importing data from MySQL to Access (it > sucks I know, but I have to do it for my work). I was thinking of using a > text-delimited file as an intermediate, but I am not quite sure on the > logistics.

    Google is your friend. Try http://www.google.co.nz/search?q=convert+access+to+mysql

    -- 
    David Robley
    Temporary Kiwi!
    

    Quod subigo farinam

    attached mail follows:


    how about http://www.php.net/manual/en/language.oop.php

    To be honest I can't remember what made classes first click for me but feel free to ask if there's anything there that you don't get.

    Classes and OOP seem self evident when you've been using them for a while but I seem to remember that that isn't always the case at first.

    Tim

    > -----Original Message----- > From: David T-G [mailto:davidtg-phpjustpickone.org] > Sent: 19 September 2002 17:13 > To: PHP General list > Cc: Tim Ward > Subject: Re: redefining a function > > > Tim, et al -- > > ...and then Tim Ward said... > % > % is using classes an option? > > I don't know. I suppose I need to learn about classes :-) Where do I > start? > > > % > % Tim Ward > % www.chessish.com > > > TIA & HAND > > :-D > -- > David T-G * It's easier to fight for > one's principles > (play) davidtgjustpickone.org * than to live up to them. -- > fortune cookie > (work) davidtgworkjustpickone.org > http://www.justpickone.org/davidtg/ Shpx gur > Pbzzhavpngvbaf Qrprapl Npg! > >

    attached mail follows:


    then keep this info in a config file off root and use a data abstraction class to connect.

    Tim www.chessish.com

    > -----Original Message----- > From: Oliver Witt [mailto:oliverwittt-online.de] > Sent: 19 September 2002 19:15 > To: php-generallists.php.net; Stephan Seidt > Subject: Re: PHP source code > > > Stephan Seidt schrieb: > > > On Thu, 19 Sep 2002 16:50:16 +0200 > > oliverwittt-online.de (Oliver Witt) wrote: > > > > > Hi, > > > Is there any way to read php source code? I didn't think > so until I > > > heard about people you have done that... > > > Kind regards, > > > Oliver > > > > > > > If you mean php's source, download it ;) > > Well, but if I write a script with MySQl, there has to be my user name > and password in the source code. If anybody could read it, > anybody could > have access to my databases! > Oliver > > > >

    attached mail follows:


    Martin,

    MT> If you're using serialised variables, I'd suggest serialising a MT>few simple ones and see what the output looks like so that you can MT>see when things are going amiss.

    An interesting suggestion. I have a "set and forget" data api which handles all these transformations in the background. So it is probably a year since I looked at a serialized string. Which meant that when I introduced a bug that sometimes double-serialized the string, I was at a loss about how to diagnose the problem.

    I will take your suggestion and become more familiar with the guts of the serialized string.

    Thanks again for helping out...

    -- 
    Geoff Caplan
    Advantae Ltd
    

    mailto:geoffadvantae.com http://www.advantae.com

    attached mail follows:


    Hi all,

    Forgive me for making this off topic question here, but since I need to install PHP under Linux tonight and came across this problem, I guess some one from here can help me. I need my Red Hat 7.2 to read the contents of all my FAT32 partitions in order to transfer the PHP packages. If any one (awake) knows the answer or have the solution, please e-mail me privately to keep this things off the list.

    Thanks in advance,

    César Aracena On Dial-Up

    attached mail follows:


    Hi all,

    I'm having a problem with sessions. I use PHP version 4.2.2. The project I'm working on, only uses the global variables, $_GET, $_POST and $_SESSION.

    When I store something in the $_SESSION variable, everything goes well. I can print the contents of this array with print_r, and every variable I stored is there. But when I leave the page with the header(...) directive (or any other way), the session is empty!

    The session file contains no data (so it is created!), the $_SESSION variable is empty...

    Some extra information: - I've tried this on PHP 4.1.2, and that works OK - I've tried output_buffering (on and off) - I've tried registered_globals (on and off) - I've tried using "session_write_close()" before leaving the page - I've checked the "session_start()" statement (Yes, it's there :-) )

    I hope someone can help me with this...

    Thanks in advance,

    Erwin

    attached mail follows:


    I've looked through the docs but can't find what I want.

    Is there a function that will let me load a jpg image, change the saturation level and save the changed image as a new jpg?

    Jc

    attached mail follows:


    Does anybody know of a class or a solution to converting an HTML page to a text only page via PHP, but leaving in href links in and a certain degree of formatting.

    Cheers,

    Tim

    attached mail follows:


    Try to remove all strings starting with "<" and ending with ">". Be sure not to remove "<A href ... ></A>"'s. Also you need to format line endings via "\n" or "<BR>".

    it might seem a little bit hard, but any other solution won't work rather than this.

    Tim Haynes wrote:

    >Does anybody know of a class or a solution to converting an HTML page to a >text only page via PHP, but leaving in href links in and a certain degree of >formatting. > >Cheers, > >Tim > > >

    -- 
            Vehbi Sinan Tunalioglu
    

    * email : vstpost.com * * email : vstsita.com.tr * * email : webmastersita.com.tr *

    attached mail follows:


    Feel free to use strip_tags()

    --
    

    Nicos - CHAILLAN Nicolas nicosphp.net www.WorldAKT.com - Hébergement de sites Internet

    "Tim Haynes" <thaynesshropshirestar.co.uk> a écrit dans le message de news: 20020920102136.81331.qmailpb1.pair.com... > Does anybody know of a class or a solution to converting an HTML page to a > text only page via PHP, but leaving in href links in and a certain degree of > formatting. > > Cheers, > > Tim > >

    attached mail follows:


    William wrote:

    >1) Payroll apps require large tax libraries (federal, every state and >locality). > > > Split them into more files (diffrent states etc.) and include_once them when they are needed, and perhaps mysql can take part of the job.

    >4)Loosely Typed Variables. > I fear it might be to simple in PHP to have a dollar amount converted to >a string and become rounded or truncated, because php's loose type. > This might be a smaller issue than I think? Is there a way to strictly >enforce types/conversions so my numerics stay numerics? > The issue is with floating point numbers, I encourage you to do the calculations in cents and round up when needed.

    attached mail follows:


    The Content-Type header changes, when uploading, you can get it from

    $HTTP_POST_FILES['userfile']['type'], also set the filename using header("Content-Disposition: attachment; filename='. $filename );

    Christian Ista wrote:

    >>You'll need to prompt the download by sending the appropriate headers. >>Something like.. >> >><a href=http://www.mydomain.com/downloadmyfile.php>Download</a> >> >><? // downloadmyfile.php >>header("Content-Type: application/zip"); >>header("Content-Disposition: attachment"); >>readfile("file.zip"); >>?> >> >> > >It's not only .zip file but may be .exe or .rar > >That's change something in your code ? > >I can put the code to update a database field in the downloadmyfile.php >? > > >Bye > > > >

    attached mail follows:


    Hi,

    Can someone point me to the documentation to make the same search system as php.net like www.php.net/lala that will search on the manual.

    Thanks.

    --
    

    Nicos - CHAILLAN Nicolas nicosphp.net www.WorldAKT.com - Hébergement de sites Internet

    attached mail follows:


    I found it at http://www.php.net/urlhowto.php

    Thanks anyway.

    --
    

    Nicos - CHAILLAN Nicolas nicosphp.net www.WorldAKT.com - Hébergement de sites Internet

    <nicosphp.net> a écrit dans le message de news: 20020920110340.4721.qmailpb1.pair.com... > Hi, > > Can someone point me to the documentation to make the same search system > as php.net like www.php.net/lala that will search on the manual. > > Thanks. > > -- > > Nicos - CHAILLAN Nicolas > nicosphp.net > www.WorldAKT.com - Hébergement de sites Internet > > >

    attached mail follows:


    If you look at the tutorial no. 5 on www.fpdf.org, all you need is to change LoadData function, example: function LoadData($condition) { $res=mysql_query("SELECT * FROM table WHERE 1 AND ($condition)"); while($data[]=mysql_fetch_row($res) ) { } return $data; }

    Chuck Payne wrote:

    >Hi, > >I found a free pdfclass called FPDF http://www.fpdf.org, that I can use with >PHP to create pdf files with. Before someone tells me "Read The Manual", I >have read their page and used Google to search for notes on how called mysql >into a PDF and I am lost. Does anyone know where there is a tutorial. > >Thanks, > >Chuck Payne >Magi Design and Support > > > > >