[PHP] File uploads...

2002-11-25 Thread David Russell
Hi all,

I am updating a site accounting for register_globals = off. I have a
page which allows for the uploading of a number of files. The page sends
these in an "array" of files.

The destination script used to have:

  if ($AttachmentCount > 0) {
foreach($userfile as $key => $value) {
  AddAttachment($BPFNo, $value, $userfile_name[$key],
$userfile_size[$key], $userfile_type[$key]);
}
  }

Where attachmentcount was a variable which could be 0 (no uploads) or
more (counting the number of $userfile[] variables there should be.
AddAttachment is a function that actually saves the attachment into a
database.

How would I re-do this?

What I would preferably do is have the script AddAttachment for each
$_FILES[] there might be. If I need to change it from an array type
($userfile[]) in the calling script, I can easily do this.

Can someone help me?

Thanks


David Russell
IT Support Manager
Barloworld Optimus (Pty) Ltd
Tel: +2711 444-7250 
Fax: +2711 444-7256
e-mail: [EMAIL PROTECTED]
web: www.BarloworldOptimus.com



smime.p7s
Description: application/pkcs7-signature


[PHP] Dumb POST Array question

2002-11-25 Thread David Russell
Hi all,

I have a multiple select called Consultants[] In one page.

On the target page, how would I reference it? Would it be:

$_POST['Consultants'][0]
$_POST['Consultants'][1]
Etc

Or something else?

Thanks

David Russell
IT Support Manager
Barloworld Optimus (Pty) Ltd
Tel: +2711 444-7250 
Fax: +2711 444-7256
e-mail: [EMAIL PROTECTED]
web: www.BarloworldOptimus.com



smime.p7s
Description: application/pkcs7-signature


[PHP] PHP receiving e-mail

2003-01-14 Thread David Russell
Hi all,

I want to develop a script that can read an e-mail from a pop account,
and then perform actions on that e-mail based on characteristics of the
e-mail (e.g. header information, attachments, etc)

Does anyone know of a way to receive e-mails via php, and then to parse
them easily. My assumption would be that there should be a class out
there somewhere that handles it well.

Thanks

David Russell
IT Support Manager
Barloworld Optimus (Pty) Ltd
Tel: +2711 444-7250 
Fax: +2711 444-7256
e-mail: [EMAIL PROTECTED]
web: www.BarloworldOptimus.com



smime.p7s
Description: application/pkcs7-signature


[PHP] Mailing list addon for PHP-Nuke-type app

2003-03-19 Thread David Russell
Hi all,

I am looking for a PHP-Nuke/Slashdot -type of php-based application, which
can run on an Interbase database. On drawback I currently have with the
others is that it does not seem to have a listserv type of interface, with
subscription/unsubscription requests/archives/digests/etc.

Does anyone know about something written in PHP that I can use for this. A
modular approach which allows for other things later on
(cataloguing/download management/etc) would be useful.

Oh, it also needs access control.

Anyone??



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



[PHP] Sessions problem and unsettling Session variables

2002-09-11 Thread David Russell

Hi all,

I have a problem...

I have 3 pages in a search mechanism.

Page 1 (Search.php) 
unsets all related session variables. 
It then displays a form which allows the user to specify search
criteria. Submission sends us to Page 2

Page 2 (generateListSQL.php)
Sets up the basic database search query
Adds the filters specified in page 1 to the search query
Each filter is saved as a session variable (using $_SESSION['varname'] =
$_GET['varname'];) to re-process later if needed
Saves the final (working) SQL queries as session variables
Calls Page 3

Page 3 (ListBPF.php)
Displays the filter conditions (from the Session Variables)
Executes the query
Displays the results in a table.

This all works - on the first attempt. Subsequent attempts will happily
overwrite the session variables, but will not remove them (as specified
in page 1)
Page 1 startes with:

Session_start();
$_SESSION['variablename1'] = null;
unset ($_SESSION['Variablename1'];
$_SESSION['variablename2'] = null;
unset ($_SESSION['Variablename2'];
$_SESSION['variablename3'] = null;
unset ($_SESSION['Variablename3'];

And so on.
Why will this not work? I refresh the page. I am using PHP 4.2.2.
Register Globals - Off, Track Vars - on. Any ideas why the session
variables refuse to be unset?

Thanks


David Russell
IT Support Manager
Barloworld Optimus (Pty) Ltd
Tel: +2711 444-7250 
Fax: +2711 444-7256
e-mail: [EMAIL PROTECTED]
web: www.BarloworldOptimus.com



smime.p7s
Description: application/pkcs7-signature


[PHP] File upload problem...

2002-10-29 Thread David Russell
Hi all,

I have a form with a file upload section. The target script contains the
following:

if (is_uploaded_file($_FILES['newuserfile']['tmp_name']))  {
  AddAttachment($BPFNo, $newuserfile, $newuserfile_name,
$newuserfile_size, $newuserfile_type);
}

AddAttachment() is an included function which works elsewhere.

When running this, I get the following error:
Notice: Undefined index: newuserfile in
c:\webpages\intranet\htmlroot\optimiza\bpf\updatebpf.php on line 77

And obviously, the attachment is not added.

Where can I look for info on the $_FILES global array, and start
narrowing down the problem.

One caveat - I currently have no internet access (e-mail only). Could
people please e-mail me information especially if they want to include
links to relevant websites.

Thanks

David Russell
IT Support Manager
Barloworld Optimus (Pty) Ltd
Tel: +2711 444-7250 
Fax: +2711 444-7256
e-mail: [EMAIL PROTECTED]
web: www.BarloworldOptimus.com


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




[PHP] Unsetting Session Variables

2002-10-30 Thread David Russell
Hi all,

I am having problems unsetting Session Variables - where I know it
should work.

I have a form. It contains both links with GET variables, and also a
POST form. They all go to the same next page.

Page 2 simply clears all session variables, and then sets them based
upon the contents of the GET or POST array. It then calls page 3 which
displays information based on the SESSION variable contents.

My problem is that a session variable does not seem to unset. I am
using:

unset ($_SESSION['variablename']); 

But this does not seem to destroy the session variable. (it is still
available later in other scripts)

What can I do?

David Russell
IT Support Manager
Barloworld Optimus (Pty) Ltd
Tel: +2711 444-7250 
Fax: +2711 444-7256
e-mail: [EMAIL PROTECTED]
web: www.BarloworldOptimus.com



smime.p7s
Description: application/pkcs7-signature


RE: [PHP] Unsetting Session Variables

2002-10-30 Thread David Russell
PHP 4.2.2
Register Globals Off
Using only $_SESSION
No session_register() calls at all

Interestingly enough, doing session_unregister('variablename') *in*
*addition* does work (although I am sure it shouldn't)
session_write_close() does not help

Any suggestions?

> -Original Message-----
> From: David Russell [mailto:DavidR@;BarloworldOptimus.com]
> Sent: 30 October 2002 14:32
> 
> I am having problems unsetting Session Variables - where I know it 
> should work.
> 
> I have a form. It contains both links with GET variables, and also a 
> POST form. They all go to the same next page.
> 
> Page 2 simply clears all session variables, and then sets them based 
> upon the contents of the GET or POST array. It then calls page 3 which

> displays information based on the SESSION variable contents.
> 
> My problem is that a session variable does not seem to unset. I am
> using:
> 
> unset ($_SESSION['variablename']);
> 
> But this does not seem to destroy the session variable. (it is still 
> available later in other scripts)
> 
> What can I do?

PHP version?  register_globals on or off?  Using only $_SESSION, or are
there any session_register() calls?

All of these can affect what you have to do to destroy session values,
but...

Have you tried doing session_unregister('variablename') *in* *addition*?

Does session_write_close() help?

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 





smime.p7s
Description: application/pkcs7-signature


[PHP] New Server advice

2002-10-31 Thread David Russell
Hi all,

I am setting up a new production server. Assuming that I do not need
register globals, what does everyone suggest for setting it up:

Linux machine
Apache 
PHP 4.2.3

My real question is whether I should install with Apache 1.3.27 or
Apache 2.0.43 This implies 3 questions:
1. Does PHP 4.2.3 work properly with Apache 2.0.43? In a production
server?
2. Are there features in Apache 2.0 that would be beneficial?
3. What is the learning curve line from moving to installing,
configuring and running Apache 1.3 to 2.0?

Thanks

David Russell
IT Support Manager
Barloworld Optimus (Pty) Ltd
Tel: +2711 444-7250 
Fax: +2711 444-7256
e-mail: [EMAIL PROTECTED]
web: www.BarloworldOptimus.com



smime.p7s
Description: application/pkcs7-signature


[PHP] phpinfo

2002-11-01 Thread David Russell
Hi all,

I upgraded php and apache on my development machine (Windows XP). I am
now running apache 1.3.27 and php 4.2.3.

When I run a phpinfo(), I get my full list of stuff as expected, except
that the apache version reported is 1.3.24.

Has anyone else seen this. Have I done something wrong? 

Thanks

David Russell
IT Support Manager
Barloworld Optimus (Pty) Ltd
Tel: +2711 444-7250 
Fax: +2711 444-7256
e-mail: [EMAIL PROTECTED]
web: www.BarloworldOptimus.com



smime.p7s
Description: application/pkcs7-signature


RE: [PHP] phpinfo

2002-11-03 Thread David Russell
Been there, done that. Didn't help...

I was told (off list) that it is because php4.2.3 is compiled with
Apache 1.3.24. is this possible?

It is definitely Apache 1.3.27 (404 error message returned the version
number), but php is not reporting as such.

Thanks again

David Russell
IT Support Manager
Barloworld Optimus (Pty) Ltd
Tel: +2711 444-7250 
Fax: +2711 444-7256
e-mail: [EMAIL PROTECTED]
web: www.BarloworldOptimus.com

-Original Message-
From: Matt T. Galvin [mailto:mattg@;disaster.com] 
Sent: 01 November 2002 10:50 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] phpinfo


Restart apache... that should be it

on XP use the Restart Script in you apache program group

on unix do a

/usr/local/apache/bin/apachectl graceful

or just

apachectl graceful

if it is in your path

HTH,

Matt

At 05:50 AM 11/2/2002 +0900, you wrote:
><[EMAIL PROTECTED]>



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




smime.p7s
Description: application/pkcs7-signature


[PHP] Battling with highlighting search criteria

2002-11-04 Thread David Russell
Hi there,

My brain has just gone very fuzzy...

I have a search string ($search) and a result ($result). I need to
highlight every occurance of $search in $result.

I know that it means that I need to change (for example)

$result = "This is a test, isn't it?"
$search = "is"

Into 

$result = "this is a test, is'nt
it"

Now I can easily see how to change the FIRST occurrence of the word, but
how can I change every occurance?

Thanks



David Russell
IT Support Manager
Barloworld Optimus (Pty) Ltd
Tel: +2711 444-7250 
Fax: +2711 444-7256
e-mail: [EMAIL PROTECTED]
web: www.BarloworldOptimus.com



smime.p7s
Description: application/pkcs7-signature


RE: [PHP] Re: Battling with highlighting search criteria

2002-11-04 Thread David Russell
Hey there

I told you my brain was feeling fuzzy :)

This works great. Only one problem... I would like it to be case
insensitive... Any way?

I assume that it would be a ereg/preg replace, but I have no clue with
regexp at all.

Anyone who could help??

David Russell
IT Support Manager
Barloworld Optimus (Pty) Ltd
Tel: +2711 444-7250 
Fax: +2711 444-7256
e-mail: [EMAIL PROTECTED]
web: www.BarloworldOptimus.com

-Original Message-
From: Erwin [mailto:erwin@;isiz.com] 
Sent: 04 November 2002 10:42 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Battling with highlighting search criteria


> I have a search string ($search) and a result ($result). I need to 
> highlight every occurance of $search in $result.
> 
> I know that it means that I need to change (for example)
> 
> $result = "This is a test, isn't it?"
> $search = "is"
> 
> Into
> 
> $result = "this  class="highlight">is a test,  class="highlight">is'nt it"
> 
> Now I can easily see how to change the FIRST occurrence of the word, 
> but how can I change every occurance?

How about str_replace?

$result = "This is a test, isn't it?";
$search = "is";

$replacement = '' . $search . ''; $result
= str_replace( $search, $replacement, $result );

HTH
Erwin

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




smime.p7s
Description: application/pkcs7-signature


RE: [PHP] Re: Battling with highlighting search criteria

2002-11-04 Thread David Russell
Hi Erwin,

Yep, this does exactly what str_replace does. 

How can I make the whole thing case insensitive:

$result= "This Is A Test, Isn't It?"
$search= "IS"

It will include the 'is' in 'This', and also the 'Is' and the 'is' in
'isn't'.

cheers

David Russell
IT Support Manager
Barloworld Optimus (Pty) Ltd
Tel: +2711 444-7250 
Fax: +2711 444-7256
e-mail: [EMAIL PROTECTED]
web: www.BarloworldOptimus.com

-Original Message-
From: Erwin [mailto:erwin@;isiz.com] 
Sent: 04 November 2002 11:27 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: Battling with highlighting search criteria


David Russell wrote:
> Hey there
>
> I told you my brain was feeling fuzzy :)
>
> This works great. Only one problem... I would like it to be case 
> insensitive... Any way?
>
> I assume that it would be a ereg/preg replace, but I have no clue with

> regexp at all.

Try the following one:

$result = "This is a test, isn't it?";
$search = "is";

$result = preg_replace( '/(' . $search . ')/i', "\$1", $result );


Grtz Erwin


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




smime.p7s
Description: application/pkcs7-signature


RE: [PHP] Battling with highlighting search criteria

2002-11-04 Thread David Russell
Ok, this works.

Just one more thing,

How can I get the return in the same case as it was originally?

Ie if I have $string = "Forward" , and $search = "for", I want
Forward, not forward.

Thanks

David Russell
IT Support Manager
Barloworld Optimus (Pty) Ltd
Tel: +2711 444-7250 
Fax: +2711 444-7256
e-mail: [EMAIL PROTECTED]
web: www.BarloworldOptimus.com

-Original Message-
From: Justin French [mailto:justin@;indent.com.au] 
Sent: 04 November 2002 12:49 PM
To: David Russell
Subject: Re: [PHP] Battling with highlighting search criteria


Yeap, you need a regexp...

$result = eregi_replace($search,"$search",$result);

This will be a little slower that str_replace, but it's the easiest way
if you need case insensitivity...


Justin


on 04/11/02 7:27 PM, David Russell ([EMAIL PROTECTED]) wrote:

> Hmmm, old method:
> 
> Find starting point of substring, and do a substr replace (not really
> elegant)
> 
> But how can I make your method case insensitive? I presume ereg/preg 
> replaces. My regexp knowledge is non-existent, however!!
> 
> Cheers
> 
> David Russell
> IT Support Manager
> Barloworld Optimus (Pty) Ltd
> Tel: +2711 444-7250
> Fax: +2711 444-7256
> e-mail: [EMAIL PROTECTED]
> web: www.BarloworldOptimus.com
> 
> -Original Message-
> From: Justin French [mailto:justin@;indent.com.au]
> Sent: 04 November 2002 12:27 PM
> To: David Russell; [EMAIL PROTECTED]
> Subject: Re: [PHP] Battling with highlighting search criteria
> 
> 
> how are you doing it for only the FIRST???
> 
> Anyhoo, a simple string replace should do it... I'd do this:
> 
> $result = str_replace($search," class=\"highlight\">{$search}",$result);
> 
> Justin
> 
> 
> on 04/11/02 6:27 PM, David Russell ([EMAIL PROTECTED]) 
> wrote:
> 
>> Hi there,
>> 
>> My brain has just gone very fuzzy...
>> 
>> I have a search string ($search) and a result ($result). I need to 
>> highlight every occurance of $search in $result.
>> 
>> I know that it means that I need to change (for example)
>> 
>> $result = "This is a test, isn't it?"
>> $search = "is"
>> 
>> Into
>> 
>> $result = "this > class="highlight">is a test, > class="highlight">is'nt it"
>> 
>> Now I can easily see how to change the FIRST occurrence of the word, 
>> but how can I change every occurance?
>> 
>> Thanks
>> 
>> 
>> 
>> David Russell
>> IT Support Manager
>> Barloworld Optimus (Pty) Ltd
>> Tel: +2711 444-7250
>> Fax: +2711 444-7256
>> e-mail: [EMAIL PROTECTED]
>> web: www.BarloworldOptimus.com
>> 
> 




smime.p7s
Description: application/pkcs7-signature


RE: [PHP] Re: Battling with highlighting search criteria

2002-11-04 Thread David Russell
Sorry, my mistake...

This is what happens when you have 2 machines - one production and one
development. You get confused between the two 

Just one more thing,

How can I get the return in the same case as it was originally?

Ie if I have $string = "Forward" , and $search = "for", I want
Forward, not forward.

David Russell
IT Support Manager
Barloworld Optimus (Pty) Ltd
Tel: +2711 444-7250 
Fax: +2711 444-7256
e-mail: [EMAIL PROTECTED]
web: www.BarloworldOptimus.com

-Original Message-
From: David Russell [mailto:DavidR@;BarloworldOptimus.com] 
Sent: 04 November 2002 11:54 AM
To: 'Erwin'; [EMAIL PROTECTED]
Subject: RE: [PHP] Re: Battling with highlighting search criteria


Hi Erwin,

Yep, this does exactly what str_replace does. 

How can I make the whole thing case insensitive:

$result= "This Is A Test, Isn't It?"
$search= "IS"

It will include the 'is' in 'This', and also the 'Is' and the 'is' in
'isn't'.

cheers

David Russell
IT Support Manager
Barloworld Optimus (Pty) Ltd
Tel: +2711 444-7250 
Fax: +2711 444-7256
e-mail: [EMAIL PROTECTED]
web: www.BarloworldOptimus.com

-Original Message-
From: Erwin [mailto:erwin@;isiz.com] 
Sent: 04 November 2002 11:27 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: Battling with highlighting search criteria


David Russell wrote:
> Hey there
>
> I told you my brain was feeling fuzzy :)
>
> This works great. Only one problem... I would like it to be case
> insensitive... Any way?
>
> I assume that it would be a ereg/preg replace, but I have no clue with

> regexp at all.

Try the following one:

$result = "This is a test, isn't it?";
$search = "is";

$result = preg_replace( '/(' . $search . ')/i', "\$1", $result );


Grtz Erwin


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




smime.p7s
Description: application/pkcs7-signature


RE: [PHP] Re: Battling with highlighting search criteria

2002-11-04 Thread David Russell
Hi Erwin,

Great thanx, my brain is cleared . Well, a little more...

Where would I be able to find more info about regexp's?

TIA

David Russell
IT Support Manager
Barloworld Optimus (Pty) Ltd
Tel: +2711 444-7250 
Fax: +2711 444-7256
e-mail: [EMAIL PROTECTED]
web: www.BarloworldOptimus.com

-Original Message-
From: Erwin [mailto:erwin@;isiz.com] 
Sent: 04 November 2002 12:08 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: Battling with highlighting search criteria


> How can I get the return in the same case as it was originally?
>
> Ie if I have $string = "Forward" , and $search = "for", I want 
> Forward, not forward.

Read my reply to your previous reply ;-))

