php-general Digest 4 Nov 2001 17:48:36 -0000 Issue 975

Topics (messages 73373 through 73400):

Re: Number_Format Question
        73373 by: Steve Werby

Re: site last updated
        73374 by: Steve Werby
        73376 by: Chip
        73377 by: speedboy
        73385 by: Rudi Ahlers

Re: passing variables between pages without using url??
        73375 by: Steve Werby

filemtime() problems
        73378 by: Ventsyslav Vassilev

why cant I: array_keys($arr)[0] ?
        73379 by: operator.superprivate.com
        73380 by: Yasuo Ohgaki
        73381 by: Yasuo Ohgaki
        73386 by: Matt McClanahan

Can you help me about apache connect with php ?
        73382 by: edward.ita.org.mo
        73384 by: Brian Clark

Access $HTTP_POST_VARS from class member fucntion
        73383 by: Daniel Harik

PHP/Mysql error handling
        73387 by: George E. Papadakis

replace nested custom html tags
        73388 by: Bruce BrackBill

Apache / PHP Question
        73389 by: George E. Papadakis

ISAPI modul for IIS5.0
        73390 by: Marek Erneker

Hello, per making .zip files
        73391 by: Joelmon2001.aol.com

Adv Paypal Shopping Cart
        73392 by: Kacey A. Murphy

.inc files
        73393 by: Rudi Ahlers
        73399 by: Jan Grafstr÷m

Re: [PHP-INST] Can you help me about apache connect with php ?
        73394 by: Boyack, Kurt
        73396 by: edward.ita.org.mo

User authentication?
        73395 by: Daniel AlsÚn
        73398 by: Jan Grafstr÷m

Get Content-Type of a remote file
        73397 by: Lasar Liepins

Am i crazy?
        73400 by: Martin

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


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


"Jeff Oien" <[EMAIL PROTECTED]> wrote:
> I have a number like this 0.51 and I would like it to display without
> the leading 0. How can I do this? Thanks.

There are lots of solutions.

$num = 0.51;

$num_parts = explode( '.', $num );
$num_new = '.' . $num_parts[1];

Or if it's always going to be a number b/w 0 and 1 then you could use
substr() to get the part you want.  You could also use something like
ereg_replace().  Someone else may have a solution that's better.

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





"Ryan Christensen" <[EMAIL PROTECTED]> wrote:
> You can do this in a per-page basis w/:
> 
> $modified = stat("yourfile.html"); 
> echo date("l, F dS",$modified[9]);

Also see getlastmod() and filemtime().

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





On Saturday 03 November 2001 21:12, Steve Werby wrote:
> "Ryan Christensen" <[EMAIL PROTECTED]> wrote:
> > You can do this in a per-page basis w/:
> >
> > $modified = stat("yourfile.html");
> > echo date("l, F dS",$modified[9]);
>
> Also see getlastmod() and filemtime().

I am interested in this also. I understand the way it is working here, but 
what about using a common footer.inc which contains the last modified script, 
to show the last modified date of another inc file, body.inc, inside page.php?
This would have to know the body.inc file name loaded into page.php I guess. 
That'd sure be easier than adding the script to several hundred seperate 
pages.
 
--
Chip W.




last modified <?php echo date("D d-m-Y H:i:s", filectime(__FILE__)); ?>

^ I put that on the bottom of every page on some sites I make.





Would there be a way of adding one script to a common footer, which in
included in any file, and this script can check any file on the server, and
echo the "last updated" string to a file. Thus, you don't need to add the
script to the file, the footer automatically echos that info to any file on
the server. Would that be possible? Cause then you could simply add pages,
and the whole footer could be echoed to it.

Rudi Ahlers
UNIX Specialist and Web Developer
Bonzai Web Design - http://www.bonzai.org.za
Cell: 082 926 1689

----- Original Message -----
From: "Chip" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, November 04, 2001 7:32 AM
Subject: Re: [PHP] site last updated


> On Saturday 03 November 2001 21:12, Steve Werby wrote:
> > "Ryan Christensen" <[EMAIL PROTECTED]> wrote:
> > > You can do this in a per-page basis w/:
> > >
> > > $modified = stat("yourfile.html");
> > > echo date("l, F dS",$modified[9]);
> >
> > Also see getlastmod() and filemtime().
>
> I am interested in this also. I understand the way it is working here, but
> what about using a common footer.inc which contains the last modified
script,
> to show the last modified date of another inc file, body.inc, inside
page.php?
> This would have to know the body.inc file name loaded into page.php I
guess.
> That'd sure be easier than adding the script to several hundred seperate
> pages.
>
> --
> Chip W.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>





