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: Sun Aug 12 2001 - 06:20:39 CDT

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

    php-general Digest 12 Aug 2001 11:20:39 -0000 Issue 811

    Topics (messages 62279 through 62300):

    ?op=
            62279 by: Gerard Samuel
            62280 by: Tyler Longren
            62281 by: Gerard Samuel

    Re: replacing variables in file
            62282 by: CC Zona
            62285 by: Paul Roberts
            62287 by: Matthew Loff

    Re: large commercial sites that use php?
            62283 by: Tom Malone

    Reliable PHP web hosts
            62284 by: Tom Malone
            62291 by: Adam

    Auto Responders...
            62286 by: ReDucTor
            62296 by: Chris
            62297 by: ReDucTor

    select 3 files that were created last
            62288 by: sarahana
            62290 by: Andrew Braund

    Re: Having problems with REVOKE
            62289 by: Steve Werby

    the last word of a string??
            62292 by: zerosumzero.yahoo.com
            62294 by: Mukul Sabharwal

    another regex question
            62293 by: Joe Sheble \(Wizaerd\)

    lexical parsing?
            62295 by: Daniel Adams

    Cant load MSSQL extension (Win, PHP, Apache)
            62298 by: Phil

    array...session variable...Separate records on separate pages
            62299 by: Andrew Austin

    Page caching
            62300 by: Nick

    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:


    Hey all. Im trying to figure out how some people script with this
    feature. xxx.php?op=xxx as a link.
    To me it kinda remind me of the goto statement of basic programming.
    Im not sure as to how it works, but I searched the mailing list, google
      and the manual and came up dev/null. If there is something in the
    manual or a link on the net, that you could point me to, that would be
    great. Thanks

    attached mail follows:


    An example.
    say my link it http://www.domain.com/view.php?option=A
    If I have some code on view.php that says:
    <?
    print "$option";
    ?>
    "A" will be printed to the page. The stuff after the "?" is a
    variable, and it's value is whatever it equals.

    Tyler Longren
    Captain Jack Communications
    tylercaptainjack.com
    www.captainjack.com
     

    On Sat, 11 Aug 2001 19:46:00 -0400, Gerard Samuel wrote:
    >Hey all. Im trying to figure out how some people script with this
    >feature. xxx.php?op=xxx as a link.
    >To me it kinda remind me of the goto statement of basic programming.
    >Im not sure as to how it works, but I searched the mailing list,
    >google
    > and the manual and came up dev/null. If there is something in the
    >manual or a link on the net, that you could point me to, that would
    >be
    >great. Thanks
    >
    >

    attached mail follows:


    Thanks to ReDucTor & Tyler Longren. Your examples, seem to make sense.
    I have to let it mull around the brain for a bit....
    Thanks

    ReDucTor wrote:
    > what do you mean
    >
    > script.php?op=a
    >
    > turns $op into a and
    >
    > script.php?op=a&pop=fun
    >
    > turns $op into a and $pop into fun and
    >
    > script.php?op=a&pop=fun&run=scary
    >
    > turns $op into a and $pop into fun and $run into scary
    >
    > - James "ReDucTor" Mitchell
    > ----- Original Message -----
    > From: "Gerard Samuel" <trini0optonline.net>
    > To: "PHP" <php-generallists.php.net>
    > Sent: Sunday, August 12, 2001 9:46 AM
    > Subject: [PHP] ?op=
    >
    >
    >
    >>Hey all. Im trying to figure out how some people script with this
    >>feature. xxx.php?op=xxx as a link.
    >>To me it kinda remind me of the goto statement of basic programming.
    >>Im not sure as to how it works, but I searched the mailing list, google
    >> and the manual and came up dev/null. If there is something in the
    >>manual or a link on the net, that you could point me to, that would be
    >>great. Thanks
    >>
    >>
    >>--
    >>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:


    In article <000001c122b9$e055d460$7763883eportable1>,
     roberts_paulbigfoot.com (Paul Roberts) wrote:

    > | $template="/path/to/somefile.inc";
    > | include($template);
    > |
    > | The variable substitution happens automatically (as long as $var occurs
    > | within proper PHP syntax, such as "<?php $myvar1 ?>"). Output to browser
    > | is also automatic. See <http://php.net/include> for more info.
    > |
    >
    > I tried this
    > print (include($filelocation)); returns true and prints 1

    Like I said before: "See <http://php.net/include> for more info." There's
    a wealth of useful info there (for example, note that if the included file
    returns a value, that value can be captured into a variable, like
    "$myvar=include($filelocation);"). If there's something in those docs that
    you need clarification on, do post again.

    > print (include($filelocation)); returns true and prints 1
    >
    > include($filelocation)); causes the template file to be dumped into the
    > middle of the script causing errors.

    Perhaps if you explained what differences you expected to get from these
    two lines...? (Looks to me like you *want* to dump the template file right
    at that point. What errors specifically is PHP reporting?)

    > if I could get to work as in Perl I'd be happy, is there an equivalent of $1
    > in php
    >
    > foreach $item (template) {
    > $item =~s/\$(\w+)/${$1}/g;

    See <http://php.net/foreach> and <http://php.net/preg-replace>.

    -- 
    CC
    

    attached mail follows:


    I want to read the include file in, replace the variables with any data present and then send the included file to the browser between some header and footer templates. I want the template to be straight html which can be edited with a wysiwyg editor if required.

    if I include the file as html I get errors as there are " and no valid syntax I my php block ie no ;

    i'd like to just do

    $formdata = (include($filelocation));

    but this returns 1 and pts it in the variable, I need the html form in the variable. ----- Original Message ----- From: "CC Zona" <cczonanospam.invalid> To: <php-generallists.php.net> Sent: Sunday, August 12, 2001 1:35 AM Subject: Re: [PHP] Re: replacing variables in file

    | In article <000001c122b9$e055d460$7763883eportable1>, | roberts_paulbigfoot.com (Paul Roberts) wrote: | | > | $template="/path/to/somefile.inc"; | > | include($template); | > | | > | The variable substitution happens automatically (as long as $var occurs | > | within proper PHP syntax, such as "<?php $myvar1 ?>"). Output to browser | > | is also automatic. See <http://php.net/include> for more info. | > | | > | > I tried this | > print (include($filelocation)); returns true and prints 1 | | Like I said before: "See <http://php.net/include> for more info." There's | a wealth of useful info there (for example, note that if the included file | returns a value, that value can be captured into a variable, like | "$myvar=include($filelocation);"). If there's something in those docs that | you need clarification on, do post again. | | > print (include($filelocation)); returns true and prints 1 | > | > include($filelocation)); causes the template file to be dumped into the | > middle of the script causing errors. | | Perhaps if you explained what differences you expected to get from these | two lines...? (Looks to me like you *want* to dump the template file right | at that point. What errors specifically is PHP reporting?) | | > if I could get to work as in Perl I'd be happy, is there an equivalent of $1 | > in php | > | > foreach $item (template) { | > $item =~s/\$(\w+)/${$1}/g; | | See <http://php.net/foreach> and <http://php.net/preg-replace>. | | -- | CC | | -- | 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:


    I can't quite understand exactly what you want to do... Replace what varaibles with what data?

    If you're saying you want to include HTML code with blanks in it, and have the PHP fill in the blanks with variables, that's easy...

    file1.php: [html stuff] <B><?php echo $variable;?></B> [html stuff] .........

    file2.php: <?php

    [php code]

    include("file1.php");

    [php code]

    ?>

    Or-- If you're saying you want to store the contents of a file in a variable, then do this:

    // get contents of a file into a string $filename = "/usr/local/something.txt"; $fd = fopen ($filename, "r"); $contents = fread ($fd, filesize ($filename)); fclose ($fd);

    (taken from PHP manual entry for fread())

    Also see file() -- that performs a similar function, reading the file into an array.

    -----Original Message----- From: Paul Roberts [mailto:roberts_paulbigfoot.com] Sent: Saturday, August 11, 2001 10:21 PM To: php-generallists.php.net Subject: Re: [PHP] Re: replacing variables in file

    I want to read the include file in, replace the variables with any data present and then send the included file to the browser between some header and footer templates. I want the template to be straight html which can be edited with a wysiwyg editor if required.

    if I include the file as html I get errors as there are " and no valid syntax I my php block ie no ;

    i'd like to just do

    $formdata = (include($filelocation));

    but this returns 1 and pts it in the variable, I need the html form in the variable. ----- Original Message ----- From: "CC Zona" <cczonanospam.invalid> To: <php-generallists.php.net> Sent: Sunday, August 12, 2001 1:35 AM Subject: Re: [PHP] Re: replacing variables in file

    | In article <000001c122b9$e055d460$7763883eportable1>, | roberts_paulbigfoot.com (Paul Roberts) wrote: | | > | $template="/path/to/somefile.inc"; | > | include($template); | > | | > | The variable substitution happens automatically (as long as $var occurs | > | within proper PHP syntax, such as "<?php $myvar1 ?>"). Output to browser | > | is also automatic. See <http://php.net/include> for more info. | > | | > | > I tried this | > print (include($filelocation)); returns true and prints 1 | | Like I said before: "See <http://php.net/include> for more info." | There's a wealth of useful info there (for example, note that if the | included file returns a value, that value can be captured into a | variable, like "$myvar=include($filelocation);"). If there's | something in those docs that | you need clarification on, do post again. | | > print (include($filelocation)); returns true and prints 1 | > | > include($filelocation)); causes the template file to be dumped into | > the middle of the script causing errors. | | Perhaps if you explained what differences you expected to get from | these two lines...? (Looks to me like you *want* to dump the template

    | file right | at that point. What errors specifically is PHP reporting?) | | > if I could get to work as in Perl I'd be happy, is there an | > equivalent of $1 | > in php | > | > foreach $item (template) { | > $item =~s/\$(\w+)/${$1}/g; | | See <http://php.net/foreach> and <http://php.net/preg-replace>. | | -- | CC | | -- | 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:


    I don't know if anyone posted this company, but they use PHP, and they are a huge, global advertising conglomerate: Young & Rubicam - http://brand-dialogue.com/home/index2.php

    Tom Malone Web Designer http://www.tom-malone.com

    attached mail follows:


    I know this is slightly OT and has been covered before, but I searched through the MARC and could not find the answers I was looking for. Can anyone suggest some reliable, reputable web hosts that support LAMP (Linux-Apache-MySQL-PHP) and have a responsive, not-too-rude technical support staff? I'm not as concerned about the cost as I am these other factors (although I don't want to pay an arm and a leg) - I was thinking in the $20-$40 range (monthly). Any suggestions would be much appreciated. Thank you all.

    Tom Malone Web Designer http://www.tom-malone.com

    attached mail follows:


    > I know this is slightly OT and has been covered before, but I searched > through the MARC and could not find the answers I was looking for. Can > anyone suggest some reliable, reputable web hosts that support LAMP > (Linux-Apache-MySQL-PHP) and have a responsive, not-too-rude technical > support staff? I'm not as concerned about the cost as I am these other > factors (although I don't want to pay an arm and a leg) - I was thinking in > the $20-$40 range (monthly). Any suggestions would be much appreciated. > Thank you all.

    www.affordablehost.com check out their pricing here. http://www.affordablehost.com/hosting.shtml

    -Adam

    attached mail follows:


    What Scripts, or Snippts are there for auto responders made in PHP, that people will let be customised?!? - James "ReDucTor" Mitchell

    attached mail follows:


    As in an Emailer? ----- Original Message ----- From: ReDucTor <sjdtmvtpg.com.au> To: <php-generallists.php.net> Sent: Wednesday, July 11, 2001 10:57 PM Subject: [PHP] Auto Responders...

    > What Scripts, or Snippts are there for auto responders made in PHP, that > people will let be customised?!? > - James "ReDucTor" Mitchell > > > -- > 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:


    one that will check for email, then if there is an email in that box, it will send a message to the person that sent the message.... - James "ReDucTor" Mitchell ----- Original Message ----- From: "Chris" <chrisdersonameritech.net> To: "ReDucTor" <sjdtmvtpg.com.au>; <php-generallists.php.net> Sent: Friday, August 10, 2001 4:02 AM Subject: Re: [PHP] Auto Responders...

    > As in an Emailer? > ----- Original Message ----- > From: ReDucTor <sjdtmvtpg.com.au> > To: <php-generallists.php.net> > Sent: Wednesday, July 11, 2001 10:57 PM > Subject: [PHP] Auto Responders... > > > > What Scripts, or Snippts are there for auto responders made in PHP, that > > people will let be customised?!? > > - James "ReDucTor" Mitchell > > > > > > -- > > 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:


    Hi, Please let me know how I can select 3 files from a directory that were last created..

    Also, the directory (out of all the directories placed in the parent directory) that was last created.

    Thanks, sarahana

    attached mail follows:


    I use this function (on windows) to get a sorted list of files in a directory. If you are going to use it on *nix it might need some adjustment.

    HTH Andrew Braund

    // Reads a directory and puts filenames into a array sorted by date function GetFilesByDate ($DataPath, &$files, &$nfiles) { $handle=opendir($DataPath); if ($handle) { $nfiles = 0; while (false!==($file = readdir($handle))) { if ($file != "." && $file != ".." ) { $files[$nfiles][name] = $file; $files[$nfiles][date] = filemtime($DataPath."\\".$file); $nfiles++; } } closedir($handle); if($nfiles>1){ usort($files, create_function( '$a,$b', 'return $a["date"]==$b["date"]?0:($a["date"]<$b["date"]?1:-1);') ); } } }

    > -----Original Message----- > From: sarahana [mailto:stellarsarahana.com] > Sent: Monday, 13 August 2001 03:58 > To: php-generallists.php.net > Subject: [PHP] select 3 files that were created last > > > Hi, > Please let me know how I can select 3 files from a directory that were last > created.. > > Also, the directory (out of all the directories placed in the parent > directory) that was last created. > > Thanks, > sarahana > > > -- > 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:


    "Richard Kurth" <rkurthpacifier.com> wrote: <snip> > I am having problems with the Revoke statement. I add a database and > give the user privileges with this Grant statement </snip>

    Richard,

    This is not a PHP issue at all. You are aware of the MySQL mailing list aren't you? List-Subscribe: <mailto:mysql-subscribelists.mysql.com>

    > The manual does not go into REVOKE as much as it does for GRANT so > what am I missing hear. > also I realize that the revoke statement does not remove the info from > the db table or the usr table. How do I go about that without > debiting a user for a different database.

    I'm not sure what you're getting at, but if you want to remove a user you can always use a DELETE statement on the user and db tables (and wherever else is necessary), then issue a FLUSH PRIVILEGES.

    > On the db table it is easy > because I can do it were usr = $user and db = $db but in the usr table > every host name is localhost and the password is encrypted is there a > way to do somthing like were user =$username and password > =$password(encrypted). </snip>

    If you have the unencrypted password you can. I think that's what your 'password=$password(encrypted)' meant after realizing it wasn't [hopefully] meant to be PHP or SQL. WHERE user = 'user_here' AND password = PASSWORD('password_here'). But why would you need to do that? Why not just WHERE user = 'user_here'? After all, if all the hosts are set to localhost there should only be one record per user in the user table.

    > Yes I could go there manually. and remove it but this is being done by a > program in PHP that will remove the database revoke the privileges and > reset all of the info in a customers information database

    Hopefully I've answered your questions. If not please post to the MySQL list instead of here as a courtesy to the rest of the list members and yourself (since it's the right tool for the job).

    --
    Steve Werby
    President, Befriend Internet Services LLC
    http://www.befriend.com/
    

    attached mail follows:


    So I opened a file like this:

    $filename ="text.txt"; $fh = fopen($filename, "r");

    then I get the last line of the file like this:

    while (!feof ($fh)) { $lastline = fgets($fh, 4096); }

    now I want the last word of $lastline ... how do I do this? I've been trying all kinds of things but nothing seems to be what I need.

    I would also like to be able to get the last X words of $lastline?

    so if

    $lastline = "I am a newbie"

    I get: "am a newbie"

    Help!

    -- 
    susanfuturebird.com
    http://futurebird.diaryland.com
    

    attached mail follows:


    Hi,

    here :

    $arr = explode($lastline, " ");

    that puts lastline into arr which is an array and you can use the sizeof operator to get the nth (or the last) element.

    print $arr[sizeof($arr)];

    --- "zerosumzeroyahoo.com" <zerosumzeroyahoo.com> wrote: > So I opened a file like this: > > > $filename ="text.txt"; > $fh = fopen($filename, "r"); > > then I get the last line of the file like this: > > while (!feof ($fh)) { > $lastline = fgets($fh, 4096); > } > > > now I want the last word of $lastline ... how do I > do this? I've been > trying all kinds of things but nothing seems to be > what I need. > > I would also like to be able to get the last X words > of $lastline? > > so if > > $lastline = "I am a newbie" > > I get: "am a newbie" > > Help! > > > > > -- > susanfuturebird.com > http://futurebird.diaryland.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 >

    ===== ********************************* http://www.geocities.com/mimodit *********************************

    __________________________________________________ Do You Yahoo!? Send instant messages & get email alerts with Yahoo! Messenger. http://im.yahoo.com/

    attached mail follows:


    I have a function that goes through and highlights specified text:

    function HiLightText( $HilightThis, $InThis ) { if( $HilightThis == "" ) { $cRet = $InThis; } else { $cTextReplace = "<SPAN CLASS=\"HiLightText\">\\1</SPAN>"; $cRet = eregi_replace( "(".$HilightThis.")" , $cTextReplace, $InThis ); }

    return $cRet; }

    and it works great, except it also ends up hilighting text that falls within HTML tags, thus throwing off the display of the highlighted search results. How can I modify this to highlight the requested text appropriately, but skipping the HTML tags?

    attached mail follows:


    can you do this in php? - Dan

    -- 
    

    attached mail follows:


    Hi everybody,

    If I edit the php3.ini and activate a extension, I can see the effect with the function phpinfo(). This works with all extensions, exept mssql.dll and mssql70.dll. What am I doing wrong?? I dont think this is a general problem!!

    And, ladies and gentleman, I need help... thx!!

    attached mail follows:


    Hi

    I have a mysql db with about 15 pages of information all of which follow sequentially which I want to appear as pages in a book.

    Is there a nice way to have the recordset presented with each record on a separate page. I think I could do something with an array of the index field using it to call each record to a page and check what came last and what is next?

    Andrew

    attached mail follows:


    Is there any way that I can tell my PHP not to be cached?

    I've got a page that produces a map, and there are zoom buttons on it. When a user clicks on a zoom button the page calls itself with a different zoom setting in the url. The page works fine, but sometimes the map is cached in the browser so the user sees the old zoom level. I can't change the users caching settings, so can I do it in PHP? (I know in ASP there is a response.expires command - is there something similar I can use?)

    Thanks

    Nick