Re: [PHP] Re: your method for validating forms

2003-10-02 Thread Robert Cummings
On Thu, 2003-10-02 at 01:57, Manuel Lemos wrote:
 
 I suppose that you missed the point that the class provides you to do 
 both client side and server side validation in cases that it is possible.
 

[--CROPPED--]

 I don't think that hardware speed will make the Internet connections any 
 faster. A lot of people still use dial-up connections and having to 
 submit a form to let the server tell the user that something is wrong is 
 a needless additional round trip that many times could be avoided and 
 make your site more usable, ie, less annoying for the users.

Personally I find Javascript validation intrusive and ugly. It decreases
my experience and IMHO makes the site less usable *grin*.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Re: your method for validating forms

2003-10-02 Thread Chris Shiflett
--- Robert Cummings [EMAIL PROTECTED] wrote:
 Personally I find Javascript validation intrusive and ugly. It
 decreases my experience and IMHO makes the site less usable *grin*.

I was going to say the same thing. :-)

There are definitely benefits to saving the extra request and response
necessary to properly display errors, but I'm not so sure I would count
usability as one of them. In addition, the user's perception of the site's
general quality and professionalism may be a concern, and a JavaScript popup
certainly doesn't improve this.

Chris

=
My Blog
 http://shiflett.org/
HTTP Developer's Handbook
 http://httphandbook.org/
RAMP Training Courses
 http://www.nyphp.org/ramp

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



Re: [PHP] storing japanese in mysql (or pgsql)

2003-10-02 Thread - Edwin -
On Wed, 1 Oct 2003 09:10:05 -0700
Chris W. Parker [EMAIL PROTECTED] wrote:

 - Edwin - mailto:[EMAIL PROTECTED]
 on Tuesday, September 30, 2003 7:00 PM said:
 
  What exactly do you mean by extended characters? And, do you
  mean all *other* characters are inserted properly? Anyway,... 
 
 I just mean the characters that you can't type unless you do
 something like alt-250, alt-145, etc.

Hmm... these characters can be entered as #250; (for alt-250) and
#145; (for alt-145) and this has nothing to do with your DB being
able to handle Japanese characters...

  If they're not ujis (for euc-jp), add this to your my.cnf
  file:(Under [mysqld] and [client]) 
  
default-character-set = ujis
 
 I added that line to the [mysqld] section but there was no [client]
 section so i added the following.
 
 [client]
 default-character-set = ujis

That's correct.

  Btw, check your php.ini as well and make sure that your settings
  under [mbstring] are correct. 
 
 Each line in the [mbstring] section was commented out. So I
 uncommented them. I also uncommented the mbstring extension.

Hmm... (sounds like you're on Windows) since I don't do Windows, I'm
not really sure if that will work. Under Linux, for example, the
extension should be compiled in... Anyway, just try it. If it doesn't
work, maybe you need to grab a copy of a patched or compiled for
Japanese version of php at http://www.php.gr.jp/project/i18n/ . (I
don't think this is necessary though...)

 I'm just about to restart both servers, so we'll see what happens.
 

Ok.

- E -
__
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!
http://bb.yahoo.co.jp/

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



Re: [PHP] Attempt at putting greedy htmlspecialchars on a diet

2003-10-02 Thread Eugene Lee
On Wed, Oct 01, 2003 at 02:46:14PM -0400, Gerard Samuel wrote:
: 
: When I say that I don't know what characters Im expecting.
: Im not talking about normal html entities, like amp; nbsp lt;
: Im talking about chinese/japanese/korean/taiwanese alphabet, numbers 
: (even punctuation if applicable).
: Maybe Im thinking too hard, but trying to take far east languages 
: alphanumeric charaters into account,
: seems like overkill.
: Feel free to correct me.

Okay, I will.  :-)

There's two issues: input and output.

HTML character references address the problem of displaying certain
characters on a web browser.  This is an output issue.

When you get CJKV data, you are most likely getting it in some encoding.
Different Asian languages use their own encoding sets.  For example, if
you get Japanese text, it will be encoded in JIS, Shift-JIS, EUC, or
something Unicode.  You *have* to determine the type of data and its
encoding.  This is an input issue.

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



[PHP] Repost: PHP,filesys,IIS

2003-10-02 Thread Michael Kochendoerfer
Hi,

does anyone know how to handle file and directory paths on a IIS 5.0 
server? Problem is that the server has multi-domain and each domain has an 
associated 'root' dir below e:\webspaces.

So if one uses relative path strings, an opendir() for example will fail. 
One has to use e:\\webspaces\\root_of_domain_1\\images\\ to access the 
/images folder of the configured domain 1.

I'm sure there are functions and env vars to accomplish this, but I'm quite 
new to PHP and didn't find them yet.

Problem is (I didn't describe it in my former post) that I'm unable to set 
a global document root that is valid for all domains and subdomains. I 
guess the webserver would assemble the path by itself, uniquely for each 
domain, to get the desired result.

Practical example: On one domain, they mix up FrontPage and PHP. Since 
FrontPage doesn't like PHP, they construct one part of the web using 
FrontPage (and its features like so-called 'designs' - which aren't more 
than stylesheets - and common borders - which are simply files in a hidden 
directory '_borders'), and the other part using PHP.
To combine both of them and to make them look almost the same, they could 
include a header and a footer.

Header file/section looks like:

?php
  echo link rel='stylesheet' type='text/css' 
href='_themes/mytheme.css';
  include ./_borders/top.htm;
?

Footer looks similar except for the filename (which is 'bottom.htm' here). 
When included in a .php file at their 'root' level, it works well. But if 
they use a subdir like /scripts, it won't. And changing the include file 
from ./borders/top.htm to /borders/top.htm, PHP puts the complete physical 
path to the left of the filename. But this is not relative to their root :-
(

To recall: Their root level is (physically mapped):

e:\\webspaces\\root_of_domain_1


Hope this has been clear enough to show my problem.

Thanks in advance!

- Michael

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



RE: [PHP] Variables not passed on localhost setup

2003-10-02 Thread Angelo Zanetti
with regard to register_globals being off, what kind of security
implications are there? And what would you define as badly/poorly written
php code?

brush your teeth?? =)

-Original Message-
From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 01, 2003 7:06 PM
To: [EMAIL PROTECTED]; Gal
Subject: Re: [PHP] Variables not passed on localhost setup


From: Gal [EMAIL PROTECTED]


 Reply - this means your php is running on php defaults configuration.
 you need to copy the 'php.ini-dist' file as 'php.ini' to c:\windows.
 edit the the file 'C:\windows\php.ini'
 and change register_globals = Off to register_globals = On

(and restart your web server)

(and make sure you understand the security implications that may arise from
having globals on and poorly written code)

(and brush your teeth)

---John Holmes...

--
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] Variables not passed on localhost setup

2003-10-02 Thread - Edwin -
Hi,

On Thu, 2 Oct 2003 09:26:37 +0200
Angelo Zanetti [EMAIL PROTECTED] wrote:

 with regard to register_globals being off, what kind of security
 implications are there? And what would you define as badly/poorly
 written php code?

Here's a (simple) example:

  http://www.php.net/manual/en/security.registerglobals.php

- E -

__
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!
http://bb.yahoo.co.jp/

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



Re: [PHP] Help with treeview

2003-10-02 Thread - Edwin -
Hi,

On Thu, 2 Oct 2003 15:18:48 +1000
Stephen [EMAIL PROTECTED] wrote:

 Does anyone know how to implement a treeview style display in PHP?

Hmm... what exactly do you mean by treeview? Anyway, *I think* this
is more of a Javascript/HTML question... So, find a site that uses
treeview then study the code.

- E -
__
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!
http://bb.yahoo.co.jp/

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



Re: [PHP] CURL + https

2003-10-02 Thread - Edwin -
Hi,

On Wed, 1 Oct 2003 14:14:11 +0200
Yonatan Ben-Nes [EMAIL PROTECTED] wrote:

 well when i try to work with curl through the shell it work fine
 without any problems more then that when i use the curl with php
 at my server to another page at my server its working fine also,
 just when i try to use it through php it make the problems so i
 think that its installed, or i mistake?

I think, that's exactly why Marek asked this: (Because you're going to
use it WITH php...)

  Did you compile php with openssl support?

See whether your php is compiled with --with-openssl, I think...
(Or, just check curl and openssl support in your phpinfo().)

- E -
__
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!
http://bb.yahoo.co.jp/

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



Re: [PHP] Attempt at putting greedy htmlspecialchars on a diet

2003-10-02 Thread - Edwin -
On Thu, 2 Oct 2003 01:54:43 -0500
Eugene Lee [EMAIL PROTECTED] wrote:

 On Wed, Oct 01, 2003 at 02:46:14PM -0400, Gerard Samuel wrote:
 : 
 : When I say that I don't know what characters Im expecting.
 : Im not talking about normal html entities, like amp; nbsp lt;
 : Im talking about chinese/japanese/korean/taiwanese alphabet,
 numbers : (even punctuation if applicable).
 : Maybe Im thinking too hard, but trying to take far east languages 
 : alphanumeric charaters into account,
 : seems like overkill.
 : Feel free to correct me.
 
 Okay, I will.  :-)
 
 There's two issues: input and output.
 
 HTML character references address the problem of displaying certain
 characters on a web browser.  This is an output issue.
 
 When you get CJKV data, you are most likely getting it in some
 encoding. Different Asian languages use their own encoding sets. 
 For example, if you get Japanese text, it will be encoded in JIS,
 Shift-JIS, EUC, or something Unicode.  You *have* to determine the
 type of data and its encoding.  This is an input issue.

Hmm... but the characters in question were already (at least in the
examples used) in something Unicode (#n;). So, there's really
no need to know whether it's JIS, Shift-JIS, EUC, etc.

?

- E -
__
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!
http://bb.yahoo.co.jp/

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



Re: [PHP] Attempt at putting greedy htmlspecialchars on a diet

2003-10-02 Thread - Edwin -
But,

On Wed, 01 Oct 2003 14:46:14 -0400
Gerard Samuel [EMAIL PROTECTED] wrote:

...[snip]...

 When I say that I don't know what characters Im expecting.
 Im not talking about normal html entities, like amp; nbsp lt;
 Im talking about chinese/japanese/korean/taiwanese alphabet, numbers
 
 (even punctuation if applicable).
 Maybe Im thinking too hard, but trying to take far east languages 
 alphanumeric charaters into account,
 seems like overkill.
 Feel free to correct me.

Far east languages are not necessarily in this form: #n; So,
running htmlspecialchars() on, say, Japanese characters would do NO
harm since , , ', ,  are NOT Japanese characters ;)

Or, am I missing something? :)

- E -
__
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!
http://bb.yahoo.co.jp/

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



Re: [PHP] (another) regex difficulty

2003-10-02 Thread jonas_weber
Am Donnerstag, 02.10.03 um 01:37 Uhr schrieb Cristian Lavaque:
doh, I now understand your question, you don't mean the asterisk 
literally,
but as any character that follows a backslash... sorry -_-
that's right ;) -- anyway, thanks for your effort!

my problem was that i misunderstood the escape-the-meta-char-idea (see 
below).

Am Mittwoch, 01.10.03 um 23:23 Uhr schrieb Curt Zirzow:
'\\' always gets translated to '\'  So the string:

'/(\\)/' translates to '/(\)/' which is an invalid regex, you'll
get a complaint about unclosed paren.
this is also a bit tricky:
echo beg \\ end\n;
echo beg \ end\n;

c) Why do I hate regular expressions so much?
perhaps because you're using them wrong.
klugscheisser ;)

I've answered all 5 of em so far.
thanks, your answers helped a lot!

- jns

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


[PHP] array_diff

2003-10-02 Thread Angelo Zanetti
Hi all,

I am getting some weird results when using the array_diff() function.

eg: $arrayResult = array_diff($array1, $array2);

When i use it the resulting array ($arrayResult) gets the correct number of
elements, however when I echo the elements in $arrayResult it contains some
blank values.

eg:

$array1 = [123] [120] [44] [54]
$array2 = [120] [54]

then when I display $arrayResult:
[123] ... - blank value which should be 44.

According to the manual : Array_diff() returns an array containing all the
values of array1 that are not present in any of the other arguments

it should return [123] and [44]. What is the reason for it being blank??

