[PHP] fopen()

2002-09-19 Thread Donahue Ben

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

Ben

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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Encrypting/Decrypting Data

2002-09-19 Thread Evan Nemerson

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

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




On Thursday 19 September 2002 00:54, [-^-!-%- wrote:
 Hello.

 How do you decrypt a data that's encrypted with crypt($data).

 Now, the php documents says crypt() is a one-way crypting function, so
 there is no decrypt() function. I was wondering if someone could shed some
 light on alternative ways to encrypt  decrypt data.

 I've looked at mcrypt_generic and mdecrypt_generic, but am confused by the
 'resource td' parameter. Perhaps, someone can explain that as well.

 Any help is greatly apprciated.

 -john

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

  Web Developement. Database. Hosting. Multimedia.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] fopen()

2002-09-19 Thread Brad Bonkoski

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

-Brad

Donahue Ben wrote:

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

 Ben

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

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] java in php4 on debian testing distribution?

2002-09-19 Thread Monique Y. Herman

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

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

I tried simply using

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

and got the following:

Fatal error: Cannot instantiate non-existent class: java

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

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

Thanks in advance for any insight!

-- monique



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] MUST READ: ALL MySQL Newbies!

2002-09-19 Thread Shane

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

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

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

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

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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] custom user login

2002-09-19 Thread Daniel Negron/KBE

Hi all,

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

basic tutorial on how to make php session logins.

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

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

?

// login.php - performs validation

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

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

 // register some session variables
 session_register(SESSION);

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

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

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

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

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

?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] adding unix account via system command

2002-09-19 Thread tim tom

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

--
tim

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


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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Good OO PHP resources? Open Source APIs?

2002-09-19 Thread Michael Sims

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

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

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

http://pear.php.net

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

http://www.horde.org

You can browse their source code directly from:

http://cvs.horde.org

HTH

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: fopen()

2002-09-19 Thread Jason Morehouse

Yup!

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

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

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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] MySQL errors in newer PHP 4.2.3

2002-09-19 Thread Steven Roussey

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

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

php,sql,query


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] session cookies

2002-09-19 Thread Jeff Bluemel

 Jeff Bluemel wrote:

 I want to force it to use a cookie that points to a transparent SID on
 my system.
 

 Can you elaborate on this? I have no idea what you mean.

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

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

 I've got the following options in my php.ini, but the system doesn't seem
to
 ever use a cookie, and the sessions don't die.  (that's my biggest
concern
 is that the user has to login to the system EVERY time he visits the
site.)
 
 session.use_cookies = 1
 session.use_only_cookies = 1
 session.use_trans_sid = 1
 

 With use_trans_sid set, PHP is going to append the session ID to the URL
 of links, etc., on:

 1) The client's first visit, determined by the fact that the client sent
 no session ID
 2) Any other visit where the client sent a session ID on the URL but not
 in a cookie

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

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

 Happy hacking.

 Chris





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Access MySQL

2002-09-19 Thread Liam MacKenzie

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

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


Thanks a heap!
Liam




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Access MySQL

2002-09-19 Thread Peter Houchin

yeah there is tis called

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

Features

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

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

Requirements

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

Limitations

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


 -Original Message-
 From: Liam MacKenzie [mailto:[EMAIL PROTECTED]]
 Sent: Friday, 20 September 2002 12:07 PM
 To: php
 Subject: [PHP] Access  MySQL


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

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


 Thanks a heap!
 Liam




 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] syntax question - eregi()

2002-09-19 Thread Anthony Ritter

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

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

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

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

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

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

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


Thank you.
Tony Ritter





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Stripping specific tags

2002-09-19 Thread John Holmes

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

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

---John Holmes...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Stripping specific tags

2002-09-19 Thread Justin French

on 20/09/02 1:14 PM, John Holmes ([EMAIL PROTECTED]) wrote:

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

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

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

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


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

$string = striptags2('P class id styleBIBRA href target', $string)

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


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

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

striptags2('bA href[rel] target', $string)
would only allow relative links

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



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


Sorry for getting off topic!!


Regards,

Justin French


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: syntax question - eregi()

2002-09-19 Thread Philip Hallstrom

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

Check the manpage for more...

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

print(pre);
print_r($match);
print(/pre);

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

good luck

On Thu, 19 Sep 2002, Anthony Ritter wrote:

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

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

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

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

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

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

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

 Thank you.
 Tony Ritter





 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Script Modificaton question

2002-09-19 Thread Tom Ray

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

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

TIA!


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Script Modificaton question

2002-09-19 Thread John Holmes

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

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

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

This opens the file and truncates it to zero length.

 $filemessage = a
 

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

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

