Re: [PHP] instalation problem

2003-03-18 Thread Jason Wong
On Monday 17 March 2003 20:12, Guram Mosashvili wrote:
 Hi List,
 I have problem with instalation of PHP4 on my LINUX APACHE MySQL server.

 when I did:  ./configure --with-apxs=/server/apache/bin/apxs

 I got error message:
 -
 configure error: Sorry I cannot run apxs.Either you need to install Perl or
 you need to pass the absolute path of by using 
 --with-apxs=/absolute/path/to/apxs
 -

 However, Perle I already have in my server...

The second part of the error says you need to give the full path to your apxs 
executable. If you don't know where it is, use:

  find / -name apxs

to find it.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Madness has no purpose.  Or reason.  But it may have a goal.
-- Spock, The Alternative Factor, stardate 3088.7
*/


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



[PHP] Ereg sass

2003-03-18 Thread Liam Gibbs
I'm not sure why, but I can't include a period in my eregi statement:

[A-Za-z0-9_-.]*

For this, I get Warning: ereg() [function.ereg]: REG_ERANGE in 
/home/website/public_html/Functions.inc on line 27

The same goes for [A-Za-z0-9_-\.]*

Anyone know why?


Re: [PHP] Ereg sass

2003-03-18 Thread Hugh Danaher
try two backslashes to escape php special characters
- Original Message -
From: Liam Gibbs [EMAIL PROTECTED]
To: php list [EMAIL PROTECTED]
Sent: Tuesday, March 18, 2003 12:33 AM
Subject: [PHP] Ereg sass


I'm not sure why, but I can't include a period in my eregi statement:

[A-Za-z0-9_-.]*

For this, I get Warning: ereg() [function.ereg]: REG_ERANGE in
/home/website/public_html/Functions.inc on line 27

The same goes for [A-Za-z0-9_-\.]*

Anyone know why?



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



Re: [PHP] Ereg sass

2003-03-18 Thread Liam Gibbs
 try two backslashes to escape php special characters

Tried that with the same result.



 I'm not sure why, but I can't include a period in my eregi statement:
 
 [A-Za-z0-9_-.]*
 
 For this, I get Warning: ereg() [function.ereg]: REG_ERANGE in
 /home/website/public_html/Functions.inc on line 27
 
 The same goes for [A-Za-z0-9_-\.]*
 
 Anyone know why?
 
 
 


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



[PHP] (newbie)textareas ...someone...please help

2003-03-18 Thread Mirco Ellis
Guys I really need your help. How do I restrict users from changing data in
a textarea? I need to display data on a page so that users can edit it and
update the database. With the help of this mailing list I got it going but
now I am running into walls. Some of the data is sensitive and can't be
changed. But the only way I know how to display data
so that it can't be edited directly is in a normal table format or print.
After the specific data has been placed in table format and the rest in
textareas only those in textareas are being used in the mysql query, where I
actually need everything to be used. I have tried declaring global variables
for the variables displayed in table format but this is not working.

I have tried looking for solutions on the net and the php manual but can't
find anything. I know it is there but I am probably staring myself blind at
the solution. If you guys need me to include my code (embarrassing!!) just
let me know.

Your help will be greatly appreciated!

Gratefully
Mirco



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



RE: [PHP] (newbie)textareas ...someone...please help

2003-03-18 Thread Christian Rosentreter


Hi,

use 

input type=hidden name=name value=your sensitve data

for transporting sensitive data. 