Angelo Zanetti

Cell No: +27 72 441 3355
Tel No: +27 21 464 1363
Fax No: +27 21 464 1371
e-Mail: [EMAIL PROTECTED]

Z Logic
e-Business Centre
Cape Technikon
P.O. BOX 652
Cape Town
South Africa
8000

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



Re: [PHP] With problem about imagestring() function.

2003-10-02 Thread Jason Wong
On Thursday 02 October 2003 12:52, So-Net wrote:
 I'm using windows XP professional sp1 with IIS5.0
 I installed PHP 4.3.3 with GD 2.0 already.

  It is because I'm a Hong Kong people, so we required to draw some strings
 that is chinese in language. However, imagestring() cannot show it
 properly, so I'm writing to ask whether we can draw the chinese sentence to
 the created image ?

 I have tried to use chinese font, but still failed.

The following works:

  header(Content-type: image/jpeg);
  $im = imagecreate(400,30);
  $white = imagecolorallocate($im, 255,255,255);
  $black = imagecolorallocate($im, 0,0,0);
  // Replace path by your own font path
  imagettftext($im, 20, 0, 10, 20, $black,
   /usr/share/fonts/ttf/big5/bsmi00lp.ttf,
#20445;#35703;#22320;#29699;#24478;#23562;#37325;#29983;#21629;#38283;#22987;);
  imagejpeg($im);
  imagedestroy($im);


-- 
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
--
/*
Arithmetic is being able to count up to twenty without taking off your shoes.
-- Mickey Mouse
*/

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



Re: [PHP] Attempt at putting greedy htmlspecialchars on a diet

2003-10-02 Thread Eugene Lee
On Thu, Oct 02, 2003 at 05:15:32PM +0900, - Edwin - wrote:
: 
: On Thu, 2 Oct 2003 01:54:43 -0500 Eugene Lee [EMAIL PROTECTED] wrote:
:  
:  There's two issues: input and output.
:  
:  HTML character references address the problem of displaying certain
:  characters on a web browser.  This is an output issue.
:  
:  When you get CJKV data, you are most likely getting it in some
:  encoding. Different Asian languages use their own encoding sets. 
:  For example, if you get Japanese text, it will be encoded in JIS,
:  Shift-JIS, EUC, or something Unicode.  You *have* to determine the
:  type of data and its encoding.  This is an input issue.
: 
: Hmm... but the characters in question were already (at least in the
: examples used) in something Unicode (#n;). So, there's really
: no need to know whether it's JIS, Shift-JIS, EUC, etc.

The Chinese characters in question were already converted to their HTML
numeric character references.  That's because someone made the conscious
and purposeful decision to provide the correct Unicode decimal numbers
for those Chinese characters.  Your concern about accepting CJKV data is
vague because you don't explain the source of the data or the encoding
method of the data.  You must determine these critical bits of info
before you can decide how to display the data.  There's no guarantee
that the user will send you CJKV data in nice HTML numeric character
references.  I'm not even sure exactly what you're trying to do.

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



Re: [PHP] PHP Bug Problems

2003-10-02 Thread Eugene Lee
On Wed, Oct 01, 2003 at 07:50:10PM -0700, Richard Baskett wrote:
: 
: Well I saw a post on a forum talking about a certain bug that PHP has for
: Mac OS X.. so I thought.. Im on OS X, I should see if that bug is real since
: on bugs.php.net they say it's bogus which you can view here:
: 
: http://bugs.php.net/bug.php?id=25394

I was able to replicate the problem you saw on my OS X box.  And I
posted a comment on the bug.  Hopefully, my comment won't get deleted
as quickly.  :-)

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



Re: [PHP] array_diff

2003-10-02 Thread Eugene Lee
On Thu, Oct 02, 2003 at 10:44:15AM +0200, Angelo Zanetti wrote:
: 
: I am getting some weird results when using the array_diff() function.
: 
: eg: $arrayResult = array_diff($array1, $array2);
: 
: When i use it the resulting array ($arrayResult) gets the correct number of
: elements, however when I echo the elements in $arrayResult it contains some
: blank values.
: 
: eg:
: 
: $array1 = [123] [120] [44] [54]
: $array2 = [120] [54]
: 
: then when I display $arrayResult:
: [123] ... - blank value which should be 44.

It works for me:

?php
$arr1 = array(123, 120, 44, 54);
$arr2 = array(120, 54);
$arr3 = array_diff($arr1, $arr2);
print_r($arr3);
?

with the output:

Array
(
[0] = 123
[2] = 44
)

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



Re: [PHP] Attempt at putting greedy htmlspecialchars on a diet

2003-10-02 Thread - Edwin -
On Thu, 2 Oct 2003 03:58:48 -0500
Eugene Lee [EMAIL PROTECTED] wrote:

 On Thu, Oct 02, 2003 at 05:15:32PM +0900, - Edwin - wrote:
 : 
 : On Thu, 2 Oct 2003 01:54:43 -0500 Eugene Lee [EMAIL PROTECTED]
 wrote::  
 :  There's two issues: input and output.
 :  
 :  HTML character references address the problem of displaying
 certain:  characters on a web browser.  This is an output issue.
 :  
 :  When you get CJKV data, you are most likely getting it in some
 :  encoding. Different Asian languages use their own encoding sets.
 
 :  For example, if you get Japanese text, it will be encoded in
 JIS,:  Shift-JIS, EUC, or something Unicode.  You *have* to
 determine the:  type of data and its encoding.  This is an input
 issue.: 
 : Hmm... but the characters in question were already (at least in
 the: examples used) in something Unicode (#n;). So, there's
 really: no need to know whether it's JIS, Shift-JIS, EUC, etc.
 
 The Chinese characters in question were already converted to their
 HTML numeric character references.  That's because someone made the
 conscious and purposeful decision to provide the correct Unicode
 decimal numbers for those Chinese characters.  Your concern about
 accepting CJKV data is vague because you don't explain the source of
 the data or the encoding method of the data.

I can't really tell you that since *I* wasn't the OP ;)

 You must determine these critical bits of info
 before you can decide how to display the data.

Unless you know it's already in unicode...

 There's no guarantee
 that the user will send you CJKV data in nice HTML numeric character
 references.

Very true.

 I'm not even sure exactly what you're trying to do.

Again, it's not me ;) (Wrong thread!)

But, I'm wondering as well, I'm not even sure exactly what the
original poster is trying to do. :)

- E -
__
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!
http://bb.yahoo.co.jp/

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



RE: [PHP] array_diff

2003-10-02 Thread Angelo Zanetti
thanx Eugene,

I know what the problem was, firstly that when doing an array_diff the keys
are preserved. Therefore If I was looping through $arrayResult for the count
of elements (in this case 2) then thats where the blank value comes in. SO
therefore if I wanted to get all the values out of the $arrayResult that are
not blank, would I loop through the array the amount of times that there are
elements in the $array1, because $arrayResult will be the same size as
$array1 and also because the keys are preserved?

Im not sure if Im heading in the right direction, with regards to gettig the
values out the $arrayResult.

TIA.


-Original Message-
From: Eugene Lee [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 02, 2003 11:09 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] array_diff


On Thu, Oct 02, 2003 at 10:44:15AM +0200, Angelo Zanetti wrote:
:
: I am getting some weird results when using the array_diff() function.
:
: eg: $arrayResult = array_diff($array1, $array2);
:
: When i use it the resulting array ($arrayResult) gets the correct number
of
: elements, however when I echo the elements in $arrayResult it contains
some
: blank values.
:
: eg:
:
: $array1 = [123] [120] [44] [54]
: $array2 = [120] [54]
:
: then when I display $arrayResult:
: [123] ... - blank value which should be 44.

It works for me:

?php
$arr1 = array(123, 120, 44, 54);
$arr2 = array(120, 54);
$arr3 = array_diff($arr1, $arr2);
print_r($arr3);
?

with the output:

Array
(
[0] = 123
[2] = 44
)

--
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] File download problem using Netscape 7.x

2003-10-02 Thread Ulrich Hacke
Hello,
I have some files on a website which the user can download (e.g. pdf,
zip...). The files sould not bw displayes but the browser should aks the
user what to do (e.g. save it to disk, open it). My code look like this:

header(Content-type: application/octet-stream);
header(Content-disposition: attachment; filename=$userfile);
header(Content-Length: .filesize($userfile));
header(Content-Transfer-Encoding: binary\n);

if($fp = fopen($userfile, rb) fpassthru($fp);

This works fine in most browsers except Netscape 7.x. Here the file is saved
as document.pdf.php instead of document.pdf. Does anyone know how to fix
this? Any help is appreciated.

Yours, Uli

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



RE: [PHP] array_diff [SOLVED]

2003-10-02 Thread Angelo Zanetti


-Original Message-
From: Angelo Zanetti [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 02, 2003 11:28 AM
To: Eugene Lee; [EMAIL PROTECTED]
Subject: RE: [PHP] array_diff


thanx Eugene,

I know what the problem was, firstly that when doing an array_diff the keys
are preserved. Therefore If I was looping through $arrayResult for the count
of elements (in this case 2) then thats where the blank value comes in. SO
therefore if I wanted to get all the values out of the $arrayResult that are
not blank, would I loop through the array the amount of times that there are
elements in the $array1, because $arrayResult will be the same size as
$array1 and also because the keys are preserved?

Im not sure if Im heading in the right direction, with regards to gettig the
values out the $arrayResult.

TIA.


-Original Message-
From: Eugene Lee [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 02, 2003 11:09 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] array_diff


On Thu, Oct 02, 2003 at 10:44:15AM +0200, Angelo Zanetti wrote:
:
: I am getting some weird results when using the array_diff() function.
:
: eg: $arrayResult = array_diff($array1, $array2);
:
: When i use it the resulting array ($arrayResult) gets the correct number
of
: elements, however when I echo the elements in $arrayResult it contains
some
: blank values.
:
: eg:
:
: $array1 = [123] [120] [44] [54]
: $array2 = [120] [54]
:
: then when I display $arrayResult:
: [123] ... - blank value which should be 44.

It works for me:

?php
$arr1 = array(123, 120, 44, 54);
$arr2 = array(120, 54);
$arr3 = array_diff($arr1, $arr2);
print_r($arr3);
?

with the output:

Array
(
[0] = 123
[2] = 44
)

--
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] array_diff

2003-10-02 Thread Eugene Lee
On Thu, Oct 02, 2003 at 11:28:23AM +0200, Angelo Zanetti wrote:
: 
: I know what the problem was, firstly that when doing an array_diff the keys
: are preserved. Therefore If I was looping through $arrayResult for the count
: of elements (in this case 2) then thats where the blank value comes in. SO
: therefore if I wanted to get all the values out of the $arrayResult that are
: not blank, would I loop through the array the amount of times that there are
: elements in the $array1, because $arrayResult will be the same size as
: $array1 and also because the keys are preserved?
: 
: Im not sure if Im heading in the right direction, with regards to gettig the
: values out the $arrayResult.

How about using a foreach() automatically walk the array without having
to worry about the keys?

I wonder if there is a function to re-index an array while preserving
numerical order.  If order is not important, a sort() will re-index the
array.

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



[PHP] MySQL get second row problem

2003-10-02 Thread Joe Harman
Hello... I am having just alittle trouble with this... I know it's
simple... Look at my comment for the problem I am having

?php
mysql_select_db($database_ideation, $ideation);
$query_rsLastL = SELECT * FROM logins WHERE user_id = '$UserID'
ORDER BY `date` DESC;
$rsLastL = mysql_query($query_rsLastL, $ideation) or
die(mysql_error());
$row_rsLastL = mysql_fetch_assoc($rsLastL);
$totalRows_rsLastL = mysql_num_rows($rsLastL);

// Prints the first row... I just want to print just the second row
echo $row_rsLastL['date'];

mysql_free_result($rsLastL);
?

Thanks

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



Re: [PHP] MySQL get second row problem

2003-10-02 Thread Petre Agenbag
Either limit your query to return only the second row ( look in mysql
manual for the limit caluse), or you will need to move the array counter
forward one for the $row_rsLastL = mysql_fetch_assoc($rsLastL)
operation.(php manual under array functions)


On Thu, 2003-10-02 at 12:10, Joe Harman wrote:
 Hello... I am having just alittle trouble with this... I know it's
 simple... Look at my comment for the problem I am having
 
 ?php
   mysql_select_db($database_ideation, $ideation);
   $query_rsLastL = SELECT * FROM logins WHERE user_id = '$UserID'
 ORDER BY `date` DESC;
   $rsLastL = mysql_query($query_rsLastL, $ideation) or
 die(mysql_error());
   $row_rsLastL = mysql_fetch_assoc($rsLastL);
   $totalRows_rsLastL = mysql_num_rows($rsLastL);
   
 // Prints the first row... I just want to print just the second row
   echo $row_rsLastL['date'];
   
   mysql_free_result($rsLastL);
 ?
 
 Thanks

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



RE: [PHP] MySQL get second row problem [Solved]

2003-10-02 Thread Joe Harman
Hey Thanks Petre

Cheers... And a big brain fart



 -Original Message-
 From: Petre Agenbag [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, October 02, 2003 6:17 AM
 To: Joe Harman
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] MySQL get second row problem
 
 
 Either limit your query to return only the second row ( look 
 in mysql manual for the limit caluse), or you will need to 
 move the array counter forward one for the $row_rsLastL = 
 mysql_fetch_assoc($rsLastL) operation.(php manual under array 
 functions)
 
 
 On Thu, 2003-10-02 at 12:10, Joe Harman wrote:
  Hello... I am having just alittle trouble with this... I know it's 
  simple... Look at my comment for the problem I am having
  
  ?php
  mysql_select_db($database_ideation, $ideation);
  $query_rsLastL = SELECT * FROM logins WHERE user_id = 
 '$UserID' 
  ORDER BY `date` DESC;
  $rsLastL = mysql_query($query_rsLastL, $ideation) or 
  die(mysql_error());
  $row_rsLastL = mysql_fetch_assoc($rsLastL);
  $totalRows_rsLastL = mysql_num_rows($rsLastL);
  
  // Prints the first row... I just want to print just the second row
  echo $row_rsLastL['date'];
  
  mysql_free_result($rsLastL);
  ?
  
  Thanks
 
 
 

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



[PHP] Dynamic tables-Change cell colour with drop down menu

2003-10-02 Thread irinchiang

Hi all:

I am doing a dynamic kinda timetable where all the cells are uniquely coloured.
And then for each cell, I would like to change its colour through a dropdown
menu. This dropdown menu should of course have a list of colours for me to
choose. Once I have selected the colour I want, the particular cell colour
should be changed to the colour which i have selected earlier on, once the page
is refreshed. Is there any way to do it using PHP ??I do not want to it using
javascript as java script can only display data on the client side but not the
server side.

Any help given are greatly appreciated.

Regards, 
Irin.

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



RE: [PHP] Dynamic tables-Change cell colour with drop down menu[Scanned]

2003-10-02 Thread Michael Egan
One possible solution:

In the form create the dropdown menu with the colour name being displayed to the user 
but the hexadecimal value of the colour being stored in the value field, i.e.

select name='colour'
option value='#ff'Red/option
/select

When user selects the colour this should give you the colour reference to use when 
displaying the resulting page, i.e. $colour, which you could then use when creating 
the cell in the table - td bgcolor='$colour'

HTH,

Michael Egan

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 02 October 2003 11:40
To: 'PHP General'
Subject: [PHP] Dynamic tables-Change cell colour with drop down
menu[Scanned]



Hi all:

I am doing a dynamic kinda timetable where all the cells are uniquely coloured.
And then for each cell, I would like to change its colour through a dropdown
menu. This dropdown menu should of course have a list of colours for me to
choose. Once I have selected the colour I want, the particular cell colour
should be changed to the colour which i have selected earlier on, once the page
is refreshed. Is there any way to do it using PHP ??I do not want to it using
javascript as java script can only display data on the client side but not the
server side.

Any help given are greatly appreciated.

Regards, 
Irin.

-- 
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] Too many connections fix?

