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: Sat Feb 24 2001 - 22:49:28 CST

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

    php-general Digest 25 Feb 2001 04:49:28 -0000 Issue 532

    Topics (messages 41497 through 41541):

    Re: Class methods in PHP
            41497 by: Christian Reiniger
            41501 by: Kevin Beckford
            41505 by: Aaron Tuller

    Re: isset()
            41498 by: Christian Reiniger

    Re: DIsplaying page before script finnished
            41499 by: James Moore
            41500 by: Fredrik Wahlberg

    Re: Binding A Socket
            41502 by: Kyndig

    Help with mass import to MySQL using PHP
            41503 by: Clayton Dukes
            41504 by: richard merit
            41507 by: Clayton Dukes
            41508 by: Clayton Dukes

    parsing multiple xml documents
            41506 by: Daniel Convissor

    function mail
            41509 by: Augusto Cesar Castoldi

    file handle error? or something else?
            41510 by: rick - SomersNet, Inc.
            41511 by: CC Zona

    Please help - File Uploads, 2nd try
            41512 by: Ed Lazor
            41516 by: Gustavo Vieira Goncalves Coelho Rios
            41526 by: Ed Lazor
            41527 by: Koncz Ádám
            41528 by: Koncz Ádám

    C vs PHP
            41513 by: Gustavo Vieira Goncalves Coelho Rios
            41518 by: James Moore
            41524 by: Michael Kimsal

    CLOB update difficulties
            41514 by: Chris Murtland

    searching Oracle 8i CLOB columns
            41515 by: Chris Murtland

    Re: Using while as for...
            41517 by: Steve Edberg

    Inserting user name and password into mysql...
            41519 by: Felipe Lopes

    Cookie References?
            41520 by: Jeff Oien
            41523 by: php3.developersdesk.com

    Re: $result = $$function
            41521 by: Simon Garner

    Re: checking $more still does not work !
            41522 by: Simon Garner

    persistant user tracking
            41525 by: Mitchell Hagerty

    Re: Database Paging using MSSQL 2000
            41529 by: Manuel Lemos

    Re: <select name=....
            41530 by: Kath

    comparing numbers
            41531 by: Clayton Dukes
            41532 by: Joe Stump
            41533 by: David Harrison
            41535 by: Clayton Dukes

    PHP4 install question
            41534 by: Ed Lazor

    compiling in imap probs
            41536 by: Mitchell Hagerty

    Detecting if JavaScript is enabled
            41537 by: Jochen Kächelin

    generate e.g. circles on the fly with coordinates for postioning
            41538 by: Helmut Ott
            41540 by: Joe Conway

    Detecting JavaScript
            41539 by: Jochen Kächelin

    Temporarily turning off magic quotes?
            41541 by: Ben Cheng

    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:


    On Saturday 24 February 2001 17:05, Kevin Beckford wrote:
    > Is there class methods in php?

    Well, there are classes, classes can have methods, there are methods to
    handle classes, methods to inspect methods, methods to inspect classes
    and propably more.

    I have no idea what you mean with your question, but I hope that some
    part of the above answers it...

    -- 
    Christian Reiniger
    LGDC Webmaster (http://sunsite.dk/lgdc/)
    

    "The number of Unix installations has grown to 10, with more expected." -- The Unix Programmer's Manual, 2nd Edition, June 1972

    attached mail follows:


    Well I meant class functions that do not need an object to be declared... but don't worry about it - I found out. There are none in php.

    ----- Original Message ----- From: "Christian Reiniger" <creinigmayn.de> To: <php-generallists.php.net>out Sent: Saturday, February 24, 2001 11:49 AM Subject: Re: [PHP] Class methods in PHP

    : On Saturday 24 February 2001 17:05, Kevin Beckford wrote: : > Is there class methods in php? : : Well, there are classes, classes can have methods, there are methods to : handle classes, methods to inspect methods, methods to inspect classes : and propably more. : : I have no idea what you mean with your question, but I hope that some : part of the above answers it... : : -- : Christian Reiniger : LGDC Webmaster (http://sunsite.dk/lgdc/) : : "The number of Unix installations has grown to 10, with more expected." : -- The Unix Programmer's Manual, 2nd Edition, June 1972 : : -- : PHP General Mailing List (http://www.php.net/) : To unsubscribe, e-mail: php-general-unsubscribelists.php.net : For additional commands, e-mail: php-general-helplists.php.net : To contact the list administrators, e-mail: php-list-adminlists.php.net

    attached mail follows:


    that's not true.

    you can call a static method with the "::" notation.

    like ClassName::method();

    there's doesn't need to be an instance to do that.

    not sure if that's true for all of PHP4 or just 4.04 or whatnot.

    -aaron

    At 11:56 AM -0500 2/24/01, Kevin Beckford wrote: >Well I meant class functions that do not need an object to be declared... >but don't worry about it - I found out. There are none in php. > >----- Original Message ----- From: "Christian Reiniger" <creinigmayn.de> >To: <php-generallists.php.net>out >Sent: Saturday, February 24, 2001 11:49 AM >Subject: Re: [PHP] Class methods in PHP > > >: On Saturday 24 February 2001 17:05, Kevin Beckford wrote: >: > Is there class methods in php? >: >: Well, there are classes, classes can have methods, there are methods to >: handle classes, methods to inspect methods, methods to inspect classes >: and propably more. >: >: I have no idea what you mean with your question, but I hope that some >: part of the above answers it... >: >: -- >: Christian Reiniger >: LGDC Webmaster (http://sunsite.dk/lgdc/) >: >: "The number of Unix installations has grown to 10, with more expected." >: -- The Unix Programmer's Manual, 2nd Edition, June 1972 >: >: -- >: PHP General Mailing List (http://www.php.net/) >: To unsubscribe, e-mail: php-general-unsubscribelists.php.net >: For additional commands, e-mail: php-general-helplists.php.net >: To contact the list administrators, e-mail: php-list-adminlists.php.net > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: php-general-unsubscribelists.php.net >For additional commands, e-mail: php-general-helplists.php.net >To contact the list administrators, e-mail: php-list-adminlists.php.net

    attached mail follows:


    On Saturday 24 February 2001 17:18, PHPBeginner.com wrote: > in my preceding email I've written: > > if($var!='') > > will fix your all your worries without an intervention of a strings > function.

    Except that it will throw a warning in PHP4 if $var is not set. => isset () should be used.

    -- 
    Christian Reiniger
    LGDC Webmaster (http://sunsite.dk/lgdc/)
    

    "The number of Unix installations has grown to 10, with more expected." -- The Unix Programmer's Manual, 2nd Edition, June 1972

    attached mail follows:


    > -----Original Message----- > From: David Tandberg-Johansen [mailto:daviddatajo.no] > Sent: 24 February 2001 16:34 > To: php-generallists.php.net > Subject: [PHP] DIsplaying page before script finnished > > > Hello! > > I wonder if there are any way to display the page before the script is > finished? > > I have a loop in my script,and I want to display the resoult for > each loop.

    If you have output buffering on then you need to flish the buffer (see the manual) otherwise it should happen automatically.

    James

    attached mail follows:


    I think if you use flush() you can send it continually. Rembember to end every line or the browser will not understand that it shall show it. Tables can also give you problems, they do not show until they are closed.

    /Fredrik

    On Sat, 24 Feb 2001, David Tandberg-Johansen wrote:

    > Hello! > > I wonder if there are any way to display the page before the script is > finished? > > I have a loop in my script,and I want to display the resoult for each loop. >

    ------------- fredrikwahlberg.se ------------- Fredrik Wahlberg Kristinehovsgatan 12 Home: +46-8-642 35 23 S-117 29 Stockholm Work: +46-8-54 54 56 12 Sweden Mobile: +46-70-576 16 51

    attached mail follows:


    I posted this message, but it never went through:

    Not sunny on this end, abit drab today,

    I'm workin up a socket bind for a MUD game. Heh, why not, nothin ta do wright now. I've taken the main socket() call off of php.net page as an example to bind a port. The script functions, but when I telnet to the binded port...I get nothing. Any help?

    <?php

    function init_socket( $port ) { /* Allow the script to hang around waiting for connections. */ set_time_limit (0);

    $address = '216.166.223.178';

    if (($sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { echo "socket() failed: reason: " . strerror ($sock) . "\n"; }

    if (($ret = bind ($sock, $address, $port)) < 0) { echo "bind() failed: reason: " . strerror ($ret) . "\n"; }

    if (($ret = listen ($sock, 5)) < 0) { echo "listen() failed: reason: " . strerror ($ret) . "\n"; }

    do { if (($msgsock = accept_connect($sock)) < 0) { echo "accept_connect() failed: reason: " . strerror ($msgsock) . "\n"; break; } do { $buf = ''; $ret = read ($msgsock, $buf, 2048); if ($ret < 0) { echo "read() failed: reason: " . strerror ($ret) . "\n"; break 2; } if ($ret == 0) { break 2; } $buf = trim ($buf); if ($buf == 'quit') { close ($msgsock); break 2; } $talkback = "PHP: You said '$buf'.\n"; write ($msgsock, $talkback, strlen ($talkback)); echo "$buf\n"; } while (true); close ($msgsock); } while (true); }

    $port = "6969"; $control = init_socket( $port ); printf("Game is up and runnin on %d.", $port ); close ($control); exit( 0 );

    ?>

    -- 
    Kind Regards,
    ---
    Kyndig
    Online Text Game Resource Site:  http://www.kyndig.com
    ICQ# 	10451240
    -------------------------------------------------------
    

    -- Kind Regards, --- Kyndig Online Text Game Resource Site: http://www.kyndig.com ICQ# 10451240 -------------------------------------------------------

    -- Kind Regards, --- Kyndig Online Text Game Resource Site: http://www.kyndig.com ICQ# 10451240

    attached mail follows:


    Hi everyone,

    I'm working on converting my site to PHP/MySql.

    I need to figure out a way to import several thousand text files into the database while applying certain PHP functions to them.

    From now on, when a user submits a new document, it gets a random docid assigned to it using the following method:

    $time = time(); $rand = Random_Password(5); $docid = $time . $rand;

    Random_Password is defined as:

    function Random_Password($length) { mt_srand((double)microtime()*10000000); $possible_characters = "abcdefghijklmnopqrstuvwxyz"; $string = ""; while(strlen($string)<$length) { $string .= substr($possible_characters,(mt_rand()%(strlen($possible_characters))),1); } return($string);

    After they fill in a form and paste thier document, the following fields are submitted to the database:

    $query = "INSERT INTO documents VALUES ('$docid', '$category', '$subcategory', '$date', '$subject', '$title', '$author', '$email', '$language', '$grade', '$level', '$city', '$state', '$county', '$school', '$zip', '$authors_comments', '$teachers_comments', 'N', '$docdata')";

    Now, the million dollar question is: how do I import the several thousand text documents I already have while applying this formulae, aside from manually submitting each one ;-)?

    Here's an example of one of the text documents: Currently, all text documents have exactly the same format: -------------------------------------------------------------- $docid $subject $title $author $email $language $grade $school $country $author_comments $teacher_comments $date -------------------------------------------------------------- The only thing that changes are the fields after the colon and the body itself. I realize that the current text files do not have all of the information for the new database such as $subcategory, I'm going to have to grandfather the old text files in somehow. Also, there are certain fields that are enums in the database, so I need to make sure that each field conforms to that, eg; one of the subject fields in the database only allows for "Computers and Internet" not Computer, so I need to rewrite that string before placing it in the database. I also need to change $grade from any alpha strings to a percentile grade, eg: [b-B]=92 (see database format below).

    -------------------------------------------------------------- Document ID : 100 Subject : Computer Title : internet beyond human control Author : Email Address : Language : english Grade : b School System : ohio state university Country : USA Author's Comments : tom dodd Teacher's Comments : well done Date : 5/96 --------------------------------------------------------------

    The Internet Beyond Human Control The Internet has started to change the way of the world during this decade. More homes, companies, and schools are getting hooked online with the Internet during the past few years. This change has started to become the new way of life present and future. The Internet system is

    And here's the database format: CREATE TABLE dox ( id bigint(20) DEFAULT '0' NOT NULL auto_increment, docid varchar(20), category enum('Language Arts','Sciences','Humanities','Arts','Special Subjects','Other'), subcategory enum('Physics','Biology','Chemistry','Math','Computers and Internet','History','Economics','Geography','Law','Religion','Philosophy','Black Awareness','Countries','Drugs','Education','Environmental Awareness','Politics','Health','Sex and Sexuality','Female Awareness','Art','Movies or TV','Music','Sports','Charles Dickens','Shakespeare','Biography','Fictional Stories','Astronomy','Mythology'), date varchar(10), subject varchar(200), title varchar(200), author varchar(200), email varchar(50), language enum('English','Danish','Dutch','Finnish','German','Spanish'), grade int(3), level enum('High School','College','Other'), city varchar(15), state varchar(15), county varchar(15), school varchar(45), zip smallint(5), authorcomments varchar(200), teachercomments varchar(200), approve enum('Y','N'), docdata text, PRIMARY KEY (id), UNIQUE id (id) );

    I realize that this is a lot, but from what I have read since being subscribed to this e-mail list, you guys have talents that are far above and beyond the scope of this. Thank you so much for your help (and wisdom!).

    Regards, Clayton Dukes CCNA, CCDA, CCDP, CCNP Internetwork Solutions Engineer Internetwork Management Engineer

    attached mail follows:


    No answer, but a question. I noticed you're using, in effect, two id's for each entry, a id number and a doc id number. The first is accomplished thru auto-increment. Wouldn't it be easier to us just one id number, a=LAST_INSERT_ID(id+b) and reserve the first 10k numbers (b), whatever is needed for your old files then run a php code to format your old entries and increment those 1 - 100000....and forget about random numbers. If I'm not mistaken, if you generate random numbers you'll have to check, to be on the safe side, to make sure the random number wasn't used for someother doc.

    __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/

    attached mail follows:


    1. Local Server 2. Either one, I'm trying to learn PHP 3. Yes, this is just a project for which I am not making any money, but I can pay someone in respect and admiration ;-)

    ----- Original Message ----- From: Todd Pillars To: Clayton Dukes Sent: Saturday, February 24, 2001 2:25 PM Subject: RE: [PHP] Help with mass import to MySQL using PHP

    Hi, couple of questions: 1.are you doing this on a local server or a server on the internet? 2.are you looking for a direction to do this yourself or for someone to write the code? 3.are you looking for free advice?...I am all for free source, but this is going to take some time and energy.

    Todd -----Original Message----- From: Clayton Dukes [mailto:cdukescdukes.com] Sent: Saturday, February 24, 2001 1:38 PM To: php-generallists.php.net Subject: [PHP] Help with mass import to MySQL using PHP

    Hi everyone,

    I'm working on converting my site to PHP/MySql.

    I need to figure out a way to import several thousand text files into the database while applying certain PHP functions to them.

    From now on, when a user submits a new document, it gets a random docid assigned to it using the following method:

    $time = time(); $rand = Random_Password(5); $docid = $time . $rand;

    Random_Password is defined as:

    function Random_Password($length) { mt_srand((double)microtime()*10000000); $possible_characters = "abcdefghijklmnopqrstuvwxyz"; $string = ""; while(strlen($string)<$length) { $string .= substr($possible_characters,(mt_rand()%(strlen($possible_characters))),1); } return($string);

    After they fill in a form and paste thier document, the following fields are submitted to the database:

    $query = "INSERT INTO documents VALUES ('$docid', '$category', '$subcategory', '$date', '$subject', '$title', '$author', '$email', '$language', '$grade', '$level', '$city', '$state', '$county', '$school', '$zip', '$authors_comments', '$teachers_comments', 'N', '$docdata')";

    Now, the million dollar question is: how do I import the several thousand text documents I already have while applying this formulae, aside from manually submitting each one ;-)?

    Here's an example of one of the text documents: Currently, all text documents have exactly the same format: -------------------------------------------------------------- $docid $subject $title $author $email $language $grade $school $country $author_comments $teacher_comments $date -------------------------------------------------------------- The only thing that changes are the fields after the colon and the body itself. I realize that the current text files do not have all of the information for the new database such as $subcategory, I'm going to have to grandfather the old text files in somehow. Also, there are certain fields that are enums in the database, so I need to make sure that each field conforms to that, eg; one of the subject fields in the database only allows for "Computers and Internet" not Computer, so I need to rewrite that string before placing it in the database. I also need to change $grade from any alpha strings to a percentile grade, eg: [b-B]=92 (see database format below).

    -------------------------------------------------------------- Document ID : 100 Subject : Computer Title : internet beyond human control Author : Email Address : Language : english Grade : b School System : ohio state university Country : USA Author's Comments : tom dodd Teacher's Comments : well done Date : 5/96 --------------------------------------------------------------

    The Internet Beyond Human Control The Internet has started to change the way of the world during this decade. More homes, companies, and schools are getting hooked online with the Internet during the past few years. This change has started to become the new way of life present and future. The Internet system is

    And here's the database format: CREATE TABLE dox ( id bigint(20) DEFAULT '0' NOT NULL auto_increment, docid varchar(20), category enum('Language Arts','Sciences','Humanities','Arts','Special Subjects','Other'), subcategory enum('Physics','Biology','Chemistry','Math','Computers and Internet','History','Economics','Geography','Law','Religion','Philosophy','Black Awareness','Countries','Drugs','Education','Environmental Awareness','Politics','Health','Sex and Sexuality','Female Awareness','Art','Movies or TV','Music','Sports','Charles Dickens','Shakespeare','Biography','Fictional Stories','Astronomy','Mythology'), date varchar(10), subject varchar(200), title varchar(200), author varchar(200), email varchar(50), language enum('English','Danish','Dutch','Finnish','German','Spanish'), grade int(3), level enum('High School','College','Other'), city varchar(15), state varchar(15), county varchar(15), school varchar(45), zip smallint(5), authorcomments varchar(200), teachercomments varchar(200), approve enum('Y','N'), docdata text, PRIMARY KEY (id), UNIQUE id (id) );

    I realize that this is a lot, but from what I have read since being subscribed to this e-mail list, you guys have talents that are far above and beyond the scope of this. Thank you so much for your help (and wisdom!).

    Regards, Clayton Dukes CCNA, CCDA, CCDP, CCNP Internetwork Solutions Engineer Internetwork Management Engineer

    attached mail follows:


    the first field, ID, is just for keeping a standard sequence and isn't called from any web pages. The second ($docid) is a random field which is called from a web page, which makes it harder (if not impossible) to guess/hack. This makes it a bit more secure.

    A note about the old docid #'s, my intention is to replace the old $docid with one in the new format. And, since the random docid is based (partly) on the time at which it was generated, there's not much chance of it being duplicated.

    ----- Original Message ----- From: "richard merit" <richand2002yahoo.com> To: <php-generallists.php.net> Sent: Saturday, February 24, 2001 2:30 PM Subject: Re: [PHP] Help with mass import to MySQL using PHP

    > No answer, but a question. I noticed you're using, in > effect, two id's for each entry, a id number and a doc > id number. The first is accomplished thru > auto-increment. Wouldn't it be easier to us just one > id number, a=LAST_INSERT_ID(id+b) and reserve the > first 10k numbers (b), whatever is needed for your old > files then run a php code to format your old entries > and increment those 1 - 100000....and forget about > random numbers. If I'm not mistaken, if you generate > random numbers you'll have to check, to be on the safe > side, to make sure the random number wasn't used for > someother doc. > > __________________________________________________ > Do You Yahoo!? > Get email at your own domain with Yahoo! Mail. > http://personal.mail.yahoo.com/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > For additional commands, e-mail: php-general-helplists.php.net > To contact the list administrators, e-mail: php-list-adminlists.php.net

    attached mail follows:


    Hi Folks:

    I just wrote a basic XML parser using the parse_xml() function set. Does what I want on the first document. But, if I try to run a second document through, it chokes saying "junk after document element."

    All of the files are valid and parse okay if I just send one file through. Also, the program runs fine if I redeclare the parser before parsing each file. While this works, having to redeclare the parser each time seems far from efficient.

    So, is there a better way to handle this, please?

    Sample code is below if you're interested.

    Thanks,

    --Dan

    <?php

    # Declare Parser Once. # Only works for first file.

    # NOTE: 'StartHandler', 'EndHandler' and 'CharacterHandler' # functions left out for clarity.

    $Parser = xml_parser_create('UTF-8'); xml_set_element_handler($Parser, 'StartHandler', 'EndHandler'); xml_set_character_data_handler($Parser, 'CharacterHandler');

    $DirHandle = opendir("./StartTest"); while ( $FileName = readdir($DirHandle) ) { if ( ereg("^file.[0-9]{5}$", "$FileName") ) { $Contents = implode( '', file("./StartTest/$FileName") );

    if ( xml_parse($Parser, $Contents) ) { echo "\n<br />Yipee!"; } else { echo "\n<br />UGH! "; echo xml_error_string(xml_get_error_code($Parser)); } } }

    ?>

    <?php

    # Declare Parser before parsing each file. # Works fine, but seems inefficient.

    # NOTE: 'StartHandler', 'EndHandler' and 'CharacterHandler' # functions left out for clarity.

    $DirHandle = opendir("./StartTest"); while ( $FileName = readdir($DirHandle) ) { if ( ereg("^file.[0-9]{5}$", "$FileName") ) { $Contents = implode( '', file("./StartTest/$FileName") );

    $Parser = xml_parser_create('UTF-8'); xml_set_element_handler($Parser, 'StartHandler', 'EndHandler'); xml_set_character_data_handler($Parser, 'CharacterHandler');

    if ( xml_parse($Parser, $Contents) ) { echo "\n<br />Yipee!"; } else { echo "\n<br />UGH! "; echo xml_error_string(xml_get_error_code($Parser)); } } }

    ?>

    -- 
                    PHP scripts that make your job easier
                  http://www.analysisandsolutions.com/code/
             SQL Solution  |  Layout Solution  |  Form Solution
     T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
     4015 7 Ave, Brooklyn NY 11232    v: 718-854-0335    f: 718-854-0409
    

    attached mail follows:


    $sent=mail("castoldiinf.ufsc.br", $subject, $msg, $from);

    if $sent==1 --> the e-mail was sent

    if $sent==0 --> problem when sending e-mail??

    how this works? When the function mail will have a problem?

    if the "to" mail are wrong?

    regards,

    Augusto Cesar Castoldi

    attached mail follows:


    Hello All...

    I wanted to write a program that would search google for specific keywords from my database, and report to me if it found my domain, and if so what page it was on.

    Well it works, and it's very cool I might add, but then it fails... :( But it doesn't fail right away.. I have had it fail as fast as 5 mins into exec, and as long as 1 1/2 hours into exec... and when it does fail, it spits out 1 error over, and over, and over, just as fast as it can (i think it gets stuck in the "for").. and the error says something about "invalid file handle resource"...

    I am testing it with 4 domains, and 90 keywords, and only having it search the first 50 pages.. It takes a domain from mysql and then gets the list of keywords to check. It then calls google and checks each keyword page for the key domain.

    Below is a copy of my code as it stands right now. I don't expect anyone to have a quick answer to this problem, but I am hopeful that someone might see something in the code that could be done better.. hopefuly.... :)

    BTW.. I am running FreeBSD/3.4 and PHP/4.0.2

    <?php

    ############################################################### # # Google (Search Engine) Rating Tracking System # # Track domain and keyword page ranks. Analyze data and report # stats and history. # # Multi domain and keyword friendly. #

    ######### # START # ######### # #

    $month=date("m"); $day=date("d"); $year=date("Y");

    $connect = mysql_connect("hostname","user","pass"); mysql_select_db("Google");

    # get domain list $domains=mysql_query("SELECT * FROM Domains"); while ($row = mysql_fetch_row($domains)) { $domain="$row[0]";

    # get keyword list $keywords=mysql_query("SELECT * FROM Keywords"); while ($roz = mysql_fetch_row($keywords)) { $keyword="$roz[0]";

    $found=""; $sp="";

    # search first 50 pages for keyword for ($i = 0;;$i = $i + 10) { if ($i > 500) { break; }

    $agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)'; $mydata=("q=$keyword&hl=en&lr=&safe=off&start=$i&sa=N"); $host="www.google.com"; $filename = "/search?$mydata"; $sp=fsockopen($host,80) or brake; socket_set_timeout($sp, 600) or brake; fputs($sp,"GET $filename HTTP/1.1\n") or brake; fputs($sp,"Host: $host\n"); fputs($sp,"User-Agent: $agent\n"); fputs($sp,"Connection: close\n\n"); while(!feof($sp)) { $output .= fgets($sp,128); } fclose($sp); $sp="";

    if(ereg("$domain","$output")){ $found=1; $output=""; break; } else{ $found=0; $output="";}

    }

    if($found == "1"){ $page = $i / 10; print "$domain / $keyword - page $page <BR>\n"; } else{ $page = "50"; print "$domain / $keyword - page $page+ <BR>\n";}

    flush();

    # add to database mysql_query("INSERT INTO Stats VALUES('$domain','$keyword','$month','$day','$year','$page')");

    # end keywords } print "<BR>\n<BR>\n"; # end domains }

    mysql_close($connect);

    ?>

    Thanks for your time and help, I really appreciate it... I am hope it's just something simple... :)

    Thanks Allot,

    ..rick

    attached mail follows:


    In article <3A98271D.22B0DA44somers.net>, ricksomers.net ("rick - SomersNet, Inc.") wrote:

    > $sp=fsockopen($host,80) or brake; > socket_set_timeout($sp, 600) or brake; > fputs($sp,"GET $filename HTTP/1.1\n") or brake;

    Hmm. What's that 'or brake' stuff? 'brake' is used as a constant, but you don't show what it's defined as. I assume what you're going for is an 'or die()' function call...?

    -- 
    CC
    

    attached mail follows:


    I upgraded my web server and now file uploads don't work. A test script is listed below. It puts the file on the server, but the file has

    Content-Type: image/pjpeg^M ^M

    pre-pended to it, thus breaking the file. Do you know why it's doing this and how to fix it?

    -Ed

    <?php

    global $HTTP_POST_VARS; global $REQUEST_URI;

    if (empty($HTTP_POST_VARS)) { # Display form ?> <h3>File Upload Test</h3> <form method="post" enctype="multipart/form-data" action="<?php echo $REQUEST_URI;?>"> <input type="hidden" name="max_file_size" value="35000000">

    <table border="0" callpadding="0" cellspacing="0"> <tr> <td align=right width=125> <font size=2 face="Verdana, Arial"><b> Upload: &nbsp; </b></font> </td> <td> <input type="file" name="uploadedfile" size="39"> </td> </tr> <tr> <td colspan="2" align=right> <input type="submit" value="UPLOAD"> </td> </tr> </table> </form>

    <? } else { # process form global $uploadedfile_name; global $uploadedfile; # replacing spaces with the _ symbol $Filename = ereg_replace(" ", "_", $uploadedfile_name);

    # move the uploaded file to the archive # I put <path to files> here for display purposes only $Location = "<path to files>/htdocs/attachments/test/" . $Filename; #copy($uploadedfile, $Location);

    move_uploaded_file($uploadedfile, $Location);

    print "File upload processed.<br><br><br>"; print "<a href='/attachments/test/$Filename'>Link to file</a><br>"; } ?>

    attached mail follows:


    Ed Lazor wrote: > > I upgraded my web server and now file uploads don't work. A test script is > listed below. It puts the file on the server, but the file has > > Content-Type: image/pjpeg^M > ^M > > pre-pended to it, thus breaking the file. Do you know why it's doing this > and how to fix it? >

    This happens because you are dealing with DOS text in a unix environment. You can use dos2unix utility in order to correct this problem. Remenber, always transfer text files unix->dos->unix using ascii mode.

    attached mail follows:


    At 06:44 PM 2/24/2001 +0000, Gustavo Vieira Goncalves Coelho Rios wrote: >Ed Lazor wrote: > > > > I upgraded my web server and now file uploads don't work. A test script is > > listed below. It puts the file on the server, but the file has > > > > Content-Type: image/pjpeg^M > > ^M > > > > pre-pended to it, thus breaking the file. Do you know why it's doing this > > and how to fix it? > > > >This happens because you are dealing with DOS text in a unix >environment. >You can use dos2unix utility in order to correct this problem. Remenber, >always transfer text files unix->dos->unix using ascii mode.

    I don't understand. It's appending Content-Type to all of the files. I tested a few other files like tgz files and it put a content type in them as well. Since the files are being uploaded in a browser form, shouldn't the unix / dos issue be eliminated?

    -Ed

    attached mail follows:


    As Ed Lazor wrote:

    > I upgraded my web server and now file uploads don't work. A test script is > listed below. It puts the file on the server, but the file has > Content-Type: image/pjpeg^M > ^M > pre-pended to it, thus breaking the file. Do you know why it's doing this > and how to fix it?

    That's a php 4.0.4pl1 BUG.

    To find a _possible_ patch visit:

    http://bugs.php.net/bugs.php?id=8995

    AND use trim() to remove unwanted linebreaks (appear in the front of the var. values)!

    attached mail follows:


    Sorry, wrong link was added in my prev mail.

    > To find a _possible_ patch visit:

    http://marc.theaimsgroup.com/?l=php-dev&m=98233943916254&w=2

    attached mail follows:


    Hi folks!

    I am a used C programmer and now my company decide to switch every non performance critical web stuf to php. Since i am just a php beginner i have some questions i could not find anywhere!

    As you may know, C does not provide any kind of support for garbage collection, every thing you want to be done you have to tell (in C) by yourself. But in PHP i have no ideia about how it manages memory. for instance:

    In C:

    str = (char *) malloc(10u);

    if i decide to alloc new memory for str (just for explanation purposes), and i do:

    str = (char *) malloc(33u);

    i would be in trouble, cause the reference for the previous allocated pool of memory would be lost. The approach could be to save the previous references or use realloc.

    Now, my doubt: How PHP deals with this:

    $query = "select * from apm where id=3";

    /* do my processing */

    /* and set query to a new string */

    $query = "Query done without errors";

    What will happen with the previous allocated memory for $query? I don't like my application eating memory without releasing it after they are no need any more.

    May some one explain how to prevent such scenarios ?

    Thanks a lot for your time and cooperation.

    best regrads.

    Gustavo Rios

    attached mail follows:


    > As you may know, C does not provide any kind of support for garbage > collection, every thing you want to be done you have to tell (in C) by > yourself. But in PHP i have no ideia about how it manages memory. for > instance:

    You dont need to worry about mem mangement as PHP does it all for you.

    James

    attached mail follows:


    http://www.zend.com/zend/art/under-php4-hood.php and http://www.zend.com/zend/art/ref-count.php

    are articles that go into a bit more depth on this topic. Maybe not as detailed as you'd like, but they explain a bit more about how/why "PHP does it for you" is a valid reply to your question.

    Gustavo Vieira Goncalves Coelho Rios wrote:

    > Hi folks! > > I am a used C programmer and now my company decide to switch every non > performance critical web stuf to php. Since i am just a php beginner i > have some questions i could not find anywhere! > > As you may know, C does not provide any kind of support for garbage > collection, every thing you want to be done you have to tell (in C) by > yourself. But in PHP i have no ideia about how it manages memory. for > instance: > > In C: > > str = (char *) malloc(10u); > > if i decide to alloc new memory for str (just for explanation purposes), > and i do: > > str = (char *) malloc(33u); > > i would be in trouble, cause the reference for the previous allocated > pool of memory would be lost. > The approach could be to save the previous references or use realloc. > > Now, my doubt: How PHP deals with this: > > $query = "select * from apm where id=3"; > > /* do my processing */ > > /* and set query to a new string */ > > $query = "Query done without errors"; > > What will happen with the previous allocated memory for $query? > I don't like my application eating memory without releasing it after > they are no need any more. > > May some one explain how to prevent such scenarios ? > > Thanks a lot for your time and cooperation. > > best regrads. > > Gustavo Rios > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > For additional commands, e-mail: php-general-helplists.php.net > To contact the list administrators, e-mail: php-list-adminlists.php.net

    attached mail follows:


    Hello,

    I am trying to update an Oracle 8i CLOB field. I have looked at previous messages on the list and am trying the following:

    $sql="update murtland.articles set title='$title',release_date=TO_DATE('$release_date','YYYY-MM-DD'),body=:body text,sections='$sections',mod_date=TO_DATE('$mod_date','yyyy-mm-dd hh24:mi:ss'),mod_userid=$userid where articleid=$articleid"; //echo $sql; $stmt=OCIParse($conn,$sql); $bodytext = OCINewDescriptor($conn, OCI_D_LOB); OCIBindByName($stmt,":bodytext",&$bodytext,-1,OCI_B_CLOB); OCIExecute($stmt, OCI_DEFAULT); $bodytext->save($body); OCICommit($stmt); $bodytext->free(); OCIFreeStatement($stmt); OCILogoff($conn);

    However, this gives me the error: invalid LOB locator specified.

    Any suggestions would be greatly appreciated.

    Thanks, Chris

    ~~~~~~~~~~~~~~~~~~~~ Chris Murtland Studio Moxie, LLC www.studiomoxie.com 336.773.1684 800.707.2367 fax/voicemail

    attached mail follows:


    Does anyone have any example code for searching Oracle 8i CLOB fields? Do I have to create a stored procedure to be able to do this?

    I want to be able to search a separate varchar column in addition to searching the CLOB column.

    Thanks, Chris

    ~~~~~~~~~~~~~~~~~~~~ Chris Murtland Studio Moxie, LLC www.studiomoxie.com 336.773.1684 800.707.2367 fax/voicemail

    attached mail follows:


    At 12:44 PM -0800 2/24/01, Felipe Lopes wrote: >I was trying to code the following script using while instead of for, >but I'm havig a lot of problems...Is it possible to do what I want? > >for ($count = 0; $count <= 10; $count++){ >echo "Number is $count <BR>\n"; >} > >Could anyone tell me how is it with while instead of for?? >Thank you!!

    $count = 0; while ($count <= 10) { echo "Number is $count <BR>\n"; $count++; }

    I think - if you're feeling obscure - that

    $count = 0; while (($count <= 10) && print 'Number is '.$count++." <br>\n") {}

    will work too. As will - using alternate while syntax -

    $count = 0; while ($count <= 10): echo 'Number is '.$count++." <br>\n"; endwhile;

    See:

    http://www.php.net/manual/en/control-structures.while.php

    for more info.

    -steve

    >Felipe Lopes >MailBR - O e-mail do Brasil -- http://www.mailbr.com.br >Faça já o seu. É gratuito!!!

    -- 
    +--- "They've got a cherry pie there, that'll kill ya" ------------------+
    | Steve Edberg                           University of California, Davis |
    | sbedbergucdavis.edu                               Computer Consultant |
    | http://aesric.ucdavis.edu/                  http://pgfsun.ucdavis.edu/ |
    +-------------------------------------- FBI Special Agent Dale Cooper ---+
    

    attached mail follows:


    Hi! Here I am again...I have a problem to insert user name, password and host into mysql...I'd like to know what commands I need to do that (since the command to start mysql on my computer) so that way I won't be able to do anything wrong! Thank you Felipe Lopes MailBR - O e-mail do Brasil -- http://www.mailbr.com.br Faça já o seu. É gratuito!!!

    attached mail follows:


    Could you give me some URLs for tutorials related to cookies and good reference material?

    One question I have is can a cookie never expire? Jeff Oien

    attached mail follows:


    Addressed to: <jeffwebdesigns1.com> php-generallists.php.net

    ** Reply to note from <jeffwebdesigns1.com> Sat, 24 Feb 2001 16:42:09 -0600 > > Could you give me some URLs for tutorials related > to cookies and good reference material?

    Not directly, but there are a number of tutorial links at:

    http://www.php.net/links.php

    > > One question I have is can a cookie never expire?

    No, but a cookie that expires in ten years is almost as good. I bet no one will have the same cookie file long enough for that to expire.

    Rick Widmer Internet Marketing Specialists http://www.developersdesk.com

    attached mail follows:


    From: "Peter Van Dijck" <petervardus.com>

    > Hi, > I'd like to do: > $function = "build_result()"; > $result = $$function; > but it doesn't seem to work.

    Try:

    <?php $function = "build_result"; $result = $function(); ?>

    Cheers

    Simon Garner

    attached mail follows:


    From: "Web Admin" <webadminmorva.net>

    > Hi Kaab, > There must be another problem, it should work. Maybe it helps if > you send your code here. To see how a simple script works, try > this tiny script named test.php: > > <form action=test.php> > <input type=submit name=more> > </form> > <?php > if ($more) {print "<p>Submit is pressed</p>"; }; > ?> > > If you first load the php page, you don't see anything rather than a > submit button. If you press submit, you will see a message. > > Ahmad Anvari

    I think you need a value for the submit button:

    <input type="submit" name="more" value="Click for more">

    Cheers

    Simon Garner

    attached mail follows:


    What are some methods for persistant user tracking?

    I need to limit the number of times a person can search for certain material without forcing them to create a login.

    Currently I am using cookies to limit the number of searches a person can do but, quiting and removing the cookie file easily defeats that. Storing their IP address locally would work but then not everyone has a static ip. Would grabbing the MAC from their ethernet card be doable? Again alot of people use modems.

    Any thoughts or resources you know of? tks mitch

    attached mail follows:


    Hello Ankur,

    On 21-Feb-01 06:09:04, you wrote:

    >I am implementing a database application using PHP4 and MSSQL2000. I have a >database table which has a large no. of tuples. I want to display the data in >the form of pages with Prev Next buttons.

    >I wanted to know if there is some syntax in the MSSQL Select statement which >can allow me to limit the no. of records being returned. I am lookin at >functionality which is similar to LIMIT in Mysql.

    >for ex, LIMIT 10,10 in MYSQL returns to me a maximum of 10 records starting >from the 10th record in the returned recordset.

    >is there any similar functionality available in MSSQL.

    You need to use server side cursors. You may want to look how that is done in Metabase, a PHP database independent package that has a function MetabaseSetSelectedRowRange($database,$first,$limit) that may be used before executing a query and it works like if you are using the LIMIT $first,$limit query of MySQL.

    You may want get Metabase for free here:

    http://phpclasses.UpperDesign.com/browse.html/package/20

    You may also want to look into this Query result table display class that uses this Metabase feature to display query results split in pages:

    http://phpclasses.UpperDesign.com/browse.html/package/130

    Regards, Manuel Lemos

    Web Programming Components using PHP Classes. Look at: acm.org">http://phpclasses.UpperDesign.com/?user=mlemosacm.org

    --
    E-mail: mlemosacm.org
    URL: http://www.mlemos.e-na.net/
    PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp
    --
    

    attached mail follows:


    Don't forget to close the </SELECT>. Netscape doesn't like it without that sometimes.

    - Kath

    ----- Original Message ----- From: "PHPBeginner.com" <php-generalphpbeginner.com> To: "Peter Houchin" <peterhvfsa.com.au>; "PHP MAIL GROUP" <php-generallists.php.net> Sent: Saturday, February 24, 2001 1:16 AM Subject: RE: [PHP] <select name=....

    > No it will give you the same value twice... > > you need a loop > > > <SELECT NAME="state" SIZE="1"> > <OPTION VALUE="Canberra">ACT</OPTION> > <OPTION VALUE="Victoria">VIC</OPTION> > > > > looping the rows .,...{ > > echo "<OPTION VALUE=\"".$row['state']."\">".$row['state_abbr']."</OPTION> > "; > > } > > </SELECT> > > > Sincerely, > > Maxim Maletsky > Founder, Chief Developer > > PHPBeginner.com (Where PHP Begins) > maximphpbeginner.com > www.phpbeginner.com > > > > > > > -----Original Message----- > From: Peter Houchin [mailto:peterhvfsa.com.au] > Sent: Friday, February 23, 2001 1:17 PM > To: PHP MAIL GROUP > Subject: [PHP] <select name=.... > > > if i have a form with a select box in it how an i get the values to echo a > php value ... > > ie > > <SELECT NAME="state" SIZE="1"> > <OPTION VALUE="Canberra">ACT</OPTION> > <OPTION VALUE="Victoria">VIC</OPTION> > </SELECT> > > can i change it to say > <SELECT NAME="state" SIZE="1"> > <OPTION VALUE="<? echo $state ?>">ACT</OPTION> > <OPTION VALUE="<?echo $state ?>">VIC</OPTION> > </SELECT> > > so that when the page loads it shows which ever option is in the Data base? > > Peter Houchin > Sun Rentals > peterhsunrentals.com.au > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > For additional commands, e-mail: php-general-helplists.php.net > To contact the list administrators, e-mail: php-list-adminlists.php.net >

    attached mail follows:


    How can I do something like the following shell script, in PHP? (I know this won't work normally, but you get the idea).

    if [ $id <= 59 ]; then $id=81

    TIA! Clayton Dukes

    attached mail follows:


    just replace the [] with ()

    if($id <= 59) { $id = 81; }

    --Joe

    On Sat, Feb 24, 2001 at 09:54:08PM -0500, Clayton Dukes wrote: > > How can I do something like the following shell script, in PHP? (I know this won't work normally, but you get the idea). > > if [ $id <= 59 ]; then > $id > > TIA! > Clayton Dukes >

    -- 
    

    ------------------------------------------------------------------------------- Joe Stump, PHP Hacker, joestump98yahoo.com -o) http://www.miester.org http://www.care2.com /\\ "It's not enough to succeed. Everyone else must fail" -- Larry Ellison _\_V -------------------------------------------------------------------------------

    attached mail follows:


    Do you mean something like:

    <?php

    if ($id <= 59) $id = 81;

    ?>

    --dave

    -----Original Message----- From: Clayton Dukes [mailto:cdukescdukes.com] Sent: Sunday, February 25, 2001 12:54 PM To: php-generallists.php.net Subject: [PHP] comparing numbers

    How can I do something like the following shell script, in PHP? (I know this won't work normally, but you get the idea).

    if [ $id <= 59 ]; then $id=81

    TIA! Clayton Dukes

    attached mail follows:


    Ahh, cool, thanks :-)

    ----- Original Message ----- From: "Joe Stump" <jstumpzebulon.miester.org> To: "Clayton Dukes" <cdukescdukes.com> Cc: <php-generallists.php.net> Sent: Saturday, February 24, 2001 10:03 PM Subject: Re: [PHP] comparing numbers

    > just replace the [] with () > > if($id <= 59) > { > $id = 81; > } > > --Joe > > On Sat, Feb 24, 2001 at 09:54:08PM -0500, Clayton Dukes wrote: > > > > How can I do something like the following shell script, in PHP? (I know this won't work normally, but you get the idea). > > > > if [ $id <= 59 ]; then > > $id=81 > > > > TIA! > > Clayton Dukes > > > > -- > > -------------------------------------------------------------------------- ----- > Joe Stump, PHP Hacker, -o) > http://www.miester.org http://www.care2.com /\\ > "It's not enough to succeed. Everyone else must fail" -- Larry Ellison _\_V > -------------------------------------------------------------------------- -----

    attached mail follows:


    I've had PHP installed through the RedHat RPMS listed below.

    php-imap-4.0.4pl1-3 php-manual-4.0.4pl1-3 php-4.0.4pl1-3 php-ldap-4.0.4pl1-3 php-mysql-4.0.4pl1-3

    Unfortunately, I discovered there's a bug in this version, so I need to remove the rpms and install PHP by compiling the source. I've been playing with it for a few hours, but haven't had any luck, so I figured I'd ask here. What's the easiest way to compile PHP and load it into Apache?

    If I understand correctly, because of the rpm, PHP resides as the file /usr/lib/apache/libphp4.so

    Apache loads PHP with the following command in httpd.conf LoadModule php4_module modules/libphp4.so

    I'm not sure (can someone confirm please?), but I assume Apache is loading all of the modules as DSO. Is the goal is to remove the rpms and create a new /usr/lib/apache/libphp4.so file by compiling the PHP4 source code?

    If so, how do I go about it? The directions for PHP make it sound really easy. I tried them tho and the php files just show up as plain text. Here are the instructions I tried (that didn't work).

    -Ed

    $ ./configure --with-mysql --with-apxs $ make $ make install

    If you get an error telling you that the apxs script could not be found, look for it on your system and if you find it, provide the full path to it as: --with-apxs=/path/to/apxs

    Next you must copy php.ini-dist to the appropriate place (normally /usr/local/lib/php.ini) and edit it as necessary to set PHP options.

    The only thing left to do is to edit your httpd.conf file and make sure the PHP 4 mime type is there and uncommented. You need a line that looks like this:

    AddType application/x-httpd-php .php

    Then restart your server (apachectl restart) and you should be able to serve up PHP files now. Make a test file called test.php and put some PHP tags in it. Like <?phpinfo()?>, for example.

    attached mail follows:


    ok last email from me for awhile :)

    everyone on this list has been great and i've gotten some great tips and advise! tks

    i'm trying to compile in imap support --with-imap

    freebsd 4.2 apache_1.3.14 php4.0.4pl1

    followed the directions on http://www.php.net/manual/en/ref.imap.php and php compiled with no complaints. When i go to compile apache I get this:

    /usr/local/lib/libc-client4.so: undefined reference to `mm_expunged' 14 more /usr/local/lib/libc-client4.so: undefined reference to `mm_dlog' **** Error code 1

    Stop in /src/apache_1.3.14/src/helpers ========Error Output for sanity check ====== ======== end of error report ======

    Aborting!

    what gives? any suggestions?

    tks mitch

    attached mail follows:


    Who can give me a PHP-Script to detect if JavaScript is enabled?

    It should work with both, IE and NN!

    thanks

    --
    Ihr WEBberater
    Stuttgarter Str.3, D-73033 Göppingen
    Tel. +49(0)7161-929594 - Fax. +49(0)7161-929598
    http://www.wa-p.de ** mailto:jkwa-p.de
    

    attached mail follows:


    Can php + what modules do this and has anybody succeeded to do something like the followingbefore?

    I want to generate simple images on the fly, e.g. a 50px circle on a transparent background of 200x200 px using php.

    I want to position the circle on the background using x and y coodinates. Is this possible with what php and additional tools?

    Thanks alot

    Helmut

    attached mail follows:


    >Subject: [PHP] generate e.g. circles on the fly with coordinates for postioning >

    >Can php + what modules do this and >has anybody succeeded to do something like the followingbefore? > >I want to generate simple images on the fly, e.g. a 50px circle on a transparent background of 200x200 px using php. > >I want to position the circle on the background using x and y coodinates. Is this possible with what php and additional tools?

    Sure can. Take a look at: http://www.php.net/manual/en/ref.image.php

    Hope this helps,

    Joe

    attached mail follows:


    Who can give me a PHP-Script to detect if JavaScript is enabled?

    It should work with both, IE and NN!

    thanks

    --
    Ihr WEBberater
    Stuttgarter Str.3, D-73033 Göppingen
    Tel. +49(0)7161-929594 - Fax. +49(0)7161-929598
    http://www.wa-p.de ** mailto:jkwa-p.de
    

    attached mail follows:


    If I have magic quotes turned on for post/get/etc. in my php.ini, is there any way to temporarily turn it off for one page? For example, I have a preview page inbetween my data entry page and the page that actually saves to db. I don't want magic quotes turned on when going from the data entry to the preview page since all quotes keep getting backslashed. Is there a way to do this?

    -Ben