But...some more explanation:

$result = preg_replace( '/(' . $search . ')/i', "\$1", $result );

The first argument is the pattern, which is '/(for)/i' in the case of
searching for "for". That will match every occurence of "for", "For",
"fOr", and so on. The case insensitivy is reached by the "i" modifier at
the end of the pattern. The second argument is the replace string. The
$1 is an backward reference to the first item between brackets. That'll
mean that the from the word Forward, the $1 parameter will contain
"For". So, the "For" -part from "Forward" will be replaced with For and that's exactly what you want
(right?)...

Hope this clears your brain up ;-)))

Grtz Erwin


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




smime.p7s
Description: application/pkcs7-signature


RE: [PHP] Problem with header redirect with register_globals off

2002-11-12 Thread David Russell
Could you post some code?

David Russell
IT Support Manager
Barloworld Optimus (Pty) Ltd
Tel: +2711 444-7250 
Fax: +2711 444-7256
e-mail: [EMAIL PROTECTED]
web: www.BarloworldOptimus.com

-Original Message-
From: pig pig [mailto:pigpig8080@;yahoo.com.sg] 
Sent: 12 November 2002 03:52 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Problem with header redirect with register_globals off


Hi All,

I am having problem with redirecting using header
function with register_globals off.  It works fine on
my PC but not on the site as the register_globals is
off on the server.  When redirecting on the server it
gave an CGI error:

CGI Error
The specified CGI application misbehaved by not
returning a complete set of HTTP headers. The headers
it did return are:


I am using session to pass some variables to the
target page, could this cause the problem?
Is there a work around for this problem?

Thanks in advance.

CK Ong

__
Do You Yahoo!?
Great flight deals, travel info and prizes! http://sg.travel.yahoo.com

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




smime.p7s
Description: application/pkcs7-signature


RE: [PHP] Get

2002-11-18 Thread David Russell
Like this:

http://fqdn.domain.com/path/path/page.php?var1=value1&var2=value2&;...

Page.php can then reference $var1 and $var2 if register globals is on
(bad idea) or $_GET['var1'] and $_GET['var2']

hth


David Russell
IT Support Manager
Barloworld Optimus (Pty) Ltd
Tel: +2711 444-7250 
Fax: +2711 444-7256
e-mail: [EMAIL PROTECTED]
web: www.BarloworldOptimus.com

-Original Message-
From: Shaun [mailto:[EMAIL PROTECTED]] 
Sent: 18 November 2002 02:06 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Get


Hi,

I pass arguments in the url, how do i pass multiple args?

eg. href="test.php?num=1"  (only one arg)

Do i use commas , please show me !

Thanks ,
Shaun



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




smime.p7s
Description: application/pkcs7-signature