2003-10-02 Thread Raditha Dissanayake
pconnect vs connect: Isn't it  what the apache project calls the 
'stampeding herd' problem?

original question: Nicole one of the simplest, cheapest and best 
solutions is to put your log files on a separate hard disk.  you will be 
amazed by the result.  You would ofcouse get even better results if you 
switched to RAID. (assuming of course that you haven't done so already)

Curt Zirzow wrote:

* Thus wrote Chris Shiflett ([EMAIL PROTECTED]):
 

--- Nicole [EMAIL PROTECTED] wrote:
   

Originally, I used pconnect for a while. Then I learned that with
high traffic site, that's not the best idea.
 

Where did you learn this? I disagree with that notion.
   

This may be debatable, which is better? php searching through a
pool of 1000 connections for a free one or the overhead of opening
a new resource to the database each request.


Curt
 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/  |  http://www.raditha/megaupload/
Lean and mean Secure FTP applet with  |  Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB  |  with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Dynamic tables-Change cell colour with drop down menu

2003-10-02 Thread Marek Kilimajer
[EMAIL PROTECTED] wrote:

I do not want to it using
javascript as java script can only display data on the client side but not the
server side.
You can make the data available on the client side.

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


Re: [PHP] Too many connections fix?

2003-10-02 Thread Raditha Dissanayake
Hi,

Pardon me, looks like i haven't answered the original question after 
all. Need coffee.
Here is another attempt.  Have you considered mysql replication? this is 
an easy way of building both a fail safe system as well as to balance 
the load. the drawback is that you need to pay for an extra server.

best regards.
raditha


Raditha Dissanayake wrote:

pconnect vs connect: Isn't it  what the apache project calls the 
'stampeding herd' problem?

original question: Nicole one of the simplest, cheapest and best 
solutions is to put your log files on a separate hard disk.  you will 
be amazed by the result.  You would ofcouse get even better results if 
you switched to RAID. (assuming of course that you haven't done so 
already)

Curt Zirzow wrote:

* Thus wrote Chris Shiflett ([EMAIL PROTECTED]):
 

--- Nicole [EMAIL PROTECTED] wrote:
  

Originally, I used pconnect for a while. Then I learned that with
high traffic site, that's not the best idea.

Where did you learn this? I disagree with that notion.
  


This may be debatable, which is better? php searching through a
pool of 1000 connections for a free one or the overhead of opening
a new resource to the database each request.


Curt
 





--
Raditha Dissanayake.

http://www.radinks.com/sftp/  |  http://www.raditha/megaupload/
Lean and mean Secure FTP applet with  |  Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB  |  with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] upload security

2003-10-02 Thread Jay Blanchard
[snip]
I have a question concerning security of my file upload script. I'm
using
the php upload routines (move_uploaded_file,...) and variables ($_FILES)
to
upload images to a webdirectory. Everything works fine, meaning that I
can
upload images BUT only if I change the permission of the directory to
which
the uploaded images are moved to 777. I guess that this is not such a
good
thing from security point of view. So here are some questions I have:
[/snip]

You should be relatively safe, and you can probably lower the
permissions to 766 (world-writable drwxrw-rw-) and still be able to
upload. Also, check the owner and group of the file, should be something
like nobody nogroup or nobosy nobody. Your web server should be
operating as nobody which also increases security as nobody can really
do too much if set up properly. Your web host is familiar with all of
these issues, so you should be OK.

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



RE: [PHP] regex drive me crazy

2003-10-02 Thread Ford, Mike [LSS]
On 01 October 2003 21:02, [EMAIL PROTECTED] wrote:

 1. The PHP manual sais to escape the escape char, it has to
 be written
 twice*, but:


Yes, it does.  But it also says that to put a \ into a string, you need to
write it twice (escape it) ***. So:

 $term = preg_replace('/(\\)/', 'backslash $1', $term);
 causes an error** while using three backslashes (see 2.) works.

PHP's string processing replaces that \\ with a single \, so preg_replace
sees the pattern as /(\)/ which is invalid (as it needs the \ to be
escaped, or doubled).

 2.1.
 $term = beg \ end;

Here, because backslash-space is not a valid (PHP) escape sequence, PHP
passes it unchanged.

 print preg_replace('/(\\\)/', 'backslash $1', $term);

But this gets its number of backslahes reduced by one -- the initial \\ is
replaced by \, but then PHP's string processor sees \), which is not a valid
PHP escape sequnce so is passed unchanged -- i.e. as \) .  So preg_replace
sees a pattern of /(\\)/, which now contains a (preg) escape sequence of \\,
validly representing a single \ in the pattern.  And your string contains a
single \ (remember?), so it matches.

 returns: beg backslash \ end
 
 2.2.
 $term = beg \\ end;

This string contains the (PHP) escape sequence \\, which is reduced to a
single \ by php's string processing -- so this $term is, in fact, identical
to the one in 2.1.

 print preg_replace('/(\\\)/', 'backslash $1', $term);
 returns: beg backslash \ end (the same as 2.1.)

QED

 
 2.3.
 $term = beg \\\ end;
 print preg_replace('/(\\\)/', 'backslash $1', $term);
 returns: beg backslash \backslash \ end

And here, the string in $term has its triple \\\ reduced to double \\ (by
the same reasoning as before), and the pattern is (as before) matching a
single backslash.  So each of the two backslashes in $term is replaced by
backslash, a space, and the matched \, giving your result.  Again, QED.

The real trick here is that there are *two* levels of \-escaping going on --
PHP's string processing does one, and the regex interpreter does a second.
So to write an absolutely guaranteed cast-iron regex fragment that will
match a single backslash, you actually have to include *four* backslashes in
your PHP script:

preg_replace('/()/', ...)

PHP's string processing will reduce the four backslashes to two in the
actual string passed to preg_replace, and then the regex interpreter will
treat the \\ so passed as a valid escape sequence to match a single \.  This
is called backslash proliferation, or leaning toothpick syndrome.

Why is it important to use all four backslashes, even when three seems to do
it?  Well, consider this:

preg_replace(/\\\test/, ...)

Here, the first two \\ will be reduced to \ (ok), but the next two
characters, \t, are the PHP escape sequence for a tab character (oops!), so
your string will end up containing a \, a tab, and the three characters est
-- probably not what was intended!

Hope this helps you build your regexes better.  Personally, my approach is
often to write my regex without bothering to escape any backslashes, then go
through putting in the required regex escapes, and then go through again
putting in the PHP string escapes.  And if I need to decipher a regex which
has leaning toothpick syndrome, I tend to cut'n'paste it into a text editor,
and then go through it manually doing the replaces in the way that I've
described them above.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP] regex drive me crazy

2003-10-02 Thread Ford, Mike [LSS]
Ooops, forgot the footnote:

***
http://www.php.net/manual/en/language.types.string.php#language.types.string
.syntax

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



[PHP] PHP Editor

2003-10-02 Thread Nico Berg
Hi there,

I am pretty new in PHP coding. So for starters i want to know what is a good
php-editor?
I like them freeware for windows.

Greeting and thanks in advance,
Nico

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



Re: [PHP] multi uploads permissions