"sunny AT wde" <[EMAIL PROTECTED]> wrote:
> Ok, but how do I use post when using Header??

You don't.  What are you trying to achieve that makes this necessary?

> I would like to have a form, but I don't know how I would make the
> script automatcially re-direct in a form... becase I know how to use
> form variables that way.

In the HTML <form> element the "action" attribute specifies the file that
will process the form.  If your first form is form1.php and your second is
form2.php then on form1.php you'd have this:

<form method='post' action='form2.php'>

And form2.php would include the PHP code necessary to process form1.php.  If
that doesn't make sense maybe you can include some code or explain in more
detail what you're trying to accomplish and what the problem you're facing
is.  It's late here so maybe I'm just not thinking clearly.

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





Hi,
i have little problems while trying to retrieve the modification time for
some files.
The OS is Linux Red Hat 7.1 and i'm trying to get the modification time for
a MySQL table (.MYD or .MYI file).
In the beginning everything was OK and the filemtime() function worked
without any problems. But 2 days ago my database was damaged and i was
created it from the beginning. After that filemtime() reports 01.01.1970
02:00:00 for any file into this database and works correct for any other
file in the filesystem.
May be it will be important to note that i have removed the database by
simply deleting the database folder, because DROP DATABASE command not
worked with this database.
I'm absolutely new to Linux and surely doing some things wrong...
What is the reason / solution?








Why does PHP give a parse error if you do:

      echo array_keys($arr)[0];

It makes you assign the result of the function to a var first like this:

      $arr = array_keys($arr);
      echo $arr[0];

I just want to grab the 1st element of the array. Why does it make you do
it in 2 lines instead of letting you index right on the array that results
from the function?

A





[EMAIL PROTECTED] wrote:

> Why does PHP give a parse error if you do:
> 
>       echo array_keys($arr)[0];


This breaks syntax...

> 
> It makes you assign the result of the function to a var first like this:
> 
>       $arr = array_keys($arr);
>       echo $arr[0];


How about

reset($arr);
list($key,) = each($arr);
echo $key;

It's much more efficient.

> I just want to grab the 1st element of the array. Why does it make you do
> it in 2 lines instead of letting you index right on the array that results

> from the function?


Writing 2 or 3 lines for printing first key name, is not
hard work...

PHP script may need more lines to do the same thing compare
to Perl, but it's much easier to maintain. IMHO.

--
Yasuo Ohgaki






[EMAIL PROTECTED] wrote:

> Why does PHP give a parse error if you do:
> 
>       echo array_keys($arr)[0];


This breaks syntax...

> 
> It makes you assign the result of the function to a var first like this:
> 
>       $arr = array_keys($arr);
>       echo $arr[0];


How about

reset($arr);
list($key,) = each($arr);
echo $key;

It's much more efficient.

> I just want to grab the 1st element of the array. Why does it make you do
> it in 2 lines instead of letting you index right on the array that results

> from the function?


Writing 2 or 3 lines for printing first key name, is not
hard work...

PHP script may need more lines to do the same thing compare
to Perl, but it's much easier to maintain. IMHO.

--
Yasuo Ohgaki




_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com





On Sun, Nov 04, 2001 at 12:54:54AM -0700, [EMAIL PROTECTED] wrote:

> Why does PHP give a parse error if you do:
> 
>       echo array_keys($arr)[0];
> 
> It makes you assign the result of the function to a var first like this:
> 
>       $arr = array_keys($arr);
>       echo $arr[0];
> 
> I just want to grab the 1st element of the array. Why does it make you do
> it in 2 lines instead of letting you index right on the array that results
> from the function?

// Shifts the first element off the array
$first_element = array_shift($array);

// Returns the first element, preserving the array in the calling scope
function get_array_first($arr)
{
        return array_shift($arr);
}
$first_element = get_arr_first($array);

Matt




Dear All,

My System is Red Hat Linux 6.2...
When I finished the installation ( Apache , MySQL , Php ) , then the Web

Server ( Apache ) can't be good for working ( can't auto detect php
format ) with php3 ( *.php3 ) and php4 ( *.php )...
So, can you help me to solve the problem ?