And then write the first 20 lines of the file.

 }
 fclose( $fd );

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

This would work for you:

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

Adapt to your needs...

---John Holmes...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Script Modificaton question

2002-09-19 Thread Tom Ray

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

John Holmes wrote:

I have a chat script that I downloaded and according to the license I
can modify it as much as I want, and I'm a little stuck on a simple
modification I want to make. When you type in a message it stores in


in
  

a file called text.php and then the chat page does an include call for
the text.php file.  Currently, the writer of this script has it setup


so
  

all new text added is placed at the begining of the file using the


w+
  

command, according to php.net with fopen if I switch the w+ to a+


it
  

shoudl place the new data at the end of the file. However, when I make
this switch,  the data is still being placed at the begining of the
text.php file. I've including the portion of the script that writes to
text.php can someone help me find what I'm not seeing?

$filename = text.php;
$fileAr= file($filename);



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

  

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



This opens the file and truncates it to zero length.

  

$filemessage = a




href=\javascript:launcher('profile.php?username=$username');\B$user
na
  

me/B/a:
;
$filemessage .=font
color=\$fcolor\$chat/fontBR\n;
fputs($fd,$filemessage);



This write the new, formatted message.
 
  

$numLines = 20;
for ($i=0;$i$numLines;$i++) {
fputs($fd,$fileAr[$i]);



And then write the first 20 lines of the file.

  

}
fclose( $fd );



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

This would work for you:

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

Adapt to your needs...

---John Holmes...


  





Re: [PHP] Need some help please.

2002-09-19 Thread Simon Angell

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

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

David Freeman [EMAIL PROTECTED] wrote in message
009901c25fa1$ba8fb9f0$3f0a0a0a@skink">news:009901c25fa1$ba8fb9f0$3f0a0a0a@skink...

   Thats a Nice feaure you have, How do you do that?

 I have a cron event on my server that grabs the relevant page from the
 web site soon after it is updated (around 20 past each hour) using lynx
 -dump url which then pipes the resulting page dump through grep to grab
 just the line of data that includes my town and dumps that output to a
 file.

 The file contains a single line of data that includes all of the
 information I display plus some other stuff on the page that I don't
 use.

 Within my php page I open that small file and load it into an array for
 display on the page.

 Obviously there's some error checking in there for various fail
 conditions and some other stuff too but that's the basics of it.

 I've looked at doing something similar for forecasts but as I don't
 (yet) have a need to display them I haven't got around to it.

 The main advantage of this method is that you're not grabbing the data
 on every page load but, instead, only when the data on the source web
 site can reasonably be expected to have changed.

 delurkAs well as running a business with my wife I work for the BoM
 and have done for about 18 years now/delurk

 CYA, Dave






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: custom user login

2002-09-19 Thread Ivo

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

Do not use glodal $_SESSION declaration in your code.

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

regards

Ivo


Daniel Negron/Kbe [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi all,

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

 basic tutorial on how to make php session logins.

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

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

 ?

 // login.php - performs validation

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

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

  // register some session variables
  session_register(SESSION);

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

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

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

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

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

 ?





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Apache not parsing without .php on url?

2002-09-19 Thread Ivo

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

regards

Ivo


Stefan [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hello,
 I have a new Apache 2.0.40 with PHP 4.2.3 installation on a Solaris x86
box.

 Configered in httpd.conf  with:
 AddType application/x-httpd-php .php
 and
 LoadModule 

 Parsing url´s with  .php works fine, but i can´t figure out why it
 dosen´t
 work if i leave out the .phpextension in the url? This works in my old
 apache 1 installation.!

 The file is named test.php in the abc directory.
 http://my.server.se/abc/test.php; works, but not
 http://my.server.se/abc/test;

 Any tips in what i missed out in configuration or how to fix this would be
 appreciated.

 best regards,
 Stefan






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: MySQL errors in newer PHP 4.2.3

2002-09-19 Thread Zak Greant

Hello Jocelyn and Steven,

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

Cheers!

Zak Greant
PHP QA Team


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] RE: MySQL errors in newer PHP 4.2.3

2002-09-19 Thread Steven Roussey

Hmm, do you use pconnect or connect? 

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

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

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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: MySQL errors in newer PHP 4.2.3

2002-09-19 Thread Jocelyn Fournier

I've always used pconnect.
- Original Message -
From: Steven Roussey [EMAIL PROTECTED]
To: 'Jocelyn Fournier' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Cc: 'Mysql' [EMAIL PROTECTED]
Sent: Friday, September 20, 2002 2:38 AM
Subject: RE: MySQL errors in newer PHP 4.2.3


 Hmm, do you use pconnect or connect?

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

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

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


 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail
[EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




<    1   2