2003-10-02 Thread Raditha Dissanayake
Hi,
you can either use the chown function in php syntax:
|int chown|(string filename, mixed user);
or use backticks (`) to call the system chown executable. The simplest 
way however might be to ask your sysadmin to set the umask for you.

best regards

Cameron Metzke wrote:

Hi all,
I have a multi upload script, which works, but the end result is that the
files that are uploaded are set to permissions of 600. Im think this is
because they have a tmp name then are written to the uploads folder so in
effect they are written by another system user? (lol ok so im new to php not
sure if i followed that myself). well here is the script.
---Start Code--
$where_to_go = $path./home/user/uploader/originals/; //with trailing slash
  if (!$Submit)
  {
while (list ($key, $value) = each ($_FILES['file']['tmp_name']))
{
umask(000);
$ok = (move_uploaded_file($_FILES['file']['tmp_name'][$key], $where_to_go .
$_FILES['file']['name'][$key]));
--End Code---
is there anyway to set the permissions to 777 as i would like to further
manipulate the images? and is that a good idea? or would it be better to
chown them, (which i have no idea how to do via php). Or does anyone have
any other ideas im completely stumped.
Thankyou
Cam
 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/  |  http://www.raditha/megaupload/
Lean and mean Secure FTP applet with  |  Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB  |  with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] PHP Bug Problems

2003-10-02 Thread Jay Blanchard
[snip]

So I tried it out.. at first I created a loop that assigned $x = 1; a whole
bunch of times, but that didn¹t crash anything.. .. 7996 

Well to make an already long story short.. it looks like after a couple of
hours bugs.php.net has removed my post.

My question to you is.. is there any reason why they would remove my post?
[/snip]

Because it is not a bug, it is bad code design! 8000+ lines of $x = 1; is just 
downright goofy! Did you happen to try it with 8000+ repeated blocks of any other 
type? My bet is that it would quit then too. 
:)

?php

$i = 0;

while($i  12000){
$x = 1;
$i++;
}
echo $x . \n;
?

No crash.

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



RE: [PHP] PHP Session not working

2003-10-02 Thread Jay Blanchard
[snip]
We are facing some problems in using sessions in our applications.
Recently 
we have moved our web site to a new Apache server (1.3). We have
installed 
PHP on this server. But sessions are not working on this server. The
values 
in the session variables are not carried forward to the consequent
pages.
PHP Module entry in httpd.conf file: LoadModule php4_module 
modules/mod_php4-4.3.2.so

The same scripts  web site are working fine on a similar Apache server
and 
same version of PHP.
[/snip]

*sigh* Check register_globals in your php.ini. It is probably off (by
default). Please change it to 'on' and restart your web server. Then
make sure all of your code is tightly written so as to prevent possible
harm.

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



RE: [PHP] PHP Editor

2003-10-02 Thread Jay Blanchard
[snip]
I am pretty new in PHP coding. So for starters i want to know what is a
good
php-editor?
I like them freeware for windows.
[/snip]

EDIT for windows is great, it's free, it's already installed and it
requires that you do no additional searching of manuals, archives, or
the web to use. Click Start-Run. Type command and hit enter. When the
command prompt arrives type 'edit' and hit enter. Voila! A windows
freeware editing too. You can even use it for batch files, PERL, ASP,
and several other languages.

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



[PHP] Do not use Apache 2.0 and PHP in a production environment neither on Unix nor on Windows.

2003-10-02 Thread Dave Restall - System Administrator
Hi,

not sure if this is the right place to ask but does anybody have any ideas
how long it will be before PHP/Apache 2 is considered stable enough to be
used in a production environment ?.  I set up a test box with them both on
nearly a year ago and the online documentation still cautions against use.

Are the problems with Apache or are they with PHP or is it a bit of both ?
Will PHP5 be any better ?

Regards,


Dave
mail/php/2003-10-01.tx php-general
++
| Dave Restall,   IIRC Limited, PO Box 46, Skelton, Cleveland, TS12 2GT. |
| Tel. +44 (0) 1287 639309 Mob. +44 (0) 7973 831245 Fax. +44 (0) 1287 635955 |
| email : [EMAIL PROTECTED]   [EMAIL PROTECTED] Web : http://www.iirc.net |
++
| I cannot conceive that anybody will require multiplications at the rate|
| of 40,000 or even 4,000 per hour ...   |
| -- F. H. Wales (1936)  |
++

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



[PHP] datediff in php

2003-10-02 Thread bob pilly
Hi all
 
Does anyone know if there is a date difference function in php? I have searched the 
manual but found none. What im after is a function that will return the number of days 
or seconds between a start date and a second date. Much like DATEDIFF in ms sql. Any 
help or pointing to relevant docs would be greatly appreciated.
 
Thanks in advance.
 
Bob


-
Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger

RE: [PHP] datediff in php

2003-10-02 Thread Jay Blanchard
[snip]
Does anyone know if there is a date difference function in php? I have
searched the manual but found none. What im after is a function that
will return the number of days or seconds between a start date and a
second date. Much like DATEDIFF in ms sql. Any help or pointing to
relevant docs would be greatly appreciated.
[/snip]

Going to http://www.php.net/date and searching the page for datediff
revealed a function written by a member of the PHP community. Here is
that post;

matthijs at schoolnews dot nl
18-May-2003 06:59 
I first used the VERY easy way to calculate date differences, but since
I had to calculate 250+ differences, the execution time exceeded 30
seconds cause of all the loops. So I added a few improvements to fasten
up the function, no more loops :)

?
function dateDiff($row){
$s = $row[nu] - $row[lastpost]; 

$m = intval($s/60);
$s = $s % 60;

$h = intval($m/60);
$m = $m % 60;

$d = intval($h/24);
$h = $h % 24;

$diff = ; 
if ( !$d == 0 ) { 
$diff = $diff . $d days ; 
} if ( !$h == 0 ) { 
$diff = $diff . $h hours ; 
} if ( !$m == 0 ) { 
$diff = $diff . $m minutes ; 
} if ( !$s == 0 ) { 
$diff = $diff . $s seconds ; 
} if ( $diff ==  ) { 
$diff = -; 
} 
trim ($diff); 

return $diff;
}
? 

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



RE: [PHP] PHP Editor

2003-10-02 Thread Jay Blanchard
[snip]
I have the Dutch translation of the php-bible and they write:
Use the right tool, don't let anybody tell you you need notepad or tools
like that, use a proper tool.

Are they dumm? Is it better to use a tool like emacs, notepad, edit or
someting like that?
The advice Visual Slickedit but that is 30 mb and cost 50$.
[/snip]

Zend Studio - http://www.zend.com

But, you wanted freeware for windows, right? Programmers File Editor is
free

http://www.lancs.ac.uk/people/cpaap/pfe/

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



RE: [PHP] upapck() woes

2003-10-02 Thread Jay Blanchard
[snip]
Have you tried using the unpack() function ?

If you don't know the format of the original data it can be a long
process
undoing it :)
[/snip]

Thanks Tom, I was experimenting with the unpack() function...your stuff
definitely will help. I'll keep you updated if I run across anything
earth shattering.

Thanks!

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



[PHP] include() problems

2003-10-02 Thread Gustave Bernier
Hi everyone,

I'm new to PHP and I'm trying to use the include function but with no 
success... My server's ini file is  set as (allow_url_fopen, 0) so I'm 
having some trouble to pass different values for the php file I'm calling. 
The address is: http://mydomain.com/forums/ssi.php?a=active

The code I'm trying now is:
$_GET['a'] = 'active';
include('forums/ssi.php');
When I use this code I have no error, ssi.php is loaded but nothing is done 
(I believe the a value isn't passed to ssi.php) and the page where the 
include is stops loading just after the include().

What's the problem??? How can I pass values to a php file from another 
file???

Thanks,

 GuTa

_
MSN Messenger: instale grátis e converse com seus amigos. 
http://messenger.msn.com.br

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


[PHP] Re: include() problems

2003-10-02 Thread Dennis Sterzenbach
Gustave Bernier [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi everyone,

 I'm new to PHP and I'm trying to use the include function but with no
 success... My server's ini file is  set as (allow_url_fopen, 0) so I'm
 having some trouble to pass different values for the php file I'm
calling.
 The address is: http://mydomain.com/forums/ssi.php?a=active

 The code I'm trying now is:
 $_GET['a'] = 'active';
 include('forums/ssi.php');

 When I use this code I have no error, ssi.php is loaded but nothing is
done
 (I believe the a value isn't passed to ssi.php) and the page where
the
 include is stops loading just after the include().

You don't pass the value to that file, you simply tell the preprocessor
of PHP to copy the contents of forums/ssi.php file into the source
code before executing the script. You do NOT call the ssi.php by that!
As you are stating you want to call
http://mydomain.com/forums/ssi.php?a=active
why are you including the file in there?

The statement about allow_url_fopen, 0 setting controls access to
remote-resources, so if you are allowed to do something like
fopen(http://...;)
or include(http://..;).
Thus it doesn't have anything to do with your include.

--
 Dennis Sterzenbach
 www.darknoise.de

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



Re: [PHP] PHP Bug Problems

2003-10-02 Thread Richard Baskett
on 10/2/03 5:12 AM, Jay Blanchard at [EMAIL PROTECTED]
wrote:

 [snip]
 
 So I tried it out.. at first I created a loop that assigned $x = 1; a whole
 bunch of times, but that didn¹t crash anything.. .. 7996
 
 Well to make an already long story short.. it looks like after a couple of
 hours bugs.php.net has removed my post.
 
 My question to you is.. is there any reason why they would remove my post?
 [/snip]
 
 Because it is not a bug, it is bad code design! 8000+ lines of $x = 1; is just
 downright goofy! Did you happen to try it with 8000+ repeated blocks of any
 other type? My bet is that it would quit then too.
 :)
 
 ?php
 
 $i = 0;
 
 while($i  12000){
 $x = 1;
 $i++;
 }
 echo $x . \n;
 ?
 
 No crash.

Yeah no crash because that's only a couple lines of code :)  And yeah it
doesn¹t matter what you have in there just as long as you have that many
lines.. 

I didn't try include files, but apparently that counts as lines of codes
also.. so 8000+ total lines.. I agree, but it does crash and apparently the
guy that found the bug does write that many lines of code.. don't ask me.. I
don't know why :)

Rick

There are only two ways to live your life. One is as though nothing is a
miracle. The other is as though everything is a miracle. - Albert Einstein

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



RE: [PHP] PHP Bug Problems

2003-10-02 Thread Jay Blanchard
[snip]
 Because it is not a bug, it is bad code design! 8000+ lines of $x = 1; is just
 downright goofy! Did you happen to try it with 8000+ repeated blocks of any
 other type? My bet is that it would quit then too.

Yeah no crash because that's only a couple lines of code :)  And yeah it
doesn¹t matter what you have in there just as long as you have that many
lines.. 

I didn't try include files, but apparently that counts as lines of codes
also.. so 8000+ total lines.. I agree, but it does crash and apparently the
guy that found the bug does write that many lines of code.. don't ask me.. I
don't know why :)
[/snip]

You said you looped - I created a loop that assigned $x = 1; a whole bunch of times

But anyhow, I digress. We have several files that exceed 8000 (we try not to write 
them that big, but YMMV) lines of code that there are no problems with. My bet is that 
it has to do with memory amount and allocation, which would explain differences 
between yours and his.

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



[PHP] Hosting ADDR.com (0t)

2003-10-02 Thread Ryan A
Hi everyone,
Anyone else here hosting with ADDR.com?
I am hosting with them and all of a sudden they seem to have disappeared!!!

When i type http://addr.com i go to verisigns damn search page

Both the domains with them still seem to be up and functioning but cant send
mail from my php scripts there and having trouble getting mail too.

Anybody else having problems or know how i can contact them??

Excuse this mail coz I know this is terribly off topic but am a bit
desperate coz i just opened the site yesterday and invited quite a few
companies to register and now the new sites giving me problems.

Kindly reply,
-Ryan A

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



Re: [PHP] need PHP server

2003-10-02 Thread The Doctor
On Thu, Sep 25, 2003 at 05:22:44PM +0700, Hung Cuong wrote:
 I need an server to put my php file to post mail.
 So anybody can introduce me some server
 Thanks.


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

-- 
Member - Liberal International  On 11 Sept 2001 the WORLD was violated.
This is [EMAIL PROTECTED]   Ici [EMAIL PROTECTED]
Society MUST be saved! Extremists must dissolve.  
Ontario on 2 Octo 2003, VOTE LIBERAL!!

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



RE: [PHP] Help with treeview

2003-10-02 Thread Craig Lonsbury
This should get you started...

http://www.sitepoint.com/article/1105/1

it is a great article assuming that you will be using a db to
store your data. 

hth,
Craig

-Original Message-
From: Stephen [mailto:[EMAIL PROTECTED]
Sent: October 1, 2003 11:19 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Help with treeview


Does anyone know how to implement a treeview style display in PHP?

Thanks,

Stephen

-- 
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] Hosting ADDR.com (0t)

2003-10-02 Thread Dan Joseph
Hi,

I'm getting to their page ok.  Nice page really.  purple and green, has
their prices, etc..  they're probably hosting with Verisign, and Verisign
had an issue temporarily.

-Dan Joseph

 -Original Message-
 From: Ryan A [mailto:[EMAIL PROTECTED]
 Sent: Thursday, October 02, 2003 10:10 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Hosting ADDR.com (0t)


 Hi everyone,
 Anyone else here hosting with ADDR.com?
 I am hosting with them and all of a sudden they seem to have
 disappeared!!!

 When i type http://addr.com i go to verisigns damn search page

 Both the domains with them still seem to be up and functioning
 but cant send
 mail from my php scripts there and having trouble getting mail too.

 Anybody else having problems or know how i can contact them??

 Excuse this mail coz I know this is terribly off topic but am a bit
 desperate coz i just opened the site yesterday and invited quite a few
 companies to register and now the new sites giving me problems.

 Kindly reply,
 -Ryan A

 --
 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] Hosting ADDR.com (0t)

2003-10-02 Thread Ryan A
Thanks guys,
Cant understand why i cant seem to get to them for the past 2 days.

Yes, very nice site and no problem with them so far except that they are
running an old version of MySql 3.xx instead of 4.

Any ideas please mail me.

Cheers,
-Ryan



We will slaughter you all! - The Iraqi (Dis)information ministers site
http://MrSahaf.com


- Original Message - 
From: CPT John W. Holmes [EMAIL PROTECTED]
To: Ryan A [EMAIL PROTECTED]
Sent: Thursday, October 02, 2003 4:14 PM
Subject: Re: [PHP] Hosting ADDR.com (0t)


 The page comes up just fine for me.

 John

 - Original Message - 
 From: Ryan A [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, October 02, 2003 10:09 AM
 Subject: [PHP] Hosting ADDR.com (0t)


  Hi everyone,
  Anyone else here hosting with ADDR.com?
  I am hosting with them and all of a sudden they seem to have
 disappeared!!!
 
  When i type http://addr.com i go to verisigns damn search page
 
  Both the domains with them still seem to be up and functioning but cant
 send
  mail from my php scripts there and having trouble getting mail too.
 
  Anybody else having problems or know how i can contact them??
 
  Excuse this mail coz I know this is terribly off topic but am a bit
  desperate coz i just opened the site yesterday and invited quite a few
  companies to register and now the new sites giving me problems.
 
  Kindly reply,
  -Ryan A
 
  -- 
  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] PHP Bug Problems

2003-10-02 Thread Richard Baskett
on 10/2/03 7:00 AM, Jay Blanchard at [EMAIL PROTECTED]
wrote:

 [snip]
 Because it is not a bug, it is bad code design! 8000+ lines of $x = 1; is
 just
 downright goofy! Did you happen to try it with 8000+ repeated blocks of any
 other type? My bet is that it would quit then too.
 
 Yeah no crash because that's only a couple lines of code :)  And yeah it
 doesn¹t matter what you have in there just as long as you have that many
 lines.. 
 
 I didn't try include files, but apparently that counts as lines of codes
 also.. so 8000+ total lines.. I agree, but it does crash and apparently the
 guy that found the bug does write that many lines of code.. don't ask me.. I
 don't know why :)
 [/snip]
 
 You said you looped - I created a loop that assigned $x = 1; a whole bunch of
 times
 
 But anyhow, I digress. We have several files that exceed 8000 (we try not to
 write them that big, but YMMV) lines of code that there are no problems with.
 My bet is that it has to do with memory amount and allocation, which would
 explain differences between yours and his.

Well actually yes I did say:

 So I tried it out.. at first I created a loop that assigned $x = 1; a whole
 bunch of times, but that didn¹t crash anything..

But then I went on and said:

 I then read the authors post a little closer and I realized it was a number of
 lines problem.. so I created a php file that had a whole bunch of $x = 1;
 commands in it.. 7996 to be exact.. add the opening and closing php tag.. that
 made 7998 lines.. the script still worked.. Now I added one more line so that
 there were 7999 lines and guess what?  Yep you got it.. my script didn¹t work
 anymore.  

And apparently it only happens on OS X boxes as the author said in the bugg
report http://bugs.php.net/bug.php?id=25394.. so if you're on an OS X box
then Im not sure why it works for you and every single person that has
tested it on an OS X box so far it hasn¹t worked.. I would be very curious
as to how you built your php on your OS X box.. and to figure out the
difference..

Maybe we'll figure this thing out! :)

Rick

Until you have learned to be tolerant with those who do not always agree
with you; until you have cultivated the habit of saying some kind word of
those whom you do not admire; until you have formed the habit of looking for
the good instead of the bad there is in others, you will be neither
successful nor happy. - Napolean Hill

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



[PHP] Create from PHP on the Fly???

2003-10-02 Thread Jeffrey Fitzgerald

Can this be done?  How much $$$?  Quality of PDF??   Thanks very much...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Help with treeview

2003-10-02 Thread Ray Hunter
 Does anyone know how to implement a treeview style display in PHP?

PEAR has a treeview that I have used in the past and it works fine.

http://pear.php.net/package/HTML_TreeMenu

--
BigDog

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



Re: [PHP] datediff in php

2003-10-02 Thread Eugene Lee
On Thu, Oct 02, 2003 at 01:36:04PM +0100, bob pilly wrote:
:  
: Does anyone know if there is a date difference function in php? I have
: searched the manual but found none. What im after is a function that
: will return the number of days or seconds between a start date and a
: second date. Much like DATEDIFF in ms sql. Any help or pointing to
: relevant docs would be greatly appreciated.

The easiest solution is to convert both dates into Unix timestamps.
Then the difference between the two timestamps is simply the number of
seconds between between both dates.

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



Re: [PHP] Create from PHP on the Fly???

2003-10-02 Thread Raditha Dissanayake
how many glasses of beer? apples or oranges? is it raining out side? you 
are welcome.

Jeffrey Fitzgerald wrote:


Can this be done?  How much $$$?  Quality of PDF??   Thanks very 
much...




--
Raditha Dissanayake.

http://www.radinks.com/sftp/  |  http://www.raditha/megaupload/
Lean and mean Secure FTP applet with  |  Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB  |  with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Create from PHP on the Fly???

2003-10-02 Thread Dennis Sterzenbach
Jeffrey Fitzgerald [EMAIL PROTECTED] wrote:


 Can this be done?  How much $$$?  Quality of PDF??   Thanks very
much...

WTF are you talking about?
If you are talking about PDF: google is your friend.

--
 Dennis

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



Re: [PHP] Create from PHP on the Fly???

2003-10-02 Thread Robert Cummings
On Thu, 2003-10-02 at 10:36, Jeffrey Fitzgerald wrote:
   
 Can this be done?  How much $$$?  Quality of PDF??   Thanks very much...

Yes it can. Depends on the chosen solution. Depends on the chosen
solution. An easy to use system is htmldoc which can convert HTML
content to a PDF. This doesn't support forms or CSS though. So if you
need forms you'll need to use one of the other, more than likely lower
level solutions:

http://www.easysw.com/htmldoc/
http://www.php.net/manual/en/ref.pdf.php
http://www.webxd.com/zipguy/freepdf.htm

I think there's more, but you can feel free to do your own google query
lazy bum :/

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Very first web app and questions

2003-10-02 Thread David T-G
Mike --

...and then [EMAIL PROTECTED] said...
% 
% I've just to put together my very first little web application project in
% PHP and I have a couple of questions.

Yay!  Good for you :-)


% 
...
% The second question is the real one. Because this site may eventually be
% put onto the web as an unmoderated site, I was wondering what would be the
% best way to test the users input for inappropriate content (Bad words). I

I'd probably use preg_replace with an array of bad words; it's fast and
clean.


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

2003-10-02 Thread Jeff McKeon
Hey all, 

I'm building a website that will pull data from mysql db.  No problem
there. I've got a page to create users and store their info in a user
table on another db.  What I want to be able to do is have a user log in
and then only have access to view information that his profile allows.

I'm not quite sure how to do this however so I'm looking for advise to
point me in the right direction.  I suspect, that once validated via the
login page, I need to store the users permissions in a session variable
and then before each page loads, check to see if the page's permission
requierments match the user requirements stored in the session's
variable.  Is this correct? Are there any security risks with this as
this sight may one day be internet accessable.  If this isn't the
correct approach, what is?

Thanks,

Jeff

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



[PHP] How to know wheter a message will be logged or not

2003-10-02 Thread Zak Mc Kracken
Hi all,

I'm using syslog() function to log messages. My problem is enough
typical. An example:
syslog ( LOG_DEBUG, The function output is:  . very_slow_func () );

Since very_slow_func() is, as written, very slow, I would like to know
in advance if this message will be actually logged or not, so that I
could write:
if ( is_logged ( LOG_DEBUG ) )
  syslog ( LOG_DEBUG, The function output is:  . very_slow_func () );
I cannot find in PHP some is_logged() equivalent.

Any help?

Thanks.

Marco Brandizi

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


RE: [PHP] Do not use Apache 2.0 and PHP in a production environme nt neither on Unix nor on Windows.

2003-10-02 Thread Johnson, Kirk
 -Original Message-
 From: Dave Restall - System Administrator [mailto:[EMAIL PROTECTED]

 how long it will be before PHP/Apache 2 is considered stable 
 enough to be
 used in a production environment ?.

Below is how Rasmus answered this question back on 7/4/03.

Kirk



Apache2 has a number of different modes it can work in.  These modes are
called MPM's.  The default MPM is called Worker which is a multithreaded
model.  PHP, mod_perl, mod_python, and any other similar technology which
links directly into the httpd processes will need to be perfectly
threadsafe and reentrant to work effectively with a threaded Apache2 mpm.
This is doable for the core of PHP, but there are literally hundreds of
3rd party libraries that can be linked into PHP and nobody whether or not
these libraries are threadsafe.  And figuring out if a specific library is
threadsafe or not is non-trivial and it can very from one platform to
another.  And just to make it even harder, this stuff will appear to work
fine until you put it under load or hit very specific race conditions
which makes it nearly impossible to debug.

So, since we can't tell you for sure that a threaded Apache2 mpm + PHP
will work we do not suggest you use it for a production server.  And since
we can't know for sure, none of the main PHP developers use this
combination for our own servers which compounds the problem because it is
not receiving anywhere near the amount of realworld testing required to
work out all the little issues above and beyond this threading unknown.

There is an Apache2 mpm, called prefork, which isn't threaded and
basically makes Apache2 look like Apache1.  But hey, we have a very good
server already that looks like Apache1.

In the end I don't see Apache2+PHP ever becoming a production platform
with the current architecture.  The only way I see it ever working is to
pull PHP out of Apache and use a fastcgi approach.  Or, with time, perhaps
we will learn how to make sure a library is perfectly threadsafe and safe
to use in a multithreaded Apache2.

For now, I really see no reason not to simply use Apache1 if you want a
robust, fast and stable web server.

-Rasmus

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



RE: [PHP] User authentication

2003-10-02 Thread Dan Joseph
Hi,

 I'm not quite sure how to do this however so I'm looking for advise to
 point me in the right direction.  I suspect, that once validated via the
 login page, I need to store the users permissions in a session variable
 and then before each page loads, check to see if the page's permission
 requierments match the user requirements stored in the session's
 variable.  Is this correct? Are there any security risks with this as
 this sight may one day be internet accessable.  If this isn't the
 correct approach, what is?

Yes, you will need to set some session variables to hold any information
you want to check.  Make sure you do not store sensitive information in
those though.  In a site I just built, we are only storing the user's name,
user id number, and access level.  The site then checks every 60 seconds to
see if they are idle.  I track the session login times in a mysql table, and
have it do the math on how long they've been idle.  This isn't really a
common method from what I've seen though, and your security requirements
might be a bit different.  Our client wants the the site to log the EU out
if they've been idle for 15 minutes.  Some people just let PHP time out the
session, then when they go to click on something, it boots them back to the
login page.

Just remember to check for an active session each time a secure page loads.
Otherwise you'll have people bypassing login page.

For restricting what is shown on the page, there are many methods.  IF
structures, etc, just make sure are checking their access against what is
shown.

Does that help?

-Dan Joseph

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



[PHP] RE: if..else condition for checkbox

2003-10-02 Thread Rob A. Brahier
Irin,
Quite a number of issues here, actually.  We'll start with your question
and work from there.  Using the checkbox input type=checkbox
name=Cheque value=Cheque as an example, the code you would use to check
if it was set is:

if($_GET['Cheque'] == 'Cheque') {
// The Cheque checkbox was checked.
} else {
// The Cheque checkbox was NOT checked.
}


I cannot see why you would need an if...else if...else structure here
unless you only wanted to see if the Cash, Nets, OR Cheque checkbox was
selected. In that case I would use radio buttons instead of checkboxes and
give them all the same name, e.g.
input type=radio name=paymentType value=Cash
input type=radio name=paymentType value=Nets
input type=radio name=paymentType value=Cheque

Then do something like:

if($_GET['paymentType'] == 'Cash') {
// The Cash checkbox was checked.
} else if($_GET['paymentType'] == 'Nets') {
// The Nets checkbox was NOT checked.
} else {
// This must be the Cheque radio button.
}


Now a couple of caveats in your script:

You are using the GET method to send form data, which is fine.  Just be
careful when sending large forms, as there is a limit on the amount of data
you can send using GET.  I recommend using the POST method instead because
you can set the MAX_POST_SIZE in your php.ini file.

Next:
Cash: ?php echo $$_GET[cheque];?BR
This code fragment and others like it in your script are problematic.
$$_GET['cheque'] is actually saying Give me the value stored in
$_GET['cheque'], use that as a variable name, and retrieve the value stored
in that new variable.  In simplified code this would look like:

?php
$_GET['cheque'] = 'foo';
$foo = 'bar';
echo $_GET['cheque']; // Returns 'foo';
echo $$_GET['cheque']; // Returns 'bar';
?

If you don't want the extra dollar sign to be interpreted then do something
like this:
Cash: ?php echo \$$_GET[cheque];?BR

Next, your array index name MUST be surrounded by either single or double
quotes unless it is a number or a constant.  If you don't, PHP assumes you
are actually asking for the value stored in a constant named 'cheque'.
Thus, your code becomes this:
Cash: ?php echo \$$_GET['cheque'];?BR

Lastly, PHP really likes array variables to be enclosed in curly braces when
they are used within a string.  This means one final change:
Cash: ?php echo \$${_GET['cheque']};?BR

I hope that answered your question!

-Rob


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 01, 2003 11:04 PM
To: [EMAIL PROTECTED]
Subject: if..else condition for checkbox



Hi all,
   May I just ask how do I do a if..elseif..else condition to check if
a
checkbox have been checked. For some reference, I have attached my HTML
code
and  PHP code below:

HTML:
html
head
titlePayment Mode/title
style type=text/css
@import url(receipt.css);
/style
/head
body
form action=checkbox.php method=get
brbrbr
div id=pagecontent1
div class=sectionheading
Payment Mode:br
/div
  div class=lighter
  input type=checkbox name=Cash value=Cash Cashbr
  /div
  div class=darker
  input type=checkbox name=Nets value=NetsNetsbr
  /div

  div class=lighter
  input type=checkbox name=Cheque
value=ChequeChequebr/divbr
div class=sectionheading
*For Cheque plus Cash payment only:
/div
 div class=lighter
Cheque: $ input name=cheque type=text size=6 maxlength=6br
/div
div class=darker
Cash:   $ input name=cash type=text size=6
maxlength=6br/divbr

input type=submit name=submit value=submit align=center
/div
/form
/form
/body/html


PHP Code:
HTML
HEAD
titlePayment Mode/title
style type=text/css
@import url(receipt.css);
/style
/HEAD
BODY
brbr
div id=pagecontent1
div class=sectionheading
br
tr
td valign=top class=darker width=200
?php
}
?
?php echo Payment Mode:Cash Plus Cheque; ?
br
/div
/td
  Cash: ?php echo $$_GET[cheque];?BR
  Cheque:?php echo $$_GET[cash];?BR


   br
   ?php
   $total = $_GET[cheque] + $_GET[cash];
   $total=number_format($total, 2, .,  );

echo BRTotal payable: $$totalBRBR;
?
/div
/BODY
/HTML

Regards,
Irin.

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



Re: [PHP] Re: include() problems

2003-10-02 Thread Gustave Bernier
Thanks for answering.

I'm trying to include that file because in my index page because it has many 
functions I need to use in other pages... I'm on ADDR.com servers and I 
can't set allow_url_fopen to 1 (it sucks!).
In ssi.php functions are called by accessing this address: 
http://mydomain.com/forums/ssi.php?a=active
So how can I possibly include that page (ssi.php?a=active) on any of my 
pages???

From: Dennis Sterzenbach [EMAIL PROTECTED]
Reply-To: Dennis Sterzenbach [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP] Re: include() problems
Date: Thu, 2 Oct 2003 15:34:26 +0200
Gustave Bernier [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi everyone,

 I'm new to PHP and I'm trying to use the include function but with no
 success... My server's ini file is  set as (allow_url_fopen, 0) so I'm
 having some trouble to pass different values for the php file I'm
calling.
 The address is: http://mydomain.com/forums/ssi.php?a=active

 The code I'm trying now is:
 $_GET['a'] = 'active';
 include('forums/ssi.php');

 When I use this code I have no error, ssi.php is loaded but nothing is
done
 (I believe the a value isn't passed to ssi.php) and the page where
the
 include is stops loading just after the include().
You don't pass the value to that file, you simply tell the preprocessor
of PHP to copy the contents of forums/ssi.php file into the source
code before executing the script. You do NOT call the ssi.php by that!
As you are stating you want to call
http://mydomain.com/forums/ssi.php?a=active
why are you including the file in there?
The statement about allow_url_fopen, 0 setting controls access to
remote-resources, so if you are allowed to do something like
fopen(http://...;)
or include(http://..;).
Thus it doesn't have anything to do with your include.
--
 Dennis Sterzenbach
 www.darknoise.de
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
_
MSN Messenger: instale grátis e converse com seus amigos. 
http://messenger.msn.com.br

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


RE: [PHP] User authentication

2003-10-02 Thread Jeff McKeon
Dan,

That's great help and exactly what I'd like to do timeouts and all.  I
now just need to figure out he mechanics of the code for it and get a
better understanding of sessions.  I'm thinking in the user table I'll
have a bunch of boolean fields for different permissions that apply to
different pages etc.  To keep it simple at first I'll just have two
permissions read only and edit.  Read only users will not be allowed
to access pages where they can edit data.

How do you check for idle?  I suppose there is a built in variable that
you check against the value in the table.  How do I pull up or refer to
session variables?

Thank,

Jeff

 -Original Message-
 From: Dan Joseph [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, October 02, 2003 11:15 AM
 To: php
 Subject: RE: [PHP] User authentication
 
 
 Hi,
 
  I'm not quite sure how to do this however so I'm looking 
 for advise to 
  point me in the right direction.  I suspect, that once 
 validated via 
  the login page, I need to store the users permissions in a session 
  variable and then before each page loads, check to see if 
 the page's 
  permission requierments match the user requirements stored in the 
  session's variable.  Is this correct? Are there any security risks 
  with this as this sight may one day be internet accessable. 
  If this 
  isn't the correct approach, what is?
 
   Yes, you will need to set some session variables to 
 hold any information you want to check.  Make sure you do not 
 store sensitive information in those though.  In a site I 
 just built, we are only storing the user's name, user id 
 number, and access level.  The site then checks every 60 
 seconds to see if they are idle.  I track the session login 
 times in a mysql table, and have it do the math on how long 
 they've been idle.  This isn't really a common method from 
 what I've seen though, and your security requirements might 
 be a bit different.  Our client wants the the site to log the 
 EU out if they've been idle for 15 minutes.  Some people just 
 let PHP time out the session, then when they go to click on 
 something, it boots them back to the login page.
 
   Just remember to check for an active session each time 
 a secure page loads. Otherwise you'll have people bypassing 
 login page.
 
   For restricting what is shown on the page, there are 
 many methods.  IF structures, etc, just make sure are 
 checking their access against what is shown.
 
   Does that help?
 
 -Dan Joseph
 
 -- 
 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] embedding code

2003-10-02 Thread John Taylor-Johnston
Are there other ways of embedding ?php ? or ? ? code into an HTML file? On one 
project, when I try to upolad files with embedded PHP code, they actually filter for 
those tags and won't permit the FTP transfer. Like reeeal paranoid. Any ideas?

John

-
Université de Sherbrooke:
http://compcanlit.ca/

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



[PHP] Re: include() problems

2003-10-02 Thread Dennis Sterzenbach

 I'm trying to include that file because in my index page
 because it has many
 functions I need to use in other pages... I'm on ADDR.com
 servers and I
 can't set allow_url_fopen to 1 (it sucks!).

 In ssi.php functions are called by accessing this address:
 http://mydomain.com/forums/ssi.php?a=active
 So how can I possibly include that page (ssi.php?a=active) on
 any of my
 pages???
In my oppinion, if these files you need the include for aren't
on the same server as mydomain.com or even cannot access the
root where mydomain.com got placed (like they cannot do an
include by include '/home/web/com/mydomain/forums/ssi.php'),
you will never have any chance of doing so.
Due to allow_url_fopen being disabled, you cannot include
files from remote.

But just to be sure we're talking about the same problem:
You try to get the SOURCE CODE of the script
http://mydomain.com/forums/ssi.php?a=active
to use it as part of another, say
http://mydomain.co.uk/forum.php ?

If you are talking about including it in
http://mydomain.com/forum.php , simply adjust the forum.php
code to have :

?php
 ...
$a = $_GET['a'];
include 'forums/ssi.php';
 ...
?

Regards
  Dennis

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



RE: [PHP] User authentication

2003-10-02 Thread Dan Joseph
Hi,

 That's great help and exactly what I'd like to do timeouts and all.  I
 now just need to figure out he mechanics of the code for it and get a
 better understanding of sessions.  I'm thinking in the user table I'll
 have a bunch of boolean fields for different permissions that apply to
 different pages etc.  To keep it simple at first I'll just have two
 permissions read only and edit.  Read only users will not be allowed
 to access pages where they can edit data.

 How do you check for idle?  I suppose there is a built in variable that
 you check against the value in the table.  How do I pull up or refer to
 session variables?

Sessions are stored in the $_SESSION array.  A simple check would be:

if ($_SESSION['user_id'] ==  || is_null($_SESSION['user_id']))
redirect_to_index_function();

Where 'user_id' is, that would be the name of the session you created.
Just insert that at the top of each page (might be best suited in an include
file).

-Dan Joseph

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



[PHP] Reloading a specific window

2003-10-02 Thread Rich Fox
Warning for server side purists: My php scripts use javascript to popup and
close windows. So this question, although posted to a php newsgroup, has
elements of javascript too. Gasp! No flames please.

I have a main window which I will refer to as mainwindow
(window.name='mainwindow' in the onload event). The script loaded into it is
mainListing.php. From mainListing.php I popup another window, with a form
and a save button. The form's action is action.php

In action.php I update the database and then would like to: (1) refresh
mainwindow so it reflects the database changes, and (2) close the popup
window.

I have been reading, tweaking, trying different things but nothing is
working. Currently, the action script does:
...
elseif (isset($_POST['btnSave']))
{
   .. update the database, then ...
header(Location: .$_POST['CallingScript'].?ID=.$_POST['ID']);
exit;
}
...

This reloads the popup window, and then I have a close button to close the
popup. Then I have to refresh the browser window manually to see the updated
table from the database. Can I get some advice on how to accomplish (1) and
(2) above?

Many thanks,

Rich

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



RE: [PHP] User authentication

2003-10-02 Thread Dan Joseph
Hi,

 How do you check for idle?  I suppose there is a built in variable that
 you check against the value in the table.  How do I pull up or refer to
 session variables?

Additionally, I also check to see if the date_out column in my sessions
table is -00-00 00:00:00, if not, I boot 'em and do a
session_destroy();.

-Dan Joseph

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



Re: [PHP] How to know wheter a message will be logged or not

2003-10-02 Thread Marek Kilimajer
Current version of PHP cannot forsee the future, this will be worked on 
when PHP5 is out and stabilized.

Untill then you have to make your own judgments, for example if the 
array you feed into very_slow_func() has more then 1486 elements, your 
code will time out.

Zak Mc Kracken wrote:

Hi all,

I'm using syslog() function to log messages. My problem is enough
typical. An example:
syslog ( LOG_DEBUG, The function output is:  . very_slow_func () );

Since very_slow_func() is, as written, very slow, I would like to know
in advance if this message will be actually logged or not, so that I
could write:
if ( is_logged ( LOG_DEBUG ) )
  syslog ( LOG_DEBUG, The function output is:  . very_slow_func () );
I cannot find in PHP some is_logged() equivalent.

Any help?

Thanks.

Marco Brandizi

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


RE: [PHP] User authentication

2003-10-02 Thread Jeff McKeon
Thanks for the advise! It's a big help.
I'll go play now and come back with more intelligent questions later!

Jeff

 -Original Message-
 From: Dan Joseph [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, October 02, 2003 11:32 AM
 To: Jeff McKeon; Dan Joseph; php
 Subject: RE: [PHP] User authentication
 
 
 Hi,
 
  That's great help and exactly what I'd like to do timeouts 
 and all.  I 
  now just need to figure out he mechanics of the code for it 
 and get a 
  better understanding of sessions.  I'm thinking in the user 
 table I'll 
  have a bunch of boolean fields for different permissions 
 that apply to 
  different pages etc.  To keep it simple at first I'll just have two 
  permissions read only and edit.  Read only users will not be 
  allowed to access pages where they can edit data.
 
  How do you check for idle?  I suppose there is a built in variable 
  that you check against the value in the table.  How do I pull up or 
  refer to session variables?
 
   Sessions are stored in the $_SESSION array.  A simple 
 check would be:
 
   if ($_SESSION['user_id'] ==  || 
 is_null($_SESSION['user_id'])) redirect_to_index_function();
 
   Where 'user_id' is, that would be the name of the 
 session you created. Just insert that at the top of each page 
 (might be best suited in an include file).
 
 -Dan Joseph
 
 
 

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



RE: [PHP] User authentication

2003-10-02 Thread Jeff McKeon
What is stored in the date_out column?  Is that one of the colums in
your own created table or a standard one?

Jeff

 -Original Message-
 From: Dan Joseph [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, October 02, 2003 11:34 AM
 To: php
 Subject: RE: [PHP] User authentication
 
 
 Hi,
 
  How do you check for idle?  I suppose there is a built in variable 
  that you check against the value in the table.  How do I pull up or 
  refer to session variables?
 
   Additionally, I also check to see if the date_out 
 column in my sessions table is -00-00 00:00:00, if not, I 
 boot 'em and do a session_destroy();.
 
 -Dan Joseph
 
 -- 
 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] User authentication

2003-10-02 Thread Curt Zirzow
* Thus wrote Dan Joseph ([EMAIL PROTECTED]):
 Hi,
 
  That's great help and exactly what I'd like to do timeouts and all.  I
  now just need to figure out he mechanics of the code for it and get a
  better understanding of sessions.  I'm thinking in the user table I'll
  have a bunch of boolean fields for different permissions that apply to
  different pages etc.  To keep it simple at first I'll just have two
  permissions read only and edit.  Read only users will not be allowed
  to access pages where they can edit data.
 
  How do you check for idle?  I suppose there is a built in variable that
  you check against the value in the table.  How do I pull up or refer to
  session variables?
 
   Sessions are stored in the $_SESSION array.  A simple check would be:
 
   if ($_SESSION['user_id'] ==  || is_null($_SESSION['user_id']))
 redirect_to_index_function();
 
   Where 'user_id' is, that would be the name of the session you created.
 Just insert that at the top of each page (might be best suited in an include
 file).

I would suggest a require(), that way if the file can't be included
the script will fail at the require.


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



RE: [PHP] User authentication

2003-10-02 Thread Dan Joseph
Hi,

 What is stored in the date_out column?  Is that one of the colums in
 your own created table or a standard one?

That's the SQL table that I use to track sessions.  Its one I created.  I
have a functon that does a simple SQL query:

SELECT date_out FROM sessions WHERE user_id = 12

Then I check to see if if date_out != -00-00 00:00:00 and log them out
if it doesn't.  This method is both good and bad.  (1) I have a master log
of all user logins.  (2) I can force a user to log out.  Overall, it was
just more work on the sessions.  I guess I'd recommend this method if you
have to keep strong security in mind.

-Dan Joseph

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



RE: [PHP] embedding code

2003-10-02 Thread spectre013
Try 
script language=php

//php Code here 


/script

Or if you have asp tags turned on you can use

% %

Hth

-
Thank You 
Brian Paulson
Sr. Web Developer
[EMAIL PROTECTED]
www.chieftain.com
1-800-279-6397
-

-Original Message-
From: John Taylor-Johnston [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 02, 2003 9:17 AM
To: [EMAIL PROTECTED]
Subject: [PHP] embedding code


Are there other ways of embedding ?php ? or ? ? code into an HTML
file? On one project, when I try to upolad files with embedded PHP code,
they actually filter for those tags and won't permit the FTP transfer.
Like reeeal paranoid. Any ideas?

John


-
Université de Sherbrooke:
http://compcanlit.ca/

-- 
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] Create from PHP on the Fly???

2003-10-02 Thread Jay Blanchard
[snip]
Can this be done?  How much $$$?  Quality of PDF??   Thanks very
much...
[/snip]

You mean PDF creation on the fly using PHP? It's free. Start here ...

http://us3.php.net/PDF

There are some good PDF creation classes out there, such as FPDF

http://www.fpdf.org

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



Re: [PHP] Reloading a specific window

2003-10-02 Thread Marek Kilimajer
Output from action.php:
script
opener.location.reload();
close();
/script
Rich Fox wrote:
Warning for server side purists: My php scripts use javascript to popup and
close windows. So this question, although posted to a php newsgroup, has
elements of javascript too. Gasp! No flames please.
I have a main window which I will refer to as mainwindow
(window.name='mainwindow' in the onload event). The script loaded into it is
mainListing.php. From mainListing.php I popup another window, with a form
and a save button. The form's action is action.php
In action.php I update the database and then would like to: (1) refresh
mainwindow so it reflects the database changes, and (2) close the popup
window.
I have been reading, tweaking, trying different things but nothing is
working. Currently, the action script does:
...
elseif (isset($_POST['btnSave']))
{
   .. update the database, then ...
header(Location: .$_POST['CallingScript'].?ID=.$_POST['ID']);
exit;
}
...
This reloads the popup window, and then I have a close button to close the
popup. Then I have to refresh the browser window manually to see the updated
table from the database. Can I get some advice on how to accomplish (1) and
(2) above?
Many thanks,

Rich

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


Re: [PHP] Reloading a specific window

2003-10-02 Thread Rich Fox
This does not work, when I replace my header function with:
elseif (isset($_POST['btnSave']))
{
.. database update, then...
$ostr =  OUTPUT;
 script language=javascript
  document.window.opener.reload()
  self.parent.close();
 /script
OUTPUT;
 echo $ostr;
 //header(Location: .$_POST['CallingScript'].?ID=.$_POST['ID']);
 exit;
}

several things happen: the database update does not happen, the mainwindow
does not reload, and my form disappears from the popup frame and this frame
is blank.
I am probably doing something very stupid.

Marek Kilimajer wrote
 Output from action.php:
 script
 opener.location.reload();
 close();
 /script

 Rich Fox wrote:
  Warning for server side purists: My php scripts use javascript to popup
and
  close windows. So this question, although posted to a php newsgroup, has
  elements of javascript too. Gasp! No flames please.
 
  I have a main window which I will refer to as mainwindow
  (window.name='mainwindow' in the onload event). The script loaded into
it is
  mainListing.php. From mainListing.php I popup another window, with a
form
  and a save button. The form's action is action.php
 
  In action.php I update the database and then would like to: (1) refresh
  mainwindow so it reflects the database changes, and (2) close the popup
  window.
 
  I have been reading, tweaking, trying different things but nothing is
  working. Currently, the action script does:
  ...
  elseif (isset($_POST['btnSave']))
  {
 .. update the database, then ...
  header(Location: .$_POST['CallingScript'].?ID=.$_POST['ID']);
  exit;
  }
  ...
 
  This reloads the popup window, and then I have a close button to close
the
  popup. Then I have to refresh the browser window manually to see the
updated
  table from the database. Can I get some advice on how to accomplish (1)
and
  (2) above?
 
  Many thanks,
 
  Rich
 

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



[PHP] Getting many virii the last time

2003-10-02 Thread Dennis Sterzenbach
Hello to all I am receiving many virii through
the different PHP mailinglists I use to read
and post in.

Could the lists administrators please review
that problem?
i.e. my ISP told me that I receive quite a lot
Worm.Gibe.F and I see they seem to be coming
from PHP mailinglists.

If you would like to know the mailing addresses
I report them.

Thanks in advance!

--
 Dennis Sterzenbach

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



RE: [PHP] Re: your method for validating forms

2003-10-02 Thread Chris W. Parker
Chris Shiflett mailto:[EMAIL PROTECTED]
on Wednesday, October 01, 2003 11:18 PM said:

 There are definitely benefits to saving the extra request and response
 necessary to properly display errors, but I'm not so sure I would
 count usability as one of them. In addition, the user's perception of
 the site's general quality and professionalism may be a concern, and
 a JavaScript popup certainly doesn't improve this.

I went to an ecom site today that used js validation but in a very slick
way. There were no popups to be seen. Instead, when I tried to add a
product to my cart without specifying some attributes a little red
message magically appeared on the page that said Please choose a
color.

A client-side validation class would be usable imo if it doesn't utilize
popups. Not being experienced with js I can imagine that not using
popups and still warning the customer of a mistake would be complicated.

I prefer server-side but that's mainly just because I don't like js.



Chris.

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



RE: [PHP] PHP Editor

2003-10-02 Thread Chris W. Parker
Nico Berg mailto:[EMAIL PROTECTED]
on Thursday, October 02, 2003 5:09 AM said:

 I am pretty new in PHP coding. So for starters i want to know what is
 a good php-editor?
 I like them freeware for windows.

HTML-Kit www.chami.com



c.

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



RE: [PHP] User authentication

2003-10-02 Thread Jeff McKeon
Ok,

I've got a login page that has these funtions to set the userid and
password to session variables

[code start]
session_start();
if(!isset($userid)) {
login_form();
exit;
}
else {
session_register(userid, userpassword);
$username = auth_user($userid, $userpassword);
if(!$username) {
session_unregister(userid);
session_unregister(userpassword);
echo Authorization failed.  . 
 You must enter a valid userid and password
combo.  .
 Click on the following link to try
again.BR\n;
echo A HREF=\$PHP_SELF\login/ABR;
echo If you do not have login, please contact
Operations to obtain one.br\n;
exit;
}
else echo welcome, $username!;
}
[code end]

I then have a simple test page with the following code...

[code start]
?php
include ./register_functions.php;

if($_SESSION['userid'] == 'bob'){
Echo $_SESSION['userid'];
EchoAccess Denied Bobby boy!!!;
}
else {
echoOK, since it's not Bob, it's ok;
}
html_footer();
[code end]

The problem is that the $_SESSION['userid'] doesn't return anything on
this page..
Am I not calling the session variable correctly or not storing it
correctly?
In my php.ini I have globals turned off.  Does this effect it?

Thanks,

Jeff


 -Original Message-
 From: Dan Joseph [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, October 02, 2003 11:39 AM
 To: php
 Subject: RE: [PHP] User authentication
 
 
 Hi,
 
  What is stored in the date_out column?  Is that one of the 
 colums in 
  your own created table or a standard one?
 
   That's the SQL table that I use to track sessions.  Its 
 one I created.  I have a functon that does a simple SQL query:
 
   SELECT date_out FROM sessions WHERE user_id = 12
 
   Then I check to see if if date_out != -00-00 
 00:00:00 and log them out if it doesn't.  This method is both 
 good and bad.  (1) I have a master log of all user logins.  
 (2) I can force a user to log out.  Overall, it was just more 
 work on the sessions.  I guess I'd recommend this method if 
 you have to keep strong security in mind.
 
 -Dan Joseph
 
 -- 
 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] User authentication

2003-10-02 Thread Dan Joseph
Hi,

 The problem is that the $_SESSION['userid'] doesn't return anything on
 this page..
 Am I not calling the session variable correctly or not storing it
 correctly?
 In my php.ini I have globals turned off.  Does this effect it?

Hi, yeah, its my understanding (and someone can correct me if I am wrong..)
that if you have that turned off, then you can't use session_register().
Instead, do $_SESSION['userid'] = 10; and see if that works.

-Dan Joseph

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



RE: [PHP] include() problems

2003-10-02 Thread Chris W. Parker
Gustave Bernier mailto:[EMAIL PROTECTED]
on Thursday, October 02, 2003 6:20 AM said:

 The address is: http://mydomain.com/forums/ssi.php?a=active
 
 The code I'm trying now is:
 $_GET['a'] = 'active';
 include('forums/ssi.php');

You're including the parent file in itself. This could be the problem.



c.

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



RE: [PHP] User authentication

2003-10-02 Thread Ford, Mike [LSS]
On 02 October 2003 17:27, Jeff McKeon wrote:

 Ok,
 
 I've got a login page that has these funtions to set the userid and
 password to session variables
 
 [code start]
 session_start();
   if(!isset($userid)) {
   login_form();
   exit;
 }
 else {
   session_register(userid, userpassword);
   $username = auth_user($userid, $userpassword);
   if(!$username) {
   session_unregister(userid);
   session_unregister(userpassword);
   echo Authorization failed.  .
You must enter a valid userid and password
 combo.  .
Click on the following link to try
 again.BR\n;
   echo A HREF=\$PHP_SELF\login/ABR;
   echo If you do not have login, please contact
 Operations to obtain one.br\n;
   exit;
   }
   else echo welcome, $username!;
 }
 [code end]
 
 I then have a simple test page with the following code...
 
 [code start]
 ?php
 include ./register_functions.php;
 
 if($_SESSION['userid'] == 'bob'){
   Echo $_SESSION['userid'];
   EchoAccess Denied Bobby boy!!!;
   }
   else {
   echoOK, since it's not Bob, it's ok;
   }
 html_footer();
 [code end]
 
 The problem is that the $_SESSION['userid'] doesn't return anything
 on this page.. Am I not calling the session variable correctly or not
 storing it correctly? In my php.ini I have globals turned off.  Does
 this effect it? 

(1) I don't see a session_start() on the second page (unless it's in
register_functions.php?).

(2) I would advise not mixing $_SESSION and session_register() -- it's
problematical in some situations.  Just stick to using the $_SESSION array.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



Re: [PHP] include() problems

2003-10-02 Thread Chris Sherwood

-- snip --
From: Chris W. Parker [EMAIL PROTECTED]
 The address is: http://mydomain.com/forums/ssi.php?a=active
 
 The code I'm trying now is:
 $_GET['a'] = 'active';
 include('forums/ssi.php');

You're including the parent file in itself. This could be the problem.
--SNIP -- 


especially if the ssi.php is not a class

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



RE: [PHP] User authentication

2003-10-02 Thread Dan Joseph
Hi,

 (1) I don't see a session_start() on the second page (unless it's in
 register_functions.php?).

Old habbits die hard.  You have no idea how many times I forget to put this
at the top of a page.  Thanks for pointing that out.

-Dan Joseph

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



Re: [PHP] Too many connections fix?

2003-10-02 Thread Alister
On Wed, 1 Oct 2003 21:17:09 -0700 (PDT)
Chris Shiflett [EMAIL PROTECTED] wrote:

 --- Nicole [EMAIL PROTECTED] wrote:
  So I switched to connect, with no luck in fixing the too many
  connections problem.
 
 Now that's some helpful information. The first thing you need to do is
 forget about persistent connections being the problem.
 
 I don't claim to be an expert at debugging MySQL issues such as this,
 but I have always found Jeremy Zawodny's mytop to be a very handy
 tool:
 
 http://jeremy.zawodny.com/mysql/mytop/

You problem may well be that 100 apache processes * dozens of tables =
thousands of open mysql-connected threads, and they are not being closed
for a default 8 HOURS.  You can see them in PhpMyAdmin's process list.

You'll want something like this in your mysql.ini file to reduce the time-outs:
[mysqld]
set-variable=   max_connections=750
set-variable=   wait_timeout=60
set-variable=   thread_cache_size=40
# after 60 secs, expire any waiting threads
# but keep up to 40 available in a cache for easy re-use.

JZ mentions thread caching here:
http://jeremy.zawodny.com/blog/archives/000173.html

Running a PHP cache like PHP Accellerator will also help, so the PHP
isn't being reparsed all the time as well.

Alister

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



[PHP] Getting the FULL path

2003-10-02 Thread zavaboy
How do I get my FULL path... I made a web-based installer and it uses a
path.

Ok, my path to where I need it is:
/home/jimbug/public_html/zavaboy/phptest/ZML

Using dirname():
/phptest/ZML

Why is that?
How can I get PHP to output '/home/jimbug/public_html/zavaboy/phptest/ZML'
automatically?

-- 

- Zavaboy
[EMAIL PROTECTED]
www.zavaboy.com

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



Re: [PHP] Getting the FULL path

2003-10-02 Thread Jason Wong
On Friday 03 October 2003 01:33, zavaboy wrote:
 How do I get my FULL path... I made a web-based installer and it uses a
 path.

 Ok, my path to where I need it is:
 /home/jimbug/public_html/zavaboy/phptest/ZML

 Using dirname():
 /phptest/ZML

 Why is that?

If you're saying:

  echo dirname(); // outputs: /phptest/ZML

then you've got a bug in your copy of PHP.

 How can I get PHP to output '/home/jimbug/public_html/zavaboy/phptest/ZML'
 automatically?

All the info you need should be in $_SERVER.

-- 
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
--
/*
NT (as in Windows NT) is short for Nothing There.
*/

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



Re: [PHP] Getting the FULL path

2003-10-02 Thread J Morton
$_SERVER['SCRIPT_FILENAME'] or $_SERVER['DOCUMENT_ROOT']

Justin

zavaboy wrote:

 How do I get my FULL path... I made a web-based installer and it uses a
 path.

 Ok, my path to where I need it is:
 /home/jimbug/public_html/zavaboy/phptest/ZML

 Using dirname():
 /phptest/ZML

 Why is that?
 How can I get PHP to output '/home/jimbug/public_html/zavaboy/phptest/ZML'
 automatically?

 --

 - Zavaboy
 [EMAIL PROTECTED]
 www.zavaboy.com

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

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



Re: [PHP] Getting the FULL path

2003-10-02 Thread zavaboy
Ok, thanks!
$_SERVER['DOCUMENT_ROOT'].dirname($PHP_SELF)
was just what I wanted!

J Morton [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 $_SERVER['SCRIPT_FILENAME'] or $_SERVER['DOCUMENT_ROOT']

 Justin

 zavaboy wrote:

  How do I get my FULL path... I made a web-based installer and it uses a
  path.
 
  Ok, my path to where I need it is:
  /home/jimbug/public_html/zavaboy/phptest/ZML
 
  Using dirname():
  /phptest/ZML
 
  Why is that?
  How can I get PHP to output
'/home/jimbug/public_html/zavaboy/phptest/ZML'
  automatically?
 
  --
 
  - Zavaboy
  [EMAIL PROTECTED]
  www.zavaboy.com
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php

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



RE: [PHP] User authentication

2003-10-02 Thread Jeff McKeon

 
 On 02 October 2003 17:27, Jeff McKeon wrote:
 
  Ok,
  
  I've got a login page that has these funtions to set the userid and 
  password to session variables
  
  [code start]
  session_start();
  if(!isset($userid)) {
  login_form();
  exit;
  }
  else {
  session_register(userid, userpassword);
  $username = auth_user($userid, $userpassword);
  if(!$username) {
  session_unregister(userid);
  session_unregister(userpassword);
  echo Authorization failed.  .
   You must enter a valid userid and password
  combo.  .
   Click on the following link to try
  again.BR\n;
  echo A HREF=\$PHP_SELF\login/ABR;
  echo If you do not have login, please contact
  Operations to obtain one.br\n;
  exit;
  }
  else echo welcome, $username!;
  }
  [code end]
  
  I then have a simple test page with the following code...
  
  [code start]
  ?php
  include ./register_functions.php;
  
  if($_SESSION['userid'] == 'bob'){
  Echo $_SESSION['userid'];
  EchoAccess Denied Bobby boy!!!;
  }
  else {
  echoOK, since it's not Bob, it's ok;
  }
  html_footer();
  [code end]
  
  The problem is that the $_SESSION['userid'] doesn't return 
 anything on 
  this page.. Am I not calling the session variable correctly or not 
  storing it correctly? In my php.ini I have globals turned 
 off.  Does 
  this effect it?
 
 (1) I don't see a session_start() on the second page (unless 
 it's in register_functions.php?).
 

OK, including session_start(); at the top of the test_auth.php page
worked.

 (2) I would advise not mixing $_SESSION and 
 session_register() -- it's problematical in some situations.  
 Just stick to using the $_SESSION array.
 

I'm not quite sure what you mean here, can you give an example or
elaborate.  Sorry, real newbie here... :o)

Thanks,

Jeff

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



Re: [PHP] User authentication

2003-10-02 Thread Jason Wong
On Friday 03 October 2003 01:50, Jeff McKeon wrote:

  (2) I would advise not mixing $_SESSION and
  session_register() -- it's problematical in some situations.
  Just stick to using the $_SESSION array.

 I'm not quite sure what you mean here, can you give an example or
 elaborate.  Sorry, real newbie here... :o)

Examples and elaboration:

  manual  Session handling functions

-- 
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
--
/*
According to all the latest reports, there was no truth in any of the
earlier reports.
*/

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



RE: [PHP] User authentication

2003-10-02 Thread Jeff McKeon
 Hi,
 
  What is stored in the date_out column?  Is that one of the 
 colums in 
  your own created table or a standard one?
 
   That's the SQL table that I use to track sessions.  Its 
 one I created.  I have a functon that does a simple SQL query:
 
   SELECT date_out FROM sessions WHERE user_id = 12
 
   Then I check to see if if date_out != -00-00 
 00:00:00 and log them out if it doesn't.  This method is both 
 good and bad.  (1) I have a master log of all user logins.  
 (2) I can force a user to log out.  Overall, it was just more 
 work on the sessions.  I guess I'd recommend this method if 
 you have to keep strong security in mind.
 

So when a user logs in you write a user_id and datestamp to a field in
your sessions table.  Every time the person accesses a page you update
the datestamp in that record.  Then you run a function that checks every
X minutes if the timestamp is older than X minutes and if so you log the
person out?  Is this correct?  How exactly do you log them out?  By
issuing a command to clear the session variables saved during login,
thus causing function on each page that checks for valid login to fail?

Thanks,

Jeff

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



[PHP] passing form information.

2003-10-02 Thread Payne
Hi,

I am working a form to pass information from it to mysql data.  I am 
able to connect to the database. But nothing is being pass from the form 
to the php page.  This is my php code...

-form.html

html
head
   titleUntitled/title
/style
/head
body
form name=form1 method=post action=addlead.php
input name=title type=text size=40
input name=f_name type=text size=40
input name=l_name type=text size=40
input type=submit name=Submit value=Submit Information
/form
/body
/html
--addleads.php--
?
include(./config.php);

$sql = INSERT INTO $table_name
   (leads_id, title, f_name, l_name)
   VALUES
   ('$leads_id', \$title\, \$f_name\, \$l_name\);
//debug tool  

print $sql;

$result = mysql_query($sql, $connection) or
   die (Couldn't execute query.);
?
html
head
   titleUntitled/title
/style
/head
body
? echo $title ?
br
? echo $f_name ?
br
? echo $l_name
---

What I am getting this

INSERT INTO leads (leads_id, title, f_name, l_name) VALUES ('', , , )

*Salutation*

	

*First Name*

	

*Last Name*

As you can see nothing is being pass...is there some other command 
beside the print $sql statement to see why nothing is being passed.

Thanks.

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


Re: [PHP] User authentication

2003-10-02 Thread Jason Wong
On Friday 03 October 2003 01:59, Jeff McKeon wrote:

 So when a user logs in you write a user_id and datestamp to a field in
 your sessions table.  Every time the person accesses a page you update
 the datestamp in that record.  Then you run a function that checks every
 X minutes if the timestamp is older than X minutes and if so you log the
 person out?  Is this correct? 

Wrong order. First, check whether timestamp is past it's sell by date, if so 
destroy the session then redirect them to the login page, otherwise refresh 
the timestamp.

 How exactly do you log them out?  By
 issuing a command to clear the session variables saved during login,
 thus causing function on each page that checks for valid login to fail?

Yes. session_destroy().

-- 
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
--
/*
How do I love thee?  My accumulator overflows.
*/

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



  1   2   >