regards,
Christian

 -Original Message-
 From: Mirco Ellis [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, March 18, 2003 10:06 AM
 To: Php-General (E-mail)
 Subject: [PHP] (newbie)textareas ...someone...please help
 
 can edit it and
 update the database. 
 now I am running into walls. Some of the data is sensitive 
 and can't be
 changed. But the only way I know how to display data
 so that it can't be edited directly is in a normal table 
 format or print.


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



Re: [PHP] Microsoft access + php

2003-03-18 Thread fLIPIS
I've written a tutorial on my site about this subject. You can find it here:

http://www.flipis.net/tutoriales/php_myaccess.php

It's in spanish, though



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



RE: [PHP] Ereg sass[Scanned]

2003-03-18 Thread Michael Egan
Try

[A-Za-z0-9_\-\.]*

-Original Message-
From: Liam Gibbs [mailto:[EMAIL PROTECTED]
Sent: 18 March 2003 08:52
To: php list
Subject: Re: [PHP] Ereg sass[Scanned]


 try two backslashes to escape php special characters

Tried that with the same result.



 I'm not sure why, but I can't include a period in my eregi statement:
 
 [A-Za-z0-9_-.]*
 
 For this, I get Warning: ereg() [function.ereg]: REG_ERANGE in
 /home/website/public_html/Functions.inc on line 27
 
 The same goes for [A-Za-z0-9_-\.]*
 
 Anyone know why?
 
 
 


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



Re: [PHP] Ereg sass

2003-03-18 Thread Jason k Larson
It's seeing the - as a range identifier, escape it to get the literal hyphen.

How about this:
[a-zA-Z0-9_\-.]*
In my tests, the period didn't need to be escaped with the \.

HTH,
Jason k Larson
Liam Gibbs wrote:
I'm not sure why, but I can't include a period in my eregi statement:

[A-Za-z0-9_-.]*

For this, I get Warning: ereg() [function.ereg]: REG_ERANGE in /home/website/public_html/Functions.inc on line 27

The same goes for [A-Za-z0-9_-\.]*

Anyone know why?



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


Re: [PHP] (newbie)textareas ...someone...please help

2003-03-18 Thread Jason Wong
On Tuesday 18 March 2003 17:24, Christian Rosentreter wrote:
 use

 input type=hidden name=name value=your sensitve data

 for transporting sensitive data.

That is not secure at all. 

  can edit it and
  update the database.
  now I am running into walls. Some of the data is sensitive
  and can't be
  changed. But the only way I know how to display data
  so that it can't be edited directly is in a normal table
  format or print.

For the data that cannot/should not be changed, quite simply do not accept 
that value from the user. Just re-read its value from your own records.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Where it is a duty to worship the sun it is pretty sure to be a crime to
examine the laws of heat.
-- Christopher Morley
*/


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



[PHP] Re: Session problem

2003-03-18 Thread Paonarong Buachaiyo
Do not echo $query or any output before session_start(); or
session_register(xxx); (mean headers)
//echo $query

Or may be you can put ob_start(); before first output and put
ob_end_flush(); after last headers

ob_start();
echo $query
.
.
//your code.
.
.
session_register(ses_level);
ob_end_flush();

Hope this helps!




Shaun [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

 I get the following error when using using the following script to
 authenticate a user. The login form is inside a frameset, is this whats
 causing th eproblem, and is there a way round this?

 Warning: Cannot send session cookie - headers already sent by (output
 started at /home/w/o/workmanagement/public_html/authenticate_user.php:12)
in
 /home/w/o/workmanagement/public_html/authenticate_user.php on line 35

 authenticate_user.php:
 ?php
 require(dbconnect.php);

 // Assume user is not authenticated
 $auth = false;

 // Formulate the query
 $query = SELECT * FROM WMS_User WHERE
   User_Username = '$_POST[username]' AND
   User_Password = '$_POST[password]';

 echo $query;

 // Execute the query and put results in $result
 $result = mysql_query( $query )
   or die ( 'Unable to execute query.' );

 // Get number of rows in $result.
 $num = mysql_numrows( $result );

 if ( $num != 0 ) {

  // A matching row was found - the user is authenticated.
  $auth = true;

  //get the data for the session variables
  $suser_name   = mysql_result($result, 0, User_Name);
  $suser_password = mysql_result($result, 0, User_Password);
  $stype_level   = mysql_result($result, 0, User_Type);

  $ses_name  = $suser_name;
  $ses_pass  = $suser_password;
  $ses_level = $stype_level;

  session_register(ses_name); //this is line 35
  session_register(ses_pass);
  session_register(ses_level);
 }

 //if user isn't authenticated redirect to appropriate page
 if ( ! $auth ) {
 include(login.php);
  exit;
 }

 //if user is authenticated, include the main menu
 else{
  include(home.php);
 }

 //close connection
 mysql_close();
 ?

 Thanks in as=dvance for your help







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



Re: [PHP] Mail

2003-03-18 Thread Chris Hewitt
Stephen wrote:

I am trying to get mail working with my php setup.  I have an exchange
server that I want to send mail to but I get the error
Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to
relay for [EMAIL PROTECTED] in
I have setup SMTP = my server address and sendmail_from to my email address.

It is the email server that is not allowing your computer 
(pittsh.com.au) to connect to send email. Ask the administrator of that 
computer to allow your computer to relay through it. FYI it is correct 
for email servers to only allow needed computers to connect to avoid 
being an open relay for spammers.

HTH
Chris


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


[PHP] base64 to 8bit unsigned int

2003-03-18 Thread Hilmi Hilmiev
Dear All,

I have stream data encrypted BASE64. My problem is that I must decode 
this BASE64 to 8-bit unsigned array and I don't know how :(  Have a 
native possibility in PHP for making this or not? Have a somebody who 
know, where I can find more info for this? Site, pdf, link

10x in advance to all



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


Re: [PHP] base64 to 8bit unsigned int

2003-03-18 Thread Jason k Larson
You mean encoded base64 stream data, right?  Anyway, can you give us an example of the base64 
data?  PHP does have native support to encode/decode base64 data.  However you're losing me with 
the decode to an 8-bit unsigned array request.  This might very well just be the decoded 
base64 value that you then need manipluated into an array, maybe yes?

--
Jason k Larson
Hilmi Hilmiev wrote:
Dear All,

I have stream data encrypted BASE64. My problem is that I must decode 
this BASE64 to 8-bit unsigned array and I don't know how :(  Have a 
native possibility in PHP for making this or not? Have a somebody who 
know, where I can find more info for this? Site, pdf, link

10x in advance to all



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


[PHP] Forced Download Using header()

2003-03-18 Thread Kevin Kaiser
I have a simple php download script that streams a non-web-accessible file
to the browser using this generally accepted method:

 header(Expires: 0);
 header(Cache-Control: private);
 header(Content-Type: application/save);
 header(Content-Length: .filesize($total) );
 header(Content-Disposition: attachment; filename=.$file_Path);
 header(Content-Transfer-Encoding: binary);
 $fh = fopen($total, rb);
 fpassthru($fh);

While it works, this is fairly useless in my situation where files range
from 5mb to over 100mb, because due to fpassthru() or readfile() or whatever
method used to stream the data to the recipient, the 'save as'/'open' dialog
doesn't open until the entire file has been downloaded. This is very
impractical since the user has no clue how much has been downloaded / how
much longer is left, not to mention that on very large files (~75mb) apache
will actually freeze up and become unresponsive to all users (sending cpu
usage to 100%) for nearly 10 minutes or more, assumedly because it is still
reading the file (regardless of whether the 'stop' button has been clicked
or not).

With the last 2 lines commented out (fopen() and fpassthru()), the save-as
dialog opens instantly.. is there any way fopen/fpassthru() could be delayed
until after the user chooses to open or save the file ? How would you guys
go about handling large file downloads while keeping the files themselves
non-web-accessible (aka not a direct link/redirector)?

Any help would be appreciated.
-KevinSync


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



[PHP] Disabling output control when using ob_start

2003-03-18 Thread Michael Heuser
Is there a way to disable the call back function set by ob_start?
I tried:
ob_end_flush();
ob_end_clean();
ob_implicit_flush(true);

Nothing seams to work. I can't detect the call back function and I can't
prevent it either. The call back function is called no matter what!

Michael



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



Re: [PHP] Ereg sass

2003-03-18 Thread Ernest E Vogelsinger
At 10:36 18.03.2003, Jason k Larson said:
[snip]
It's seeing the - as a range identifier, escape it to get the literal hyphen.

How about this:
[a-zA-Z0-9_\-.]*

In my tests, the period didn't need to be escaped with the \.
[snip] 

The period is a regex placeholder for any character. Thus it will match a
period, but also a #, a @, and everything that's not allowed in the planned
regex.

By escaping the period you're changing the meaning from any character to
or a period (in this context) so I believe that's what you want to do.


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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



[PHP] Re: newbie:restricting users to change data in a textarea

2003-03-18 Thread Coert Metz
You can put READONLY in your TEXTAREA tag

Coert Metz

Mirco Ellis wrote:
Hi all,

I have a app that enables the user to call data out of a mysql database into
textareas. They can then edit the data and update the database. There is one
field that I whant to stop them from changing. This field I also use in my
sql query when updating the table,ie. where variable='$variable'. So what I
did was simply this:
tr\n;
print \ttd$variable/td\n;
print /tr\n;
instead of:

print textarea name=variable rows=1
cols=10.stripslashes($row['variable'])./textareabr;
This definately stopped them from editing it but also disabled the mysql
query from working. Can anyone just give me a couple of ideas how I can make
this work.
Thanks
Mirco



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


Re: [PHP] Forced Download Using header()

2003-03-18 Thread Ernest E Vogelsinger
At 11:16 18.03.2003, Kevin Kaiser said:
[snip]
   I have a simple php download script that streams a
 non-web-accessible file
to the browser using this generally accepted method:

 header(Expires: 0);
 header(Cache-Control: private);
 header(Content-Type: application/save);
 header(Content-Length: .filesize($total) );
 header(Content-Disposition: attachment; filename=.$file_Path);
 header(Content-Transfer-Encoding: binary);
 $fh = fopen($total, rb);
 fpassthru($fh);

   While it works, this is fairly useless in my situation where files
 range
from 5mb to over 100mb, because due to fpassthru() or readfile() or whatever
method used to stream the data to the recipient, the 'save as'/'open' dialog
doesn't open until the entire file has been downloaded. This is very
impractical since the user has no clue how much has been downloaded / how
much longer is left, not to mention that on very large files (~75mb) apache
will actually freeze up and become unresponsive to all users (sending cpu
usage to 100%) for nearly 10 minutes or more, assumedly because it is still
reading the file (regardless of whether the 'stop' button has been clicked
or not).

   With the last 2 lines commented out (fopen() and fpassthru()), the
 save-as
dialog opens instantly.. is there any way fopen/fpassthru() could be delayed
until after the user chooses to open or save the file ? How would you guys
go about handling large file downloads while keeping the files themselves
non-web-accessible (aka not a direct link/redirector)?
[snip] 

Disclaimer - this is just an idea, I've never dealt with downloading that
big files.

If apache freezes because the file it's reading is too big to be handled
I'd suggest to try a chunked approach, not using fpassthrough or a single
file read. The reason is that for every system I/O the operating systems
get a chance to switch process context, and to allow cooperative multitasking.

Would go something like that:

define('CHUNKSIZE', 8192);
$fp = fopen($file, 'r') or die (Cannot open $file);

header(Expires: 0);
header(Cache-Control: private);
header(Content-Type: application/save);
header(Content-Length: .filesize($total) );
header(Content-Disposition: attachment; filename=.$file_Path);
header(Content-Transfer-Encoding: binary);
   // --
while ($buffer = fread($fp, CHUNKSIZE)) {
echo $buffer;
}
fclose($fp);

You may need to experiment with the size of the chunks to keep up an
acceptable transfer rate. If you still encounter big holdups for other
processes you might consider using usleep() every 10th chunk or so, but use
your calculator to check how that would extend the overall transmission
time. For example, for a 100MB file, going to usleep for 50 msec after each
9kb chunk would mean that your process will sleep for 1.82 hours (!!) until
the file is delivered...


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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



RE: [PHP] Re: newbie:restricting users to change data in a textarea

2003-03-18 Thread Jon Haworth
Hi Coert,   

  There is one field that I whant to stop them from changing

 You can put READONLY in your TEXTAREA tag

While this would probably keep the honest people honest (assuming it's
supported across all browsers), it won't stop anyone who wants to pollute
the database. What's to stop me making my own version of your form, without
READONLY, and submitting that?

If the OP doesn't want users to change the data in the field, he/she should
either display it so it's non-editable (i.e. in a p, or something), or
simply ignore any changes users make to it.

As a rule of thumb, *never* *ever* trust data that has left your server and
then come back, regardless of whether it's in a readonly textarea, a hidden
field, a cookie, whatever. Good programmers look both ways before crossing
one-way streets.

Cheers
Jon

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



php-general Digest 18 Mar 2003 10:42:23 -0000 Issue 1945

2003-03-18 Thread php-general-digest-help

php-general Digest 18 Mar 2003 10:42:23 - Issue 1945

Topics (messages 140049 through 140100):

Session problem
140049 by: shaun
140052 by: Pete James
140057 by: shaun
140091 by: Paonarong Buachaiyo

One set of php for multiple subdomains
140050 by: Radu Manole

How to break out of nested loops
140051 by: Bix
140053 by: Philip Hallstrom
140054 by: Erik Price
140056 by: Bix
140058 by: Bix

Mail
140055 by: Stephen
140092 by: Chris Hewitt

script conflicts
140059 by: Sebastian

help from experienced devr's
140060 by: Dennis Gearon
140061 by: Ernest E Vogelsinger
140062 by: Dennis Gearon

documentation on pg_escape_string()
140063 by: Dennis Gearon
140064 by: Joe Conway
140067 by: John W. Holmes

A possible problem for PHP 4.3.0+MSession 1.21
140065 by: irenem.ms2.hinet.net

Re: complicated but fun, please help.
140066 by: Daniel McCullough

Re: stripping slashes before insert behaving badly
140068 by: Foong

Isn't it grea...t
140069 by: Bix
140071 by: Richard Whitney
140080 by: Robert Cummings

Only one works
140070 by: LinuxGeek

Searching for a file.
140072 by: Vincent M.

Re: copy ...
140073 by: John Taylor-Johnston

Reading GIF images in Win2k + Apache + PHP
140074 by: Patrick Teague
140077 by: Hugh Danaher

Re: Problem with pointer in result handle
140075 by: Blaine
140078 by: Jason Wong
140079 by: Blaine

Too all who are stuck with PHP/Apache2 under RH8
140076 by: Jason Young

Re: instalation problem
140081 by: Jason Wong

Ereg sass
140082 by: Liam Gibbs
140083 by: Hugh Danaher
140084 by: Liam Gibbs
140089 by: Jason k Larson
140097 by: Ernest E Vogelsinger

(newbie)textareas ...someone...please help
140085 by: Mirco Ellis
140086 by: Christian Rosentreter
140090 by: Jason Wong

Re: Microsoft access + php
140087 by: fLIPIS

Re: Ereg sass[Scanned]
140088 by: Michael Egan

base64 to 8bit unsigned int
140093 by: Hilmi Hilmiev
140094 by: Jason k Larson

Forced Download Using header()
140095 by: Kevin Kaiser
140099 by: Ernest E Vogelsinger

Disabling output control when using ob_start
140096 by: Michael Heuser

Re: newbie:restricting users to change data in a textarea
140098 by: Coert Metz
140100 by: Jon Haworth

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]


--
---BeginMessage---
Hi,

I get the following error when using using the following script to
authenticate a user. The login form is inside a frameset, is this whats
causing th eproblem, and is there a way round this?

Warning: Cannot send session cookie - headers already sent by (output
started at /home/w/o/workmanagement/public_html/authenticate_user.php:12) in
/home/w/o/workmanagement/public_html/authenticate_user.php on line 35

authenticate_user.php:
?php
require(dbconnect.php);

// Assume user is not authenticated
$auth = false;

// Formulate the query
$query = SELECT * FROM WMS_User WHERE
  User_Username = '$_POST[username]' AND
  User_Password = '$_POST[password]';

echo $query;

// Execute the query and put results in $result
$result = mysql_query( $query )
  or die ( 'Unable to execute query.' );

// Get number of rows in $result.
$num = mysql_numrows( $result );

if ( $num != 0 ) {

 // A matching row was found - the user is authenticated.
 $auth = true;

 //get the data for the session variables
 $suser_name   = mysql_result($result, 0, User_Name);
 $suser_password = mysql_result($result, 0, User_Password);
 $stype_level   = mysql_result($result, 0, User_Type);

 $ses_name  = $suser_name;
 $ses_pass  = $suser_password;
 $ses_level = $stype_level;

 session_register(ses_name); //this is line 35
 session_register(ses_pass);
 session_register(ses_level);
}

//if user isn't authenticated redirect to appropriate page
if ( ! $auth ) {
include(login.php);
 exit;
}

//if user is authenticated, include the main menu
else{
 include(home.php);
}

//close connection
mysql_close();
?

Thanks in as=dvance for your help


---End Message---
---BeginMessage---
You need to start the session at the beginning of the script, or use 
output buffering.

Either:
?php
session_start();
require(...
...
or

?php
ob_start();
require(...
...
You're trying to output stuff to the screen (which implicitly sends the 
headers) then trying to send more headers by calling session_register() 
(which implicitly calls session_start() )

HTH.
Pete.
shaun wrote:
Hi,

I get the following error when using using the following 

RE: [PHP] Re: newbie:restricting users to change data in a textar ea

2003-03-18 Thread Ernest E Vogelsinger
At 11:42 18.03.2003, Jon Haworth said:
[snip]
... Good programmers look both ways before crossing
one-way streets.
[snip] 

I like that one. The US administration should have some good programmers
hired then, I believe.


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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



RE: [PHP] Re: newbie:restricting users to change data in a textarea

2003-03-18 Thread Mirco Ellis
Guys thanks for your help on this matter. Luckily this is all I need. It is
on an internal lan and won't be available to the public although it does
raise an interesting discussion. I would have been lost without you blokes.

Thanks a million

Mirco Ellis


-Original Message-
From: Coert Metz [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 18, 2003 12:30
To: [EMAIL PROTECTED]
Subject: [PHP] Re: newbie:restricting users to change data in a textarea


You can put READONLY in your TEXTAREA tag

Coert Metz

Mirco Ellis wrote:
 Hi all,

 I have a app that enables the user to call data out of a mysql database
into
 textareas. They can then edit the data and update the database. There is
one
 field that I whant to stop them from changing. This field I also use in my
 sql query when updating the table,ie. where variable='$variable'. So what
I
 did was simply this:

 tr\n;
 print \ttd$variable/td\n;
 print /tr\n;

 instead of:

 print textarea name=variable rows=1
 cols=10.stripslashes($row['variable'])./textareabr;

 This definately stopped them from editing it but also disabled the mysql
 query from working. Can anyone just give me a couple of ideas how I can
make
 this work.

 Thanks
 Mirco




--
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] querying for values inside range

2003-03-18 Thread Jason Paschal
this is an sql syntax question and i know it's not appropriate for this 
mailing list, but i didn't want to subscribe to another mailing list for 
something i think one of you might be able help me with.  thank you for your 
patience.

i'm building a site utilizing PHP/MySQL.  i'm querying a table to find 
records where a field lies within a certain range.

$age1 = 20;
$age2 = 30;
$sql = select * from table where age=$age1 and age=$age2;
is there another way to write this query?  i'm going to be building the sql 
string programmatically and i was curious about different syntax being able 
to produce the same result in the hopes that it'll help streamline my PHP 
code. for example, what if i don't know which is value is greater, age1 or 
age2?  is there some sql syntax that will deal with this situation without 
me having to determine which is which via PHP?





_
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail

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


Re: [PHP] querying for values inside range

2003-03-18 Thread Wico de Leeuw
At 06:04 18-3-03 -0500, Jason Paschal wrote:
this is an sql syntax question and i know it's not appropriate for this 
mailing list, but i didn't want to subscribe to another mailing list for 
something i think one of you might be able help me with.  thank you for 
your patience.

i'm building a site utilizing PHP/MySQL.  i'm querying a table to find 
records where a field lies within a certain range.

$age1 = 20;
$age2 = 30;
$sql = select * from table where age=$age1 and age=$age2;
select * from table where age between $age1 and $age2;

is there another way to write this query?  i'm going to be building the 
sql string programmatically and i was curious about different syntax being 
able to produce the same result in the hopes that it'll help streamline my 
PHP code. for example, what if i don't know which is value is greater, 
age1 or age2?  is there some sql syntax that will deal with this situation 
without me having to determine which is which via PHP?





_
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail

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


Re: [PHP] querying for values inside range

2003-03-18 Thread Wico de Leeuw
At 06:04 18-3-03 -0500, Jason Paschal wrote:
this is an sql syntax question and i know it's not appropriate for this 
mailing list, but i didn't want to subscribe to another mailing list for 
something i think one of you might be able help me with.  thank you for 
your patience.

i'm building a site utilizing PHP/MySQL.  i'm querying a table to find 
records where a field lies within a certain range.

$age1 = 20;
$age2 = 30;
$sql = select * from table where age=$age1 and age=$age2;
if ($age1 = $age2) {
$sql = select * from table where age between $age1 and $age2;
} else {
$sql = select * from table where age between $age2 and $age1;
}
is there another way to write this query?  i'm going to be building the 
sql string programmatically and i was curious about different syntax being 
able to produce the same result in the hopes that it'll help streamline my 
PHP code. for example, what if i don't know which is value is greater, 
age1 or age2?  is there some sql syntax that will deal with this situation 
without me having to determine which is which via PHP?





_
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail

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


RE: [PHP] querying for values inside range

2003-03-18 Thread Jon Haworth
Hi Jason,

 $sql = select * from table where age=$age1 and age=$age2;
 what if i don't know which is value is greater, age1 or age2?  

PHP has a couple of handy functions for this: min() and max()

$min = min($age1, $age2); // get smallest of two values
$max = max($age1, $age2); // get largest of two values
$sql = select * from table where age = $min and age = $max;

You could also use BETWEEN in your query, which I think reads better:
$sql = select * from table where age between $min and $max;

This isn't connected to your question, but have a look at this when you have
a spare 5 minutes:
http://adopenstatic.com/faq/selectstarisbad.asp

Cheers
Jon

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



Re: [PHP] register_variables

2003-03-18 Thread Cranky Kong
The problem must certainly come from the register_global turn to off
Check this value in your php.ini file


Samug [EMAIL PROTECTED] a écrit dans le message de news:
[EMAIL PROTECTED]
 No it's not.
 It's a script called LinksCaffe
 http://www.hotscripts.com/cgi-bin/dload.cgi?ID=15062.
 In file catadd.php


 Leif K-Brooks [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Is it inside of a function?
 
  samug wrote:
 
  I'm trying to run a script which uses variables passed via a form, like
  this:
  
  if($lcat_name)
  {
  $sql_query = INSERT into category VALUES ('','$lcat_name');
  $result = mysql_query($sql_query);
  echo You add next categoryfont color=greenb
$lcat_name/b/font;
  }
  
  but the variable $lcat_name is empty unless I do this:
  $lcat_name = $_REQUEST['lcat_name'];
  
  Why?
  
  I have the variable register_globals on.
  
  
  
  
  
  
 
  --
  The above message is encrypted with double rot13 encoding.  Any
 unauthorized attempt to decrypt it will be prosecuted to the full extent
of
 the law.
 
 
 





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



Re: [PHP] Ereg sass

2003-03-18 Thread CPT John W. Holmes
If you want to look for a dash (-), you always place it last in the
brackets, other wise the regex machine will be looking for a range. So just
move the - to the last character.

[A-Za-z0-9_.-]*

---John Holmes...

- Original Message -
From: Liam Gibbs [EMAIL PROTECTED]
To: php list [EMAIL PROTECTED]
Sent: Tuesday, March 18, 2003 3:33 AM
Subject: [PHP] Ereg sass


I'm not sure why, but I can't include a period in my eregi statement:

[A-Za-z0-9_-.]*

For this, I get Warning: ereg() [function.ereg]: REG_ERANGE in
/home/website/public_html/Functions.inc on line 27

The same goes for [A-Za-z0-9_-\.]*

Anyone know why?


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



[PHP] Random array values from associative

2003-03-18 Thread Awlad Hussain
I have an associative like array[name]=hello;
I am trying to get two random values from the array, the key name and the value, but 
using the codes below from the PHP manual i am getting the inex key value rather than 
the name.

$rand_keys = array_rand ($input, 2);
print $input[$rand_keys[0]].\n;
print $input[$rand_keys[1]].\n;

so instead of getting two random values like key=name  value=hello i am getting 
key=0 and value=hello.

How do i get the name of the key not the index number?

Thanks in advance

-awlad

Re: [PHP] Random array values from associative

2003-03-18 Thread Ernest E Vogelsinger
At 12:40 18.03.2003, Awlad Hussain said:
[snip]
I have an associative like array[name]=hello;
I am trying to get two random values from the array, the key name and the 
value, but using the codes below from the PHP manual i am getting the inex 
key value rather than the name.

$rand_keys = array_rand ($input, 2);
print $input[$rand_keys[0]].\n;
print $input[$rand_keys[1]].\n;

so instead of getting two random values like key=name  value=hello i am 
getting key=0 and value=hello.
[snip] 

array_rand only operates on the value side of an array. To retrieve
random keys from an associative array, use array_keys() of the assoc. array
as input rather that the assoc. array itself:

$rand_keys = array_rand (array_keys($input), 2);
print $input[$rand_keys[0]].\n;
print $input[$rand_keys[1]].\n;



-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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



Re: [PHP] Random array values from associative

2003-03-18 Thread Awlad Hussain
Thanks for your reply, I now have only the keys but I need both keys and the
value.

??
any suggestions?

- Original Message -
From: Ernest E Vogelsinger [EMAIL PROTECTED]
To: Awlad Hussain [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, March 18, 2003 11:45 AM
Subject: Re: [PHP] Random array values from associative


 At 12:40 18.03.2003, Awlad Hussain said:
 [snip]
 I have an associative like array[name]=hello;
 I am trying to get two random values from the array, the key name and the
 value, but using the codes below from the PHP manual i am getting the
inex
 key value rather than the name.
 
 $rand_keys = array_rand ($input, 2);
 print $input[$rand_keys[0]].\n;
 print $input[$rand_keys[1]].\n;
 
 so instead of getting two random values like key=name  value=hello i
am
 getting key=0 and value=hello.
 [snip]

 array_rand only operates on the value side of an array. To retrieve
 random keys from an associative array, use array_keys() of the assoc.
array
 as input rather that the assoc. array itself:

 $rand_keys = array_rand (array_keys($input), 2);
 print $input[$rand_keys[0]].\n;
 print $input[$rand_keys[1]].\n;



 --
O Ernest E. Vogelsinger
(\)ICQ #13394035
 ^ http://www.vogelsinger.at/



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



Re: [PHP] Random array values from associative

2003-03-18 Thread Ernest E Vogelsinger
At 12:48 18.03.2003, Awlad Hussain said:
[snip]
Thanks for your reply, I now have only the keys but I need both keys and the
value.
[snip] 

But you can get the value if you have the keys, no?


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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



RE: [PHP] Loop Problem

2003-03-18 Thread Sysadmin
Yes, my apologies.  I call the script by scriptname.php?MasterPage=1 or 
2 or whatever...

-Original Message-
From: Erik Price [mailto:[EMAIL PROTECTED]
Sent: Monday, March 17, 2003 4:45 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Loop Problem




[EMAIL PROTECTED] wrote:
 Ok, here's what I got.  I'm trying to create an entire site that 
grabs 
 all it's information (Page content, titles, link info, etc.) from a 
 MySQL database.  In this site I would like to have sub pages of 
master 
 pages.  For instance, Page 1 is a master page, Page 2 is a sub page 
of 
 Page 1, and Page 3 is a sub page of Page 2 which is a sub page of 
page 
 one.  Now I would like to display this entire hierarchy if possible.  
 Here's what I have but either I get an infinite loop or it doesn't 
work 
 worth a damn
 
 ?
 mysql_connect(127.0.0.1,webuser,);
 $query=SELECT * FROM PageInfo WHERE PageID'0' and 
PageID=$MasterPage 
 ORDER BY PageID;

I might be mistaken, but it looks like $MasterPage hasn't been defined 
at this point.  This should be giving you an error.  ($MasterPage gets 
defined later, but...)  If you have your error-reporting turned off, it 
might not throw the error, so you are getting all the way to your DB. 
Try turning your error-reporting up and seeing if this causes you 
problems.

The other thing is I don't understand your query -- why are you 
selecting where PageID is greater than something and at the same time 
where it is equal to something else?  That is redundant.  Finally, in 
your query, remove the single quotes around the 0.  You don't need 
them, 
and it may be asking MySQL to treat the 0 as a character or string 
rather than an integer (and the column type is an integer).  I'm not 
really definite on that last one though (more talking out the butt, I 
suppose).



Erik


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



[PHP] Which CMS (if any) should I use for my application.

2003-03-18 Thread JawjB
I have spent 3 days looking at various CMS and template systems and seem to 
be getting nowhere.

I have looked at smarty, webditpro, phpcms, typo3, phportal, sitemanager, 
phpnuke, easysite and many others and clever and comprehensive as many of 
them are they seem too complicated for my needs.

I am not sure if I am missing the point of these programs and would 
appreciate if anyone thinks they can accomplish what I require.

As an example I want to offer customised web pages to say 'Car dealers'.

I want to offer a top,side and body frame and lead them through the creation 
step by step.
Step 1. Offer the top frame with color picker for background, or background 
image then allow addition of text for dealer name address etc.
Setp 2. Offer a selection of side bar buttons and styles. Most buttons will 
be similar such as 'Abourt Us', 'Contact', 'Car search' ,Car list', 
'Location' ,'Links' etc with some having pre defined actions ('search') and 
some where they can modify content. 
Step 3. Allow modification of content of the body pages using a WYSIWYG 
editor such as editise or htmlarea.

So no HTML knowledge to be needed, only uploads will be images to be used.

The main objects are
1. Simple to use with no support required.
2. Simple to use with no support required.
3. Simple to use with no support required.


I could put together what I outlined above quite easily in a few days but as 
with all projects things never quite stop where you intended.

No doubt users will then ask for different templates, exploding type menu 
lists, calendars, flash etc.

So basically I want a system which I can configure to my needs and know that 
added functionality is there when needed and I don't want to learn a whole 
new language.

Should I just do this myself ?

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



Re: [PHP] One set of php for multiple subdomains

2003-03-18 Thread David T-G
Radu --

...and then Radu Manole said...
% 
% Hi guys,

Hi!


% 
% I have 2 scripts located in a directory and 3 dirs with 3 subdomain.
% Something like this.
% 
% /scripts
% - input.php
% - output.php

OK...


% 
% /user1  - subdomain user1.mysite.com
% /user2  - subdomain user2.mysite.com
% /user3  - subdomain user3.mysite.com

Also OK...


% 
% What can I do to execute the input.php script from any subdomain and get
% output.php (response) in the same subdomain?
% Do I need to copy the scripts directory in each subdomain dir?

In order to call the script like

  http://user1.mysite.com/input.php

you'll have to have input.php under that site's DOCUMENT_ROOT directory.
You could do this with a symbolic link or you could just have a simple
wrapper

  $ cd /user1
  $ cat input.php
  ?php include(/scripts/input.php) ; ?

and then put all of the meat in the /scripts dir.  We do this on our
server where we have about 80 sites that use our web gallery software and
all of our clients get the new version when we publish it to our central
location.  Meanwhile, we can point test sites elsewhere (eg /scripts/test
containing input.php and output.php) just by updating that little wrapper
in a jiffy.

Once you're in your input.php script, you can also include any other
script or file.  I don't know just what you mean about executing the
input script ... and getting the output script, since usually one runs
the script and the script generates the output.  Let us know if you have
more questions, though, and we'll try to help :-)


% 
% many thanks,
% Radu


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] script conflicts

2003-03-18 Thread Marek Kilimajer
I can't see mysql_fetch_row() function anywhere in your code.

Sebastian wrote:

i have two scripts included into one page, one of them i have been running
for a long time .. i recently made another script and when i include it into
the same page the other script returns this error:
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result
resource in /home/public_html/file.php on line 59
This is part of the sql query that conflicts with the other, any ideas? it
only happens when this snippet is included in the same page that the other
is included into.
function load() {

 mysql_connect($hostname,$username,$password) or die ( Could not connet to
MySQL );
 mysql_select_db($database) or die ( Could not connect to database );
// Delete
$sql = DELETE FROM $table WHERE time   . (time()-$duration);
   $result = @mysql_query($sql) or die (Error: . mysql_error() );
   // Insert
   $sql = INSERT INTO $table (time) VALUES ( . time() . ) ;
   $result = @mysql_query($sql) or die (Error: . mysql_error() );
// Get count
$sql = SELECT time FROM $table;

   $result = @mysql_query($sql) or die (Error: . mysql_error() );

   return mysql_num_rows ($result);

}



TIA.

 



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


[PHP] storing files in database

2003-03-18 Thread Michiel van Heusden
is there any possibility using PHP 4 to store entire files as a database
field in a MySQL database?
and if so, does anybody know a way, or a tutorial describing this?

thanks
michiel



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



[PHP] what's the best way to handle this?

2003-03-18 Thread Edward Peloke
Ok, I hope this makes sense,

When a user 'registers' with our site, I want to generate their personal
webpage for them.  Currently, I have a webpage where the contents are
generated from their personal info in the db and I have a drop down to view
client pages but it is just the same page but I pass in the clientid so it
will display their data.  This is fine but I want the users to be able to
tell others..Visit my home page at www.eddiessite.com/Johnny  or something
like that...I don't want them to have to say visit my page
www.eddissite/client_pages?clientid=43  does that make sense?  Should I just
generate a folder for them with an index page that redirects then to the
clientpage with their id?

Eddie


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



[PHP] User Authentication

2003-03-18 Thread shaun
Hi,

Using the following code I am able to authenticate which type of user is
visiting my page, however if I try to log in again with a different type of
user the session variables still assume that the original user was logged
in, is there a way to reset the session variables, I have tried
session_destroy() and session_unset() but without success...

?php
require(dbconnect.php);

// Assume user is not authenticated
$auth = false;

// Formulate the query
$query = SELECT * FROM WMS_User WHERE
  User_Username = '$_POST[username]' AND
  User_Password = '$_POST[password]';

// Execute the query and put results in $result
$result = mysql_query( $query )
  or die ( 'Unable to execute query.' );

// Get number of rows in $result.
$num = mysql_numrows( $result );

if ( $num != 0 ) {

 // A matching row was found - the user is authenticated.
 $auth = true;

 //get the data for the session variables
 $suser_name   = mysql_result($result, 0, User_Name);
 $suser_password = mysql_result($result, 0, User_Password);
 $stype_level   = mysql_result($result, 0, User_Type);

 $ses_name  = $suser_name;
 $ses_pass  = $suser_password;
 $ses_level = $stype_level;

 session_register(ses_name);
 session_register(ses_pass);
 session_register(ses_level);
}

//if user isn't authenticated redirect to appropriate page
if ( ! $auth ) {
include(index.php);
 exit;
}

//if user is authenticated, include the main menu
else{
 include(home.php);
}

//close connection
mysql_close();
?

thanks for your help



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



[PHP] Re: Which CMS (if any) should I use for my application.

2003-03-18 Thread rush
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
 Should I just do this myself ?

I do not think you will find something allready done, so probably you would
need to wrap something yourself. Some template system will propably come
handy though

rush
--
http://www.templatetamer.com/




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



Re: [PHP] One set of php for multiple subdomains

2003-03-18 Thread Ernest E Vogelsinger
At 23:43 17.03.2003, Radu Manole said:
[snip]
Hi guys,

I have 2 scripts located in a directory and 3 dirs with 3 subdomain.
Something like this.

/scripts
- input.php
- output.php

/user1  - subdomain user1.mysite.com
/user2  - subdomain user2.mysite.com
/user3  - subdomain user3.mysite.com

What can I do to execute the input.php script from any subdomain and get
output.php (response) in the same subdomain?
Do I need to copy the scripts directory in each subdomain dir?
[snip] 

If you're on *nix you can simply create symbolic links to the directory:

ln -s /scripts /user1/scripts
ln -s /scripts /user2/scripts
ln -s /scripts /user3/scripts

Now all 3 user directory will contain a symbolic link to the /scripts
directory, within their domain tree.


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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



Re: [PHP] what's the best way to handle this?

2003-03-18 Thread Ernest E Vogelsinger
At 14:38 18.03.2003, Edward Peloke said:
[snip]
When a user 'registers' with our site, I want to generate their personal
webpage for them.  Currently, I have a webpage where the contents are
generated from their personal info in the db and I have a drop down to view
client pages but it is just the same page but I pass in the clientid so it
will display their data.  This is fine but I want the users to be able to
tell others..Visit my home page at www.eddiessite.com/Johnny  or something
like that...I don't want them to have to say visit my page
www.eddissite/client_pages?clientid=43  does that make sense?  Should I just
generate a folder for them with an index page that redirects then to the
clientpage with their id?
[snip] 

You could either use Apache's mod_rewrite to rewrite the URL, or use an
ErrorDocument handler to deliver the correct page.


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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



Re: [PHP] Performance and Function Calls

2003-03-18 Thread Noah
Thanks Jason.

I was hoping that was what was happening.

Happy php'ing

--Noah


- Original Message -
From: Jason Sheets [EMAIL PROTECTED]
To: Don Read [EMAIL PROTECTED]
Cc: CF High [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Saturday, March 15, 2003 8:46 PM
Subject: RE: [PHP] Performance and Function Calls


 Storing the results of a function in a variable and referencing the
 variable will almost always be faster, this should be no surprise
 because instead of executing the function PHP just has to return the
 variable's value.

 In #1 since you only call the function once the function is only
 executed once, in a loop it is executed once for each loop iteration.

 Jason

 On Sat, 2003-03-15 at 21:25, Don Read wrote:
  On 15-Mar-2003 CF High wrote:
   Hey all.
  
   Quick question:
  
   If I have a function that, say, prints out the months in a year, and I
   call
   that function within a 10 cycle loop, which of the following is
faster:
  
   1) Have function months() return months as a string; set var
   string_months = months() outside of the loop; then echo string_months
   within
   the loop
  
   -- OR
  
   2) Just call months() for each iteration through the loop
  
   I'm not sure how PHP interprets option number 1.
  
   Guidance for the clueless much appreciated...
  
 
  Easy enuff to test:
 
  ?php
 
  function getmicrotime(){
  list($usec, $sec) = explode( ,microtime());
  return ((float)$usec + (float)$sec);
  }
 
  $time_start = getmicrotime();
  for ($m=1; $m 11; $m++) {
  echo date('F', strtotime(2003-$m-1)), 'br';
  }
  echo 'PA: ', getmicrotime() - $time_start , 'P';
 
  $time_start = getmicrotime();
  for ($m=1; $m 11; $m++) {
  $str[]=date('F', strtotime(2003-$m-1));
  }
  echo implode('br',$str);
  echo 'PB: ', getmicrotime() - $time_start , 'P';
 
  unset($str);
  $time_start = getmicrotime();
  for ($m=1; $m 11; $m++) {
  $str[]=date('F', strtotime(2003-$m-1));
  }
 
  while (list(,$v)= each($str)) {
  echo $v, 'br';
  }
  echo 'PC: ', getmicrotime() - $time_start , 'P';
 
  ?
 
  On my machine I get numbers like:
  A: 0.000907063484192
  B: 0.000651001930237
  C: 0.000686049461365
 
  The function call within the loop is slower (contrary to what I
  expected), the real question is how much effort do you want to expend to
  save 2-3 micro-seconds?
 
  Regards,
  --
  Don Read   [EMAIL PROTECTED]
  -- It's always darkest before the dawn. So if you are going to
 steal the neighbor's newspaper, that's the time to do it.
 --
 Jason Sheets [EMAIL PROTECTED]



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



RE: [PHP] what's the best way to handle this?

2003-03-18 Thread Edward Peloke
thanks, not sure how to do either of these...but I will look them up.

-Original Message-
From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 18, 2003 9:14 AM
To: Edward Peloke
Cc: [EMAIL PROTECTED] Php. Net
Subject: Re: [PHP] what's the best way to handle this?


At 14:38 18.03.2003, Edward Peloke said:
[snip]
When a user 'registers' with our site, I want to generate their personal
webpage for them.  Currently, I have a webpage where the contents are
generated from their personal info in the db and I have a drop down to view
client pages but it is just the same page but I pass in the clientid so it
will display their data.  This is fine but I want the users to be able to
tell others..Visit my home page at www.eddiessite.com/Johnny  or something
like that...I don't want them to have to say visit my page
www.eddissite/client_pages?clientid=43  does that make sense?  Should I
just
generate a folder for them with an index page that redirects then to the
clientpage with their id?
[snip]

You could either use Apache's mod_rewrite to rewrite the URL, or use an
ErrorDocument handler to deliver the correct page.


--
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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



[PHP] Mailing List Digest

2003-03-18 Thread Tom Sommer
What does the mailing list digest contain, compared to a normal 
subscription? What is the difference?

-- 
Tom Sommer, Denmark
www.tsn.dk - www.dreamcoder.dk

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



Re: [PHP] what's the best way to handle this?

2003-03-18 Thread Chris Hayes
At 14:38 18-3-03, you wrote:
Ok, I hope this makes sense,

When a user 'registers' with our site, I want to generate their personal
webpage for them.  Currently, I have a webpage where the contents are
generated from their personal info in the db and I have a drop down to view
client pages but it is just the same page but I pass in the clientid so it
will display their data.  This is fine but I want the users to be able to
tell others..Visit my home page at www.eddiessite.com/Johnny  or something
like that...I don't want them to have to say visit my page
www.eddissite/client_pages?clientid=43  does that make sense?  Should I just
generate a folder for them with an index page that redirects then to the
clientpage with their id?
wow wouldn't that create a huge directory structure!

this is the way i did it, to be able to make all sorts of fake urls, from 
/page/33 to /person/3 or person/jones or even /jones if you want.
You need a server that is setup to read .htaccess files.

In the .htaccess file for your site, you write
---
 ErrorDocument 404 /subdirectories/to/redirect.php
---
This way all the urls that would normally be led to a 404 warning page, are 
now first led to a php file. It is VITAL to not use the complete URL but 
only the part after www.domain.org, otherwise you loose all existing form 
and url information.

In redirect.php you check your url and split it up. You can do this any way 
you like. I'll show some usefull examples:

---
?PHP
$basis='http://www.sense.nl/';   //my base url to build the links on.
global $_SERVER;
$path=trim($_SERVER[REQUEST_URI]);
$path_bits=explode('/',$path);
switch (strtolower($path_bits[1]))
{
case 'educationworkshop':
Header(Location: 
.$basis.index.php?module=ContentExpressfunc=displayceid=15);
break;

case 'news':
Header(Location: 
.$basis.modules.php?op=modloadname=Newsfile=articlemode=nestedorder=0thold=0sid=.trim($path_bits[2]) 
);
break;

case 'research':
case 'researcher':
case 'researchers':
case 'researchguide':
case 'research_guide':
Header(Location: 
.$basis.redirect/research.php?.trim($path_bits[2]) );
break;

default:
Header(Location: .$basis.redirect/404.html);
}

?
---
As you can see i simply split up the url on the slashes.
Some words, for example  'educationworkshop', lead to a fixed page. I have 
a whole bunch of these, very useful. Leads to: 
http://www.domain.org/educatiionworkshop

'news' expects an extra value like http://www.xx.org/news/11, then leads 
directly to the long url.

'research' and a couple of lookalike words are forwarded with the extra 
data to another PHP file specialized in selecting the descriptions, just as 
you want.

in research.php i then look:
 is the extra data a number ? then go to the url.'ID='.$thenumber
 is it a word or phrase? then do a query to find the right number
The last one is the one you could use. For instance if it finds
http://www.domain.org/research/jones,
 a query is made that looks up Joneses. If there is only one Jones, get 
the ID number and show the Jones directly.
If not, show a list of Joneses with links made with their respective ID 
numbers.

Chris







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


Re: [PHP] storing files in database

2003-03-18 Thread Jason Wong
On Tuesday 18 March 2003 21:25, Michiel van Heusden wrote:
 is there any possibility using PHP 4 to store entire files as a database
 field in a MySQL database?
 and if so, does anybody know a way, or a tutorial describing this?

google  mysql store files

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Mediocrity finds safety in standardization.
-- Frederick Crane
*/


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



Re: [PHP] what's the best way to handle this?

2003-03-18 Thread Chris Hayes
I forgot to mention, you may need to finetune this: not every server gives 
exactly the same $SERVER values.

When default is reached, the url is really wrong and you give them a nice 
scowling in the 404.html file.
(A nice suggestion: HEY You dumb pi3ce of sh1t3! Learn to 
type! Or do not bother to ever come here again. You are WASTING 
my bandwith!)

default:
Header(Location: .$basis.redirect/404.html);


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


[PHP] MySQL Users Conference

2003-03-18 Thread Bill Doerrfeld
Do you plan on attending the first MySQL Users Conference to be held 
next month in San Jose, Calif?

Our company is one of the sponsors for this event and we very much 
look forward to meeting many of you.

If you haven't already registered for this important event, we 
strongly encourage you to do so. Check out the following link for a 
special discount on conference passes 
https://order.mysql.com/?sub=pgpg_no=14ref=blw7 .

There will be a wealth of information presented at this event and it 
will be a great opportunity to network and learn from many of the 
leading minds in the MySQL community.

Of course, this is an official MySQL event hosted by MySQL AB and 
many of the employees of MySQL AB will be on hand.

Look forward to meeting many of you next month in San Jose.

Best,

Bill
--
-
Bill Doerrfeld[EMAIL PROTECTED]
Blue World Communications, Inc.   http://www.blueworld.com/
-
 Build and serve powerful data-driven Web sites
  with Lasso Studio and Lasso Professional.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Calling function in php page via GET?

2003-03-18 Thread Daniel Joyce
I have a file that draws charts, called chart.php.

Right now, I can call it using GET methods inside IMG tags

IMG src=chart.php?foo=bar

Well, I'd like to be able to wrap it in a function, and call it via a 
function

drawgraph();

and by GET syntax

IMG src=chart.php.drawgraph?foo==bar ??

Is there a way to call a FUNCTION/METHOD in a php file using URLS?

-Daniel

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


Re: [PHP] complicated but fun, please help.

2003-03-18 Thread Erik Price


Daniel McCullough wrote:
Yes sorry for not being clear.   I am trying to use exec() and system().
I guess I'm trying to see if there is another way to do it, like write 
to a file and have acron job run every minute or so, or if there is some 
way to make it seem like I am doing this with the right permissions.
That sounds like a good plan.



Erik

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


[PHP] Re: Which CMS (if any) should I use for my application.

2003-03-18 Thread Alexandru COSTIN
Hello,
We have a free but still complicated solution for your needs.

It's called Komplete Lite (the free version of one of our commercial
products) and it allows you to visually edit your menu and page content.

See the demo of the full version at http://komplete.interakt.ro/

The Lite version is due for release this weekend.

Alexandru

--
Alexandru COSTIN
Chief Operating Officer
http://www.interakt.ro/
+4021 411 2610
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
 I have spent 3 days looking at various CMS and template systems and seem
to
 be getting nowhere.

 I have looked at smarty, webditpro, phpcms, typo3, phportal, sitemanager,
 phpnuke, easysite and many others and clever and comprehensive as many of
 them are they seem too complicated for my needs.

 I am not sure if I am missing the point of these programs and would
 appreciate if anyone thinks they can accomplish what I require.

 As an example I want to offer customised web pages to say 'Car dealers'.

 I want to offer a top,side and body frame and lead them through the
creation
 step by step.
 Step 1. Offer the top frame with color picker for background, or
background
 image then allow addition of text for dealer name address etc.
 Setp 2. Offer a selection of side bar buttons and styles. Most buttons
will
 be similar such as 'Abourt Us', 'Contact', 'Car search' ,Car list',
 'Location' ,'Links' etc with some having pre defined actions ('search')
and
 some where they can modify content.
 Step 3. Allow modification of content of the body pages using a WYSIWYG
 editor such as editise or htmlarea.

 So no HTML knowledge to be needed, only uploads will be images to be used.

 The main objects are
 1. Simple to use with no support required.
 2. Simple to use with no support required.
 3. Simple to use with no support required.


 I could put together what I outlined above quite easily in a few days but
as
 with all projects things never quite stop where you intended.

 No doubt users will then ask for different templates, exploding type menu
 lists, calendars, flash etc.

 So basically I want a system which I can configure to my needs and know
that
 added functionality is there when needed and I don't want to learn a whole
 new language.

 Should I just do this myself ?



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



[PHP] Question about a text file and foreach

2003-03-18 Thread Jim Greene
Hi All,
I have a text file that has entries like the following:
user1:mbox1:
user1:mbox2:

I basically do: $mboxs = `cat file | grep user1 | cut -d: -f2';
I then want to print out the data in the $mboxs variable (array)
I am trying to use foreach but it does not work..  I am assuming the data is not 
considered an array?
Any help would be appreciated.. Thanks
Jim



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



Re: [PHP] User Authentication

2003-03-18 Thread Chris Shiflett
--- shaun [EMAIL PROTECTED] wrote:
 Using the following code I am able to authenticate which type of user is
 visiting my page, however if I try to log in again with a different type of
 user the session variables still assume that the original user was logged
 in, is there a way to reset the session variables, I have tried
 session_destroy() and session_unset() but without success...
 
 ?php
 require(dbconnect.php);
 
 // Assume user is not authenticated
 $auth = false;
 
 // Formulate the query
 $query = SELECT * FROM WMS_User WHERE
   User_Username = '$_POST[username]' AND
   User_Password = '$_POST[password]';
 
 // Execute the query and put results in $result
 $result = mysql_query( $query )
   or die ( 'Unable to execute query.' );
 
 // Get number of rows in $result.
 $num = mysql_numrows( $result );
 
 if ( $num != 0 ) {
 
  // A matching row was found - the user is authenticated.
  $auth = true;
 
  //get the data for the session variables
  $suser_name   = mysql_result($result, 0, User_Name);
  $suser_password = mysql_result($result, 0, User_Password);
  $stype_level   = mysql_result($result, 0, User_Type);
 
  $ses_name  = $suser_name;
  $ses_pass  = $suser_password;
  $ses_level = $stype_level;
 
  session_register(ses_name);
  session_register(ses_pass);
  session_register(ses_level);

This is the moment where you lose your new session data. You need to register
your session variables before you use them. At this point, PHP retrieves the
session data that is saved for you, and you lose all of the stuff you did
above.

Chris

=
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/

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



Re: [PHP] Question about a text file and foreach

2003-03-18 Thread Jim Lucas
You need to split() the variable ($mboxs)  on newlines \n

Jim

- Original Message -
From: Jim Greene [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, March 18, 2003 8:22 AM
Subject: [PHP] Question about a text file and foreach


 Hi All,
 I have a text file that has entries like the following:
 user1:mbox1:
 user1:mbox2:

 I basically do: $mboxs = `cat file | grep user1 | cut -d: -f2';
 I then want to print out the data in the $mboxs variable (array)
 I am trying to use foreach but it does not work..  I am assuming the data
is not considered an array?
 Any help would be appreciated.. Thanks
 Jim



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



Re: [PHP] Question about a text file and foreach

2003-03-18 Thread Erik Price


Jim Greene wrote:
Hi All,
I have a text file that has entries like the following:
user1:mbox1:
user1:mbox2:
I basically do: $mboxs = `cat file | grep user1 | cut -d: -f2';
I then want to print out the data in the $mboxs variable (array)
I am trying to use foreach but it does not work..  I am assuming the data is not 
considered an array?
I might be mistaken, but wouldn't the value of $mboxs just be a string 
containing those characters?  If you meant to use backticks to open up a 
shell pipe, I /think/ that's something you can do only in Perl.  You can 
do it in PHP with the system() function, but it doesn't return an array 
but rather a string.  You can parse the string into an array with 
string-processing functions.

Erik

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


Re: [PHP] what's the best way to handle this?

2003-03-18 Thread CPT John W. Holmes
 When a user 'registers' with our site, I want to generate their personal
 webpage for them.  Currently, I have a webpage where the contents are
 generated from their personal info in the db and I have a drop down to
view
 client pages but it is just the same page but I pass in the clientid so it
 will display their data.  This is fine but I want the users to be able to
 tell others..Visit my home page at www.eddiessite.com/Johnny  or
something
 like that...I don't want them to have to say visit my page
 www.eddissite/client_pages?clientid=43  does that make sense?  Should I
just
 generate a folder for them with an index page that redirects then to the
 clientpage with their id?

If you really wanted to write the file and not use some fancy rewrite rule
or Apache trick, you could do this:

$fp = fopen(http://www.eddissite.com/client_pages.php?clientid=43;,'r');
while(!feof($fp))
{ $data = fread($fp,1); }
fclose($fp);

mkdir(/home/path/to/your/www/$client_name,0777);

$fp2 = fopen(/home/path/to/your/www/$client_name/index.html,'w');
fwrite($fp2,$data);
fclose($fp2);

Just make sure all of your paths for images and links are still correctly
created by client_pages.php

You could use output buffering for the first part, too...

---John Holmes...


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



[PHP] MySQL passwords dont work.

2003-03-18 Thread Taylor York
I have recently made a server on FreeBSD.  I've run into 2 problems.

1. I cant get PHP to compile with mysql
2. I can use mysql in PHP, but if i use phpMyAdmin, with user/pass...I
ALWAYS get No databases.  If i do user/no pass, it works.

wth?



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



Re: [PHP] Question about a text file and foreach

2003-03-18 Thread David T-G
Jim --

Please don't hijack threads.  This message has nothing to do with calling
a function in a page via GET.  When you wish to ask a fewsh and unrelated
question, please send a fresh and unrelated message.  [I keep hearing
good things about Evolution.  Doesn't it have decent threading?]

...and then Jim Greene said...
% 
% Hi All,
%   I have a text file that has entries like the following:
% user1:mbox1:
% user1:mbox2:

Good enough.


% 
% I basically do: $mboxs = `cat file | grep user1 | cut -d: -f2';

Why?


% I then want to print out the data in the $mboxs variable (array)
% I am trying to use foreach but it does not work..  I am assuming the data is not 
considered an array?

Right; all you've done is create a string variable with a bunch of
entries in it.


% Any help would be appreciated.. Thanks

I'd just fopen it, myself, rather than messing with the system call:

  $fh = fopen(/tmp/file,'r') ;
  while ( ! feof($fh) and list($user,$mbox) = explode(:,trim(fgets($fh))) )
{ $mboxes[] = $mbox ; }
  fclose($fh) ;
  print_r($mboxes) ;

If you want to maintain the relationship of userN to mboxN, you could
instead say

  { $mboxes[$user] = $mbox ; }

and then later address them by name instead of number.


% Jim


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


[PHP] Register_globals question

2003-03-18 Thread Mike Tuller
I found a class that allows you to have a multiple page listing, where 
it displays a certain number of items, and then you click on the next 
page to show the next results. I found that it needs to have 
register_globals turned on. I am learning, and would like to have 
someone look at the class to tell me where in this class 
register_globals is required. I have emailed the person that created 
the class, I am just trying to understand this.

Mike

Here is the class code:

?

class pn_buttons{

  /* Public Variables */
  var $query_total_pages = 0;
  var $limited_query;
  var $next_button;
  var $previous_button;
  /* Functions */
  function pn_buttons($sql, $step, $page=0){
  $result = mysql_query( $sql );
  $query_total_rows = mysql_num_rows( $result );
  // if query return some rows
 if ( $query_total_rows0 ){
 if ( $query_total_rows%$step!=0 ){
$total_pages = intval( $query_total_rows/$step)+1;
 }else{
$total_pages = $query_total_rows/$step ;
 }
 $this-query_total_pages = $total_pages;

 // if page is set
 if ( empty($page) ) {
$from = 0;
$this-current_page= 1;
 }else{
if ( $page = $this-query_total_pages ) {
 $from = $step * ( $page - 1 );
 $this-current_page= $page;
}else{
 $from = 0;
 $this-current_page= 1;
}
 }
 $this-limited_query = $sql .  LIMIT . $from ., . 
$step;
  }

  } // end  function

  // create previous and next buttons
  function make_buttons( $link, $link_params, $txt_next=next, 
$txt_previous=previous, $image= ){

  if ( $this-query_total_pages1 ){

  if ( ($this-current_page  $this-query_total_pages)  
($this-current_page1) ){
  $next_page = $this-current_page+1;
  $prev_page = $this-current_page-1;
  $next_lnk = a href='.$link . $link_params . 
page=. $next_page .'$txt_next/a;
  $prev_lnk = a href='.$link . $link_params . 
page=. $prev_page .'$txt_previous/a;
  }else if( ($this-current_page  
$this-query_total_pages)  ($this-current_page==1) ){
  $next_page = $this-current_page+1;
  $prev_page = ;
  $next_lnk = a href='.$link . $link_params . 
page=. $next_page .'$txt_next/a;
  $prev_lnk = ;
  }else if( $this-current_page = $this-query_total_pages 
){
  $next_page = ;
  $prev_page = $this-current_page-1;
  $next_lnk = ;
  $prev_lnk = a href='.$link . $link_params . 
page=. $prev_page .'$txt_previous/a;
  }
  $this-next_button = $next_lnk;
  $this-previous_button = $prev_lnk;
  }

  } // end function

  // display all pages
  function count_all_pages( $link, $link_params ){
  for ($i=1; $i=$this-query_total_pages; $i++){
  if ($i==$this-current_page){
  echo b[$i]/b;
  }else{
  echo a href='$link$link_paramspage=$i'[$i]/a;
  }
  }
  }
} // end Class

?

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


Re: [PHP] Register_globals question

2003-03-18 Thread CPT John W. Holmes
 I found a class that allows you to have a multiple page listing, where
 it displays a certain number of items, and then you click on the next
 page to show the next results. I found that it needs to have
 register_globals turned on. I am learning, and would like to have
 someone look at the class to tell me where in this class
 register_globals is required. I have emailed the person that created
 the class, I am just trying to understand this.

 Mike

 Here is the class code:

 ?

 class pn_buttons{

/* Public Variables */
var $query_total_pages = 0;
var $limited_query;
var $next_button;
var $previous_button;

/* Functions */
function pn_buttons($sql, $step, $page=0){
$result = mysql_query( $sql );
$query_total_rows = mysql_num_rows( $result );

// if query return some rows
   if ( $query_total_rows0 ){

   if ( $query_total_rows%$step!=0 ){
  $total_pages = intval( $query_total_rows/$step)+1;
   }else{
  $total_pages = $query_total_rows/$step ;
   }

   $this-query_total_pages = $total_pages;

   // if page is set
   if ( empty($page) ) {
  $from = 0;
  $this-current_page= 1;
   }else{
  if ( $page = $this-query_total_pages ) {
   $from = $step * ( $page - 1 );
   $this-current_page= $page;
  }else{
   $from = 0;
   $this-current_page= 1;
  }
   }

   $this-limited_query = $sql .  LIMIT . $from ., .
 $step;
}

} // end  function

// create previous and next buttons
function make_buttons( $link, $link_params, $txt_next=next,
 $txt_previous=previous, $image= ){

if ( $this-query_total_pages1 ){

if ( ($this-current_page  $this-query_total_pages) 
 ($this-current_page1) ){
$next_page = $this-current_page+1;
$prev_page = $this-current_page-1;
$next_lnk = a href='.$link . $link_params .
 page=. $next_page .'$txt_next/a;
$prev_lnk = a href='.$link . $link_params .
 page=. $prev_page .'$txt_previous/a;
}else if( ($this-current_page 
 $this-query_total_pages)  ($this-current_page==1) ){
$next_page = $this-current_page+1;
$prev_page = ;
$next_lnk = a href='.$link . $link_params .
 page=. $next_page .'$txt_next/a;
$prev_lnk = ;
}else if( $this-current_page = $this-query_total_pages
 ){
$next_page = ;
$prev_page = $this-current_page-1;
$next_lnk = ;
$prev_lnk = a href='.$link . $link_params .
 page=. $prev_page .'$txt_previous/a;
}
$this-next_button = $next_lnk;
$this-previous_button = $prev_lnk;
}

} // end function

// display all pages
function count_all_pages( $link, $link_params ){
for ($i=1; $i=$this-query_total_pages; $i++){
if ($i==$this-current_page){
echo b[$i]/b;
}else{
echo a href='$link$link_paramspage=$i'[$i]/a;
}
}
}

 } // end Class

Since it's a class, register_global variables would not have any scope
within it. Since there are no 'global' calls in any of the methods, it
doesn't look like it's relying on any outside variables. Everything this
script acts upon is passed to it, so it does not rely on register globals.
How this class was implemented may rely on them, though.

---John Holmes...


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



Re: [PHP] Calling function in php page via GET?

2003-03-18 Thread Leif K-Brooks
Not built in, that would be a HORRIBLE security risk.  You can try 
something like this (untested):

call_user_func_array($_GET['func'],$_GET['params']);

Then use it like 
myscript.php?func=somefunctionparams[]=fooparams[]=bar, which would be 
the same as calling somefunction('foo','bar');

Daniel Joyce wrote:

I have a file that draws charts, called chart.php.

Right now, I can call it using GET methods inside IMG tags

IMG src=chart.php?foo=bar

Well, I'd like to be able to wrap it in a function, and call it via a 
function

drawgraph();

and by GET syntax

IMG src=chart.php.drawgraph?foo==bar ??

Is there a way to call a FUNCTION/METHOD in a php file using URLS?

-Daniel


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


[PHP] openssl_pkey_get_private() problem

2003-03-18 Thread Jens Rehsack
Hi list,

I have a problem with openssl_pkey_get_private which shows up like:

-BEGIN Test-Script-
?PHP
$fp = fopen( ../signkeys/fp3-cert.pem, r );
$pubkey = fread( $fp, 65000 );
fclose( $fp );
$fp = fopen( ../signkeys/fp3-privkey.pem, r );
$privkey = fread( $fp, 65000 );
fclose( $fp );
echo public key (read)\n;
$pubres = openssl_get_publickey( $pubkey );
while( $msg = openssl_error_string() )
{
  echo openssl_error: '$msg'\n;
}
var_dump( $pubres );
echo private key (read)\n;
$privres = openssl_get_privatekey( $privkey, flexpage );
while( $msg = openssl_error_string() )
{
  echo openssl_error: '$msg'\n;
}
var_dump( $privres );
echo public key (load)\n;
$pubres = openssl_get_publickey( file://../signkeys/fp3-cert.pem );
while( $msg = openssl_error_string() )
{
  echo openssl_error: '$msg'\n;
}
var_dump( $pubres );
echo private key (load)\n;
$privres = openssl_get_privatekey( file://../signkeys/fp3-privkey.pem, 
flexpage );
while( $msg = openssl_error_string() )
{
  echo openssl_error: '$msg'\n;
}
var_dump( $privres );

$data = Hello World\n;
$rc_sign = openssl_sign( $data, $signature, $privres );
$rc_verify = openssl_verify( $data, $signature, $pubres );
var_dump( $rc_sign );
var_dump( $rc_verify );
$privkey = ;
openssl_pkey_export( $privres, $privkey, flexpage );
echo exported private key\n; var_dump( $privkey );
$privres = openssl_get_privatekey( $privkey, flexpage );
while( $msg = openssl_error_string() )
{
  echo openssl_error: '$msg'\n;
}
var_dump( $privres );
?
-END Test-Script-
-BEGIN Script-Output-
public key (read)
resource(6) of type (OpenSSL key)
private key (read)
openssl_error: 'error:0D09A0A3:asn1 encoding 
routines:d2i_PrivateKey:unknown public key type'
openssl_error: 'error:0906700D:PEM routines:PEM_ASN1_read_bio:ASN1 lib'
bool(false)
public key (load)
resource(7) of type (OpenSSL key)
private key (load)
resource(8) of type (OpenSSL key)
bool(true)
int(1)
exported private key
string(1751) -BEGIN RSA PRIVATE KEY-
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,04AB90E107EDE2D0

Wp5eYHn1LNTOayEC0vV33y2DbVRc89EeMonSX6IjHpaf3X9AhllU6wsnLbfqCsTk
cJyrplaepX+x90OwDYSFqvT0LTT1mK/T9w4gInn4SHmgJbUjfeUSC7ZdTUFggjWf
+JlxkdGcjiJZ99rYctRS3d0RgHBkrGyd7gLIsyuFp4Nt8RPGDcwmd5ksFl9Pp8kH
BYbXtcqxkNg0lDn+DyrOM14bXdOvIRojYxsBHfXPn1aJDZUR5qna7CCZJTDz3b+G
WYFwMrGu4XlmaDYY0ttPFXKW3h9cQkak2Dn8cJJCaZHRY6xzN0zhYEIT3ge4MLIL
3zoKxi9pw1pcW+JjvS6iWMzyWNIPnK6A5e2uiWOJFlVqPSx41tpvA81/mJRS+DL1
XLIKrWXyvTOKPJWLzSbBh+Ke1VpOD53MkBNb1Or9x2IH1OqYAbK0wqC/eP1pkx5D
thgIYEAFC6VMHIT1JEyOpEFIvhqlDak26iM0iAEmX6lQx55mo3yHJT1p2eLvDPwX
VEyFkVGyhMkfHGeVQyOFMEc5EtwO3an2Jiwelb8JsGbWPyupfK3k82jdNJXUIXrF
Ez4KCb5p8HrbtTg1lAaZrrSmWAuhCdR/OekngKc3jkgPfSySNSs2pjF30sh1gvlc
z+1JEAajtmK7qYz6b26RaZf7RZkahUUu2jUeCM3w9UHh5QVACkL6O3BrSCAXVxN3
pxI9vdzKvXTGz20iZvrMkwWbfFbPAK6HtcGhHyIiFgSTcl6j4p/rEaPYL23ZwyZx
Vh6p9ihvAjRgf2XZes68SRF45zfWyylRzdfWNdLLXAsPTXurrhNlhK0uL0WgP7UX
986bIyx4hKDciS2euJzO9MGgBFbxlbIqZefTtvq00Th5RpUifFHUB5LR2uIknr6N
u9DjLEYmguNechkxZddN1TY0NSvD9UnFl9ZIjKEhOisrkSpRfIirH76ubFoxUWtz
Y5jbkdhIBj9If0TnnGp5EXQEyT4yr2o/kPiQnsktkK2dStOpWTp8hrKHN3w7hCnt
cG31WnUcpdxVusFm3hKmQBEn/X+4D2NnF4M0zRCyKMutB9NmNUIjrSZYnNwt6tNN
toVrz4HYNhEINIodGs/DBRlr9oHAUN/1Yf8Atlf8adA6y04UUhTVdexzeW260d4+
suqU1MTIJi986OYoaSYpH3B0zZSifI33fmpw8MeC679qAd2ryHAtHYKB5rCPiPrs
L+XlGlK+dgwGaCsJltLiy9aEBBF4NXM/UYU13q3HSOxnobzcSdhqvUbOopKgDAfI
iySSGtWUZINq6wxXhzcwI1ePiXeuSn8HCEEieketZXHOtITQ6cNYpR+vvEj+J4VC
rkL8eBBzDLbFuzs7JPoKpe3vCgKBP8//KM7pc5AZ6F4OWI32TJ/N/Fo8znVP1g8A
wzvuK2PUBv7pLKKxpvbl7dcDfRNOBcgQmqbXys8tDJ3g1kJeN34Q1pBsRKq9eXcQ
SXIeSrywFnmn0JE40sdSzvTiEek/y4k/CFGQUy5DD+h7ryp8BORk3Cl1n/wM5td3
5lKHyvnECyAs+9yCQGOxgN0OQWp9/8c1IaI9rKpq+6jslAdP9v3upsBB3JImhGfc
-END RSA PRIVATE KEY-

openssl_error: 'error:0E06D06C:configuration file 
routines:NCONF_get_string:no value'
openssl_error: 'error:0E06D06C:configuration file 
routines:NCONF_get_string:no value'
openssl_error: 'error:0E06D06C:configuration file 
routines:NCONF_get_string:no value'
openssl_error: 'error:0E06D06C:configuration file 
routines:NCONF_get_string:no value'
openssl_error: 'error:0E06D06C:configuration file 
routines:NCONF_get_string:no value'
openssl_error: 'error:0E06D06C:configuration file 
routines:NCONF_get_string:no value'
openssl_error: 'error:0E06D06C:configuration file 
routines:NCONF_get_string:no value'
openssl_error: 'error:0D09A0A3:asn1 encoding 
routines:d2i_PrivateKey:unknown public key type'
openssl_error: 'error:0906700D:PEM routines:PEM_ASN1_read_bio:ASN1 lib'
bool(false)
-END Script-Output-

Is it a bug in PHP with new OpenSSL 0.9.7a or is it a my failure?

Any help is nice,
Jens
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Register_globals question

2003-03-18 Thread Mike Tuller
Well, I know it has something to do with register_globals, because it 
only starts working when I turn register_globals on. If it is off, the 
script doesn't work.

Here is the php file that calls to the class. It doesn't seem to have 
anything that is global, but as I said before, I am not very familiar 
with this.

?

  mysql_connect(localhost,username,password);
  mysql_select_db(MyDatabase);
  // this is a dump variable just for demonstration purposes
  $cod= 5;
  // how many rows do you want per page???
  $step = 10;


  # Include class file
  include (pn.class.php);
  # the sql query without Limit
  $sql = select asset_id, developer, title, version, platform from 
software_assets ORDER BY asset_id;
  $res= mysql_query( $sql );
  $total = mysql_num_rows( $res );

  # initiate class
  # parameters explanation
  # 1st param : the sql query without Limit expretion
  # 2nd param : number of elements to display per page.
  # 3rd param : current page; this should be null
  # 4rth param : total rows of query
  //$buttons = new pn_buttons( $sql, $step, $page );
  $buttons = new pn_buttons( $sql, $step, $page, $total );
  # $buttons-limited_query is the sql query with limit expretion
  # class create this
  $res = mysql_query ($buttons-limited_query);
  echo 
  html
body;
 // table headers describing columns
  echo 
  table width=\500\ border=\1\ cellspacing=\5\ 
cellpadding=\3\
		tr bgcolor=\#bb\
			td align=\center\bAsset ID/b/td
			td align=\center\bDeveloper/b/td
			td align=\center\bSoftware Title/b/td
			td align=\center\bVersion/b/td
			td align=\center\bPlatform/b/td
		/tr
		;

  // list elements one by one until there are no more in the database
  while ( list ( $asset_id, $developer, $title, $version, $platform ) = 
mysql_fetch_row($res) ){
  echo 
		tr
		td align=\left\a 
href=\editsoftwareasset.php?id=$asset_id\$asset_id/a/td
		/td
		td align=\left\$developer
		/td
		td align=\left\$title
		/td
		td align=\left\$version
		/td
		td align=\left\$platform
		/td
		/tr
		;
  }

  // close table once list elements loop is finished
  echo /table;
  // Beginning of prev/next buttons. Will be centered in the table.
  echo
  table width=\500\ border=\1\
  tr align=\center\
td
center;
  # Create Prev and next buttons
  # parameters explanation
  # 1st param : the page that displays results with ?  at the end
  # 2nd param : additional url parameters e.g. cid=$cidtop=$top
  # 3rd param : Text to display in next link
  # 4th param : Text to display in previous link
  $buttons-make_buttons(pn_classexample.php?,cid=$cod,Next 
Results, Previous Results);

  # display previous and next links
  echo $buttons-previous_button .  nbsp;nbsp;  
.$buttons-next_button;

  # display current page number and total pages number
  echo brPage . $buttons-current_page .  of  . 
$buttons-query_total_pages;
  echo brbrbr;
  echo  $buttons-count_all_pages(pn_classexample.php?,cid=$cid);

?
/center
/td
/tr
/table
/body
/html
On Tuesday, March 18, 2003, at 11:02 AM, CPT John W. Holmes wrote:

I found a class that allows you to have a multiple page listing, where
it displays a certain number of items, and then you click on the next
page to show the next results. I found that it needs to have
register_globals turned on. I am learning, and would like to have
someone look at the class to tell me where in this class
register_globals is required. I have emailed the person that created
the class, I am just trying to understand this.
Mike

Here is the class code:

?

class pn_buttons{

   /* Public Variables */
   var $query_total_pages = 0;
   var $limited_query;
   var $next_button;
   var $previous_button;
   /* Functions */
   function pn_buttons($sql, $step, $page=0){
   $result = mysql_query( $sql );
   $query_total_rows = mysql_num_rows( $result );
   // if query return some rows
  if ( $query_total_rows0 ){
  if ( $query_total_rows%$step!=0 ){
 $total_pages = intval( $query_total_rows/$step)+1;
  }else{
 $total_pages = $query_total_rows/$step ;
  }
  $this-query_total_pages = $total_pages;

  // if page is set
  if ( empty($page) ) {
 $from = 0;
 $this-current_page= 1;
  }else{
 if ( $page = $this-query_total_pages ) {
  $from = $step * ( $page - 1 );
  $this-current_page= $page;
 }else{
  $from = 0;
  $this-current_page= 1;
 }
  }
  $this-limited_query = $sql .  LIMIT . $from ., .
$step;
   }
   } // end  function

   // create previous and next buttons
   function make_buttons( $link, $link_params, $txt_next=next,
$txt_previous=previous, $image= ){
   if ( $this-query_total_pages1 ){

   if ( 

[PHP] HOW TO ?

2003-03-18 Thread Luis A
hi everyone

any one here know where can i get an tutorial of php who explin detailded . how to 
upload files by php 

i been read the php manual but i need one tutorial who explained to me by more 
examples couse i cant upload the files 
 
thanks anyway 
;-)
 


__
Luis Atala 
Profetional Web Desinger
Facultad de Cultura Fisica
Linux User#: 412375
ICQ#: 132736035
  Current ICQ status: 
+  More ways to contact me 
__



[PHP] Authentication

2003-03-18 Thread Beauford.2002
Hi,

I am looking for a simple authentication script that uses MySQL. I have
downloaded about 10 of them (most with no instructions on it's use), but
even at that they are not what I need.

When you go to the main page of my site it will ask you to login or signup.
So I want to be able to authenticate the user if he logs in (not to much of
a problem here, but I want to protect all pages (I don't want to use cookies
as not everyone has these enabled). What other options do I have? If anyone
knows a small script that can be modified, or point me in the right
direction of how to do this, it would be appreciated.

Thanks



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



Re: [PHP] Getting false positive on strpos ... despite doublecheck... HELP!

2003-03-18 Thread -{ Rene Brehmer }-
On Mon, 17 Mar 2003 05:40:05 -0800 (PST), Rasmus Lerdorf wrote about Re:
[PHP] Getting false positive on strpos ... despite doublecheck... HELP!
what the universal translator turned into this:

   case strpos($line,#date:) == 0  strpos($line,#date:) !== false:

You can just do a === 0 check here, you don't need the second 
check to make sure it isn't false.  However, that's not really how you use 
a switch expression anyway.  The expressions in the case statement should 
be constants.  If you rewrite your code to look like this it will work 
fine:

10-4 ... didn't know that ...

But what's with the continue commands in your rewrite - 
haven't seen them before ... What do they do?

  while (! feof($fp)) {
$line = fgets($fp, 4096);
if(substr($line,0,6)=='#date:') {
$print = strtr(substr($line, 7),\r\n,  );
$print = date(j F Y H.i.s O,strtotime(trim($print)));
echo span class=\ylwbld\On $print, ;
continue;
}

Do they cause the same behaviour as an if ... elseif structure???

But thanks ... will change it ASAP ...

Rene

-- 
Rene Brehmer

This message was written on 100% recycled spam.

Come see! My brand new site is now online!
http://www.metalbunny.net

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



[PHP] UTF-8 and PCRE

2003-03-18 Thread Jürgen Hauser
Hello!

I would appreciate if anybody could tell me how to use an utf8 encoded 
string in a regular expression.

I have tried this

$string = a username written in greek letters;
preg_match('#^[\w][\w0-9_]{2,39}$#', $string);
Which does not work, i have also tried to utf8_decode the string and pass 
it to the regex, which doesn't work either.
I would appreciate if anybody could help me out here, i have searched the 
web but with no results.

Thanks a lot in advance,
Jürgen Hauser


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


Re: [PHP] Authentication

2003-03-18 Thread Erik Price


Beauford.2002 wrote:
I am looking for a simple authentication script that uses MySQL. I have
downloaded about 10 of them (most with no instructions on it's use), but
even at that they are not what I need.
The PEAR project has 7 different authentication packages, including Auth 
which I understand lets you design your own.  PEAR code tends to be 
widely used and well-tested.  Also there is a mailing list similar to 
this one dedicated to discussion of and support for PEAR projects.

http://pear.php.net/packages.php?catpid=1catname=Authentication

When you go to the main page of my site it will ask you to login or signup.
So I want to be able to authenticate the user if he logs in (not to much of
a problem here, but I want to protect all pages (I don't want to use cookies
as not everyone has these enabled). What other options do I have? If anyone
knows a small script that can be modified, or point me in the right
direction of how to do this, it would be appreciated.
If you really want to reinvent the wheel, write an include file that is 
included onto every page of your site except your login page and the 
ones that you don't need to protect.  This include file should check for 
a flag that indicates whether or not the user is logged in.  If the user 
is not logged in, send a redirect header to the login page followed 
immediately by an exit() call.  This way none of your scripts will be 
accessible without the user being logged in.  To handle the login, the 
simple way to do it is to accept a username and password input from the 
user on the login screen and ship these to the database or wherever your 
user list is kept and test to see if they are valid.  If they are valid, 
set the flag in the user's session indicating that they are logged in 
(which is checked by the include file).  For maximum security, use SSL 
and beware the possibility of session hijacking.  If you don't want to 
use cookies, you can either embed the SID in all hyperlinks of your site 
or just recompile PHP with the --enable-trans-sid flag (unless you're on 
PHP 4.2 or greater).

Erik

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


Re: [PHP] Getting false positive on strpos ... despite doublecheck...HELP!

2003-03-18 Thread Rasmus Lerdorf
 Do they cause the same behaviour as an if ... elseif structure???

Yes, continue simply discards the rest of the statements inside a loop and 
goes to the next iteration.

-Rasmus


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



Re: [PHP] script conflicts

2003-03-18 Thread Sebastian
the error is being returned by the other script that is being included into
the same page .. but its the code below that is causing the other to give
the error, and i cannot figure out why.

- Original Message -
From: Marek Kilimajer [EMAIL PROTECTED]


| I can't see mysql_fetch_row() function anywhere in your code.
|
| Sebastian wrote:
|
| i have two scripts included into one page, one of them i have been
running
| for a long time .. i recently made another script and when i include it
into
| the same page the other script returns this error:
| 
| Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result
| resource in /home/public_html/file.php on line 59
| 
| This is part of the sql query that conflicts with the other, any ideas?
it
| only happens when this snippet is included in the same page that the
other
| is included into.
| 
| function load() {
| 
|   mysql_connect($hostname,$username,$password) or die ( Could not connet
to
| MySQL );
|   mysql_select_db($database) or die ( Could not connect to database );
| 
|  // Delete
|  $sql = DELETE FROM $table WHERE time   . (time()-$duration);
| $result = @mysql_query($sql) or die (Error: . mysql_error() );
| 
| // Insert
| $sql = INSERT INTO $table (time) VALUES ( . time() . ) ;
| 
| $result = @mysql_query($sql) or die (Error: . mysql_error() );
|  // Get count
| 
|  $sql = SELECT time FROM $table;
| 
| $result = @mysql_query($sql) or die (Error: . mysql_error() );
| 
| return mysql_num_rows ($result);
| 
| }
| 
| 
| 
| 
| TIA.
| 
| 
| 
|


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



Re: [PHP] Getting false positive on strpos ... despite doublecheck... HELP!

2003-03-18 Thread -{ Rene Brehmer }-
On Mon, 17 Mar 2003 13:14:46 -0700, Kevin Stone wrote about Re: [PHP]
Getting false positive on strpos ... despite doublecheck... HELP! what
the universal translator turned into this:

 It interprets the text correctly 100%, BUT I get a false positive date
 check at the end of the file, which results in an extra (today's) date.
 Extract of resulting HTML (last part):

 span class=ylwbldOn 5 January 2003 21.17.18 +0100, Knap Knapstrup/a
 of city, country wrote:/spanbr
 span class=whttxtAdder badder, pladder madder. Adder badder, pladder
 madder. Adder badder, pladder madder. Adder badder, pladder madder. Adder
 badder, pladder madder. Adder badder, pladder madder. Adder badder,
 pladder madder. Adder badder, pladder madder. Adder badder, pladder
 madder. Adder badder, pladder madder./spanbr
 span class=ylwbldLink:/span a href=http://www.anotherlink.ext;
 target=_new class=ylwlinkwww.anotherlink.ext/abr
 hr width=85% color=#ff noshade align=center
 span class=ylwbldOn 17 March 2003 00.00.00 +0100,

 ^^^NOTE THE LAST LINE!!!
 It's not supposed to be there ... Can anyone tell me how to avoid it, and
 possibly what causes it???

 Side-remark: The text-file is to be written from entries in a form I
 haven't coded yet. Like I said in the top, some of the fields are
 optional, and the read script is made to compensate for this.

Rene, I copied and pasted your code into a test file and ran it on my
server.  It worked just fine for me.. no extra date line at the bottom.
Don't know what to say.

Well ... the guestbook.txt I've got for testing was written in windows XP,
and has an empty line at the end. The extract of it that I posted does not
(depending on how you cut'n'paste it of course).

I've got a feeling that the empty line had something to do with it ...
since it did at both on my testserver (PHP 4.2.3 on Apache 2.0.40 on WinXP
Pro) and at my website (PHP 4.2.3 on Apache 1.3.23 on Linux 2.2.4).

But after rewriting the code according to Rasmus' suggestion, it works
correctly, without the extra date line ...

So now I just gotta read up on the write functions to make the part that
actually makes the source file...

Thx all

Rene

-- 
Rene Brehmer

This message was written on 100% recycled spam.

Come see! My brand new site is now online!
http://www.metalbunny.net

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



Re: [PHP] Getting false positive on strpos ... despite doublecheck... HELP!

2003-03-18 Thread -{ Rene Brehmer }-
On Tue, 18 Mar 2003 01:50:57 -0800 (PST), Rasmus Lerdorf wrote about Re:
[PHP] Getting false positive on strpos ... despite doublecheck... HELP!
what the universal translator turned into this:

 Do they cause the same behaviour as an if ... elseif structure???

Yes, continue simply discards the rest of the statements inside a loop and 
goes to the next iteration.

Thanks ... just managed to find it in the manual in the meantime ...
sometimes one just gotta read before asking ... ;-)

Rene

-- 
Rene Brehmer

This message was written on 100% recycled spam.

Come see! My brand new site is now online!
http://www.metalbunny.net

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



Re: [PHP] User Authentication

2003-03-18 Thread shaun

Chris Shiflett [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 --- shaun [EMAIL PROTECTED] wrote:
  Using the following code I am able to authenticate which type of user is
  visiting my page, however if I try to log in again with a different type
of
  user the session variables still assume that the original user was
logged
  in, is there a way to reset the session variables, I have tried
  session_destroy() and session_unset() but without success...
 
  ?php
  require(dbconnect.php);
 
  // Assume user is not authenticated
  $auth = false;
 
  // Formulate the query
  $query = SELECT * FROM WMS_User WHERE
User_Username = '$_POST[username]' AND
User_Password = '$_POST[password]';
 
  // Execute the query and put results in $result
  $result = mysql_query( $query )
or die ( 'Unable to execute query.' );
 
  // Get number of rows in $result.
  $num = mysql_numrows( $result );
 
  if ( $num != 0 ) {
 
   // A matching row was found - the user is authenticated.
   $auth = true;
 
   //get the data for the session variables
   $suser_name   = mysql_result($result, 0, User_Name);
   $suser_password = mysql_result($result, 0, User_Password);
   $stype_level   = mysql_result($result, 0, User_Type);
 
   $ses_name  = $suser_name;
   $ses_pass  = $suser_password;
   $ses_level = $stype_level;
 
   session_register(ses_name);
   session_register(ses_pass);
   session_register(ses_level);

 This is the moment where you lose your new session data. You need to
register
 your session variables before you use them. At this point, PHP retrieves
the
 session data that is saved for you, and you lose all of the stuff you did
 above.

 Chris

 =
 Become a better Web developer with the HTTP Developer's Handbook
 http://httphandbook.org/

sorry but you have lost me, surely the session_register(); function is
storing what I have done above this point, if not then how would I store the
new values instead?



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



Re: [PHP] script conflicts

2003-03-18 Thread Marek Kilimajer
why are you using mysql_connect in this function?
where are $hostname,$username,$password and $database coming from?


Sebastian wrote:

the error is being returned by the other script that is being included into
the same page .. but its the code below that is causing the other to give
the error, and i cannot figure out why.
- Original Message -
From: Marek Kilimajer [EMAIL PROTECTED]
| I can't see mysql_fetch_row() function anywhere in your code.
|
| Sebastian wrote:
|
| i have two scripts included into one page, one of them i have been
running
| for a long time .. i recently made another script and when i include it
into
| the same page the other script returns this error:
| 
| Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result
| resource in /home/public_html/file.php on line 59
| 
| This is part of the sql query that conflicts with the other, any ideas?
it
| only happens when this snippet is included in the same page that the
other
| is included into.
| 
| function load() {
| 
|   mysql_connect($hostname,$username,$password) or die ( Could not connet
to
| MySQL );
|   mysql_select_db($database) or die ( Could not connect to database );
| 
|  // Delete
|  $sql = DELETE FROM $table WHERE time   . (time()-$duration);
| $result = @mysql_query($sql) or die (Error: . mysql_error() );
| 
| // Insert
| $sql = INSERT INTO $table (time) VALUES ( . time() . ) ;
| 
| $result = @mysql_query($sql) or die (Error: . mysql_error() );
|  // Get count
| 
|  $sql = SELECT time FROM $table;
| 
| $result = @mysql_query($sql) or die (Error: . mysql_error() );
| 
| return mysql_num_rows ($result);
| 
| }
| 
| 
| 
| 
| TIA.
| 
| 
| 
|
 



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


[PHP] Sorting Recordset by a calculation between 2 Records

2003-03-18 Thread Vernon
I am calculating distances between to record's zip codes using php and have
a need to sort the recordset by that value. How do I do something like this?
I mean it's not a value in the table that I can use the SQL ORDER BY
statement. I want to be able to have the distances closest to the individual
first.

Any ideas?

Thanks



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



Re: [PHP] User Authentication

2003-03-18 Thread olinux
use:
$_SESSION['ses_name'] = 'something';
$_SESSION['ses_pass'] = 'something';
$_SESSION['ses_level'] = 'something';

instead of:
 session_register(ses_name);
 session_register(ses_pass);
 session_register(ses_level);

All $_SESSION entries are automatically registered.

See the following for more info
http://us2.php.net/manual/en/security.registerglobals.php
http://us2.php.net/manual/en/function.session-register.php

olinux

--- shaun [EMAIL PROTECTED] wrote:
 
 Chris Shiflett [EMAIL PROTECTED] wrote in message

news:[EMAIL PROTECTED]
  --- shaun [EMAIL PROTECTED] wrote:
   Using the following code I am able to
 authenticate which type of user is
   visiting my page, however if I try to log in
 again with a different type
 of
   user the session variables still assume that the
 original user was
 logged
   in, is there a way to reset the session
 variables, I have tried
   session_destroy() and session_unset() but
 without success...
  
   ?php
   require(dbconnect.php);
  
   // Assume user is not authenticated
   $auth = false;
  
   // Formulate the query
   $query = SELECT * FROM WMS_User WHERE
 User_Username = '$_POST[username]' AND
 User_Password = '$_POST[password]';
  
   // Execute the query and put results in $result
   $result = mysql_query( $query )
 or die ( 'Unable to execute query.' );
  
   // Get number of rows in $result.
   $num = mysql_numrows( $result );
  
   if ( $num != 0 ) {
  
// A matching row was found - the user is
 authenticated.
$auth = true;
  
//get the data for the session variables
$suser_name   = mysql_result($result, 0,
 User_Name);
$suser_password = mysql_result($result, 0,
 User_Password);
$stype_level   = mysql_result($result, 0,
 User_Type);
  
$ses_name  = $suser_name;
$ses_pass  = $suser_password;
$ses_level = $stype_level;
  
session_register(ses_name);
session_register(ses_pass);
session_register(ses_level);
 
  This is the moment where you lose your new session
 data. You need to
 register
  your session variables before you use them. At
 this point, PHP retrieves
 the
  session data that is saved for you, and you lose
 all of the stuff you did
  above.
 
  Chris
 
  =
  Become a better Web developer with the HTTP
 Developer's Handbook
  http://httphandbook.org/
 
 sorry but you have lost me, surely the
 session_register(); function is
 storing what I have done above this point, if not
 then how would I store the
 new values instead?
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


__
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

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



Re: [PHP] User Authentication

2003-03-18 Thread Chris Shiflett
--- shaun [EMAIL PROTECTED] wrote:
...
$ses_name  = $suser_name;
$ses_pass  = $suser_password;
$ses_level = $stype_level;
  
session_register(ses_name);
session_register(ses_pass);
session_register(ses_level);
 
  This is the moment where you lose your new session data. You need to
  register your session variables before you use them. At this point, PHP
  retrieves the session data that is saved for you, and you lose all of the
  stuff you did above.
...
 sorry but you have lost me, surely the session_register(); function is
 storing what I have done above this point, if not then how would I store the
 new values instead?

How is a function supposed to do anything before it is called? I don't
understand how you come to that conclusion.

The session_register() function lets PHP know that you want a particular
variable registered in the current session. If the variable already exists, it
will retrieve it for you. This is how you are able to use a session variable on
another page.

If you don't udnerstand this, you might want to just use session_register() at
the top of your script(s) to keep yourself from making this particular mistake.
However, I strongly suggest researching sessions a lot more, or you will find
it frustratingly difficult to solve session problems without a good
understanding of what is going on.

Chris

=
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/

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



Re: [PHP] Sorting Recordset by a calculation between 2 Records

2003-03-18 Thread Erik Price


Vernon wrote:
I am calculating distances between to record's zip codes using php and have
a need to sort the recordset by that value. How do I do something like this?
I mean it's not a value in the table that I can use the SQL ORDER BY
statement. I want to be able to have the distances closest to the individual
first.
When you say using php I'm assuming that this means you are not doing 
the calculation at the database, but rather in your PHP code.  Use the 
distance you've calculated as the numeric index of an array, pointing to 
the record that corresponds to that distance.



Erik

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


[PHP] Call to undefined function: mssql_pconnect()

2003-03-18 Thread Miro Kralovic
Hi all.. I'm trying to connect MSSQL2000 Personal Edition from PHP and 
all I'm getting is Call to undefined function: mssql_pconnect() error..
I have installed PHP4.2.2-4, mod_php-4.2.2, php_devel-4.2.2, 
freetds0.53-4, php-sybase-ct-4.2.2, I think I also have php_ldap and 
php_imap..  restarted server, still nothing... running it on RedHat 7.3..
Is there anything else I have to do to get it running? Like recompilling 
PHP or something? If so, how do I do that? 

Thanks for any help in advance!!
Miro.


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



Re: [PHP] Sorting Recordset by a calculation between 2 Records

2003-03-18 Thread Vernon
 When you say using php I'm assuming that this means you are not doing
 the calculation at the database, but rather in your PHP code.

Correct.

 Use the distance you've calculated as the numeric index of an array,
pointing to
 the record that corresponds to that distance.

Can you please expalin this statement? Perhaps a tutorial somewhere?

Thanks



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



Re: [PHP] Performance and Function Calls

2003-03-18 Thread Noah
Thanks for the informative response, Don.

While a few microseconds saved isn't much, the example I gave was not the
real_world situation we're actually dealing with.

We're looping through a roster list of players (e.g. a soccer team) with a
minimum of twenty players on a team.  When filling out the roster, each
player field has a set of drop downs ranging from state and country of
origin to height and weight and jersey #.  By setting the drop downs (which
are generated by functions) to variables before looping through the number
of players on a team, I think we'll save a fair amount of time, not to
mention having to make changes in one place; not throughout the
page

Alright enough blathering.

Thanks again for your help,

--Noah


- Original Message -
From: Don Read [EMAIL PROTECTED]
To: CF High [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Saturday, March 15, 2003 8:25 PM
Subject: RE: [PHP] Performance and Function Calls



 On 15-Mar-2003 CF High wrote:
  Hey all.
 
  Quick question:
 
  If I have a function that, say, prints out the months in a year, and I
  call
  that function within a 10 cycle loop, which of the following is faster:
 
  1) Have function months() return months as a string; set var
  string_months = months() outside of the loop; then echo string_months
  within
  the loop
 
  -- OR
 
  2) Just call months() for each iteration through the loop
 
  I'm not sure how PHP interprets option number 1.
 
  Guidance for the clueless much appreciated...
 

 Easy enuff to test:

 ?php

 function getmicrotime(){
 list($usec, $sec) = explode( ,microtime());
 return ((float)$usec + (float)$sec);
 }

 $time_start = getmicrotime();
 for ($m=1; $m 11; $m++) {
 echo date('F', strtotime(2003-$m-1)), 'br';
 }
 echo 'PA: ', getmicrotime() - $time_start , 'P';

 $time_start = getmicrotime();
 for ($m=1; $m 11; $m++) {
 $str[]=date('F', strtotime(2003-$m-1));
 }
 echo implode('br',$str);
 echo 'PB: ', getmicrotime() - $time_start , 'P';

 unset($str);
 $time_start = getmicrotime();
 for ($m=1; $m 11; $m++) {
 $str[]=date('F', strtotime(2003-$m-1));
 }

 while (list(,$v)= each($str)) {
 echo $v, 'br';
 }
 echo 'PC: ', getmicrotime() - $time_start , 'P';

 ?

 On my machine I get numbers like:
 A: 0.000907063484192
 B: 0.000651001930237
 C: 0.000686049461365

 The function call within the loop is slower (contrary to what I
 expected), the real question is how much effort do you want to expend to
 save 2-3 micro-seconds?

 Regards,
 --
 Don Read   [EMAIL PROTECTED]
 -- It's always darkest before the dawn. So if you are going to
steal the neighbor's newspaper, that's the time to do it.



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



Re: [PHP] Sorting Recordset by a calculation between 2 Records

2003-03-18 Thread Erik Price


Vernon wrote:

Use the distance you've calculated as the numeric index of an array,
pointing to

the record that corresponds to that distance.


Can you please expalin this statement? Perhaps a tutorial somewhere?
I could explain it better if you could post the code that you have so 
far which extracts the records from the database.  In other words, it's 
hard for me to explain it without seeing your records' structures.  I 
don't know of a tutorial on this, when you see what I'm talking about 
you'll realize it's kind of basic.

Erik

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


Re: [PHP] User Authentication

2003-03-18 Thread shaun
i have changed the code to:

Olinux [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 use:
 $_SESSION['ses_name'] = 'something';
 $_SESSION['ses_pass'] = 'something';
 $_SESSION['ses_level'] = 'something';

 instead of:
  session_register(ses_name);
  session_register(ses_pass);
  session_register(ses_level);

 All $_SESSION entries are automatically registered.

 See the following for more info
 http://us2.php.net/manual/en/security.registerglobals.php
 http://us2.php.net/manual/en/function.session-register.php

 olinux

 --- shaun [EMAIL PROTECTED] wrote:
 
  Chris Shiflett [EMAIL PROTECTED] wrote in message
 
 news:[EMAIL PROTECTED]
   --- shaun [EMAIL PROTECTED] wrote:
Using the following code I am able to
  authenticate which type of user is
visiting my page, however if I try to log in
  again with a different type
  of
user the session variables still assume that the
  original user was
  logged
in, is there a way to reset the session
  variables, I have tried
session_destroy() and session_unset() but
  without success...
   
?php
require(dbconnect.php);
   
// Assume user is not authenticated
$auth = false;
   
// Formulate the query
$query = SELECT * FROM WMS_User WHERE
  User_Username = '$_POST[username]' AND
  User_Password = '$_POST[password]';
   
// Execute the query and put results in $result
$result = mysql_query( $query )
  or die ( 'Unable to execute query.' );
   
// Get number of rows in $result.
$num = mysql_numrows( $result );
   
if ( $num != 0 ) {
   
 // A matching row was found - the user is
  authenticated.
 $auth = true;
   
 //get the data for the session variables
 $suser_name   = mysql_result($result, 0,
  User_Name);
 $suser_password = mysql_result($result, 0,
  User_Password);
 $stype_level   = mysql_result($result, 0,
  User_Type);
   
 $ses_name  = $suser_name;
 $ses_pass  = $suser_password;
 $ses_level = $stype_level;
   
 session_register(ses_name);
 session_register(ses_pass);
 session_register(ses_level);
  
   This is the moment where you lose your new session
  data. You need to
  register
   your session variables before you use them. At
  this point, PHP retrieves
  the
   session data that is saved for you, and you lose
  all of the stuff you did
   above.
  
   Chris
  
   =
   Become a better Web developer with the HTTP
  Developer's Handbook
   http://httphandbook.org/
 
  sorry but you have lost me, surely the
  session_register(); function is
  storing what I have done above this point, if not
  then how would I store the
  new values instead?
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 


 __
 Do you Yahoo!?
 Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
 http://platinum.yahoo.com



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



[PHP] php auth instead of .htaccess

2003-03-18 Thread Bryan Koschmann - GKT
Hello,

I have gotten used to using .htaccess to protect files/directories, but
now I am looking at a need to authenticate against mysql. I have no
problem actually getting it to authenticate, but I'm wondering what the
simplest way to prevent someone from hitting anything other than the main
page (and not needing authenticate) without having to login at every page.

I'm assuming I would use something with sessions. Does anyone have a quick
sample of how to do this?

Any help would be great, I just need a step or two in the right direction.

Thanks,

Bryan



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



Re: [PHP] User Authentication

2003-03-18 Thread shaun
i have changed the code to:

 //register the session variables
 $_SESSION['ses_name']  = mysql_result($result, 0, User_Name);
 $_SESSION['ses_pass']  = mysql_result($result, 0, User_Password);
 $_SESSION['ses_level'] = mysql_result($result, 0, User_Type);

but if i try to log in again the session variables don't change, any ideas?


Olinux [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 use:
 $_SESSION['ses_name'] = 'something';
 $_SESSION['ses_pass'] = 'something';
 $_SESSION['ses_level'] = 'something';

 instead of:
  session_register(ses_name);
  session_register(ses_pass);
  session_register(ses_level);

 All $_SESSION entries are automatically registered.

 See the following for more info
 http://us2.php.net/manual/en/security.registerglobals.php
 http://us2.php.net/manual/en/function.session-register.php

 olinux

 --- shaun [EMAIL PROTECTED] wrote:
 
  Chris Shiflett [EMAIL PROTECTED] wrote in message
 
 news:[EMAIL PROTECTED]
   --- shaun [EMAIL PROTECTED] wrote:
Using the following code I am able to
  authenticate which type of user is
visiting my page, however if I try to log in
  again with a different type
  of
user the session variables still assume that the
  original user was
  logged
in, is there a way to reset the session
  variables, I have tried
session_destroy() and session_unset() but
  without success...
   
?php
require(dbconnect.php);
   
// Assume user is not authenticated
$auth = false;
   
// Formulate the query
$query = SELECT * FROM WMS_User WHERE
  User_Username = '$_POST[username]' AND
  User_Password = '$_POST[password]';
   
// Execute the query and put results in $result
$result = mysql_query( $query )
  or die ( 'Unable to execute query.' );
   
// Get number of rows in $result.
$num = mysql_numrows( $result );
   
if ( $num != 0 ) {
   
 // A matching row was found - the user is
  authenticated.
 $auth = true;
   
 //get the data for the session variables
 $suser_name   = mysql_result($result, 0,
  User_Name);
 $suser_password = mysql_result($result, 0,
  User_Password);
 $stype_level   = mysql_result($result, 0,
  User_Type);
   
 $ses_name  = $suser_name;
 $ses_pass  = $suser_password;
 $ses_level = $stype_level;
   
 session_register(ses_name);
 session_register(ses_pass);
 session_register(ses_level);
  
   This is the moment where you lose your new session
  data. You need to
  register
   your session variables before you use them. At
  this point, PHP retrieves
  the
   session data that is saved for you, and you lose
  all of the stuff you did
   above.
  
   Chris
  
   =
   Become a better Web developer with the HTTP
  Developer's Handbook
   http://httphandbook.org/
 
  sorry but you have lost me, surely the
  session_register(); function is
  storing what I have done above this point, if not
  then how would I store the
  new values instead?
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 


 __
 Do you Yahoo!?
 Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
 http://platinum.yahoo.com



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



[PHP] PHP Processing Order || Function Calls

2003-03-18 Thread CF High
Hey all.

I was under the impression that PHP processes all php code first before
handing HTML processing over to the browser.

It seems that if you call an external function that, say, queries your db
for data and spits out populated formfields, the function is processed
somehow simultaneously with staright HTML. The result in this case is that
my submit button appears above the formfields! Here's a quick example:

*** global_functions.php 
?
function make_form($sql) {

dbConnect($sql); /* Runs db query */
while ($q = mysql_fetch_array($result)) { $string = input type=text
name=test value=$q[0]; }
return $string;

} ?

*** print_form.php 

? include 'global_functions.php';
$sql = SELECT first_name FROM customers LIMIT 1; ?
$display_form = make_form($sql);
?

form name=test
? echo $display_form; ?
input type=submit value=submit
/form

*** Result 

Submit button on top
Formfields are below submit button



Any info much appreciated.  I'd like to avoid having to pop the submit
button in based on the number of records returned, or other workaround.

Thanks in advance,

--Noah





--




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



Re: [PHP] php auth instead of .htaccess

2003-03-18 Thread Erik Price


Bryan Koschmann - GKT wrote:
Hello,

I have gotten used to using .htaccess to protect files/directories, but
now I am looking at a need to authenticate against mysql. I have no
problem actually getting it to authenticate, but I'm wondering what the
simplest way to prevent someone from hitting anything other than the main
page (and not needing authenticate) without having to login at every page.
I'm assuming I would use something with sessions. Does anyone have a quick
sample of how to do this?
Yes, create a session variable using this syntax:

$_SESSION['logged_in'] = false;

Then authenticate the user.  If the authentication succeeds, then change 
the variable's value to true.

$_SESSION['logged_in'] = true;

Now on every page except your login page, test for the session variable 
before displaying the page.  If it's present and valid, display the page 
as usual, if not, redirect to the login page.

if (isset($_SESSION['logged_in']) 
$_SESSION['logged_in'] == true) {
  // display page
}
else {
  header(Location: http://domain.com/login;);
  exit(Sorry, you are not logged in.);
}
The details are all in the manual under Sessions and Session-related 
functions.

Erik

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


Re: [PHP] PHP Processing Order || Function Calls

2003-03-18 Thread Erik Price


CF High wrote:
Hey all.

I was under the impression that PHP processes all php code first before
handing HTML processing over to the browser.
http://www.php.net/manual/en/ref.outcontrol.php



Erik

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


Re: [PHP] Mailing List Digest

2003-03-18 Thread Pete James
It is sent twice a day and contains all of the messages sent during that 
period.  It's so that you don't get 200+ messages a day in your inbox.

Tom Sommer wrote:
What does the mailing list digest contain, compared to a normal 
subscription? What is the difference?



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


[PHP] strstr() question

2003-03-18 Thread Charles Kline
What is the expected return when using strtr() to compare a string to 
an empty string?

example:

$myval = strstr('bob', '');

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


[PHP] Which is quicker, if-else statements

2003-03-18 Thread Liam Gibbs
Is it just as quick to do:

if($r == 0) {
} else if($r != 0) {
}

than to do:

if($r == 0) {
} else {
}

The reason I like the former method is because, in a large IF-ELSE block, it's clear 
what belongs to what IF and what's going on. But does this make it lag? And, if so, is 
it really all that noticeable?


Re: [PHP] Call to undefined function: mssql_pconnect()

2003-03-18 Thread -{ Rene Brehmer }-
On Tue, 18 Mar 2003 13:44:25 -0500, Miro Kralovic wrote about [PHP] Call
to undefined function: mssql_pconnect()  what the universal translator
turned into this:

Hi all.. I'm trying to connect MSSQL2000 Personal Edition from PHP and 
all I'm getting is Call to undefined function: mssql_pconnect() error..
I have installed PHP4.2.2-4, mod_php-4.2.2, php_devel-4.2.2, 
freetds0.53-4, php-sybase-ct-4.2.2, I think I also have php_ldap and 
php_imap..  restarted server, still nothing... running it on RedHat 7.3..
Is there anything else I have to do to get it running? Like recompilling 
PHP or something? If so, how do I do that? 

Did you remember to uncomment the module references in PHP.INI???

Easiest way is to just search through the file for your module(s)'s
filename(s) and remove the comment ';' markers in front of 'em ... 

Rene

-- 
Rene Brehmer

This message was written on 100% recycled spam.

Come see! My brand new site is now online!
http://www.metalbunny.net

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



Re: [PHP] Sorting Recordset by a calculation between 2 Records

2003-03-18 Thread Erik Price


vernon wrote:
I think that maybe I should explain the fist Zip comes from a session, here 
I've defined the variable. I use the caluation in the code to get the 
distance and then loop the recordset so that the distance is created each 
time the record loops through. I have taken many things from the file and am 
only looking for what we discussed, to sort the records by distance.
I see.  When you have a collection of items, the best place to put them 
is in an array.  I assumed that you were going to be putting them into 
an array anyway, so my solution simply explained a different way of 
putting them into an array so that you would easily be able to determine 
the distance if given any element in the array.

There might be ways to solve your problem without using arrays, but I 
wouldn't waste any time investigating them.  Use arrays for this, that's 
why they exist.

I've CC'd this back onto the list since this kind of discussion can be 
helpful for others who are learning too.

Erik

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


[PHP] nstalling PHP

2003-03-18 Thread Marc Bakker
Hello all,

I installed PHP, Apache and MySQL. I read the install.txt file that came
with php and changed the default values in php.ini and httpd.conf. When I
restart Apache and type my local website (127.0.0.1/index.php) IE comes with
a 'Save file As' dialog box.

Instead of parsing the php code and returning html code, Apache returns the
index.php file!

What did go wrong here

Thanks for any tips,

Marc

Apache 1.3
php 4.3.1
Windows 2000 SP3
mySQL 3.23.55


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



[PHP] Flash book help please

2003-03-18 Thread Daniel McCullough
My wife is a designer, not a technical person.  She is learning Flash and 
she needs a book to learn and learn quickly how to do some things like click 
actions for a project.

Can someone please give me an idea of 2-3 good flash books.

_
The new MSN 8: advanced junk mail protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail

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


RE: [PHP] Flash book help please

2003-03-18 Thread Clint Tredway
Get Foundation Flash MX and Foundation Actionscript from friends of ed.
These are the best for learning Flash.

www.friendsofed.com

Clint

-Original Message-
From: Daniel McCullough [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 18, 2003 2:05 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Flash book help please


My wife is a designer, not a technical person.  She is learning Flash and 
she needs a book to learn and learn quickly how to do some things like click

actions for a project.

Can someone please give me an idea of 2-3 good flash books.

_
The new MSN 8: advanced junk mail protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail


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



Re: [PHP] Which is quicker, if-else statements

2003-03-18 Thread Kevin Stone
Logically the if-else construct is faster becuase PHP doesn't have to parse
and execute the second conditional.  An if-elseif construct is ussually
followed by an else block to describe a default action if no other
conditions are true.  Otherwise you may as well use sequential if()
statements becuase it's exactly the same thing.
- Kevin

- Original Message -
From: Liam Gibbs [EMAIL PROTECTED]
To: php list [EMAIL PROTECTED]
Sent: Tuesday, March 18, 2003 1:02 PM
Subject: [PHP] Which is quicker, if-else statements


Is it just as quick to do:

if($r == 0) {
} else if($r != 0) {
}

than to do:

if($r == 0) {
} else {
}

The reason I like the former method is because, in a large IF-ELSE block,
it's clear what belongs to what IF and what's going on. But does this make
it lag? And, if so, is it really all that noticeable?




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



[PHP] Re: Which is quicker, if-else statements

2003-03-18 Thread Philip Hallstrom
 Is it just as quick to do:

 if($r == 0) {
 } else if($r != 0) {
 }

 than to do:

 if($r == 0) {
 } else {
 }

 The reason I like the former method is because, in a large IF-ELSE
 block, it's clear what belongs to what IF and what's going on. But does
 this make it lag? And, if so, is it really all that noticeable?

I don't know which is actually quicker, but I would guess that the first
case would take longer since it PHP has to evaluate $r != 0 instead of
just doing whatever is in the else { ... } clause.

If you want clarity, why not:

if($r == 0) {
 ...
} else { // $r != 0
}

that gets you the clarity, but keeps PHP from having to evaluate it.

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



  1   2   >