php-general Digest 28 Apr 2001 23:01:02 -0000 Issue 655

Topics (messages 50747 through 50774):

Re: run du command uder php
        50747 by: John Monfort

Re: Where is php.ini located by default?
        50748 by: eschmid+sic.s.netic.de

Caching & Authentification
        50749 by: Steve Haemelinck

Re: Links
        50750 by: Taylor, Stewart

localhost with $REMOTE ADDR
        50751 by: Johannes Rumpf

sorting filenames using opendir and readdir
        50752 by: Johannes Rumpf
        50753 by: Taylor, Stewart

PHP.INI
        50754 by: Manesh
        50755 by: Kath
        50756 by: PHPBeginner.com

STMP
        50757 by: Manesh

Secure authentication-Is this good?
        50758 by: Scott

Re: Database
        50759 by: Jason Lotito

Using the php_interbase.dll
        50760 by: José León Serna

Why I can not make the PHP acitve?
        50761 by: Xiaoshu Xu

grabbing variables from the query string
        50762 by: Jamie Saunders
        50765 by: PHPBeginner.com
        50766 by: Philip Olson

mysql_connect() error
        50763 by: Siim Einfeldt

OT, but dual-boot operating system question
        50764 by: Chris Cocuzzo

variables within variables
        50767 by: Robert Morrissey

PHP script that creates an SSL connection
        50768 by: Tom Beidler

using zip from php4
        50769 by: Shawn Reed

How do I call_user_func_array() on 4.0.1pl2 ?
        50770 by: Jimmy Lantz
        50771 by: Jimmy Lantz

integer checking problem from query string
        50772 by: Jamie Saunders
        50773 by: Philip Olson

Problems after reversing a guestbook
        50774 by: Mogens Nielsen

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]


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




 you might want to consider add the html PRE tag, to preserve the output
format.


 Something like,

> exec ("du -ks /home/apache",$test[]);
 echo " <pre>$test[0] </pre>";

 This will display the result in the browser, just as it does in the Unix
shell.



__________John Monfort_________________
_+-----------------------------------+_
     P E P I E  D E S I G N S
       www.pepiedesigns.com
"The world is waiting, are you ready?"
-+___________________________________+-

On Sat, 28 Apr 2001, Mark Lo (3) wrote:

> Hi,
>
>      I would like to know how to run du command under PHP.
>
> is this correct ??
>
> exec ("du -ks /home/apache",$test[]);
> echo $test[0]; --> I would like to print out the result in web browser
>
> Thank you
>
> Mark
>
>
> --
> 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]
>
>





On Sat, Apr 28, 2001 at 10:05:45AM +0000, yanto wrote:
> 
> i think the easiest way to see php setting is by running info.php script.
> if it's not on your webserver, just create one php file with content like
> this :
> <? echo phpinfo() ?>;

<?phpinfo()?> 

-Egon

-- 
LinuxTag, Stuttgart, Germany: July 5-8 2001: http://www.linuxtag.de/
All known books about PHP and related books: http://php.net/books.php 
Concert Band of the University of Hohenheim: http://www.concert-band.de/
First and second bestselling book in German: http://www.php-buch.de/




Hi all

I use sessions the authenticate users, but I seem to have a problem.
This is what happens:

1) A user logs in on PC one with his username and password. (So far so good)
2) Another user logs in with his details on the same computer --> He is
logged in with his details but the page displayed is the one of the other
user unless he refreshes the page.

I thought this was because the page might be cached, but when I set the
header("cache-control: no-cache") & the meta tag http-equiv="Expires"
content="-1" it still produces the same effect.
How can I solve this problem?

Haemelinck Steve

Personal:
Haemelinck.be - Developers Unite :)
Junior WebDeveloper
http://www.haemelinck.be:8080/
[EMAIL PROTECTED]

Work:
MCT IT Consulting - Take consulting 2 the next level
Junior IT Consultant
http://www.mct.be/
[EMAIL PROTECTED]



Haemelinck Steve

Personal:
Haemelinck.be - Developers Unite :)
Junior WebDeveloper
http://www.haemelinck.be:8080/
[EMAIL PROTECTED]