[PHP] Stripping HTML tags, but keeping entities...

2002-11-20 Thread David Russell
Hi all

I have a text field that users can enter any information into (it is
supposed to be a description field)

For obvious reasons, I want to strip unfriendly HTML/PHP tags. This I am
doing using:

strip_tags($_POST['Duplicate'], '   
  ');

OK, so this is cool. I got this list from the Slashdot allowed tags
list, which I would assume is ok. Now I get someone sending me
information such as:
"In fact the value of the destination is < the source."

Strip_tags removes all info after the < sign. Obviously I would like to
convert it to a > entity, but how can I do both of these?

Thanks for any advice.

David Russell
IT Support Manager
Barloworld Optimus (Pty) Ltd
Tel: +2711 444-7250 
Fax: +2711 444-7256
e-mail: [EMAIL PROTECTED]
web: www.BarloworldOptimus.com



smime.p7s
Description: application/pkcs7-signature


RE: [PHP] character ' in switch

2002-11-21 Thread David Russell
Hi Martin,

Just a thought - can't you escape it?

switch ($_GET['action']) {
   case "about":
   code
   break;

   case "what\'s new": <-- i want this...
   code
   break;

   default:
   break;
}

You would definitely need to put it into quotes (as I have above)

For newer versions of PHP, you would also want register globals off, and
thus you would probably want to use $_GET['action'] as I have above. If
you are using OLD PHP, then use HTTP_GET_VARS instead.

David Russell
IT Support Manager
Barloworld Optimus (Pty) Ltd
Tel: +2711 444-7250 
Fax: +2711 444-7256
e-mail: [EMAIL PROTECTED]
web: www.BarloworldOptimus.com

-Original Message-
From: Martin Hudec [mailto:[EMAIL PROTECTED]] 
Sent: 21 November 2002 02:11 PM
To: PHP
Subject: [PHP] character ' in switch


Hello all,

I would like to know how can I put ' character to case in switch...

Situation:

from flash i am getting url: index.php?action=what's new

i need to pass this thing to switch like:

switch ($action) {
   case about:
   code
   break;

   case what's new: <-- i want this...
   code
   break;

   default:
   break;
}

but PHP can't use 'i am thinking about making urlencode() to put
that character to %XX value

any advices?


-- 
Best regards,
 Martin  mailto:[EMAIL PROTECTED]


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




smime.p7s
Description: application/pkcs7-signature


RE: [PHP] Session not Registering

2002-11-21 Thread David Russell
I assume that you do have a sesion_start() on the second (Target) page

It needs to be present on each page using your session.

David Russell
IT Support Manager
Barloworld Optimus (Pty) Ltd
Tel: +2711 444-7250 
Fax: +2711 444-7256
e-mail: [EMAIL PROTECTED]
web: www.BarloworldOptimus.com

-Original Message-
From: Stephen [mailto:[EMAIL PROTECTED]] 
Sent: 21 November 2002 02:43 PM
To: Ernest E Vogelsinger
Cc: PHP List
Subject: Re: [PHP] Session not Registering


I didn't orginially put that there. I also made it echo out the session
varaible on the first page where they login and it displayed correctly.
It's just when you go to a new page.

The line 38 is the part where it echos out.


- Original Message -
From: "Ernest E Vogelsinger" <[EMAIL PROTECTED]>
To: "Stephen" <[EMAIL PROTECTED]>
Cc: "PHP List" <[EMAIL PROTECTED]>
Sent: Thursday, November 21, 2002 3:26 AM
Subject: Re: [PHP] Session not Registering


> At 04:02 21.11.2002, Stephen said:
> [snip]
> >I have a PHP script that logs someone in then takes them to another 
> >page indicating their online status. However, when I try echoing out 
> >the contents of the session variable, it says this:
> >
> >Notice: Undefined variable: _SESSION in c:\program files\apache 
> > group\apache\htdocs\checker\members\index.php on line 38
> >
> >Here's the code that registers the variable, or is atleast supposed 
> >to:
> >
> >  if ($dbconn) {
> >$querystr = "SELECT user FROM users WHERE (user = '" .
> > prepareData($_POST['user']) . "' and pass=PASSWORD('" .
> > prepareData($_POST['pass']) . "'))";
> >$result = mysql_query($querystr,$dbconn);
> >if ($result) {
> >  if ($frow = mysql_fetch_row($result)) {
> >session_start();
> >   session_register('user');
> >$_SESSION['user'] = $frow[0];
> >header("Location: index.php?" . SID);
> >exit();
> >  }
> >  else {
> >$error = "Invalid username and password combo.";
> >  }
> >}
> >
> >Here's where I echo it out:
> >
> >Logged in as  > echo $_SESSION['user']; ?>
> [snip]
>
> What's line 38 - is it the line where you assign to it, or is it the 
> line with the echo?
>
> If it's the line with the assignment - duh, this should work IMHO if 
> it's the line with the echo - you got nothing from mysql and didn't 
> start the session.
>
> BTW - you shouldn't mix session_register() and accessing the $_SESSION

> array. Definetely it's not needed.
>
>
> --
>>O Ernest E. Vogelsinger
>(\)ICQ #13394035
> ^ http://www.vogelsinger.at/
>
>


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




smime.p7s
Description: application/pkcs7-signature


RE: [PHP] character ' in switch

2002-11-21 Thread David Russell
Hi Ernest,

I stand corrected. (I tend to standardise on double quotes where
possible, and rarely use singles)

Thanks for correcting me on this.

Thanks

David Russell
IT Support Manager
Barloworld Optimus (Pty) Ltd
Tel: +2711 444-7250 
Fax: +2711 444-7256
e-mail: [EMAIL PROTECTED]
web: www.BarloworldOptimus.com

-Original Message-
From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED]] 
Sent: 21 November 2002 02:59 PM
To: David Russell
Cc: 'Martin Hudec'; 'PHP'
Subject: RE: [PHP] character ' in switch