the installation packages :

apache_1.3.20.tar.gz
mysql-3.23.41.tar.gz
php-4.0.6.tar.gz

installation steps :

Apache :
./configure --prefix=/usr/local/apache \
--enable-shared=max
make
make install
/usr/local/apache/bin/apachectl start

MySQL :
groupadd mysql
useradd -g mysql mysql
./configure --with-charset=big5
make
make install
scripts/mysql_install_db
chown -R root /usr/local/share/mysql
chown -R mysql /usr/local/var
chgrp -R mysql /usr/local/share/mysql
cp /usr/local/share/mysql/mysql.server /etc/rc.d/init.d/mysql
/etc/rc.d/init.d/mysql start

php ( php + apache ) :
./configure \
--with-mysql \
--with-apxs=/usr/local/apache/bin/apxs \
--with-imap \
--enable-versioning \
--enable-track-vars
make
make install
cp php.ini-dist /usr/local/lib/php.ini

Thank for your help !

Edward.







Hi Edward,

@ 3:43:51 AM on 11/4/2001, [EMAIL PROTECTED] wrote:

> the installation packages :

> apache_1.3.20.tar.gz

Why not 1.3.22?

> mysql-3.23.41.tar.gz
> php-4.0.6.tar.gz

> installation steps :

> Apache :
> ./configure --prefix=/usr/local/apache \
> --enable-shared=max
> make
> make install
> /usr/local/apache/bin/apachectl start

> MySQL :
> groupadd mysql
> useradd -g mysql mysql
> ./configure --with-charset=big5
> make
> make install
> scripts/mysql_install_db
> chown -R root /usr/local/share/mysql
> chown -R mysql /usr/local/var
> chgrp -R mysql /usr/local/share/mysql
> cp /usr/local/share/mysql/mysql.server /etc/rc.d/init.d/mysql
> /etc/rc.d/init.d/mysql start

> php ( php + apache ) :
> ./configure \
> --with-mysql \

Use:  --with-mysql=/usr/local

> --with-apxs=/usr/local/apache/bin/apxs \
> --with-imap \

You probably need a path to imap too.

> --enable-versioning \

You don't need this if you're only running 4.0.6

> --enable-track-vars
> make
> make install
> cp php.ini-dist /usr/local/lib/php.ini

Did you restart Apache?

/usr/local/apache/bin/apachectl stop
/usr/local/apache/bin/apachectl start

If that doesn't fix it, make sure you have these lines (uncommented)
in /usr/local/apache/conf/httpd.conf:

DirectoryIndex index.htm index.html index.php index.php3 index.php4
AddType application/x-httpd-php .php .php3 .php4
AddType application/x-httpd-php-source .phps

Then:

/usr/local/apache/bin/apachectl stop
/usr/local/apache/bin/apachectl start

--
 -Brian Clark | PGP is spoken here: 0xE4D0C7C8
  Please, DO NOT carbon copy me on list replies.





Hello

 I have a class called Member, it has member function called
 vallidateForm(), i try to pass it a $HTTP_POST_VARS array it looks like this:

 
clas Member{
var $HTTP_POST_VARS;
   function vallidateForm ($HTTP_POST_VARS){
    echo $HTTP_POST_VARS['frmUsername'];
   }
}

$user = new Member;
if($action=="register"){
   global $HTTP_POST_VARS;
   $user->vallidateForm($HTTP_POST_VARS);
}else{
   $user->displayForm();
}
?>

But i can't acces  $HTTP_POST_VARS['frmUsername'] within the function


Thank You very much





Hi,

Is there any way to make php notify me of any errors through email?
I know it may sounds funny, but imagine having this huge site and u just
want it to run smoothly but u juct cant check it all the time . If there was
a way that php would notify u for a an error on a specific page/line that
would make debuggin much easier and without guessing..
So, is it possible?

Thanks.

-- phaistonian






Hi,

Anyone have any ideas on how I could modify
the following to work on nested tags?

The regex replaces custom tags [i] [u] [b]
with real tags.

The Regex takes any of the characters in the class \[([ubi])\]
then non greedily matches any character (.*?) then matches
the result of the first reference from the character
class \[\/(\\1)\]/ . It then replaces the [u]stuff[/u] to
<u>stuff</u> etc.