Work:
MCT IT Consulting - Take consulting 2 the next level
Junior IT Consultant
http://www.mct.be/
[EMAIL PROTECTED]






How about something like.

'start_page.php'
Some HTML...
<A HREF="index.php?action=displayScreen1">display screen 1</A>
<A HREF="index.php?action=displayScreen2">display screen 2</A>
More HTML...

'index.php'
<?php
Some Code....
switch($action)
{
  case "displayScreen1":
  {
     include_once "displayScreen1.php";
     break;
  }
  case "displayScreen2":
  {
     include_once "displayScreen2.php";
     break;
  }
  default:
  {
     include_once "start_page.php";
     break;
  }
}
Some More Code....
?>




-----Original Message-----
From: Ben Quinn [mailto:[EMAIL PROTECTED]]
Sent: 28 April 2001 11:57
To: [EMAIL PROTECTED]
Subject: [PHP] Links


Hi all,

I've been trying for many hours to find information on this, but not having
much luck.  What i want to do is have an index.php page, and then each link
on that page has a URL like index.php?linkid    ie.  index.php?links  etc

Can anyone point me in the right direction?




-- 
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]




Hi!
I'm writting a PHP script which has to print the IP address of a 
visitor, I'm using the variable $REMOTE_ADDR. I've seen it working on 
other servers, but for me it doesn't work, if I visit the script I 
allways get ip 127.0.0.1 and localhost as a name. The script is on a 
webserver, not on my PC. Thanxalot,
Greetings,
                         Johannes Rumpf





Hi!
I wanted to get a txt files in a dircetory, I wrote the script using 
opendir and readdir functions. But now I would like to sort the files 
while I read them in. how could I solve this problem?
Greetings,
                      Johannes Rumpf





Read them into an array then sort the array.


while more files
{
  get file name
  $arrFilenames[] = $filename;
  $arrFilenames = array_sort($arrFilenames);
}

The above sorts the array each time a file is read as you requested, 
however its more efficient to read them all in then sort

while more files
{
   get file name
   $arrFilenames[] = $filename;
}

$arrFilenames = array_sort($arrFilenames);

-Stewart;
 

-----Original Message-----
From: Johannes Rumpf [mailto:[EMAIL PROTECTED]]
Sent: 28 April 2001 13:43
To: [EMAIL PROTECTED]
Subject: [PHP] sorting filenames using opendir and readdir


Hi!
I wanted to get a txt files in a dircetory, I wrote the script using 
opendir and readdir functions. But now I would like to sort the files 
while I read them in. how could I solve this problem?
Greetings,
                      Johannes Rumpf


-- 
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]




Do u have to resart ur comp after you change ur PHP.INI




Not with Linux, in my experience at least.

- Kath

----- Original Message -----
From: "Manesh" <[EMAIL PROTECTED]>
To: "Taylor, Stewart" <[EMAIL PROTECTED]>; "'Johannes
Rumpf'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, April 28, 2001 8:56 AM
Subject: [PHP] PHP.INI


> Do u have to resart ur comp after you change ur PHP.INI
>
> --
> 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]
>





Computer?

wow!

no, just restart your apache (whatever system you use)


Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com




-----Original Message-----
From: Manesh [mailto:[EMAIL PROTECTED]]
Sent: Saturday, April 28, 2001 9:56 PM
To: Taylor, Stewart; 'Johannes Rumpf'; [EMAIL PROTECTED]
Subject: [PHP] PHP.INI


Do u have to resart ur comp after you change ur PHP.INI

-- 
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]






can someone gimme step by step direction on setting up a STMP server? i have
IIS5




Can anyone tell me if this example would be considered a secure method for
authentication using sessions. The login page is a form to validate the user
and begin the session. The second bit of code is at the top of every page to
authenticate the user. I can't figure out if this is the best way.
Thanks

login page:
---------------------------------------
if($action=="validate"){ // Form submitted so check userid and password
against database
    $query="SELECT memberid,name,lastname from members WHERE userid =
'$userid' and password = '$password'";
    $result=mysql($database,$query);
    $rows=mysql_num_rows($result);
    if ($rows == 0){
        $err_no=100; // bad userid or password
        header("Location:login.php?err_no=$err_no");
        exit();
    }else{ // Input validated issue session id
        $rs=mysql_fetch_array($result);
        $name=$rs["name"];
        $lastnamename=$rs["lastname"];
        $memberid=$rs["memberid"];
        session_register("name");
        session_register("lastname");
        session_register("memberid");
        header("Location:mem_welcome.php");
        exit();
    }
}