At 13:16 21.11.2002, David Russell spoke out and said:
[snip]
>Hi Martin,
>
>Just a thought - can't you escape it?
>
>switch ($_GET['action']) {
>   case "about":
>   code
>   break;
>
>   case "what\'s new": <-- i want this...
>   code
>   break;
>
>   default:
>   break;
>}
[snip] 

You need to escape a quote if it's in a string that is quoted with the
same
quote:
   "Double quoted string needs to \"escape\" double quotes but not
'single quotes'"
   'Single quoted string needs not to "escape" double quotes but
\'single quotes\'"


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



smime.p7s
Description: application/pkcs7-signature


[PHP] Preg_replace question

2002-11-21 Thread David Russell
Hi all,

Following on from a previous discussion, I am trying to write a "safe"
strip_tags function.

I start by applying htmlentities to the entire string, and then convert
"allowed" tags back.

One of the steps I am looking at doing is to replace something "<a
href="blah" onmouseover="blah">" with ""

What would be a good preg_replace string for this?

Preg_replace('/(<A)/i', ',
but drop everything else.

I will be googling on this too, but a reply from this group is always
quicker 

Thanks

David Russell
IT Support Manager
Barloworld Optimus (Pty) Ltd
Tel: +2711 444-7250 
Fax: +2711 444-7256
e-mail: [EMAIL PROTECTED]
web: www.BarloworldOptimus.com



smime.p7s
Description: application/pkcs7-signature


[PHP] Database Abstraction Suite

2002-06-13 Thread David Russell

Hi all

I am busy developing a PHP DB application. I obviously want this to be 
as portable as possible - and then went to the Zend pages.

I have looked at the DB abstraction Applications. There are five or so 
which have all been rated as a four dot (I presume out of 5).

Does anyone have any experience with DB Absteraction suites. If so, I 
need one that supports InterBase/Firebird and also supports MySQL. I 
would like to know what they are like in terms of ease of learning the 
generic things, etc, etc.

Thanks in advance

David Russell


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




[PHP] Stock Prices

2002-07-03 Thread David Russell

Hi all

How would I get recent stock prices in a page? I obviously need to get 
this from some source.

I am looking for local (South African) and international share prices 
for a portal-type system. What I will probably do (for the sake of 
speed) is have a cron job periodically fetch the relevant prices, and 
put them in a database. This will then be displayed from the database (I 
know - delayed stock prices are ok)

What I am really after is a method of getting share prices from the net. 
I have no idea about how to go about doing this - where to get them 
from, etc. Please help...

Thanks

David R


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




[PHP] Editing Word Documents

2002-07-08 Thread David Russell

Hi all

I have just had a request about editing Word Documents...

I have an intranet, which provides access to, amongst others, Word 
Documents about policies, etc. What the guys are looking for is a way to 
do the following:

1. Show a list of files available for editing
2. If a file is clicked, then it is locked for other users (no access)
3. The file opens on the client's machine
4. The client edits it
5. The client then closes the file, it "auto-saves" and he goes about 
his business.

Points 1 through 3 are relatively trivial. Point 4 and 5 (especially 5) 
have me lost.

How do you get a file to be edited, and then automatically returned to 
the server by M$ Word in it's changed format. Is this possible?

How would this change in a database-backended system (including the 
files as BLOBs)?

Thanks

David R


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




[PHP] replacing multiple spaces with one

2002-07-15 Thread David Russell

Hi all

(easy one - I think)

I need to replace all instances of multiple spaces in a string with a 
single space.

I tries the following:
   $ArticleText = str_replace('  ', ' ', $ArticleText);
but if I have four spaces, I am left with two - this is wrong...

I am sure that I am really looking for a ereg_replace or preg_replace, 
but having no c/perl programming background, I do not know either perl 
or standard regex syntax.

Could someone tell me what the correct ereg/preg expression for this 
would be? I would also like a pointer to regex syntax, if someone knows 
offhand.

Thanks

David R


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




[PHP] Classes Constructor syntax

2002-07-17 Thread David Russell

Hi all,

I am finally spending some time converting a million and one functions 
into a class - this is for a software issue tracking system.

I have:

class issue {
   var
   var
   ...

   function issue() { //default constructor
 //initialise all variables to defaults, and start getting the stuff 
from forms
   }

   function issue($number) { //1 variable constructor
 // Query database and populate variables accordingly
   }
}

My question is: will this work? does PHP OOP support more than one 
constructor? If my syntax is wrong, please let me know the correct syntax.

Thanks

David R


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




[PHP] Database and files

2002-04-22 Thread David Russell

Hi all,

I have a database. It receives from my users files - which could be word 
documents, Adobe PDF files, text docs, anything...

I store these in a BLOB field of the database.

On a certain page, I include a link to these files which have been saved 
into the blob. The link is Document.

Now when people link to this (to go to gatattachment.php?fileid=65) the 
getattachment does the following:

Finds out the attachment mime type

Sends a:

Header("Content-type: ");
Header("Header("Content-Disposition: attachment; filename=\"File65.doc\"" );
Stream the contents of the blob to the browser.

Where the Attachment Filename changes depending on the fileid, and the mime 
type (eg. Excel files would be xls)

Now when I click the link, I get garbled content on my browser (no matter 
which browser i use - IE, Konqueror, Opera, etc). If I change the headers 
to echos, teh I get teh correct results.

What am I doing wrong?

Thanks

David R

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




Re: [PHP] Database and files

2002-04-22 Thread David Russell

Hi all,

Another bug bites the dust...

Thank you so much for your responses... 

As for the DB/filesystem issue, we need to be able to easily replicate this 
at some time to another server as the system may easily become a 
distributed intranet system. We made the decision to use a database as this 
is easier to move around - (Backup, copy, restore) (yes, yes I know about 
tar/gz etc, but this seemed the easiest at the time.

I am using InterBase as a database backend (actually IBFirebird) as this is 
a database system that we have been using extensively int eh office for a 
while.

I think it was the uppercase/lowercase thing that bit me - (the 
header("Header(" thing was a type, decided to copy/paste after typing 
header(" 

Thanks again

David R

Richard Archer wrote:

> At 11:25 AM +0100 22/4/02, Danny Shepherd wrote:
> 
>>If you get multiple requests for files, expect the db to fall over very
>>quickly - what's wrong with storing them on the filesystem and having a
>>list of them in the db?
> 
> If your DB falls over, get a better one. You wouldn't do this with
> Access, but MySQL or PostgreSQL will handle this with no problems.
> 
> And storing them in the file system requires the web server process to
> have write access to the directory in which the files are stored. And
> so will any other users on that server. Security nightmare.
> 
> 
>>One thing - note that that the header names and the actual mimetype are in
>>lower case. Got weird results with anything different.
> 
> Interesting tip. I'll try that out on Mac IE which never did download
> properly, IIRC.
> 
>  ...R.


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




[PHP] Header variables

2002-04-24 Thread David Russell

Hi there,

Each time I look at code from websites/etc, I notice a different set of 
headers that get sent to the browser. Amongst others, there are:

location : 
content-type : 
content-disposition : attachment 

Is there anywhere where I can find a standard set of headers available to 
me? I had a look at the w3c site for this (briefly) but found a short (and 
seemingly incomplete) set of stuff.

Anyone know of such a list?

Thanks

David R

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