Everthing works fine, except when the tags are nested.

I'm actually suprised that you can use a reference ( eg: \\1 )
in the pattern and not only in the replacement.  There does
not seam to be any mention of that anywhere.  The use of
references in the pattern does not appear to be related
in any way the the problem.


echo preg_replace ("/\[([ubi])\](.*?)\[\/(\\1)\]/msi","<\\1>\\2</\\1>",
           " [b] [u] underlined and bold [/u] [/b] [i] italic [/i]");


The output:( it doesn't replace the nested [u] [/u] ):

<b> [u] underlined and bold [/u] </b> <i> italics </i>

Thanks,
Bruce



_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp





Hello,

In my lnx server  I can do index.php/var1/var2/var3
I try the same exact thing in windows (using the same config (Apache/php) )
and it gives me internal server error.
Any ideas?

Thanks

-- phaistonian





Hi,

I have IIS5 on W2k Server, and a can not use isapi modul from php 4.0.6. If I using 
modul from 4.0.pl2 then everything is OK, but when I use 4.0.6 then it is not 
functionally and i must use cgi. 

Can you help me (someone).

Thanks,






Hello, I have tried the zend.com articles to no avail

on php/linux 
4.03 or even 4.05 whatever

is there a way to speciy a directory, in let's say
zip.php and when joe schmoe goes to that page, that directory
which is specified is downloaded immediately as zip?

Not a user interface to make them

nobody seems to have a straight answer
trying not to talk about 3rd party $10m components

can php do this? If so, how? I get errors with every 'solution'
so I figured I'd ask here. 

Thanks




This is a difficult one, What I am doing is designing a website to sell
DVD's well what I am running into is that when a Person buys the DVD they
are getting charged 2.35 for shipping an additional 1.00 for purchasing 2 ..
Well that works fine if they buy the same DVD, but when they buy 2 different
DVD's they are getting charged 2.35 twice.

What I was wondering if I can munipulate the code below to solve this
problem using PHP, I have a mySQL database that I pull from and below you
can see I am pulling the Shipping from ITM_SHIP field and ITM_ASHIP is for
the additional movie they put in there cart.

So can I do a math eccuasion so that it does WIEGTH say 1 lb and multiply
that by $1 and then put that code in my link below..

Anyone done anything like this, I would love to learn something to this
effect!

https://www.paypal.com/cart/add=1&business=MYACCOUNT&item_name=<?php echo
$products->Fields("itm_title")?>&item_number=<?php echo
$products->Fields("itm_num")?>&amount=<?php echo
$products->Fields("itm_price")?>&shipping=<?php echo
$products->Fields("itm_ship")?>&shipping2=<?php echo
$products->Fields("itm_aship")?>&image_url=https%3A//www.citystoked.com/logo
.jpg&return=http%3A//www.p-traders.com/success.php&cancel_return=http%3A//ww
w.p-traders.com/index.php

sincerely Kacey A. Murphy
netBuilder's, Inc.

You can see what I mean by going to http://www.p-traders.com/







Hi

I was wondering, is there a different way using .inc files? I have a lot of
.inc files, which are displayed as normal text when you call it in the
browser. I would like to still have a file with the username / password /
database / etc in, but make it say config.inc.php. How would I get the app
to read a file like that, where say $admin="rudi";
But also, how would I be able to change the values from another file? ie.
write to it, and delete lines in it?
I'm still learnin PHP, and it's great and a lot of fun.
Regards

Rudi Ahlers






Hi Rudi!
Check out this example from Hotscripts.
http://www.hotscripts.com/cgi-bin/dload.cgi?ID=12367

Regards
Jan Grafstrom
"Rudi Ahlers" <[EMAIL PROTECTED]> skrev i meddelandet
008401c16534$dcb77580$0c00a8c0@camelot">news:008401c16534$dcb77580$0c00a8c0@camelot...
> Hi
>
> I was wondering, is there a different way using .inc files? I have a lot
of
> .inc files, which are displayed as normal text when you call it in the
> browser. I would like to still have a file with the username / password /
> database / etc in, but make it say config.inc.php. How would I get the app
> to read a file like that, where say $admin="rudi";
> But also, how would I be able to change the values from another file? ie.
> write to it, and delete lines in it?
> I'm still learnin PHP, and it's great and a lot of fun.
> Regards
>
> Rudi Ahlers
>
>







Sounds like you need to uncomment the following line in your httpd.conf:

    AddType application/x-httpd-php .php



> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, November 04, 2001 12:44 AM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: [PHP-INST] Can you help me about apache connect with php ?
> 
> 
> Dear All,
> 
> My System is Red Hat Linux 6.2...
> When I finished the installation ( Apache , MySQL , Php ) , 
> then the Web
> 
> Server ( Apache ) can't be good for working ( can't auto detect php
> format ) with php3 ( *.php3 ) and php4 ( *.php )...
> So, can you help me to solve the problem ?
> 
> the installation packages :
> 
> apache_1.3.20.tar.gz
> mysql-3.23.41.tar.gz
> php-4.0.6.tar.gz
> 
> installation steps :
> 
> Apache :
> ./configure --prefix=/usr/local/apache \
> --enable-shared=max
> make
> make install
> /usr/local/apache/bin/apachectl start
> 
> MySQL :
> groupadd mysql
> useradd -g mysql mysql
> ./configure --with-charset=big5
> make
> make install
> scripts/mysql_install_db
> chown -R root /usr/local/share/mysql
> chown -R mysql /usr/local/var
> chgrp -R mysql /usr/local/share/mysql
> cp /usr/local/share/mysql/mysql.server /etc/rc.d/init.d/mysql
> /etc/rc.d/init.d/mysql start
> 
> php ( php + apache ) :
> ./configure \
> --with-mysql \
> --with-apxs=/usr/local/apache/bin/apxs \
> --with-imap \
> --enable-versioning \
> --enable-track-vars
> make
> make install
> cp php.ini-dist /usr/local/lib/php.ini
> 
> Thank for your help !
> 
> Edward.
> 
> 
> 
> 
> -- 
> PHP Install Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: 
> [EMAIL PROTECTED]
> 