if ($err_no==100){
    $login_header="User ID or Password do not match";
}else if ($err_no==200){
    $login_header="Please Log In Again";
}else {
    $login_header="Please Log In";
}
<html>
Print out the login form here
</html


top of page to authenticate user:
----------------------------------------------------
session_register("memberid");
if (!isset($memberid) && !isset($PHPSESSID)){
    $err_no=200;
    header("Location:login.php?err_no=$err_no");
    exit();
}





I suggest reading this:

http://www.newbienetwork.net/sections.php?op=viewarticle&artid=10

Jason Lotito
www.NewbieNetwork.net
<?php print chr(114).chr(116).chr(102).chr(109); ?>


> -----Original Message-----
> From: Manesh [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 27, 2001 8:24 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Database
> 
> 
> How do i make table, just a simple one called  sympoll_auth
> 
> 
> -- 
> 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]
> 
> 




Hello:
    I'm relatively new to php and I want to use Interbase instead of MySQL.
I have found a problem loading the module php_interbase.dll , because it
always shows me an error

Unable to load dynamic library 'c:/php/extensions/php_interbase.dll'

I have modified the extension_dir in the php.ini with foreslashes instead of
backslashes, I have searched over the web, in php.net, in the forums, in the
news, and I have only found questions about this, but any solution. The
question is:

How can I load the php_interbase.dll module in W2K Professional, using IIS
5.0 and the latest version of PHP?

Best Regards.

-------------------------------------------------------------
ebnoud.com, El Boletín No Oficial de Usuarios de Delphi
http://www.ebnoud.com
VCLCrawler.com, your VCL search engine
http://www.vclcrawler.com







I have install my apache_1.3.17 with php-4.0.4 as the following the steps
but I can not make the php active. 

First I have download apache_1.3.17.tar.gz and php-4.0.4.tar.gz to the same directory.
1  gunzip apache_1.3.17.tar.gz
2  tar xvf apache_1.3.17.tar
3  gunzip php-4.0.4.tar.gz
4  tar xvf php-4.0.4.tar
5  cd apache_1.3.17
6  ./configure --prefix=/www
7  cd ../php-4.0.4
8  ./configure --with-mysql --with-apache=../apache_1.3.17 --enable-track-vars
9  make
10 make install
11  cd ../apache_1.3.17
12  ./configure --prefix=/www --active-module=src/modules/php4/libphp4.a
13 make
14  make install
15  cd ../php-4.0.4
16  cp php.ini-dist /usr/local/lib/php3.ini
17  then i have added 
    AddType application/x-httpd-php .php
to my httpd.conf
18  start my apache

the apache works but the php still unactive

pls, do me favor to tell me why 
thanks a lot


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


Xiaoshu Xu
FocusTech Shanghai Office
Phone:(86 21)50541368 Fax:(86 21)50541369
www.focuschina.com
www.Made-in-China.com
[EMAIL PROTECTED]





Hi,

How do you grab variables from a query string in a URL?
I've used this with ASP and it would be done as follows:

firstName = request.querystring("fName")

I've tried different variations of this in my PHP pages but I can't seem to 
get it to work.  I've looked in the PHP manual but can't find any 
information relating to the query string.

Thanks.

Jamie Saunders
Mail: [EMAIL PROTECTED]
Web: http://jamie-s.co.uk






try:
echo $fName;

they are loaded in the page automatically.

or..

loop HTTP_GET_VAR



Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com




-----Original Message-----
From: Jamie Saunders [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 29, 2001 1:00 AM
To: [EMAIL PROTECTED]
Subject: [PHP] grabbing variables from the query string


Hi,

How do you grab variables from a query string in a URL?
I've used this with ASP and it would be done as follows:

firstName = request.querystring("fName")

I've tried different variations of this in my PHP pages but I can't seem to
get it to work.  I've looked in the PHP manual but can't find any
information relating to the query string.

Thanks.

Jamie Saunders
Mail: [EMAIL PROTECTED]
Web: http://jamie-s.co.uk


--
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]






if register_globals setting is on (in php.ini) then $foo will be 
available, otherwise use the predefined variable HTTP_GET_VARS :

  index.php?foo=blah

  print $foo;
  print $HTTP_GET_VARS['foo'];

  
  http://www.php.net/manual/en/language.variables.predefined.php
  http://www.php.net/manual/en/configuration.php#ini.register-globals

btw, you'll note predefined variable QUERY_STRING exists in there too :-)

regards,
philip


On Sat, 28 Apr 2001, Jamie Saunders wrote:

> Hi,
> 
> How do you grab variables from a query string in a URL?
> I've used this with ASP and it would be done as follows:
> 
> firstName = request.querystring("fName")
> 
> I've tried different variations of this in my PHP pages but I can't seem to 
> get it to work.  I've looked in the PHP manual but can't find any 
> information relating to the query string.
> 
> Thanks.
> 
> Jamie Saunders
> Mail: [EMAIL PROTECTED]
> Web: http://jamie-s.co.uk
> 
> 
> -- 
> 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]
> 





I get this kind of error when trying to connect to mysql - 
http://myhost/~myname/baas.php

What migth be the problem? The error exists on all accounts.

PS: Drop a line to my private email as well




Hey,

completely OT i know...

In a few months when I put together for college, I'm considering doing a
dual-boot type system, with some windows OS, and also a unix OS. However, I
don't know that much about any free unix OS' that are out there. The two I
can think of to use would be Solaris and Linux. Can anyone give me some
advice on which to use, and also if possible point me to a site where I can
get information on doing this type of thing?

Chris





Hi,

 I have a form on one page with a text box called 'emailtext'. This gets
passed to a php script that gets info from a database (such as $name,
$email, etc) and mails selected email addresses; my problem is this:

Say, the form passes $emailtext as "Hello $name, how're you?", and this is
passed to mail() in the php form, rather than emailing "Hello Bob, how're
you?" it prints "$name" literally.

Seeing as $name isn't pulled from the database till the php script is it
possible to get it to print the value? or do I have to pull $name from the
database  in the original form? (which'll is going to be a lot more
complicated).

Does this make sense?

Thanks for any help,

    Robert Morrissey






Can you create an SSL connection directly through PHP? I'm trying to
integrate a form with a payment processing center, Authorize.net and I'm
running into a problem.

The documentation for what they call ADC Direct Response requires a secure
socket which I wrongfully assumed to mean posting from a secure page to
their secure server. It seems that the secure socket must be handled
directly from the script and not by the end user submitting a form.

Here's what I received from their tech support.

"The problem is that you can't send an HTML form POST when using Direct
Response.  You must write a script that creates an SSL connection directly
with our server (port 443) and send the information to us through that
connection.  I do not know if this is possible through PHP but usually this
is done with PERL, CGI, or ColdFusion.  If you are not familiar with
creating direct SSL connections and would like to send the transaction
information in an HTML form POST, then you should use the Relay-Response
method instead.  Please refer to the Developer's guide for more information:

https://secure.authorize.net/docs

Thank you for contacting tech support."

Any input or direction greatly appreciated.

Tom

>>.>>.>>>.>>>>>.>>>>>>>>>.>>>>>>>>
Tom Beidler
Orbit Tech Services
805.682.8972 (phone)
805.682.5833 (fax)
[EMAIL PROTECTED]
http://www.orbittechservices.com/
>>.>>.>>>.>>>>>.>>>>>>>>>.>>>>>>>>






Hello all,

I am attempting to write a script which will compress a group of files on my server 
into a zip file, and then set a password on the zip file.  The code below is what I 
have come up with:

<?
        $zipfile = popen("zip -eR /tmp/test.zip tf/*", "w");
        fputs($zipfile, "testpass\n\r");
        fputs($zipfile, "testpass\n\r");
        pclose($zipfile);
        echo("Zip file creation complete.");
?>

Now, the problem is... the script finishes fine, and I get the "Zip file creation 
complete" message in my browser... but when I check /tmp, there is no test.zip file 
there.  Any ideas as to why?