Kurt Boyack wrote:

> Sounds like you need to uncomment the following line in your httpd.conf:
>
>     AddType application/x-httpd-php .php

Hello to you,

Now, I have just finished the reinstall Red Hat Linux System , Apache , php
and MySQL,
But when I start the apache ( web server ) after the re-installation and
uncomment the line, these is the error :

Syntax error on line 222 of /usr/local/apache/conf/httpd.conf:
Cannot load /usr/local/apache/libexec/libphp4.so into server:
/usr/local/apache/
libexec/libphp4.so: undefined symbol: gss_mech_krb5
/usr/local/apache/bin/apachectl start: httpd could not be started

So, can you help me ? who can help me ?
Thanks you and all !

Edward.






Hi,

do aonyone know of any comprehensive tutorial for user authentication
session managment with php4 sessions and mysql? Preferably with some sort of
code examples?

I have tried searching the larger code libraries but haven┤t found anything
that suits me (the ones i actually got interested in was dead links).

Regards
# Daniel AlsÚn    | www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   |                  #





Hi Daniel!
Phpbuilder have some articles with examples under security.
http://www.phpbuilder.com/columns/

Regards
Jan Grafstrom
Lillemans Hus AB
Sweden
"Daniel alsÚn" <[EMAIL PROTECTED]> skrev i meddelandet
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
>
> do aonyone know of any comprehensive tutorial for user authentication
> session managment with php4 sessions and mysql? Preferably with some sort
of
> code examples?
>
> I have tried searching the larger code libraries but haven┤t found
anything
> that suits me (the ones i actually got interested in was dead links).
>
> Regards
> # Daniel AlsÚn    | www.mindbash.com #
> # [EMAIL PROTECTED]  | +46 704 86 14 92 #
> # ICQ: 63006462   |                  #
>






Hi.

Is it possible to check the Content-type header of a remote 
file? If so, how? I want to fetch a file using file(), but I 
want to make sure it is an HTML file first.

Thanks,

_ Lasar





Did I forget everything in a few months?
if ($name='admin') {
                        header("Location: $MYPATH/admin.php");
                }

Doesn't. That is it doesn't redirect to whatever $MYPATH/admin.php 
translates to. Doing an echo $MYPATH directly after the line shows that the 
path is interpreted correctly - and the file exists (I checked). And the 
$name is correct - echo $name gives admin. And neither does the php.net 
example work ...

if ($name='admin') {
        header("Location: http://www.php.net/";);
}

doesn't redirect to php.net. 

*sigh*

Martin


Reply via email to