Any help you can offer would be appreciated.

Sincerely,
Shawn Reed
Chief Technology Officer
RBC Incorporated - home of "Remote Backup Center"
[ [EMAIL PROTECTED] / www.remotebackupcenter.com ]





Hi, I wonder if there's a way to get the same result as with call_user_func_array()
on 4.0.1pl2 .
I need to do the following :
 
foreach($formArray as $arrays){
         foreach($arrays as $key => $value){
         call_user_func_array($key, explode (",", $value)");
         //Not working since I have 4.01
         $key(explode (",", $value));
        //This aint working either since explode returns an array, and I need to return
        //a list of vars to call. (different amount of vars each time!)
     }
}
 
Is there another way to do this using a function or something, I cant update since it's
not my own server.
Thanx
Jimmy from Sweden
_________________________________________________
IncrediMail - Email has finally evolved - Click Here




Hi, I wonder if there's a way to get the same result as with
call_user_func_array()
on 4.0.1pl2 .

I need to do the following :

foreach($formArray as $arrays){
         foreach($arrays as $key => $value){
         call_user_func_array($key, explode (",", $value)");
         //Not working since I have 4.01
         $key(explode (",", $value));
        //This aint working either since explode returns an array, and I
need to return a list of vars to call. (different amount of vars each
time!)
     }
}

Is there another way to do this using a function or something, I cant
update since it's not my own server.
Thanx
Jimmy from Sweden






Hi,

I'm submitting a phone number from an HTML form to a PHP page that examines 
it to see if it's an integer:

form.html:

<html>
<form method="get" action="validate.php">
<input type="text" name="phonenumber">
<input type="submit">
</form>

validate.php:

<html>
<?php

$phonenumber = trim($phonenumber);

if (is_int($phonenumber)) {
         echo "Integer";
} else {
         echo "Not Integer";
}

?>

</html>


However, for some reason the script doesn't recognize the number as an 
Integer - why is this and how can I remedy it?


Jamie Saunders
Mail: [EMAIL PROTECTED]
Web: http://jamie-s.co.uk






It's a string, not an integer.  Try using is_numeric() instead.  To see
what type it is, do this :

  echo gettype($phonenumber); // prints string

You may want to strip all non-numbers first, just in case they enter :

  333-333-3333

Something like :

  $phonenumber =  preg_replace('/[^0-9]/','',$phonenumber);

Btw, $string = '3'; // is a string.
     $number = 3;   // is an integer


regards,
philip


On Sat, 28 Apr 2001, Jamie Saunders wrote:

> 
> Hi,
> 
> I'm submitting a phone number from an HTML form to a PHP page that examines 
> it to see if it's an integer:
> 
> form.html:
> 
> <html>
> <form method="get" action="validate.php">
> <input type="text" name="phonenumber">
> <input type="submit">
> </form>
> 
> validate.php:
> 
> <html>
> <?php
> 
> $phonenumber = trim($phonenumber);
> 
> if (is_int($phonenumber)) {
>          echo "Integer";
> } else {
>          echo "Not Integer";
> }
> 
> ?>
> 
> </html>
> 
> 
> However, for some reason the script doesn't recognize the number as an 
> Integer - why is this and how can I remedy it?
> 
> 
> Jamie Saunders
> Mail: [EMAIL PROTECTED]
> Web: http://jamie-s.co.uk
> 
> 
> -- 
> 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]
> 






Hey there!

This is my absolutely first time posting in a newsgroup, so be nice please
; )
I've written a guestbook, and in an attempt to get the newest entries first
I reversed the guestbook-txt-file. Like so:
$tabell = file( "gjestebok.txt" );
$revtab = array_reverse( $tabell );

$antall = count( $revtab );

$i = 0;

if( !( $fil = fopen( "guestbook.txt", "r+" ) ) )
    die();

while( $i < $antall )
{
  fwrite( $fil, "$revtab[$i]" );
  $i++;
}

fclose( $fil );

Now the problem: If I post a message with a line of text, a newline (as in
hitting the return-key), some more text and newlines, these
newline-separated text-lines show before the posting itself after reversing
because they are independent elements in the array.....
How can I fix this????


Mogens




Reply via email to