FW: [PHP] Reverse plural forms to singular for search

2005-04-15 Thread Mark Rees
Eugene, your reply-to address is set

-Original Message-
From: Mark Rees 
Sent: 15 April 2005 09:08
To: 'Eugene Voznesensky'
Subject: RE: [PHP] Reverse plural forms to singular for search


That sounds like a nightmare! Assuming you are talking about English,
you might be able to make some progress by removing trailing s or es for
words. This would trim words down to their stem. You could do this with
a regular expression, which will need to do something like look for es
or s with no preceding s  at the end of words (to avoid trimming words
like glass).

It will not catch forms like medium/media and thesis/theses. You could
think about trying to trim words like that down to their stem (med in
this case). In fact, would just trimming off the last two letters and
searching for that do for you? It depends on the range of words you are
searching for. 

Good luck

Mark

-Original Message-
From: Eugene Voznesensky [mailto:[EMAIL PROTECTED] 
Sent: 14 April 2005 17:22
To: php-general@lists.php.net
Subject: [PHP] Reverse plural forms to singular for search


I'm trying to reverse plural forms to singular ones
and use the result for search [in database].

Is there any third party product to integrate with
PHP, or some reliable algorithm?

Thank you,

Eu.

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

Gamma Global : Suppliers of IBM, Compaq, Cisco, Sun Microsystems, 3Com and HP 
Products.

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



RE: [PHP] Re: How to unset a post variable

2005-04-15 Thread Mark Rees
Your best bet is to check that the data has not already been inserted
rather than try to fiddle with the post:

Don't know what db you are using but something like

IF NOT EXISTS (SELECT X FROM Y WHERE Z=1)
INSERT INTO Y VALUES X

Cheers

Mark

-Original Message-
From: Nieko Maatjes [mailto:[EMAIL PROTECTED] 
Sent: 15 April 2005 14:34
To: php-general@lists.php.net
Subject: [PHP] Re: How to unset a post variable


On Fri, 15 Apr 2005 14:08:36 +0200, Mario de Frutos Dieguez  
<[EMAIL PROTECTED]> wrote:
> My question is, how can i unset $_POST["buttonNew"] or leave it empty
> because when the user refresh the page make insert commans again
because  
> the $_POST["buttonNew"] arent empty.

The browser sends $_POST, you can't just tell PHP to accept it the one
time, and not the other, unless you use sessions of course. You might
also try to refresh using a "302"-header I think, but I forgot how it
worked exactly. It makes the browser refresh so that next time the user
presses F5 or something the POST-data doesn't get sent.

-- 
Nieko Maatjes
http://www.nieko.net/

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

Gamma Global : Suppliers of IBM, Compaq, Cisco, Sun Microsystems, 3Com and HP 
Products.

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



RE: [PHP] mysql blob datatype for documents

2005-04-19 Thread Mark Rees
It depends to some extent on who has access to the machine where you
wish to store the documents, and how sensitive the documents are. When
you are storing very sensitive documents with severe access restrictions
it can make sense to use the DB for storage. You have to be careful when
writing the data in and reading it out, but it can be done. I recall
implementing a document storage system in SQL Server a few years ago  -
you will see a lot of advice both ways but actually the filesystem and
the db are both suitable for this. It really depends on what your
requirements are.

Mark

-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED] 
Sent: 19 April 2005 03:27
To: Bosky, Dave
Cc: php-general@lists.php.net
Subject: Re: [PHP] mysql blob datatype for documents


On Mon, April 18, 2005 5:40 am, Bosky, Dave said:
> Would it be better to store uploaded pdf, word, or excel documents in 
> a MySql blob field rather than keeping them in a directory?
>
> I really want to secure the documents and limit document access to 
> specific users.

It shouldn't be significantly easier to limit access with BLOBs than
with actual files if your Security Model and Design is any good.

And the penalties for using BLOBs to store these are legion.

There is a custom super-fast souped up database storage software package
specifically optimized for large chunks of data like this that you
should be using.

It's call "the file system" :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



FW: [PHP] Last visitors

2005-04-19 Thread Mark Rees
Couple of options: a CRON job/scheduled job which invokes a SQL command
deleting all but the 10 most recent records, or do the same every time
you insert a record. 

As to exactly how you decide which are the most recent 10 records to do
this deletion, that is a little more complex. 

Something like 
DELETE FROM profile_visits
WHERE user='billy'
AND time_of_visit NOT IN (
Select time_of_visit
FROM
profile_visits 
WHERE user='billy' 
ORDER by time_of_visit DESC LIMIT 10
)

Should give you an idea.

Mark

-Original Message-
From: Ryan A [mailto:[EMAIL PROTECTED] 
Sent: 19 April 2005 14:27
To: [EMAIL PROTECTED]
Cc: php
Subject: Re: [PHP] Last visitors


> I am not checking for the last people logged in, I want to see the
> last people who have viewed the profile... each profile will have its 
> own last "10 people visited"

/*
ah! i see. sorry for misunderstanding you.
perhaps on the script for the profiles page, the logic should be like:

profile for user: adam

if the browsing user is logged in: (for example the browsing user is
ben)
  insert into the database that ben has seen adam's profile end
if

and your table in the database can be:

user   visitor  time_of_visit
adam  ben 1290122141 (unix timestamp)

then you can query it on the database for each user.

SELECT * FROM profile_visits WHERE user='adam' ORDER by time_of_visit
DESC LIMIT 10 As for cleaning up... that's the bit that I can't figure
out myself :(. */

Hey,
Thanks for replying.

> ah! i see. sorry for misunderstanding you.

No problem, I guess i didnt explain it well enough, and you dont have to
help me but you are trying, so thank you.

> As for cleaning up... that's the bit that I can't figure out myself
> :(.

exactly, I came to the same part as youbut then i would have a LOT
of wasted records without the cleanup... just cant figure it out.

Thanks,
Ryan




-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 4/18/2005

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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**

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



RE: [PHP] One more time (Duft Punk) about hyperlink

2005-04-20 Thread Mark Rees
Why not try selecting both the short and the full values of loc1 from
the database? Then you can display them both in the html output.

Select loc1,  left(loc1,3) as locx, etc 

Have I missed your point here?

Mark

-Original Message-
From: Sugimoto [mailto:[EMAIL PROTECTED] 
Sent: 20 April 2005 08:15
To: PHP ML
Subject: [PHP] One more time (Duft Punk) about hyperlink


Thank you very much, I do appreciate your help.

Ur script doens work, but, curiously, it works when I changed a bit...
   select left(loc1,3) as locx, openart_id, tit1, pub1, id1, ref1 from
openart_table

If possible, can I ask one more thing?
This part is the problem
   .jpg">

I got 3 letters, but I would like to show all "loc1" data (eg "1-2 near
entrance") in the table, and have first 3 letters of "loc1" for jpg
hyperlink (http://www.heyjude.com/image/1-2.jpg).

Do you know how to fix this?

script--
$result = mysql_query("select left(loc1,3) as locx, openart_id, tit1,
pub1, id1, ref1 from openart_table
 where tit1   like '%$tit%'
   and res1   like '%$res%'
   and pub1  like '%$pub%'
   and date1  like '%$date%'
   and id1   like '%$id%'
   and ref1  like '%$ref%'
   and loc1  like '%$loc%'
   and type1   like '%$type%'
   and vol1  like '%$vol%'
   and fre1  like '%$fre%'
   and note1   like '%$note%' order by tit1");

$rows = mysql_num_rows($result);
 echo $rows,"Record Found ";
 while($row = mysql_fetch_array($result)){
 ?>
  
  ">
  
  
  
  
  
  .jpg">
  
  
  

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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



RE: [PHP] set cookie function problem

2005-04-20 Thread Mark Rees
You might consider using JavaScript to set the cookie, as that will
execute on the client and therefore use the client's time to make any
calculations regarding expiry. This may or may not suit your purpose.

Mark

-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED] 
Sent: 20 April 2005 04:18
To: Ospinto
Cc: php-general@lists.php.net
Subject: Re: [PHP] set cookie function problem


On Tue, April 19, 2005 2:20 pm, Ospinto said:
> Can someone help me with this problem? setcookie('myCookie',"blah");
> works fine. but when i try to set it with an expiry time, it doesn't.
> setcookie('myCookie',"blah",time()+3600);
>
> I have cookies enabled on my browser of course. And the way I know the

> second statement is not working is cos I'm doing a var_dump of 
> $_COOKIES. Thanks for your help.

If the user's computer clock is way out of whack, and you are setting a
cookie to expire in 1 hour, you're likely to have problems...

Though *maybe* browsers account for this by comparing your Date: header
and your clock time, and ignore the user clock.

For sure, though, *some* versions of IE will *NOT* work when you set a
Cookie time, but not a path.

That's because the Microsoft engineers mis-read the Cookie spec (on
purpose perhaps) and require *both* time and path, or neither, but not
just path.

YMMV

-- 
Like Music?
http://l-i-e.com/artists.htm

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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



RE: [PHP] Re: 1 web site, 3 servers, 3 countries - best practises?

2005-04-22 Thread Mark Rees
Be very careful with timezones. If you have dedicated servers with full
control over each one, you can simplify this by setting them all to the
same timezone. If not, you have a lot of work to do.

Mark

-Original Message-
From: Jochem Maas [mailto:[EMAIL PROTECTED] 
Sent: 22 April 2005 08:13
To: Richard Davey
Cc: php-general@lists.php.net
Subject: Re: [PHP] Re: 1 web site, 3 servers, 3 countries - best
practises?


Richard Davey wrote:
> Hello Satyam,
> 
> Thursday, April 21, 2005, 5:07:52 PM, you wrote:
> 
> S> My domain, satyam.com.ar, though supposedly in Argentina resides in

> S> Spain, where I currently live hundreds of kilometers away from it, 
> S> which I mention to point out that domain names do not correlate to 
> S> physical locations. Unless there is a political issue regarding who

> S> owns the actual machine and budgeting problems, I would rather keep

> S> just one server farm fed from multiple international locations.
> 
> No offense, but that entire post was completely useless with regards 
> to my original message.

in a round about way he seems to be asking 'why'? which is not totally
invalid.

> 
> This is nothing to do with domain names, I was simply asking if anyone

> had experience of handling one site spread across multiple remote 
> located servers from a PHP/SQL perspective (syncing content, user 
> accounts, etc).

I don't have any answers, but maybe some questions might be useful:

do you want/need a master/slave configuration
or true decentralisation and/or two way syncing?

what definition of 'seamless' have you been given?

what kind of content?

sounds like a costly undertaking, not to be taken lightly... I'm
interested to understand the requirement that dictates such server
redundancy. Given the implied cost, planning/implementation should
probably left to a company who already knows the answers to your
questions :-/?

anyway interesting problem you have before you!

> 
> Best regards,
> 
> Richard Davey

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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



RE: [PHP] image maps in PHP

2005-04-22 Thread Mark Rees
Yes, I once did this for all the states in Brazil. It took me a few
hours to trace the states, but it looked beautiful when it was finished.
This will already have been done for the states many times - you could
probably borrow someone else's work and scale it up or down a bit if it
doesn't fit.

Mark

-Original Message-
From: Mike [mailto:[EMAIL PROTECTED] 
Sent: 22 April 2005 14:16
To: php-general@lists.php.net
Subject: RE: [PHP] image maps in PHP


> Hi!
> I need to create an image map on a country map, where people
> can click on any state and get some info related to it.. In 
> such case the regular polygon/circle/rectengle image map wont 
> do bcoz of shapes of state..
> 
> I guess this must be possible someway in PHP.. please tell me
> if you have any idea how to go abt this..
> 
Is the problem you're experiencing that the image map isn't being built
properly or are you passing information to it that does not appear to be
consistant.

If it's the former, then PHP has nothing to do with that. I'm sure you
can find some tools to generate image maps for you. There have always
been free ones with a minimum of effort. 

If you're having problem with PHP in the mix, can you describe the PHP
problem, provide some code, some sample output, etc.? 

I've used image maps in the past (though I try to stay away from them)
and you can create a link with virtually any polygon if you have the
patience to may out the plot points. You could easily create a star with
many, many points and have it be clickable - which would indicate that
most states would be a piece of cake. 

-M

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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



RE: [PHP] image maps in PHP

2005-04-22 Thread Mark Rees
Oh, funnily enough I did a similar thing for India as well for a cricket
website, but only based on test match venues. 

You should be able to find something, try government websites etc. 

Good luck

-Original Message-
From: Dasmeet Singh [mailto:[EMAIL PROTECTED] 
Sent: 22 April 2005 14:34
To: Mark Rees
Subject: Re: [PHP] image maps in PHP


Mark Rees wrote:
> Yes, I once did this for all the states in Brazil. It took me a few 
> hours to trace the states, but it looked beautiful when it was 
> finished. This will already have been done for the states many times -

> you could probably borrow someone else's work and scale it up or down 
> a bit if it doesn't fit.
> 
> Mark
> 
> -Original Message-
> From: Mike [mailto:[EMAIL PROTECTED]
> Sent: 22 April 2005 14:16
> To: php-general@lists.php.net
> Subject: RE: [PHP] image maps in PHP
> 
> 
> 
>>Hi!
>>I need to create an image map on a country map, where people can click

>>on any state and get some info related to it.. In such case the 
>>regular polygon/circle/rectengle image map wont do bcoz of shapes of 
>>state..
>>
>>I guess this must be possible someway in PHP.. please tell me if you 
>>have any idea how to go abt this..
>>
> 
> Is the problem you're experiencing that the image map isn't being 
> built properly or are you passing information to it that does not 
> appear to be consistant.
> 
> If it's the former, then PHP has nothing to do with that. I'm sure you

> can find some tools to generate image maps for you. There have always 
> been free ones with a minimum of effort.
> 
> If you're having problem with PHP in the mix, can you describe the PHP

> problem, provide some code, some sample output, etc.?
> 
> I've used image maps in the past (though I try to stay away from them)

> and you can create a link with virtually any polygon if you have the 
> patience to may out the plot points. You could easily create a star 
> with many, many points and have it be clickable - which would indicate

> that most states would be a piece of cake.
> 
> -M
> 

Thanks.. actually I found some maps for US states with image map done.. 
but I am looking for a map of India.. and still havent find any

-
Free Website Promotion - A Complete Guide
http://hostwindow.info/web-hosting/9/free-website-promotion/1/
Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



RE: [PHP] Repeat Accross, then down

2005-04-22 Thread Mark Rees
Use a counter when iterating through the results

When counter % (modulus) 3=0 then write a new row

Mark

-Original Message-
From: Simon Allison [mailto:[EMAIL PROTECTED] 
Sent: 22 April 2005 15:00
To: php-general@lists.php.net
Subject: [PHP] Repeat Accross, then down


Say for a photo album with photo paths taken from a database (or
anything from a database for that matter) how can you use PHP to repeat
across for three photos and then add a new row with the next 3 photos
and so on and so on?

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



RE: [PHP] MSSqlServer table/field information

2005-04-23 Thread Mark Rees
Look into the INFORMATION SCHEMA views in SQL Books Online for a
starting point.

Mark

-Original Message-
From: Chris Boget [mailto:[EMAIL PROTECTED] 
Sent: 22 April 2005 15:51
To: PHP General
Subject: [PHP] MSSqlServer table/field information


Is there a way to programatically get information about a 
specific table and/or field?  And also any constraints that 
a field has?

thnx,
Chris

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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



RE: [PHP] Re: Cache control

2005-04-26 Thread Mark Rees
One rather brute force way to get round this is to append a unique (per-session 
at least) id to the querystring of each page, which means that the page will be 
requested from the server rather than the cache. I believe this works in Opera 
as well as other browsers.

There is more to cache-control and expiring pages than meets the eye, do a 
search on it or read the rfc. Ultimately it is down to how user agents 
interpret those commands, and there is no substitute for testing...

Mark

-Original Message-
From: William Stokes [mailto:[EMAIL PROTECTED] 
Sent: 26 April 2005 09:55
To: php-general@lists.php.net
Subject: [PHP] Re: Cache control


Talkin' to myself...

does this solve the issue?

header ("Cache-Control: no-cache");



-Will

"William Stokes" <[EMAIL PROTECTED]> kirjoitti 
viestissä:[EMAIL PROTECTED]
> Hello,
> I have an web application that checks users rights to specific parts 
> of
> the apllication at the beginning of each page. However I noticed, with the 
> help of Jason Barnett, that opera caches pages locally and the users 
> rights check fails. The application works fine with Firefox and IE. So I 
> think I need to prevent the pages from beeing cached. How this can be 
> done? I'm totally inexperinced with this stuff.
>
> The authentication is a 2 part task. First the username and password 
> are
> checked and the user is given or denied access. This works ok with every 
> browser. But once inside the user access rights check to differt parts of 
> the application fails because of the Opera cache.
>
> Thanks
> -Will

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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



RE: [PHP] Some Question

2005-04-26 Thread Mark Rees

Hello I have some questions:
1.How I can make a optional argument in function that if I dont mention
it in my code does not make problem? 

Start here
http://www.php.net/manual/en/functions.arguments.php#functions.variable-
arg-list

2.How I can see apache or IIS headers? Thanks

http://www.google.co.uk/search?q=view+http+headers&sourceid=mozilla-sear
ch&start=0&start=0&ie=utf-8&oe=utf-8&client=firefox-a&rls=org.mozilla:en
-GB:official

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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



RE: [PHP] Re: handling a user pressing browser's back button

2005-04-27 Thread Mark Rees
Perhaps it might help to think about this from the point of view of what
you are trying to prevent. Is the most important thing to make sure that
your data integrity is intact?

For example, 

- you allow users to add a record on page 1
- on page 2, check that the record does not already exist, if it doesn't
then insert it

- you allow users to update or delete a record on page 1
- the only problem here is if they are trying to update a record they
have already deleted, then pressed back to see it again. Once again, you
just need to check for its existence on page before running the update
query.

This way, you don't need to worry about what the browser does when the
user hits back, or which page it serves

Mark
-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED] 
Sent: 27 April 2005 06:03
To: Matthew Weier O'Phinney
Cc: php-general@lists.php.net
Subject: Re: [PHP] Re: handling a user pressing browser's back button


On Tue, April 26, 2005 7:02 pm, Matthew Weier O'Phinney said:
> 1. Display form on page 1. Page 1 has Cache-Control: no-cache header. 
> 2. User submits form to page 2 3. Page 2 processes form, stores 
> required variables in session, and then
>redirects to page 3.
> 4. Page 3 displays results (success page, search results, etc.)
>
> At this point, when you hit the back button, you *should* get to page 
> 1... which, because of the no-cache header, is forced to reload.

Except that if you're fast enough, and can hit the ALT-left_arrow, and
then escape fast enough to get to page 2.

Or, with some browsers, you can't get "back" to page 1 AT ALL, unless
you hit "back" twice rapidly in succession, or use the popup back menu
to "skip" the middle page that does the re-direct.

I *hate* sites that do this to me!

I've even been known to just stop using a site if it annoys me often
enough in this regard.

YMMV

NATAU (Not applicable to all users)

-- 
Like Music?
http://l-i-e.com/artists.htm

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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



RE: [PHP] Check for doubleposts

2005-05-04 Thread Mark Rees
-Original Message-
From: Fredrik Arild Takle [mailto:[EMAIL PROTECTED] 
Sent: 03 May 2005 17:49
To: php-general@lists.php.net
Subject: [PHP] Check for doubleposts


Hi,

what is the easiest way to check if a person i registered twice in a 
mysql-table. Lets assume that I only check if the last name is in the
table 
more than once. This is in mysql 4.0 (subquery not an option).
---
How about 
SELECT lastname, count(lastname) 
FROM table 
GROUP BY lastname
HAVING count(lastname)>1 
--
Do I have to use arrays and in_array. Or is there a more elegant
solution?

Best regards
Fredrik A. Takle 

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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



RE: [PHP] setting condition problem

2005-05-04 Thread Mark Rees
Does this help?

Select 
* 
From
Projects
Order By 
Relate,Title

If not, please provide more details on the output you want to see and
the structure of your table

Mark


-Original Message-
From: Ahmed Abdel-Aliem [mailto:[EMAIL PROTECTED] 
Sent: 02 May 2005 21:49
To: php-general@lists.php.net
Subject: [PHP] setting condition problem


hi all
i have a query that grabs records from the database, it works fine,
but i have a problem with  acondition i want to set for it
the variable $Record[Relate] has 1 of 2 values, "self" or "share"
what i wanna do is that when the variable has the value "share" it do
check the records grabbed and get the other records that has the value
share and $Record[Title] the same and display them once,
i don't know how to start doing this,
can anyone guide me or tell me how to do it 
thanks in advance

here is the query 



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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



RE: [PHP] Tracking what has been changed

2005-05-05 Thread Mark Rees
-Original Message-
From: Robb Kerr [mailto:[EMAIL PROTECTED] 
Sent: 05 May 2005 00:29
To: php-general@lists.php.net
Subject: [PHP] Tracking what has been changed


Here's the scenario...

I am building a site in which users will be able to create and then
later edit personal information. When they edit their information, I
need to keep track of what was changed so that I can inform via email a
person to approve the changes. Here's the flow I'm considering...

When an UPDATE page is loaded, I build an array like...

$fields = array("table.field1" => value, "table.field2" => value,
"table.field3" => value)

I then plan to save this array to a SESSION variable. Then, when the
form is posted I save the new form contents to another SESSION variable.
Then I compare the two arrays and save the names of the fields changed
to an array saved in a third SESSION variable. Finally, when I build the
email, I can parse the changed fields array to inform the person who
must approve the changes.

First, does anyone have a suggestion of a better way to do this? 
--
How long do you expect people to take to approve the changes? What
happens if they don't approve them? What if they are on holiday? What if
someone changes the data, then someone else makes another change, then
the person who approves them approves the first change?

I would recommend storing the change information in a db. 
Say you have a table t_personal_info

Id
firstName
surName
Telephonenumber
dateUpdated

You can then have another table 
t_personal_info_pending
With an additional field changeid (to handle multiple changes to the
same record)

With the same fields. When someone approves a change, update
t_personal_info with the change and delete the record from
t_personal_info_pending


Second, I can't seem to save an array to a SESSION variable. I build the
array in a local variable and then set the SESSION variable equal to it.
When I recall the SESSION varialbe, it's contents is "Array". Then, when
I print_r() the SESSION variable, I still get "Array" as the contents.
What's up?

Thanx in advance for any help.
-- 
Robb Kerr
Digital IGUANA

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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**

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



RE: [PHP] insert not working

2005-05-05 Thread Mark Rees
-Original Message-
From: Ross [mailto:[EMAIL PROTECTED] 
Sent: 05 May 2005 10:16
To: php-general@lists.php.net
Subject: [PHP] insert not working


 $query = "INSERT INTO sheet1 (title, fname, sname, job_title,
organisation, 
street, postcode, city, telephone, mobile, fax, email, web, add_info)
VALUES 
('$title', '$fname', '$sname', '$job_title', '$organisation', '$street',

'$postcode', '$city', '$telephone', '$mobile', '$fax', '$email', '$web',

'$add_info')";

   $result= mysql_query($query);
  if($result){
  echo "sucess";
  }

why yould this not work? I can retrievethe data but not write any data
to 
the database??

http://uk2.php.net/manual/en/function.mysql-query.php

Does the account you are using have INSERT permission on the database?
Does the insert statement work in mySQL's query window?

R. 

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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



RE: [PHP] Re: sort by date

2005-05-06 Thread Mark Rees
I strongly recommend that you convert the db column to the datetime datatype if 
at all possible. However if you do wish to do it this way, read:

http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html

And if you can't get it to work, bear in mind that STR_TO_DATE() is available 
as of MySQL 4.1.1.


-Original Message-
From: William Stokes [mailto:[EMAIL PROTECTED] 
Sent: 06 May 2005 08:23
To: php-general@lists.php.net
Subject: [PHP] Re: sort by date


Ok tested this and it won't work. Next question is sql question but 
anyway...

Can I use  STR_TO_DATE() or GET_FORMAT(DATE,'EUR') to query and sort dates 
to web page as a date even if the data is just a string in the db? Probably 
with GET_FORMAT(DATE,'EUR') it wont work cause it's a varchar field in the 
DB.

Any idea how to put STR_TO_DATE() in to the following SQL query:

SELECT event_id,name,date,time,place,type,info FROM test_table WHERE (group = 
'$group') AND (type = 'Game' OR type = 'training') ORDER BY date ASC

Thanks a lot
-Will



"William Stokes" <[EMAIL PROTECTED]> kirjoitti 
viestissä:[EMAIL PROTECTED]
> Hello,
>
> I made a mistake and stored date information to DB as varchar values
> (dd.mm.yyy). When I read the DB is it still possible to sort the data by 
> date with SQL query (ORDER BY date ASC)? Or is it nessessary to have the 
> date information to be stored as a date in the DB? Will it work or is the 
> output going to be sorted randomly?
>
> Thanks
> -Will

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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



RE: [PHP] I'm having a blond moment with a while loop???

2005-05-09 Thread Mark Rees


-Original Message-
From: George Pitcher [mailto:[EMAIL PROTECTED] 
Sent: 08 May 2005 11:56
To: php-general@lists.php.net
Subject: [PHP] I'm having a blond moment with a while loop???


Hi guys,

I'm doing something dumb but I can't see it.

The basic premise is:

sql search of orders sorted by customer
set g_customer_id to ''
loop through resultset
  if customer_id not same as last record's customer_id (g_customer_id)
get customer email details
set up message header if this is the first record for a customer
set item details
  else
set item details
-
Try moving the next line to below "send email", It would be easier to
help if you posted your code.

set g_customer_id to customer_id

-
  endif
  send email
end loop

The problem is that as a sample I have two records from one demo
customer
(me) and I can only get my email to handle one record - either sending
separate records for each record or one email covering the last record
only

Its as if I should have another inner loop

Any tips

MTIA

George

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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



RE: [PHP] need manual reload on Mac client

2005-05-09 Thread Mark Rees


-Original Message-
From: Francesco Casalena [mailto:[EMAIL PROTECTED] 
Sent: 09 May 2005 10:18
To: php-general@lists.php.net
Subject: [PHP] need manual reload on Mac client



Hi,



I've a strange problem on this scenario:



-SERVER MacOs X server w/

Apache's httpd2, MySql Max, PHP5



-CLIENT1 MacOs X w/ Netscape (JS enabled)

-CLIENT2 Linux 2.6 w/ Netscape (JS enabled also)



In a web application, I need to open a JS window

within data came from MySql and processed by PHP.

On CLIENT1 the JS window opens ok, but doesn't

contain the right data, I need a manual reload 

to view them.

On CLIENT2 all works well.

I've seen MySql's log, in both cases queries

are right and done in appropriate time. 

PHP code includes coockie.



Any idea? Should be a browser (or JS) error 

or a PHP for Mac mistake?
--
It's hard to say without any code to look at.

It might be a caching problem - do you see the "old" data on the Mac? If
so, adjust your browser settings, or if you need this to work reliably,
try giving the window a unique name (use a timestamp or similar).
--


Regards, thanks in advance!

Ciao,

Francesco

---
Scegli il tuo dominio preferito e attiva la tua email! Da oggi l'eMail
di superEva e' ancora piu' veloce e ricca di funzioni!
http://webmail.supereva.it/new/
---

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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



RE: [PHP] Accessible HTML - OT

2005-05-09 Thread Mark Rees


-Original Message-
From: Mikey [mailto:[EMAIL PROTECTED] 
Sent: 09 May 2005 15:40
To: php-general@lists.php.net
Subject: [PHP] Accessible HTML - OT


Hiya!
 
I have just come back from the client visit and one of the issues that
arose was over the use of accessible markup, more specifically the use
of tables versus the use of layers.
 
Now, my long held belief was that div/layers were added to the spec so
that designers could separate presentation markup from content - that
is, use positioned layers for laying out content, use tables for tables
of data as they were originally intended.  However, my client seemed
adamant that it was the other way around and that the use of tables was
preferred owing to browser compatibility issues.
--
It depends how far back you want to go with this in terms of
compatibility. It is simple to code for IE5+ and NN6+ /Mozilla which
covers well over 90% of the market without using tables for layout
purposes. I wouldn't say there was anything inherently "wrong" with
using tables to control layout but the presentation vs layout argument
you advance is fairly convincing.

Accessibility (for e.g. the blind or partially sighted) is another
matter. Look at Bobby for more information bobby.watchfire.com/

--
 
Now, I have just had a look around w3 and have found some inferences
that support my view but nothing that states clearly in either
direction.  Does anyone on this list have a definitive answer for this
one?
 
TIA,

Mikey
--
The revolution will not be sent as an e-mail attachment.

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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



RE: [PHP] how to know whether web server of a remote machine is running or not

2005-05-10 Thread Mark Rees
In addition to the valid suggestions thus far, another option which may
suit your purpose is to display an image from webserver2 in the page on
webserver1. You can put a JavaScript redirection in the image's onload
event.

-Original Message-
From: Brent Baisley [mailto:[EMAIL PROTECTED] 
Sent: 10 May 2005 15:44
To: balwant singh
Cc: php-general@lists.php.net
Subject: Re: [PHP] how to know whether web server of a remote machine is
running or not


Try connecting to it on port 80, the default for web servers. You can 
actually play around by connecting to a webserver (or mail server) 
through telnet. On the command line just type "telnet website.com 80". 
If the server is up, you should be able to interact with the webserver. 
Type something and press return. If you didn't type a valid command, 
you'll get some html code back.
You should be able to do something like this with all the commands in 
php, I have looked into which ones.



On May 10, 2005, at 7:59 AM, balwant singh wrote:

> Hi,
>
> I want to make a page (on a webserver) which will be redirected to
> another page on another webserver and hence i  want to know whether 
> the another webserver is running or not so that if the webserver is 
> not running it do something else.
>
> is there any method to know whether the other webserver is running or
> not.
>
> your help will be appreciated.
>
>
> with best wishes
> balwant
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
-- 
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577

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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



RE: [PHP] SQL Date guru in the house?

2005-05-11 Thread Mark Rees


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: 11 May 2005 07:17
To: php-general@lists.php.net
Subject: [PHP] SQL Date guru in the house?


Hi All,

I have a small problem.   

I have a project in which someone has got three integer fields for
holding the date.   DD, MM,  in an sql database.I now have to
have a page that inputs two dates and select records between those two
dates. 

If I had a date field in the table it would be fairly simple, but I'm
hoping to do this search/comparison without having to rewrite the
pages/database that has already been designed.

-
I strongly recommend that you rewrite the application to use dates! Can
you at least add a column to the table which makes a datetime out of
those three fields? Then you can do your date comparisons easily. 

Which database are you using?


-

Start Date: 11/05/2005
End Date:   11/04/2005
SELECT * FROM blah WHERE mm BETWEEN 04 AND 05 AND dd BETWEEN 11 AND 11
AND  BETWEEN 2005 AND 2005

Doesn't work for obvious reasons.  Is there any way that I can do
this date comparison I the SQL statement without having a decent date
field? My apologies as this is australian date format and this list is
in the US I think? 

No need to apologise - this list is on the internet and has posters from
all over the world
---

Regards Matthew


Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



RE: [PHP] Inner Join or 2nd Query...?

2005-05-11 Thread Mark Rees
Hi All,

with wanting to show both product types(Switch, Router etc) and 
Makers(Cisco, Avaya, etc) on the one page in select boxes, I was 
wondering, do you use 2 seperate queries to the database or do you inner

join to get all in 1..? I have set up different tables with related id's

etc. So, to get Products.product_name and Products.product_id along with

what the below query pulls, what wold be best..? I believe if I do a 2nd

query, than some variables need to be identified with the particular 
query, yes..? Cheers.

What is your question in one sentence?

Is it "how do I do an inner join"?
Is it "are two separate queries on two tables faster than one query on
both tables"?
Or something else entirely?





JUMBO STATUS
Used Hardware Specialist

Admin


PRODUCT TYPE



$product_type";
}
?>







email: [EMAIL PROTECTED]
Telephone: 03-5209-1777
Fax: 03-5209-2539





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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



RE: [PHP] protect your CSS files, and possibly other extenstionsas well...

2005-05-11 Thread Mark Rees

Richard Lynch wrote:

>You could do all this...
>
>Or you could just move the files outside your web tree and change your 
>include path.  [shrug]
>  
>
This is probably true, but I was thinking of a virtual hosting 
environment where its easier to maintain the code when its all in a 
sub-directory named by the address. But even then I guess you can make 
the document root one below the virtual host root and then place 
includes next to the document root to keep them grouped together, yet 
seperated.

>>if( !isset( $_SERVER["HTTP_REFERER"]) ||
>>!strpos($_SERVER["HTTP_REFERER"],$_SERVER["SERVER_NAME"]) )
>>
>>
>
>I don't think you can count on HTTP_REFERER to be set by browsers.
>
>It's not required by the HTTP spec, as I understand it.
>
>Plus, it seems to me like you are asking for trouble between 
>www.example.com and example.com if they surf to www. but your 
>developer/designer only uses 'example.com'
>
>I also would wonder if this will scale up to server farms?  Maybe the 
>REFERER/SERVER_NAME stuff is all hunky-dory consistent there...
>  
>
I tested the HTTP_REFERER in both IE v6 and FireFox v1 and the code is 
working. I dont have an IE v5.x to test on or I would've verified that 
as well. the SERVER_NAME string will be equal to www.example.com or just

example.com, whichever was used to access the site -- it is pulled from 
between the http:// and the next / so it will allow access to only a 
self referring server call.

As for server farms, the SERVRE_NAME part will have to be modified to 
include every allowable server that can refer to it.
--
Some anti-virus/firewall type software does not allow the  browser to
send the referrer - it cannot be relied upon, which is Richard's point.

--
>If an end user wants to read your CSS or JS bad enough, they can get 
>it.
>
>Nor is this really a problem.
>  
>
There have been incidents in the past when another website stripped an 
artists site entirely; html, css, js, images, everything. This code will

prevent css and js from being directly downloaded from a web browser. 
This will work as long as you dont have another service accessing the 
directories, such as ftp that bypasses the web server parsing routine.

The following two methods for linking to stylesheets was used in
testing:


 and
 @import('http:///styles.css');


The css and js files will still be transmitted to the client, so they
can be retrieved from temporary internet files or wherever the browser
stores them. I don't see how your method will prevent anyone from
accessing these files - they need to be on the client for your page to
display correctly.

>You definitely do *NOT* want them able to surf to non-entry (ie,
>'include'd) files!
>
>Your developers (you) almost certainly spent zero time wondering "what 
>if" the user did that, and them executing your .php/.inc/.inc.php file 
>out of context could wreak havoc.
>
That is the whole intention of this exercise, to prevent direct user 
access to included
files both templated and configuration files. As mentioned earlier, my 
intention was on
virtual host directories that keep all the files under on roof. This 
method for hiding php
scripts is already used widely in many php-portal kits that keep 
everything in one directory
for ease of install for end-users.

My ammendum for css and js files prevents nosey ripoffs away from an 
original designers
work. They spent a lot of time in these designs and dont want random joe

to just copy it for
self-serving purposes. Even if they have all the html, they will have to

spend some time trying
to figure out the styles and javascript calls to match your sites look 
and feel. I dont think the
majority of the ripoff artists will spend that time, and they will move 
on to someone else.

>There are many "solutions" for this -- But to me, moving the files out 
>of the web tree and setting include_path makes the most sense as the 
>safest.
>
>There's *NO* *WAY* you're gonna screw up your httpd.conf or .htaccess 
>files and make the files not in the web tree suddenly accessible.
>
>It's not like setting include_path is rocket science once you figure 
>out that this is EXACTLY what that is for.
>
>Just my opinion.
>
As mention earlier I will look into the shuffling of directories and 
modification of the include_path
for hiding included files and see what modifications are needed for the 
code then.

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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended

RE: [PHP] sleep function

2005-05-13 Thread Mark Rees
You could try sending all the data to the client at once then achieving
the delay effect with JavaScript perhaps? That way, you are not reliant
on external factors like connection speed.

On Thu, May 12, 2005 8:38 pm, James Williams said:
> I just tried a couple of output_buffering on a test script I made and 
> it won't work... It simply waits for 10 seconds then displays 
> everything...  Kinda sucks.

If you're going to flush() and ob_flush() that much, you might as well
not use ob_start or output buffering at all.

Rip out all the ob_* stuff and see if it works under Windoze.

PS The one I looked at on your site worked just fine...

-- 
Like Music?
http://l-i-e.com/artists.htm

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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



RE: [PHP] Add to array problem

2005-05-16 Thread Mark Rees
-Original Message-
From: mayo [mailto:[EMAIL PROTECTED] 
Sent: 16 May 2005 15:26
To: php
Subject: [PHP] Add to array problem


I'm having a little problem adding to an array. Each time I add to an
array it wipes what was previously added. I'm using array_push().
 
$items=array();
Looking at the PHP docs (always a  good place to start), it appears that
you do not need to assign the result of this function to an array,
rather it modifies the array you specify
hence

$items=array_push($items, $_POST["whatever"]);
 
Should be
array_push($items, $_POST["whatever"]);

I'm missing something easy.

http://uk.php.net/manual/en/function.array-push.php

 
thx
 
Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



RE: [PHP] Unknown column 'peterspeters' in 'where clause'

2005-05-18 Thread Mark Rees
I expect (indeed I sincerely hope) that customer_username  AND
customer_password columns are character datatypes. So it would be a good
idea to put single quotes around the values you are trying to select
from them.

-Original Message-
From: Mark Sargent [mailto:[EMAIL PROTECTED] 
Sent: 18 May 2005 07:28
To: php-general@lists.php.net
Subject: [PHP] Unknown column 'peterspeters' in 'where clause'


Hi All,

the below code generates this error,

Unknown column 'peterspeters' in 'where clause'

mysql_select_db("status", $db);
$username = $_POST["username"];
$password = $_POST["password"];
$result = mysql_query("SELECT customer_id FROM Customers WHERE 
customer_username = $username AND customer_password = $password") or die

(mysql_error());
$myrow = mysql_fetch_row($result);
$customer_id = $myrow[0];
$_SESSION['customer_id'] = $customer_id;
?>


';
echo "CustomerID = $customer_id";
?>

Cheers.

Mark Sargent.

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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



RE: [PHP] Class function calling another function in class

2005-05-19 Thread Mark Rees
You might find this interesting if you are working with hierarchies in
SQL

http://www.intelligententerprise.com/001020/celko.jhtml?_requestid=72430
3

-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED] 
Sent: 19 May 2005 07:35
To: Charles Kline
Cc: php-general@lists.php.net
Subject: Re: [PHP] Class function calling another function in class


On Wed, May 18, 2005 5:04 pm, Charles Kline said:
> I have an organization table in mySQL. Pretty standard. My first 
> function getDepts() is working as I intend and returning the tree just

> as I like it. The new piece I added in there that is not working now 
> is the call to getPositions() within the first function. What I am 
> trying to do is once I get a Department, I want to loop through the 
> Positions table and get the positions that are under that Department. 
> This code goes haywire and loops for ever printing a huge list to the 
> screen. Eventually I need to return this data not to the screen but 
> into an array. Anyone see what I might have wrong in my logic?

What is in the huge list?...

Actually...

If your organization and/or its budget positions is at all large, this
is an incredibly inefficient way to do it.

You're hammering your database with query after query, and you are using
PHP to do all the iteration and ordering.

SQL was *designed* to handle large amounts of data efficiently.

You would be better served with something not unlike:

$query = "select boOrgId, boOrgName, bpPositionID ";
$query .= " from BudgetedOrganization, BudgetedPosition "; $query .= "
where BudgetedOrganization.boOrgID = BudgetedPosition.bp_boOrgID ";
$query .= " order by boSuperiorOrgID "; $rs =
$this->retrieveData($query); if ($rs){
  while ($row = mysql_fetch_array($rs)){
//Store $row in your array or whatever you want to do with it.
  }
}

> I have a class and it contains these two functions.
>
>  function getDepts ( $parent = 0, $level = 1 ) {
>  $sql = 'SELECT BudgetedOrganization.* ';
>  $sql .= 'FROM BudgetedOrganization ';
>  $sql .= 'WHERE BudgetedOrganization.boSuperiorOrgID = ' . 
> $parent;
>
>  $rs = $this->retrieveData($sql);
>  if ($rs)
>  {
>  while($row = mysql_fetch_array($rs)){
>  $num = 1;
>
>  while ($num <= $level) {
>  $this->str .= "\t";
>  $num++;
>  }
>  $this->str .= $row['boOrgID'] . ", " . $row 
> ['boOrgName'] . "\n";
>
> // just added this and it ain't working
>  $this->str .= $this->getPositions($row['boOrgID']);
>  $this->getDepts($row['boOrgID'],$level+1);
>  }
>  }
>  return($this->str);
>  }
>
>  function getPositions ( $org = 0 ) {
>  $sql = 'SELECT BudgetedPosition.* ';
>  $sql .= 'FROM BudgetedPosition ';
>  $sql .= 'WHERE BudgetedPosition.bp_boOrgID = ' . $org;
>  //echo $sql;
>  $rs = $this->retrieveData($sql);
>  if ($rs)
>  {
>  while($row = mysql_fetch_array($rs)){
>  $this->str .= " - " . $row['bpPositionID'] . "\n";
>  }
>  }
>  return($this->str);
>  }
>
>
> Later
>
> $depts = $org->getDepts();
> echo "" . $depts . "";
>
>
> Thanks,
> Charles
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Like Music?
http://l-i-e.com/artists.htm

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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



RE: [PHP] OT - Table help needed~ PLEASE

2005-05-20 Thread Mark Rees
Something along these lines should get you started

Tclothes (holds all the possible variations of size, colour and style)
Id PK
Styleid FK to Tstyle
Sizeid FK to Tsize
Colourid FK to Tcolour

Tstyle
Styleid PK
StyleDescription VARCHAR

Tsize
Sizeid PK
SizeDescription VARCHAR

Tcolour
Colourid PK
ColourDescription VARCHAR

Mark
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: 20 May 2005 00:12
To: php-general@lists.php.net
Subject: [PHP] OT - Table help needed~ PLEASE


Hi,

I am working on a program for a clothing manufacture and need some help
designing the tables for the database. I have to track the inventory
levels of each style by color and size and can not figure the tables
out. Here is the information I need to track.

Style number
Color
Size (can have from 1 to 10 different sizes)

Also need to track the transactions. Receipt Number for incoming
inventory and Invoice number for outgoing. 

Can anyone help me figure out how to setup the tables? Once that is
done, I think I can get the rest working.

Thanks!!!
Kevin

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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



RE: [PHP] Php with mysql

2005-05-23 Thread Mark Rees
This is a beginner's guide to SQL syntax, please review it
http://www.webdevelopersnotes.com/tutorials/sql/mysql_guide_querying_mys
ql_tables.php3?PHPSESSID=fb6c7c7a548b6a271a75d623ce04cc9c

The answer to your question (which someone has already given in a
previous reply to you) is 

SELECT `User_name` , (replaces AND) `User_pass` FROM `user` 
WHERE `User_name` = '$_POST['user_id']' AND  '$_POST['user_id']'

-Original Message-
From: Rittwick Banerjee [mailto:[EMAIL PROTECTED] 
Sent: 23 May 2005 09:01
To: php-general@lists.php.net
Subject: [PHP] Php with mysql


Hi friends,

I am Rittwick Banerjee

Some one gave me an idea about that past php code that is :

$sql = "SELECT `User_name` AND `User_pass` FROM
`user` 
WHERE `User_name` = '$_POST['user_id']' AND  '$_POST['user_id']' ";

but I found that it still not working ...
Plaese give me another code , by the way I am using Fedora 2(PCQ Linux
2004)

Thank you..

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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



RE: [PHP] Php with mysql

2005-05-23 Thread Mark Rees
(posted again with another syntax error corrected)

This is a beginner's guide to SQL syntax, please review it
http://www.webdevelopersnotes.com/tutorials/sql/mysql_guide_querying_mys
ql_tables.php3?PHPSESSID=fb6c7c7a548b6a271a75d623ce04cc9c

The answer to your question (which someone has already given in a
previous reply to you) is 

SELECT `User_name` , (replaces AND) `User_pass` FROM `user` 
WHERE `User_name` = '$_POST['user_id']' AND (PASSWORD= ADDED HERE)
PASSWORD='$_POST['user_id']'

-Original Message-
From: Rittwick Banerjee [mailto:[EMAIL PROTECTED] 
Sent: 23 May 2005 09:01
To: php-general@lists.php.net
Subject: [PHP] Php with mysql


Hi friends,

I am Rittwick Banerjee

Some one gave me an idea about that past php code that is :

$sql = "SELECT `User_name` AND `User_pass` FROM
`user` 
WHERE `User_name` = '$_POST['user_id']' AND  '$_POST['user_id']' ";

but I found that it still not working ...
Plaese give me another code , by the way I am using Fedora 2(PCQ Linux
2004)

Thank you..

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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades,
D-Link, Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO
9001 2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not
the intended recipient, please notify the sender IMMEDIATELY; you should
not copy the email or use it for any purpose or disclose its contents to
any other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may
not necessarily reflect the view of Gamma Global (UK) Ltd. Be advised
that no content herein may be held binding upon Gamma Global (UK) Ltd or
any associated company unless confirmed by the issuance of a formal
contractual document or Purchase Order,  subject to our Terms and
Conditions available from http://www.gammaglobal.com

E&OE

**
**


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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



RE: [PHP] dynamic drop down

2005-06-02 Thread Mark Rees
The dropdown list is on the client (browser). Javascript runs on the
client. PHP runs on the server. 

You have 2 options 

- one is to do as Richard says and use javascript to change the contents
of one select box when an option is selected in another. 
- the other is to refresh the page when the option is selected and write
different data into the second select box based on the option selected.
This is a question of using echo and iterating through the data you wish
to output.


-Original Message-
From: Danny Brow [mailto:[EMAIL PROTECTED] 
Sent: 01 June 2005 07:08
To: PHP-Users
Subject: Re: [PHP] dynamic drop down


On Tue, 2005-05-31 at 22:08 -0700, Richard Lynch wrote:
> On Tue, May 31, 2005 8:48 pm, Danny Brow said:
> > Could someone point me to an example with code for dynamic drop 
> > downs in PHP? I would like to be able to have drop downs like 
> > "Select Country" and another drop down show the states/provinces 
> > based on the selected country.
> 
> Well, the "dynamic" part of it isn't gonna be in PHP at all ; It's 
> gonna be JavaScript.

I thought I'd have to use JS, but was hoping someone knew a way to do it
with PHP.


> You can Google for "JavaScript dynamic menus" to find what you want.  
> Then you just need to use PHP to spew out the JavaScript you want to 
> spew out, but that's no different than spewing out the HTML you want 
> to spew out, really.

Tons on google, thanks,

Dan.

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND REGISTERED FOR 
ISO 9001:2000 CERTIFICATION

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


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



[PHP] cUrl and proxies

2005-06-30 Thread Mark Rees
Hello

This code gives me a 407  Proxy Authentication Required message. Can anyone
see what is missing? The username and password are definitely correct, as
are the proxy IP and port.

Win2k. php 5.0.4

$ch=curl_init();
curl_setopt ($ch, CURLOPT_URL, 'http://www.google.com/');
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch,CURLOPT_HTTP_VERSION,'CURL_HTTP_VERSION_1_1');
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($ch,CURLOPT_PROXY,'10.0.0.8:8080');
curl_setopt($ch,CURLOPT_PROXYUSERPWD,'abc:123');
$ret = curl_exec($ch);

Thanks in advance

Mark

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



[PHP] Re: cUrl and proxies

2005-06-30 Thread Mark Rees
UPDATE: I think it is a bug in cURL, according to this link (I am using an
ISA proxy).

https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1188280&group_i
d=976

So all I need to do is install the latest version of cURL then. I am really
struggling with this - I don't have a good understanding of how PHP and cURL
interact. I already have the necessary dlls on my machine :

php_curl.dll
libeay.dll
ssleay.dll

But what can I download from

http://curl.haxx.se/download.html

I don't see any of those files there, and the windows package includes only
curl.exe - where does that fit in?

The readme files in the package I did download don't really help either:
http://curl.haxx.se/dlwiz/?type=*&os=Win32&flav=-&ver=2000%2FXP

Please help if you can

Mark

""Mark Rees"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello
>
> This code gives me a 407  Proxy Authentication Required message. Can
anyone
> see what is missing? The username and password are definitely correct, as
> are the proxy IP and port.
>
> Win2k. php 5.0.4
>
> $ch=curl_init();
> curl_setopt ($ch, CURLOPT_URL, 'http://www.google.com/');
> curl_setopt($ch, CURLOPT_HEADER, 1);
> curl_setopt($ch,CURLOPT_HTTP_VERSION,'CURL_HTTP_VERSION_1_1');
> curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
> curl_setopt($ch,CURLOPT_PROXY,'10.0.0.8:8080');
> curl_setopt($ch,CURLOPT_PROXYUSERPWD,'abc:123');
> $ret = curl_exec($ch);
>
> Thanks in advance
>
> Mark

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



Re: [PHP] Writing a PHP Web application

2005-07-01 Thread Mark Rees
"Philip Hallstrom" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > What are the options to get code to run on the server (every XX
> > minutes), without any user interaction, etc.
>
> If you are running on a unix like system (linux, freebsd, solaris, etc.)
> cron can do this for you.  See this: http://en.wikipedia.org/wiki/Cron
>
> If on windows there are probably scheduling applications, but I don't know
> anything about them.

Start-->Settings-->Control Panel-->Scheduled Tasks

You can use this to run scripts written in whatever language you like to
perform the sort of tasks you want to.

>
> > Example 1: If I have a directory that contains files, can I write a
> > script that will delete all files older that 5 days?
>
> Yes.  Write the script to do what you want it to do and then have cron
> execute it on the time period you define.
>
> > Example 2: If I write an email web application, and the user wants to
> > send an email to 50 people, can I write a script that will send emails
> > individually XX seconds apart from each other, but have the progress
> > interfaced with the web page the user is on so they can see the
> > percentage progress of sent emails.
>
> Yes.  This is a bit trickier as you would need to coordinate with a
> backend process that looks for emails that are ready to send them, does
> the sending and also writes out some status info (either to a temp file or
> to a database, or to shared memory).  Then your web page would need to
> repeatedly check that status to update the user on the progress.
>
> > Also,  back to the email example, is it possible that once an email is
> > composed and sent, that the web application can scan the email for
> > viruses, then show a message to the user if a virus was found in their
> > email, if no virus found, the email is then sent to the users as above.
>
> Yes.  You could install a virus scanner such as ClamAV
> (http://www.clamav.net/) and have it scan the message prior to handing it
> off to the backend process that does the sending.
>
> > How would I scan an email for viruses (or spam?)?
>
> Same idea, but use something like SpamAssassin
> (http://spamassassin.apache.org/)
>
> > And, scan it only once so that system resources are not used to scan
> > unnecessarily for every recipient?
>
> Sure. Just do it before handing it off to the script that actually does
> the mailing...
>
> -philip

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



Re: [PHP] error when trying to delete a record

2005-07-11 Thread Mark Rees
""Jay Blanchard"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
[snip]
$query= "DELETE FROM sheet1 WHERE id=$id";

You have an error in your SQL syntax; check the manual that corresponds
to
your MySQL server version for the right syntax to use near '' at line 1
[/snip]

try...

$query= "DELETE FROM sheet1 WHERE id = '".$id."' ";

Note the single quotes around conditional data. Imagine if $id = 1 and
you did your original query, it would read...

$query= "DELETE FROM sheet1 WHERE id=1";

Which is where id = TRUE. You could end up deleting all of the records
in the database.

---

Is the above statement true when the id field is numeric (which it surely is
in this case)? I get the expected results (in mySQL) when using statements
like

SELECT name FROM table WHERE id=1

with no single quotes round it. Putting quotes round integer values is
counter-intuitive - is it necessary in some cases?

---

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



[PHP] Re: Number of users

2005-07-12 Thread Mark Rees

<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hello all,



I have some questions and I hope someone could answer them



1.   Is there a way to find out how many users currently browsing pages
at my web site?

2.   If I write down the IP of a user that log on my web site, can I
check later if the IP still browsing pages at my web site or if he had left
my website?

--
There are various ways to achieve this.  You could use session variables,
cookies or store the information in a database and pass the lookup value
around in a querystring. Which you choose will depend a little on how robust
you want it to be, and how your website is set up. You should probably start
off by reading up on sessions - there is plenty to dip into here:

http://www.google.co.uk/search?q=php+session&sourceid=mozilla-search&start=0
&start=0&ie=utf-8&oe=utf-8&client=firefox-a&rls=org.mozilla:en-GB:official

 

Thanks

yaron

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



[PHP] Re: Plz, help

2005-07-12 Thread Mark Rees
""adolfas"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I have a line:
>
> $sql="select u.*, p.name_lt as pareiga from nese_users u left join
> nese_pareigos p on p.id=u.pareiga order by data desc";
>
> As I understand there are 2 tables: nese_users and nese_pareigos
> I need to know what atributes belong to what table form that line.
> Thanks

I hope this is what you mean. Try this for further reading if so
http://www.w3schools.com/sql/default.asp

Breaking it down:

select
--retrieve the following fields
u.*,
--* means all fields from this table (u)
p.name_lt as pareiga
-- and name_lt (renamed to pareiga) from table (p)
from
nese_users u
--(this is table u, as in u.*)
left join
--retrieve all of the rows from table u, as well as all the rows in the next
table where the ON condition is true
 nese_pareigos p
--this is table p, as in p.name_lt
on
p.id=u.pareiga
--this restricts the rows retrieved from table p
order by data desc
--means that the rows returned are ordered in this way

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



Re: [PHP] Refresh

2005-07-14 Thread Mark Rees
""david forums"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> well I see two way.
>
> First is to make a php script without end, which will run continuously.

I don't recommend this way at all. Why take up all that energy

>
> second way is to add refresh html tag, in your page, or a js script to
> reload automaticaly.

Much better and simpler idea, you can use an http header to do this.

http://4umi.com/web/html/httpheaders.htm has a list of them

Third idea, which may be overkill, depending on how important this
information is, how many people will be accessing it, and whether people
_need_ to see it real time.

set up a cron job/scheduled task to read the db value every 30 seconds, say,
and write out a flat html page with the latest data in. This is only of
value if your db is getting hammered by requests.

I only really mention this as it's the Open Golf Championship this week, and
I used to work on their live scoring app, which pretty much worked as above.

>
> I'm not seeing other solution in php.
>
> regards
>
> Le Thu, 14 Jul 2005 02:27:47 +0200, Miguel Guirao
> <[EMAIL PROTECTED]> a écrit:
>
> >
> >
> > Hello people,
> >
> > I need to have a web page (PHP) that displays a status about electric
> > facilities, this status is read from a database (MySQL), the thing is
> > that
> > these status may change from time to time in the DB so I need to re read
> > the
> > DB and display the according status on the web page.
> >
> > So, Is there a way to refresh or reload the page every 10 minutes
> > automatically?
> >
> > Regards,
> >
> > ---
> > Miguel Guirao Aguilera
> > Logistica R8 TELCEL
> > Tel. (999) 960.7994
> > Cel. 9931 600.
> >
> >
> > Este mensaje es exclusivamente para el uso de la persona o entidad a
> > quien esta dirigido; contiene informacion estrictamente confidencial y
> > legalmente protegida, cuya divulgacion es sancionada por la ley. Si el
> > lector de este mensaje no es a quien esta dirigido, ni se trata del
> > empleado o agente responsable de esta informacion, se le notifica por
> > medio del presente, que su reproduccion y distribucion, esta
> > estrictamente prohibida. Si Usted recibio este comunicado por error,
> > favor de notificarlo inmediatamente al remitente y destruir el mensaje.
> > Todas las opiniones contenidas en este mail son propias del autor del
> > mensaje y no necesariamente coinciden con las de Radiomovil Dipsa, S.A.
> > de C.V. o alguna de sus empresas controladas, controladoras, afiliadas y
> > subsidiarias. Este mensaje intencionalmente no contiene acentos.
> >
> > This message is for the sole use of the person or entity to whom it is
> > being sent.  Therefore, it contains strictly confidential and legally
> > protected material whose disclosure is subject to penalty by law.  If
> > the person reading this message is not the one to whom it is being sent
> > and/or is not an employee or the responsible agent for this information,
> > this person is herein notified that any unauthorized dissemination,
> > distribution or copying of the materials included in this facsimile is
> > strictly prohibited.  If you received this document by mistake please
> > notify  immediately to the subscriber and destroy the message. Any
> > opinions contained in this e-mail are those of the author of the message
> > and do not necessarily coincide with those of Radiomovil Dipsa, S.A. de
> > C.V. or any of its control, controlled, affiliates and subsidiaries
> > companies. No part of this message or attachments may be used or
> > reproduced in any manner whatsoever.
> >

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



[PHP] Re: gettext best practice

2005-07-14 Thread Mark Rees

"Skippy" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> How do you people best deal with text meant for i18n via gettext, which is
> either large or contains HTML tags, or both?
>
> The GNU gettext manual, in section 3.2, recommends to split long texts at
> paragraph level, or in the case of long --help screens, in batches of 5-10
> lines at most. I can dig this, but I'd still appreciate some feedback.
>
> Formatting, however, is a slightly different issue. The manual seems to
have
> been written mainly for C users, and as such only deals with spaces, tabs
and
> newlines.
>
> Of course, structural HTML is a big no-no IMO (ie. the likes of , 
or
> tables). But styling HTML is often needed (,  ...). Am I right
in
> assuming that a small set of pure style-related HTML should be allowed?
I'm
> thinking , ,  and . The alternative of replacing
them
> with %s instead and inserting them in the code on the fly looks like an
> attrocity to me.
>

Consider whether you will always display the information in a web browser.
If there is any possibility that another program may be used for display,
you don't want the HTML tags in the database.

> And allowing any tags still doesn't make me 100% happy; consider
borderline
> complications due to HTML vs XHTML, or the very principle of separating
> content from presentation, which seems to be breached.
>
> And how should  be dealt with? Allow it, or go with newlines instead,
and
> decide in the code if I want to apply a nl2br() or not?
>
> --
> Romanian Web Developers - http://ROWD.ORG

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



[PHP] Re: Win2000 easier than Win2003 ??

2005-07-14 Thread Mark Rees
""Grosz, Steve (IPG IT)"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
..
Is setting up PHP easier on Windows 2000 server rather than Win2003?
I'm having nothing but problems getting PHP files to show up in IE on
the Win2003 server, I get nothing but 404 - file not found errors.

Can you install Apache? It's straightforward to set up. I've done it on
three different win2k boxes without any problems. Top tip is to stop IIS
before attempting to install Apache

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



[PHP] Usability review - OT

2005-07-15 Thread Mark Rees
Hello

Sorry for the OT request.

Does anyone know of anywhere I can get my website picked apart from a
usability point of view? I'm thinking of general first impressions rather
than an in-depth review of functionality.

Thanks

Mark
--
www.itsagoodprice.com - top-brand electronics for less.



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



[PHP] Re: session data not recorded

2005-07-18 Thread Mark Rees
""Alessandro Rosa"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I have a problem to record session data and I would you
> help me. I suppose there's something I missed in the general
> configurations during the last install, but I can't realize it.

Review the settings in php.ini. In particular look at the one below, which
means that the session data is persisted by means of cookies.

; Whether to use cookies.
session.use_cookies = 1

>
> I arranged a couple of simple files handling sessions, to show you my
> problem.
>
> I have a file index.php :
> --
-
> 
> $_SESSION['user'] = "User";
> $_SESSION['psw'] = "Psw";
>

What happens if you try to echo these variables in index.php?

> ?>
>
> Go!
> --
-
>
> and then the file page2.php :
>
> --
-
> 
> echo $_SESSION['user'];
> echo "";
> echo $_SESSION['psw'];
>
> ?>
> --
-
>
> But when page2.php is loaded, then a blank page is displayed.
>
> What's wrong with this?
> Thanks in advance.
>
> Alessandro

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



Re: [PHP] Re: Need help with PHP / MySQL connect problem

2005-07-18 Thread Mark Rees
"Linda H" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I added the following to the top of my script:
>
> echo phpinfo();
> ?>
>
> Got all sorts of environment and path info. Not anything about MySQL, but
I
> didn't see anything that looked obviously wrong, though I don't understand
> a lot of it.
>
> I ried reinstalling MySQL, Apache, and PHP. No change.
>
> Linda

What does php.ini have for this line

display_errors = On

If it's off, set it on.

Mark

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



[PHP] Re: Post URL ?

2005-07-18 Thread Mark Rees
""Joey"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> OK I understand the difference between a get & a post but if I just have a
> URL/link which is calling a function like so:
>
> abc.com/display_information?customer_number=$value
>
> It passes to the display_information the customer number visably, is there
a
> way to do this where it's not visable?
>
> Thanks,
>
> Joey


What problem are you trying to solve here? Is it a matter of security? Are
you for example trying to stop people from seeing other users' details by
pasting in their customer number?

If so, you could require a password.
If it's important to hide the customer number, you can use a semantically
meaningless key to look it up in the db.

If you don't want it to appear in the url, make a POST request, store it in
a cookie or a session.

It all depends on what you actually want to do.

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



[PHP] Re: re-order a sql result

2005-07-18 Thread Mark Rees

""Ross"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I have a query
>
> $query = "SELECT * FROM sheet1 WHERE '$filter' LIKE '$search_field%'"
>

Simply requery the database for each search. For example, this orders the
results by surname from a-z

 $query = "SELECT * FROM sheet1 WHERE '$filter' LIKE '$search_field%'
ORDER BY surname ASC";


>
>
> This prints out a table
>
>  while  ($row = @mysql_fetch_array($result, MYSQL_ASSOC)){
>
> // this just fills the empty cells
>
> if ($row['fname']==""){
> $row['fname']=" ";
> }
> if ($row['sname']==""){
> $row['sname']=" ";
> }
> if ($row['organisation']==""){
> $row['organisation']=" ";
> }
>
> ?>
>
>
> 
>  
>?>
>   
href="view_details.php?id=&sname=">detail
s
> | edit
> |  href="delete.php?id=&sname=">delete
I
> email
>}
>  else {
>  ?>
>
href="view_details.php?id=&sname=">detail
s
> | edit
> |  href="delete.php?id=&sname=">delete
I
> empty
>}
>  ?>
>
>
>
> 
>}
>  }
>  ?>
>
>
>
> but I have the three headings  at the top which I want to use to re-order
> the results alphabetically. So when I click on surname it will re-reorder
> them aphebetically (z-a) and when I click on it again it will reverse it
> (a-z)
>
> Firstname
> Surname
> Organisation
>
>
> hope this is clear.
>
> Ross

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



Re: [PHP] Re: Need help with PHP / MySQL connect problem

2005-07-18 Thread Mark Rees
"Linda H" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> For those who didn't join this thread at the beginning, I'm running MySQL
> 4.0.21, Apache 2.0.52 and PHP 5.0.2 on a Windows XP system.
>
> I installed in the sequence - MySQL, then Apache, then PHP. MySQL was
> running when the others were installed (which is what the book I am using
> seemed to indicate). Apache was not running when PHP was installed.
>
> >What does php.ini have for this line
> >display_errors = On
>
> Now we are getting somewhere. Even though error_reporting was set to
E_ALL,
> display_errors was Off. I set it On and now I'm getting an error.
>
> Fatal error: Call to undefined function mysql_connect() in C:\Program
> Files\Apache Group\Apache2\htdocs\example\test_connect.php on line 15
>
> the phpinfo() display doesn't reference MySQL at all. It does reference
> SQLite with the following info:
>
> SQLite supportenabled:
> PECL Module version 2.0-dev $Id: sqlite.c,v 1.146.2.2 2004/08/02 22:43:42
> iliaa Exp $
> SQLite Library: 2.8.14
> SQLite Encoding: iso8859
>
> Directive: sqlite_assoc_case, Local Value: 0, Master Value: 0
>
> So it looks like MySQL didn't get configured with PHP.
>
> In the PHP FAQ on database issues, I found the following:
>
> "
> 4. PHP 5 no longer bundles MySQL client libraries, what does this mean to
> me? Can I still use MySQL with PHP? I try to use MySQL and get "function
> undefined" errors, what gives?
>
> Yes. There will always be MySQL support in PHP of one kind or another. The
> only change in PHP 5 is that we are no longer bundling the client library
> itself. Some reasons in no particular order:
> * Most systems these days already have the client library installed.
> * Given the above, having multiple versions of the library can get
> messy. For example, if you link mod_auth_mysql against one version and PHP
> against another, and then enable both in Apache, you get a nice fat crash.
> Also, the bundled library didn't always play well with the installed
server
> version. The most obvious symptom of this being disagreement over where to
> find the mysql.socket Unix domain socket file.
> * Maintenance was somewhat lax and it was falling further and further
> behind the released version.
> * Future versions of the library are under the GPL and thus we don't
> have an upgrade path since we cannot bundle a GPL'ed library in a
> BSD/Apache-style licensed project. A clean break in PHP 5 seemed like the
> best option.
>
> This won't actually affect that many people. Unix users, at least the ones
> who know what they are doing, tend to always build PHP against their
> system's libmyqlclient library simply by adding the --with-mysql=/usr
> option when building PHP. Windows users may enable the extension
> php_mysql.dll inside php.ini. Also, be sure libmysql.dll is available to
> the systems PATH. For more details on how, read the FAQ on
>
setting
> up the Windows systems PATH. Because libmysql.dll (and many other PHP
> related files) exist in the PHP folder, you'll want to add the PHP folder
> to your systems PATH."
>
> I added my PHP folder (C:\php5\) to my system path and restarted
> (libmysql.ddl is in php5). Still get the error. I enabled the extension
> php_mysql.dll in php.ini and Apache startup says it can't find it
> (php_mysql.dll is in C:\php5\ext).

Make sure this is set as follows in php.ini, then restart apache

extension_dir = "c:\php\ext"

>
> So, should I move php_mysql.dll to c:\php5, change the system path, or
> what? And what about php.ini showing sqlite instead of MySQL? Do I need to
> get the MySQL client libraries (what are they called and where do I put
> them - I already have some mysql dll's in the PHP libraries.
>
> Linda

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



Re: [PHP] sytax errors

2005-07-19 Thread Mark Rees
"John Nichel" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> babu wrote:
> > Hi,
> >
> > could someone please check where the sytax error is in these statements.
> >
> > $sqlstmt= "EXEC sp_addlogin ".$adduser." , ".$addpass;
> > $sqlstmt1= "EXEC sp_adduser  @loginame= ".$adduser." , @name_in_db=
".$adduser;
> > $sqlstmt2= "GRANT CREATE TABLE TO ".$adduser;
> > $sql=mssql_query($sqlstmt);
> > $sql1=mssql_query($sqlstmt1);
> > $sql2=mssql_query($sqlstmt2);
>
> Didn't php give you a line number?

Is it a php or mysql syntax error? If the latter, please echo $sqlstmt etc
and show us the output
>
> --
> John C. Nichel
> ÜberGeek
> KegWorks.com
> 716.856.9675
> [EMAIL PROTECTED]

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



[PHP] Re: still some problems with contact form

2005-07-20 Thread Mark Rees
An alternative (and more user-friendly) approach is to have the form's
action as itself (i.e. the form on contact.php submits to contact.php). You
can then identify which fields are incomplete and highlight them in the
form. This will make it easier for users to see what they have done wrong
and make the necessary corrections.

This is what print does
http://uk2.php.net/manual/en/function.print.php

echo
http://uk2.php.net/echo

and the difference is discussed here, although it probably won't concern you
too much for the moment.
http://www.faqts.com/knowledge_base/view.phtml/aid/1/fid/40


"Bruce Gilbert" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
thanks, makes some sense.

so now where I have echo, I should have print? or just leave as echo
and add the else and ||?

Could you provide some sample code based on the code I posted
previously by chance??

being new to PHP I am sure I will run into errors for a few days, as is...

that would help me out greatly.



thx,

On 7/19/05, James <[EMAIL PROTECTED]> wrote:
> This is what you have done
>
> if(something happens) {
> print error;
> }
>
> print thanks for sending the form!
>
> So basically you are printing the error and then thanking them. You need
to
>
> include an ELSE bracket. Like so..
>
> if(this error || that error || some other error) {
> print error;
> } else {
> //no errors, thank them!
>print THANKS!
> }
>
> - Original Message -
> From: "Bruce Gilbert" <[EMAIL PROTECTED]>
> To: 
> Sent: Tuesday, July 19, 2005 5:52 PM
> Subject: [PHP] still some problems with contact form
>
>
> Hello,
>
> on my web site contact form:
>
> http://www.inspired-evolution.com/Contact.php
>
> I am still having a few problems with the return results after filling
> out the form. Basically I am wanted to return an error msg. when all
> of the required fields are not filled out (those with a red *), and an
> invalid email address will also return an error.
>
> filling out all of the information correctly will result in a
> thank-you paragraph, we have received your submission etc.
>
> Right now even if you don't fill out the required fields, you still
> get my thank-you message for filling out the form correctly (as well
> as getting the error msg.). If someone has a chance try out the form
> yourself and you will see what I mean.
>
> What I would really like to have is a thank-you page when the form is
> completed sucussfully and an oops! page when there is an error. SO we
> are talking two different pages, based upon the results of the form
> information...
>
> The PHP code I have for the return info. currenty is:
>
> 
> $firstname = $_POST['firstname'];
> $lastname = $_POST['lastname'];
> $company = $_POST['company'];
> $phone = $_POST['phone'];
> $email = $_POST['email'];
> $email2 = $_POST['email2'];
> $URL = $_POST['URL'];
> $Contact_Preference = $_POST['Contact_Preference'];
> $Contact_Time = $_POST['Contact_Time'];
> $message = $_POST['Message'];
>
> if ((!$firstname) || (!$Contact_Preference)) {
>
> echo'Error! Fields marked 
> * are required to continue.';
> echo'Please go back to the Contact Me page and try it again!';
> }
>
> if
>
(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*"."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+".
"\\.[a-z]{2,}"."$",$email))
> {
>
> echo 'Invalid email address entered.';
> echo 'Please go back to the Contact Me page and try it again!';



> }
> if (($email) != ($email2)) {
>
> echo 'Error! e-mail addresses dont match.';
>
>
> }
>
> $email_address = "[EMAIL PROTECTED]";
> $subject = "There has been a disturbance in the force";
>
> $message = "Request from: $firstname $lastname\n\n
> Company name: $company\n
> Phone Number:  $phone\n
> Email Address: $email\n
> URL: $URL\n
> Please Contact me via: $Contact_Preference\n
> The best time to reach me is: $Contact_Time\n
> I wish to request the following additional information: $Textarea";
>
> mail($email_address, $subject, $message, "From: $email \nX-Mailer:
> PHP/" . phpversion());
>
> echo "Hello, $firstname.
> We have received your request for additional information, and will
> respond shortly.
> Thanks for visiting inspired-evolution.com and have a wonderful day! />
> Regards,
> Inspired Evolution";
>
> ?>
>
> any assistance/guidance is greatly appreciated. Thanks list!
>
> Bruce G.
> http://www.inspired-evolution.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
::Bruce::

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



Re: [PHP] problems with self referential sticky forms

2005-07-20 Thread Mark Rees

"eoghan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On 20 Jul 2005, at 02:22, Linda H wrote:
>
> > fahreheit is here:
> >
> >  > $fahr = $_GET['fahrenheit'];
> > if (is_null($fahr)){ echo 'fahr is null';}
> > $>
> >
> > The error was on the line: $fahr = $_GET['fahrenheit'];
>
> try:
> 

Do as previously suggested and check that

$fahr=isset($_GET['fahrenheit'])?$_GET['fahrenheit']:null;

(although since you are dealing with a string here, perhaps an empty string
''might be a better bet than null)
then your test is

if($fahr==''){echo 'fahr is empty');

note the semicolon at the end of each line, and your closing php tag should
be ?>, not $>

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



[PHP] Re: checking for internet connection

2005-07-20 Thread Mark Rees

"Steven" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi
>
> I am looking for a simple way to check if the server is connected to the
> Internet, they use a dialup to get Internet connection, and I need to
> email reports out, but want to check to see if the user remembered to
> connect to the Internet first.  If anybody has a nice script, or just a
> suggestion on a php function I could use to test for an Internet
connection.
>

You could try curl or fsockopen to see if there is a connection. But really,
is this necessary? You don't test to see if the computer's plugged in, do
you? So why test for this? Surely your user will have enough nous to connet
to the internet forst, and if they don't, then it just won't work.


> Thanks
> steve

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



[PHP] Re: still some problems with contact form

2005-07-21 Thread Mark Rees
>Hello Mark

>An alternative (and more user-friendly) approach is to have the form's
>action as itself (i.e. the form on contact.php submits to contact.php). You
>can then identify which fields are incomplete and highlight them in the
>form. This will make it easier for users to see what they have done wrong
>and make the necessary corrections.

>in regards to this response on my contact form issues, how would I do
>these which you mention.

>currentlly the form is:

>

>and the Thankyou.php code consit of what I posted on the forum.

>thanks for all of your help!!


A sample set up is as follows, with much room for improvement and
refinement, but it should give you the basic idea.

contact.php

email

>



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



[PHP] Re: function MAX with WHERE

2005-07-25 Thread Mark Rees
"Jesús Alain Rodríguez Santos" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I have someting like this:
>
> $test = mysql_query("SELECT MAX(dato) AS datos FROM tabla WHERE campo_mes
> = '$mes'");
> $test_m = mysql_fetch_array($test);
> $test_mes = $test_m['datos'];
>
> print $test_mes
>
> where $mes is a value
> I need to know if something its wrong, because I don't recive any error,
> but I see nothing

Try this, it will tell you if something is wrong

echo  mysql_error();

If nothing is wrong, then perhaps your query returns no rows? Test this by
removing the where clause (assuming there is some data in tabla).

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



Re: [PHP] MySQL + PHP question

2005-07-26 Thread Mark Rees
Are you familiar with Joe Celko's tree theory? It might help you understand
more about the problem.

http://www.intelligententerprise.com/001020/celko.jhtml?_requestid=235427

--

Hello,

Consider this:
tbl_project(id, name, parent)

1   6
   / \ / \
  2   3 7   8
/\
4  5

if tbl_project.parent = 0 then the project is the "top" parent.
Therefore, 1 and 6 have the field parent = 0.

So, say if you have project 5, do you want to find out its parent (2), or do
you want to find out all its parents including grandparents (2) and (1)?

What do you need to know?

C.
-Original Message-
From: André Medeiros [mailto:[EMAIL PROTECTED]
Sent: 26 July 2005 12:18
To: php-general@lists.php.net
Subject: [PHP] MySQL + PHP question

Hi guys.

I'm having some trouble here regarding a project. I have a table with
projects, wich can be recursive (ie. sub-projects) and it is related to
itself.

By making the following query

-8<--
SELECT * FROM projects LEFT JOIN projects proj_parent ON
projects.project_parent = proj_parent.parent_id WHERE project_id = 1234
-8<--

i need to be able to access to the parent project's fields, but I have a
slight problem here.

First off, I have to make the LEFT JOIN. I don't know if the project can
be parent (therefore not finding a project_id = 0 wouldn't show the row)
and I need to add some kind of prefix to the proj_parent's fields so
that I can access them (or that they can't overwrite the project i'm
getting info on.

Well... there is an obvious sollution here: use an associative array
instead of an object, and access the properties by doing $array[0],
$array[1], etc. By my experience, this is a nightmare, maintenence-wise,
so I'd only use it as a _LAST_ resource.

Does anyone have any experience with this? The answer should be pretty
obvious, but I can't seem to figure it out :(

Thanks in advance.

André

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



Re: [PHP] MySQL + PHP question

2005-07-26 Thread Mark Rees
"André Medeiros" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> One thing I didn't quite explain myself well... I'm building this to
> register objects on a permission system.
>
> The SQL weight is heavy as it is, and I want to save queries as much as
> possible. Making two queries to extract information about a project and
> it's parent is not something I'd want to do. I know recursiveness, but
> thanks for the pointers and for the reply :)
>
> Best regards

I must admit I still don't really get what you are looking for. Does this
query help?

select c.field1 AS childfield1,
c.field2 AS childfield2,
(etc)
p.field1 AS parentfield1,
p.field2 AS parentfield2,
(etc)
FROM
child AS c
LEFT JOIN
parent AS p
ON c.parent=p.id

?

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



Re: [PHP] php mySql question

2005-07-27 Thread Mark Rees
Yes, it is quite possible that you have more than one php.ini file. Check
this and delete as appropriate.
""Shaw, Chris - Accenture"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
...

Have you tried doing a search for the text "php5" in the php.ini file that
sits in your c:\windows folder?

C.

-Original Message-
From: Ned Kotter [mailto:[EMAIL PROTECTED]
Sent: 26 July 2005 04:03
To: php-general@lists.php.net
Subject: [PHP] php mySql question


I have installed php 5.0.4 on my windows 2000, IIS 6.0 server.  PHP works
but
when I try to connect to MySQL I get the Fatal error: Call to undefined
function mysql_connect().  I have uncommented the line in the php.ini file
that says 'extension=php_mysql.dll'.  I have path variables set for both
c:\php and c:\php\ext.  One very peculiar thing that I noticed when I ran
phpinfo() is that it shows the extension_dir is set to c:\php5 even though
in
my php.ini file it is set to c:\php.  I have a feeling that this is where
the
problem exists.  Any advice would be appreciated.

Thanks,
NK


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com




This message has been delivered to the Internet by the Revenue Internet
e-mail service

*

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



Re: [PHP] Multipage form redux

2005-07-27 Thread Mark Rees
"André Medeiros" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Wed, 2005-07-27 at 07:51 -0400, Jack Jackson wrote:
> > Hi,
> > I have searched the archives and seen links to tutorials at phpclasses
> > (which seem to be down) and not found an answer to my question:
> > I have a long form I want to break into seven pages. Rather than pass
> > values from page to page as hidden, I'd rather write the results to the
> > db after each page then move on.
> >
> > Anyone know of any tutorials on this?
> >
> > Thanks in advance,
> > JJ
> >
>
> That's not a very good idea. Imagine the user gets to the fourth form
> and gets a cup of coffee, or goes out to lunch. By the time he gets to
> the computer he might have lost the session, thus having data on your DB
> that is wasting space.
>
> And what if the user closes the browser window? :)
>
> Bad bad idea.

What if the form takes ages to fill out, and the user has to go away and
find out other information, then wants to come back to the form and see it
pre-filled? For an insurance quote, say?

It could be a good idea under those circumstances. You can always delete all
incomplete data with a cron job every week or so if needs be.

Do you know how to write data to a db? The mechanics of what you want to do
are not especially complex.

page 1
form vars
page 2
request form vars, write to db, display form
etc

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



Re: [PHP] preg_match - help please

2005-07-27 Thread Mark Rees
"André Medeiros" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Wed, 2005-07-27 at 15:27 +0100, Steve Turnbull wrote:
> > Hi
> >
> > I want to see that a user is submiting a form field in the correct
manner.
> > So I decided to use preg_match to verify their input.
> >
> > The pattern I am trying to match is;
> >
> > Firstname Secondname
> >
> > I am not bothered about character length just yet (but advise on this
would
> > be appreciated if it can be done with a regular expression - saves extra
> > checking code), but I would like case sensitity.
> >
> > The code I haev so far, which doesn't seem to work is;
> >
> > $un = $_REQUEST['name'];
> > $exp = '/^\b[a-zA-Z] [a-zA-Z]$/';
> >
> > if (preg_match($exp, $un)) {
> > //has this matched?
> > echo "matched";
> > }
> >
> > Help would be greatly appreciated
> >
> > Thanks
> > Steve
> >
>
> A reminder... sometimes First and Last name can contain three words.
> There are portuguese names, like "Inês de Medeiros". Watch out for that
> too.

Or even four - like Rafael van der Vaart for example - so make sure that the
surname box matches spaces as well, and special characters like the ê, as
well as ' as in John O'Kane

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



[PHP] Re: Has anybody used amfphp? (open flash remoting + php)

2005-07-28 Thread Mark Rees
"Taksam" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> Anybody used OpenAMF+PHP? ( http://www.amfphp.org/ )
>
> It is an open-source Flash Remoting gateway. I already used it with Java
and works OK. Just wanted to know if somebody here used it with PHP and
would like to know if they recommend it or not.
>

Please don't cross-post on php.general and this list

>
>
> Tak
>
> __
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com

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



Re: [PHP] Multipage form redux

2005-07-28 Thread Mark Rees
Jack Jackson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Somehow my intent has been turned around here and I apologise.
>
> I do not want to use *any* client side validation. I only want to do
> server side validation and server side storage.
>
> My intent was to remove the client from as much as possible of this - if
> I didn't need their information I wouldn't even allow clients!! :)
>
> What I wanted to do was this:
>
>
> p. 1 : I send client page one, they send answers. SUBMIT sends to page 2
> script.
>
> p 2. Before displaying anything to the client, Page 2 script validates
> input from page 1. If there are problems, page 2 script redisplays page
> one questions with highlights around problems. Clicking submit then
> resubmits page one data to page 2 script.
>
> Once page 2 script validates all page 1 answers, page 2 script stores
> all those answers to a SESSION, then sends PAGE 2 QUESTIONS ONLY (no
> $_POST information) to client. Client answers page 2 questions and
> clicking submit submits PAGE 2 QUESTIONS to page 3 script.
>
> p 3. Before displaying anything to the client, Page 3 script validates
> input from page 2 questions. If there are problems, page 3 script
> redisplays page 2 questions with highlights around problems. Clicking
> submit resubmits page 2 data to page 3 script.
>
> Once page 3 script validates all page 2 answers, the script stores all
> those answers to a SESSION, then sends PAGE 3 QUESTIONS ONLY (no $_POST
> information) to client. Client answers page 3 questions and clicking
> submit submits PAGE 3 QUESTIONS to page 4 script.
>
> At this point, if the client goes off for a bite, or two weeks
> backpacking in the Anapurna region, I'm fine, because the information is
> stored in the session (I have a very small group taking this
> questionnaire, all have a vested interested in filling it in, so I am
> not too worried abou their going aaway from it for more than a couple
> days max).
>
> Once they complete the last set of questions, I say thanks much, get all
> the information out of their SESSION, insert it into the db, send
> confirmation emails all around and we're done.

Sessions are used to identify users on a single visit to a website. They are
not intended to track users who turn off their machines, then turn them on
again and visit the website again. There are various ways of doing this, and
for all I know it may be possible with sessions, but I don't recommend you
try.

Do as suggested previously by various posters, it is the simplest and most
robust solution to your problem:

1. have the user register their details first up. Store this in a db, and
use it to identify the user on any subsequent visit.
2. when each page is submitted, write the information into the db. This way
it will definitely be associated with the right user
3. Whenever a user revisits the questionnaire, make them log in, then take
them to wherever they were up to - you will be able to work this out from
the amount of data you have recorded against them.

e.g. database table

userid
question
question
question
question
question
question







> Is this possible? How?
>
> Thanks!
>
>
>
> Marcus Bointon wrote:
> > On 27 Jul 2005, at 21:22, Jack Jackson wrote:
> >
> >
> >> Right. Except I would rather have it working in a session because I
> >> specifically do not want to have the form sending $_POST data back
> >> and forth to the browser six times for several reasons. SO I'd like to
> >>
> >> Page1 // User enters first batch of data, presses SUBMIT at bottom.
> >> Data is cleaned and written to SESSION, user passed to Page2
> >>
> >> repeat as necessary to last page. At last page, process and error
> >> check newest input, then commit it, plus all previously stored
> >> session info to db.
> >>
> >
> > As has also been said, Javascript can do this really nicely. The best
> > example I've seen of this is in Mambo's (a popular PHP CMS) admin
> > interface. It uses a tabbed multi-page form with client-side
> > validation. It's really just one big page, so if the user has JS  turned
> > off, they will get one big form with no client-side  validation, but it
> > will still work. It's a really elegant way of  working. It doesn't
> > require any server interaction between pages -  nothing is submitted
> > until the form is complete.
> >
> > See here for a howto: http://www.devx.com/webdev/Article/10483/1763/
page/1
> >
> > Admittedly this approach doesn't easily allow to you abandon and  resume
> > later (unless you get clever with JS and cookies).
> >
> > For keeping data in a session, you could combine this approach with
> > Ajax: http://particletree.com/features/smart-validation-with-ajax
> >
> > Marcus

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



Re: [PHP] Multipage form redux

2005-07-28 Thread Mark Rees
Jack Jackson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Somehow my intent has been turned around here and I apologise.
>
> I do not want to use *any* client side validation. I only want to do
> server side validation and server side storage.
>
> My intent was to remove the client from as much as possible of this - if
> I didn't need their information I wouldn't even allow clients!! :)
>
> What I wanted to do was this:
>
>
> p. 1 : I send client page one, they send answers. SUBMIT sends to page 2
> script.
>
> p 2. Before displaying anything to the client, Page 2 script validates
> input from page 1. If there are problems, page 2 script redisplays page
> one questions with highlights around problems. Clicking submit then
> resubmits page one data to page 2 script.
>
> Once page 2 script validates all page 1 answers, page 2 script stores
> all those answers to a SESSION, then sends PAGE 2 QUESTIONS ONLY (no
> $_POST information) to client. Client answers page 2 questions and
> clicking submit submits PAGE 2 QUESTIONS to page 3 script.
>
> p 3. Before displaying anything to the client, Page 3 script validates
> input from page 2 questions. If there are problems, page 3 script
> redisplays page 2 questions with highlights around problems. Clicking
> submit resubmits page 2 data to page 3 script.
>
> Once page 3 script validates all page 2 answers, the script stores all
> those answers to a SESSION, then sends PAGE 3 QUESTIONS ONLY (no $_POST
> information) to client. Client answers page 3 questions and clicking
> submit submits PAGE 3 QUESTIONS to page 4 script.
>
> At this point, if the client goes off for a bite, or two weeks
> backpacking in the Anapurna region, I'm fine, because the information is
> stored in the session (I have a very small group taking this
> questionnaire, all have a vested interested in filling it in, so I am
> not too worried abou their going aaway from it for more than a couple
> days max).
>
> Once they complete the last set of questions, I say thanks much, get all
> the information out of their SESSION, insert it into the db, send
> confirmation emails all around and we're done.

Sessions are used to identify users on a single visit to a website. They are
not intended to track users who turn off their machines, then turn them on
again and visit the website again. There are various ways of doing this, and
for all I know it may be possible with sessions, but I don't recommend you
try.

Do as suggested previously by various posters, it is the simplest and most
robust solution to your problem:

1. have the user register their details first up. Store this in a db, and
use it to identify the user on any subsequent visit.
2. when each page is submitted, write the information into the db. This way
it will definitely be associated with the right user
3. Whenever a user revisits the questionnaire, make them log in, then take
them to wherever they were up to - you will be able to work this out from
the amount of data you have recorded against them.

e.g. database table

tbluser
userid
password

tblanswers
userid
question1
question2
question3
question4
question5
question6
etc

Scenario 1
A user logs into the questionnaire. No row is present in tbluser for this
user, so create one, and send the user to the first page of the
questionnaire

Scenario 2
A user logs into the questionnaire. There is a row in tbluser, and
tblanswers also has a row, with data in columns userid, question1 and
question2. Direct this user to the third page of the questionnaire

I hope this is clearer

Mark


> Is this possible? How?
>
> Thanks!
>
>
>
> Marcus Bointon wrote:
> > On 27 Jul 2005, at 21:22, Jack Jackson wrote:
> >
> >
> >> Right. Except I would rather have it working in a session because I
> >> specifically do not want to have the form sending $_POST data back
> >> and forth to the browser six times for several reasons. SO I'd like to
> >>
> >> Page1 // User enters first batch of data, presses SUBMIT at bottom.
> >> Data is cleaned and written to SESSION, user passed to Page2
> >>
> >> repeat as necessary to last page. At last page, process and error
> >> check newest input, then commit it, plus all previously stored
> >> session info to db.
> >>
> >
> > As has also been said, Javascript can do this really nicely. The best
> > example I've seen of this is in Mambo's (a popular PHP CMS) admin
> > interface. It uses a tabbed multi-page form with client-side
> > validation. It's really just one big page, so if the user has JS  turned
> > off, they will get one big form with no client-side  validation, but it
> > will still work. It's a really elegant way of  working. It doesn't
> > require any server interaction between pages -  nothing is submitted
> > until the form is complete.
> >
> > See here for a howto: http://www.devx.com/webdev/Article/10483/1763/
page/1
> >
> > Admittedly this approach doesn't easily allow to you abandon and  resume
> > later (unless you get clever with JS and cooki

Re: [PHP] Multipage form redux

2005-07-28 Thread Mark Rees
Jack Jackson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Somehow my intent has been turned around here and I apologise.
>
> I do not want to use *any* client side validation. I only want to do
> server side validation and server side storage.
>
> My intent was to remove the client from as much as possible of this - if
> I didn't need their information I wouldn't even allow clients!! :)
>
> What I wanted to do was this:
>
>
> p. 1 : I send client page one, they send answers. SUBMIT sends to page 2
> script.
>
> p 2. Before displaying anything to the client, Page 2 script validates
> input from page 1. If there are problems, page 2 script redisplays page
> one questions with highlights around problems. Clicking submit then
> resubmits page one data to page 2 script.
>
> Once page 2 script validates all page 1 answers, page 2 script stores
> all those answers to a SESSION, then sends PAGE 2 QUESTIONS ONLY (no
> $_POST information) to client. Client answers page 2 questions and
> clicking submit submits PAGE 2 QUESTIONS to page 3 script.
>
> p 3. Before displaying anything to the client, Page 3 script validates
> input from page 2 questions. If there are problems, page 3 script
> redisplays page 2 questions with highlights around problems. Clicking
> submit resubmits page 2 data to page 3 script.
>
> Once page 3 script validates all page 2 answers, the script stores all
> those answers to a SESSION, then sends PAGE 3 QUESTIONS ONLY (no $_POST
> information) to client. Client answers page 3 questions and clicking
> submit submits PAGE 3 QUESTIONS to page 4 script.
>
> At this point, if the client goes off for a bite, or two weeks
> backpacking in the Anapurna region, I'm fine, because the information is
> stored in the session (I have a very small group taking this
> questionnaire, all have a vested interested in filling it in, so I am
> not too worried abou their going aaway from it for more than a couple
> days max).
>
> Once they complete the last set of questions, I say thanks much, get all
> the information out of their SESSION, insert it into the db, send
> confirmation emails all around and we're done.

Sessions are used to identify users on a single visit to a website. They are
not intended to track users who turn off their machines, then turn them on
again and visit the website again. There are various ways of doing this, and
for all I know it may be possible with sessions, but I don't recommend you
try.

Do as suggested previously by various posters, it is the simplest and most
robust solution to your problem:

1. have the user register their details first up. Store this in a db, and
use it to identify the user on any subsequent visit.
2. when each page is submitted, write the information into the db. This way
it will definitely be associated with the right user
3. Whenever a user revisits the questionnaire, make them log in, then take
them to wherever they were up to - you will be able to work this out from
the amount of data you have recorded against them.

e.g. database table

tbluser
userid
password

tblanswers
userid
question1
question2
question3
question4
question5
question6
etc

Scenario 1
A user logs into the questionnaire. No row is present in tbluser for this
user, so create one, and send the user to the first page of the
questionnaire

Scenario 2
A user logs into the questionnaire. There is a row in tbluser, and
tblanswers also has a row, with data in columns userid, question1 and
question2. Direct this user to the third page of the questionnaire

I hope this is clearer

Mark


> Is this possible? How?
>
> Thanks!
>
>
>
> Marcus Bointon wrote:
> > On 27 Jul 2005, at 21:22, Jack Jackson wrote:
> >
> >
> >> Right. Except I would rather have it working in a session because I
> >> specifically do not want to have the form sending $_POST data back
> >> and forth to the browser six times for several reasons. SO I'd like to
> >>
> >> Page1 // User enters first batch of data, presses SUBMIT at bottom.
> >> Data is cleaned and written to SESSION, user passed to Page2
> >>
> >> repeat as necessary to last page. At last page, process and error
> >> check newest input, then commit it, plus all previously stored
> >> session info to db.
> >>
> >
> > As has also been said, Javascript can do this really nicely. The best
> > example I've seen of this is in Mambo's (a popular PHP CMS) admin
> > interface. It uses a tabbed multi-page form with client-side
> > validation. It's really just one big page, so if the user has JS  turned
> > off, they will get one big form with no client-side  validation, but it
> > will still work. It's a really elegant way of  working. It doesn't
> > require any server interaction between pages -  nothing is submitted
> > until the form is complete.
> >
> > See here for a howto: http://www.devx.com/webdev/Article/10483/1763/
page/1
> >
> > Admittedly this approach doesn't easily allow to you abandon and  resume
> > later (unless you get clever with JS and cooki

Re: [PHP] Multipage form redux

2005-07-28 Thread Mark Rees
"André Medeiros" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> The point of sessions is that when you close your browser, you loose it.
> I'm affraid that if you want sessions that last two weeks, you'll have
> to make your own session handler :) but yeah, it's possible, and it
> beats the crap out of the "fill form, store in db, fill form, store in
> db" method.

Unless your user wishes to complete the form from a different machine, of
course.

I really don't understand the dogmatic antipathy to storing information in
the database. Sometimes it is a better solution - horses for courses.
Rolling your own session management tool, whilst undoubtedly fun and
satisfying, is hardly an appropriate solution to this type of enquiry, which
is apparently from someone taking their first steps in web development.

I should probably explain that I come from an ASP background and so have an
inherent mistrust of sessions, although I am coming to understand that PHP
sessions are much more reliable.

Sorry about the three posts before, my mistake.

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



[PHP] Re: dynamic two column table

2005-08-01 Thread Mark Rees
> i know how to break up db results into two tables but im having a hard
> problem with this:
>
> db structure
>
> ---
> | id | cid | title
> ---
> | 1  | 2  | hardware
> | 2  | 3  | software
> | 3  | 3  | software
> | 4  | 2  | hardware
>
>
> how can i have hardware on column 1 and software on column 2 using 1
> query? i thought a simple if statement on cid might do it but regardless
> it spreads the results on both columns.


Can you give an example of what you want the output to look like?


>
> thanx.
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.338 / Virus Database: 267.9.7/60 - Release Date: 7/28/2005

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



Re: [PHP] Re: error checking a null array

2005-08-01 Thread Mark Rees
>
> g.gill wrote:
> >>From what I understand the simplest solution here would be to check to
see
> > if you have $_POST['cb'] in the first place.  That would indicate if
> > checkbox was selected or not.  After, you have posted the form just do
the
> > following test.
> >
> > $check_box_exits = ((isset($_POST['cb']))? true:false);
>
>
> That helped, sonu, thank you. The problem now is that, how can I pass
> through $_POST the names of each specific checkbox, whether filled in or
> not, and then parse each to see if they have any answer? I need to do
> that or else I can only tell the ones which *have* been filled in but
> not those which have not.


It's about this time that I usually say, "forget the checkbox, let's use a
radio button instead" :-)


>
> Thanks

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



Re: [PHP] Re: error checking a null array

2005-08-01 Thread Mark Rees
On 8/1/05, Jack Jackson <[EMAIL PROTECTED]> wrote:
>
> Jochem Maas wrote:
> 
> >
> > wtf are you smoking Jack? every checkbox that was checked will exist in
the
> > $_POST array set with the value you gave it (I alway set a chekcboxes
> > value to 1
> > because the values mere existance in the submitted data indicates it's
> > chevckbox
> >  was checked), if a checkbox does not exist in the $_POST array it
> > wasn't checked!!!
>
> Oh, how I wish I were smoking something :) !
>
> > imagine you have 10 checkboxes named 'cb1' thru 'cb10' each with a value
> > of '1',
> > upon submitting the form they are in, your script sees the following in
> > the $_POST
> > array...
> >
> > $_POST = array('cb1' => '1', 'cb9' => '1', 'cb10' => '1');
> >
> > which tells you 3 checkboxes were checked... namely 'cb1', 'cb9' and
'cb10'
> > now how hard is it to determine which we're not checked?
> >
>
> Well, for me, it is - because I don't know the names of the other check
> boxes which were not checked because they were dynamically created, and
> I don't have the knowledge sufficient to pass the NAMES of all
> checkboxes through to $_POST so that I can search through and see which
> have been answered and which ones not.
>
>
>
> > maybe I'm not seeing the problem but I get the impression that you are
> > over complicating things regarding checkbox.
>
> As always this is hugely possible.
>
>
> JJ
>


You can pass those names in a hidden input field in the form,
something like this:


--

Yes, or you can make your life easier and use radio buttons instead - the
name:value is always passed without any need for the messing about which
checkboxes bring. However, if you wish to use checkboxes, Jochem and Dotan
are showing you the way.

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



Re: [PHP] returning info. from a form selection

2005-08-02 Thread Mark Rees
> >
> > can anyone give me an idea on how to return info. from a forl
> > pulldown menu
> >
> > and return that to an email address.
> >
>
> A most basic question begs a most basic answer:
>
>  if (!$_POST['submit']){ // Display form
> ?>
> 
> 
> Dropdown Value to Email
> 
> 
>
> 
> 
>   Purchase
>   Construct Home
>   
> 
> 
> 
>
>  }else{ // Mail form results
> if(mail('[EMAIL PROTECTED]','Dropdown
results',$_POST['loan_process'])){
>   echo 'Mail sent!';}
> else {
>   echo 'Mail NOT sent!';}

Even more basic, no php required (but not suitable for internet use as it
relies on your browser knowing what to do with a mailto link:

 
 
 Dropdown Value to Email
 
 
  mailto:[EMAIL PROTECTED]>
 
   Purchase
   Construct Home
   
 
 
 

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



[PHP] Re: Everything works...Unless they hit the "back" button...

2005-08-03 Thread Mark Rees
"Jack Jackson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi all. This has been an interesting week.
>
> Now the form works, and I am able to error check, if no errors look into
> user answer table and delete from that all q_ids matching the ones just
> picked, insert this page of question/answer info (q_id/a_id) into the
> user answer db, and if successful advance the category by 1 and get more
> questions. It works.
>
> I must have a logic error though because for some reason even though I
> say to delete matching  q_ids and reinsert, then move on, if the user
> hits the back button, changes answers and hits submit again, the table
> does not update . .  . and the category does not increment. We get stuck
> on this page of questions/answers forever.

Do you want to allow people to go back and chnage things ?

If so, write a suitable UPDATE statement

Sample UPDATE syntax

UPDATE table
SET field=1
WHERE field2='x'

You will probably want to check whether the answers already exist, use a
select statement for this. Unsure if this works in mysql, but

IF NOT EXISTS
(select id from table where field=1)
UPDATE table
SET field=1
WHERE field2='x'

might do the trick, or something similar will at any rate.

If you want to stop people going  back, check the referer (sic)
>
> What DOES happen after BACK is that the answers they select get passed
> back to error check (eg if they select a select box to nothing, error
> checking reenters its value into $message) and those values get passed
> back to the display page (eg $_POST[$qname] == $aid) because the
> "selected" answers change. It's just the db call and category advance
> which get stuck.

>
> Any help will be greatly appreciated - Here's the code:
>
>  //Start the session
> session_start();
> //Error announcements
> echo "POST:";
> print_r($_POST);
> echo "";
> echo "required session:";
> var_dump($_SESSION['required_fields']);
>
> echo "\$ cat:" . $cat . "";
> echo "\$message: ";
> var_dump($message);
>
> //error_reporting(E_ALL);
>
>
> /* A script to retrieve from database questions and answers,
>   * create a multi-page HTML form, error check answers and
>   * submit them to the database on a per-user basis.
>   * August 2005
>   */
>
> //Some basic vars
>   if (!isset($cat)) { $cat = "1"; }
> $error=0;
> $SUCCESS=0;
>
>
> if (!isset($message))
>  {
>  $message = array();
>  }
>
> if (!isset($_SESSION['required_fields']))
>  {
>  $_SESSION['required_fields'] = array();
>  }
>
> if(!sizeof($_POST))
> {
> include_once(QUESTIONS . 'q.inc');
>  }
>
>   //error checking
>
>   reset($_SESSION['required_fields']);
>foreach ($_SESSION['required_fields'] as $fieldname)
>  {
> if (!isset($_POST[$fieldname]) || empty($_POST[$fieldname]))
> {
>  $message[$fieldname]=1;
> }
>
>   }//error check
>if (!empty($message))
>{   $cat=$_POST['cat'];
>include_once(QUESTIONS . 'q.inc');
>}
>
> //No errors? Store what's been done so far
>
>if ( ($_POST['action'] == 'process') && (!sizeof($message) ) )
>{
>foreach($_POST as $key=>$val)
> {
> //find key/val sets within posts which are both
numeric
> if(is_numeric($key) && is_numeric($val))
> {
>$nkey=$key;
>//add keys to the qidlist
>$qidlist[] .= $key;
>//add these values ( q_id, a_id ) to sql statement
>$qanda[] .= "('1' , '" . $nkey . "' , '" . $val .
> "')";
> }
> //find key/val sets within sub-arrays of $_POST
> which are numeric
> if(is_array($val))
> {
> foreach ($val as $akey=>$aval)
> {
> //add these values ( q_id, a_id ) to sql
> statement
> $qanda[] .= "('1' , '" . $key . "' , '" .
> $aval . "')";
> var_dump($qanda);
> }
> }
> }
>
>
> $qidlist_sql="DELETE FROM $userAnswers WHERE q_id IN ("
> . (implode(",",$qidlist)) . ");";
>
> $q_a_sql="INSERT INTO $userAnswers (u_id, q_id, a_id )
>  VALUES " . (implode(",",$qanda)) . ";";
>
>   mysql_query($qidlist_sql);
>
>
>if($q_a_result = mysql_query($q_a_sql))
>  {
>unset($_SESSION['required_fields']);
>$cat = $_POST['cat']+1;
>include_once(QUESTIONS . 'q.inc');
>  }
>
>  else
>  {
>  echo "A fatal MySQL error occured.\n
>  Query: " . $q_a_sql . "\nError: (" .
> mysql_error();
> 

[PHP] Re: The Naming of Directories

2005-08-04 Thread Mark Rees
"Tom Chubb" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
This may be slightly OT, but I've modified a gallery script that I had
written for me which reads directories and echos the dir name as a
gallery.
Unfortunately, it doesn't look very nice with say picsofsomething so I
renamed the folder 'pics of something'
When this is read, the string inserts %20 for the spaces, which is
fine, but are there any reasons why I shouldn't be doing this?
Many thanks,

--

A while back, this would have been liable to cause problems in Netscape
(v3/4). I don't think it makes so much difference these days, but I just
avoid it out of habit. You can get a more readable effect wihout spaces by
using an underscore, say, in the directory name, and when you need to print
it to screen, replace the underscores with spaces
--
Tom

--
Tom Chubb
[EMAIL PROTECTED]
07915 053312

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



Re: [PHP] Advice sought on PHP site maintenance

2005-08-16 Thread Mark Rees
""George Pitcher"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> John,
>
> Thanks for the input. I just knew I hadn't covered everything. My server
is
> currently set up as NT4/IIS. I suppose I could look to switching to Apache
> though.

Far be it from me to discrouage you from switching to Apache. However, on
IIS, you can store the include files and classes you wish to use across
several sites in a single location. You can then make this accessible to all
sites by adding the location in as a virtual directory. This basically
allows you to refer to it as if it were a directory within your webroot (if
I remember right, it's been a while).

There's a brief guide here:
http://www.mvps.org/marksxp/WindowsXP/IIS/iis3.php

Giood luck

Mark

>
> Cheers
>
> George
>
> > -Original Message-
> > From: John Nichel [mailto:[EMAIL PROTECTED]
> > Sent: 16 August 2005 2:25 pm
> > To: php-general@lists.php.net
> > Subject: Re: [PHP] Advice sought on PHP site maintenance
> >
> >
> > George Pitcher wrote:
> > > Hi,
> > >
> > > I manage several sites for my company. Some are running our own
> > service to
> > > about 80 customers and others are running a service for some (5
> > and growing)
> > > of our customers. Its the latter one that I need advice on.
> > >
> > > I have an application where each customer has a website on our
> > service. The
> > > functionality and layout are almost identical throughout these
> > sites and I
> > > am striving to move any differences into configuration files.
> > However, when
> > > I make a change, I then need to make that change on each site.
> > >
> > > I would like, if possible to maintain a single set of web pages and
have
> > > that work for all sites. I currently use PEAR::DB and Smarty
> > templating. The
> > > current url syntax is www.mysite.com/client/ and I would like
> > to keep them
> > > thinking that they each have their own unique site.
> > >
> > > Can anyone suggest a structure for this?
> >
> > If I'm reading you right, you're looking to keep a group of
> > scripts/classes in one place that all sites can draw from.  If this is
> > the case, you could always set a global include directory (make it read
> > only for the users of your service), and configure that path in Apache's
> > httpd.conf or an .htaccess.  I do this on our box (all the sites are
> > ours, but when I have to update Smarty/PEAR/custom scripts, I like to
> > just do it in one place).
> >
> > 
> > ->
> > ->
> > ->
> > ->
> > ->
> > ->
> > ->
> > ->
> > ->
> > ->
> > ->
> > ->
> >
> > So on, and so forth.

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



[PHP] Re: edit $variable online?

2005-08-17 Thread Mark Rees
"Jesús Alain Rodríguez Santos" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi, I have in a php page one ($variable = 85), I woud like to change the
> value from this variable online, without any data base, for example ussing
> a form where I can put the new value and it change the value of the
> $variable.
>


Do you mean that you have a page like this, for example:

1.php
85 ){
do things;
}
?>

And you wish to permanently change the value of $variable to 86?

You could use file rewriting functions to do this. Look in the manual for
fputs, fread, fwrite and their friends.

If you wish to change the value temporarily for a single user visit
(session), use a session variable to store it. If you wish to change it for
a period of time, then perhaps consider using a class to retrieve the
variable.




>
> --
> Este mensaje ha sido analizado por MailScanner
> en busca de virus y otros contenidos peligrosos,
> y se considera que está limpio.
>

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



[PHP] Re: access multiple databases

2005-08-17 Thread Mark Rees
"Bing Du" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I need to access both MySQL and SQL server 2000 in a PHP script on RHEL
> 3.  In phpinfo(), I noticed 'supported databases' shows 'MySQL ODBC
> PostgreSQL Microsoft SQL Server FrontBase Oracle 8 (oci8)'.   And
> 'Configure Command' has '--with-unixODBC=shared' included.  Do I need to
>   install anything else, like iodbc?
>

Have you uncommented

extension=php_mssql.dll

in php.ini?

Are you having any specific problems or error messages?

> Would anybody give me some guidance how I should start from here?
>
> Thanks,
>
> Bing

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



[PHP] LDAP, PHP and MS Active Directory

2005-08-17 Thread Mark Rees
Apologies if this turns out to be a cross-post. I sent it to the list @
evolt, but have seen no traffic on that list for two days now.

---

Hello

I am using PHP v5 to write an intranet. The site is hosted on a windows 2000
server running Apache. I want to incorporate some form of Windows
authentication to allow or deny access to given resources based on usernames
and group membership.

I am trying to accomplish this using LDAP. I am able to connect and bind to
our Active Directory server (also Windows 2000) from PHP, but when I want to
perform a search, I need to know what the base record is. This is in the
format o=my company, c=the country it is in.

This is where the problem lies. How do I find out this information? Is there
some facility in Active Directory that allows me to see what the actual
name-values are for all the records (like sn=rees)?

The line of code causing the problem is this: $ds is a bound connection to
the LDAP server
$sr=ldap_search($ds, "o=company name, c=uk", "sn=g*");

It returns "Operations error"

Thanks in advance

Mark

--
www.itsagoodprice.com - top-brand electronics for less.

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



[PHP] Re: LDAP, PHP and MS Active Directory

2005-08-18 Thread Mark Rees
> Hello
>
> I am using PHP v5 to write an intranet. The site is hosted on a windows
2000
> server running Apache. I want to incorporate some form of Windows
> authentication to allow or deny access to given resources based on
usernames
> and group membership.
>
> I am trying to accomplish this using LDAP. I am able to connect and bind
to
> our Active Directory server (also Windows 2000) from PHP, but when I want
to
> perform a search, I need to know what the base record is. This is in the
> format o=my company, c=the country it is in.
>
> This is where the problem lies. How do I find out this information? Is
there
> some facility in Active Directory that allows me to see what the actual
> name-values are for all the records (like sn=rees)?
>

I found a useful utility to solve this problem called CSVDE built into
Windows 2000 and 2003. More information is available here
http://www.computerperformance.co.uk/Logon/LDAP_attributes_active_directory.
htm

I also found this page useful

http://www.developer.com/lang/php/article.php/3100951



> The line of code causing the problem is this: $ds is a bound connection to
> the LDAP server
> $sr=ldap_search($ds, "o=company name, c=uk", "sn=g*");
>
> It returns "Operations error"
>
> Thanks in advance
>
> Mark
>
> --
> www.itsagoodprice.com - top-brand electronics for less.

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



Re: [PHP] Catching all errors and redirecting

2005-08-19 Thread Mark Rees
""Jay Blanchard"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
[snip]
Is it possible to catch all parser errors (notices), and as that happens
redirecting to a 'sorry-page-not-available-at-this-moment' page, whilst
storing the error (or notice) message somewhere else (e.g. emailing it
to
the developer).
[/snip]

Yes?


/subtle

What is the point of taking this attitude with a poster who (I'm guessing
from his name) is a non-native English speaker? He asks a perfectly polite,
intelligible and on-topic question. Even if he isn't a good proportion of
posters are non-native speakers, and I imagine they find this kind of thing
a little intimidating.

One strange thing I notice about this list: even the most off-topic and
misguided question (like how can I clear a user's browser cache with PHP,
how do I set up a mailserver) gets a few intemperate answers and then
(perhaps because people's attention is drawn to it) a series of useful
answers. This encourages posters to come back and ask again, as they keep
getting answers. A well-formulated question, on the other hand, will
sometimes just be ignored, perhaps because it is buried in the general
traffic. Witness the recent post by Richard Lynch on "True Upload Max
Filesize", for example.

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



[PHP] Re: setting 'sendmail_from' on windows

2005-08-19 Thread Mark Rees
""George Pitcher"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I am sending emails out from php using a variety of 'From addresses',
> depending on who is logged on. I would like bounced messages to go
directly
> to the sender, but they are not. I suspect that this is because in
php.ini,
> I have to set the 'sendmail_from' to a specific address.
>

I don't know if this will work, but try using ini_set  to change
sendmail_from as necessary

http://uk2.php.net/manual/en/function.ini-set.php

List of ini options here

http://uk2.php.net/manual/en/ini.php#ini.list


> Can anyone suggest an alternative, other than switching platforms?
>
> MTIA
>
>
> George

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



Re: [PHP] LDAP problem

2005-08-24 Thread Mark Rees
>How long does it take to fail?
>I get the answer immidiatly (0-1sec.)...

Are you sure you are connecting? As in, do you only try to bind if you have
a successful connection?

Have you checked ldap_error?

Are you doing an anonymous bind, or using a username and password? Try each
and see what happens

How about posting some code?

I have just spent several days trying on and off to work out LDAP, from a
starting position of "what's LDAP?".

Good luck

Mark

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



Re: [PHP] PHP vs. ColdFusion

2005-08-24 Thread Mark Rees
> >> I'm betting you'll have the SAME ISSUE, and that the problem has
> >> NOTHING to do with PHP whatsoever.
> >
> > And you'd win that bet. I thought that would be the proof I'd need to
> > show that it wasn't PHP, but management has some notion that PHP might
> > have somehow tainted IIS.
>
> Gotta love a management group that doesn't listen to their IT guys and
> think they know the answer to all the IT problems even though they have
> no clue about IT.  I've been there done that and guess what?  I'm still
> doing it to this day.  I think it's one of those never ending things.
> What you should do is configure IIS to parse PHP with .asp extensions
> and just tell them that it's ASP.  Now that would be funny!
>
> >> PHP works fine with IIS and Windows.
> >
> > I've tried to tell the that there are Fortune 500 companies running
> > PHP on Windows and IIS (there are, right?).
>
> Target, Tickmaster, Yahoo, Amazon, and the list goes on and on.

Not too sure about this:

http://uptime.netcraft.com/up/graph?site=amazon.com
http://uptime.netcraft.com/up/graph?site=ticketmaster.com

etc
PHP, possibly, but not on IIS and Windows.


>
>
> Or you could leave IIS on the Windows machine and install Apache on the
> same Windows box and run PHP using Apache on Windows and see if that
> solves your problem.  Then of course don't tell management that you are
> running Apache! ;-)


Class idea! I think you should do this!

Good luck

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



Re: [PHP] php solution to html problem

2005-08-24 Thread Mark Rees
""Jay Blanchard"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
[snip]
doesn't work CSS acts the same way with a long unbroken string.
[/snip]

Well, you have no way of determining how many pixels wide something can
be with PHP. You might have to use JavaScript to break up the string as
the table is rendered.

Just a thought, and probably not very relevant to the OP: can you use a
fixed width font, specify the size with CSS and then work out the width?
I've done something similar with ASP to determine the size of pop-up
windows, but it was a big pain in the backside although it kind of works
(good enough for a hobby site anyway).

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



[PHP] Re: PHP open source newsletter software

2005-08-25 Thread Mark Rees
"Angelo Zanetti" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi guys.
>
> Does anyone know of any open source software written in PHP to create
> HTML news letters (head, side and bottom graphics). as well as being
> able to send the newsletters.

PHPlist from www.tincan.co.uk

>
> thanks in advance.
>
> --
>
> Angelo Zanetti
> Z Logic
> www.zlogic.co.za
> [c] +27 72 441 3355
> [t] +27 21 469 1052

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



Re: [PHP] Re: php ldap

2005-08-26 Thread Mark Rees
"Santosh Jambhlikar" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> then can i output the SMD5 of my password in php.
>
>
> Jeff Loiselle wrote:
>
> > Santosh Jambhlikar wrote:
> >
> >> Hi ,
> >>
> >> I  have a ldap server the user password are stored in that. my php
> >> ldasearch result says that the result is
> >> ldap user password : {SMD5}eRuT8dttD6M6N6tgMJF33/TNAvc=
> >> i want to compare this password with the user given password in other
> >> application (obviously php) but when i md5("passwordgiven") then it
> >> is showing different output.
> >> Any suggestions.

You could try to bind to the server using ldap_bind with the supplied
password. That will check if it is valid or not.

> >
> >
> > MD5 and SMD5 are not the same type of encryption. md5() will not
> > return the correct results.
> >
>
> --
> Santosh Jambhlikar
> Linux Administrator
> Cash-Tech Solutions
> Pride Parmar Galaxy, Pune
> Maharashtra.
> Ph.
> O.:- 56052000
> ext. 2150

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



[PHP] Re: Help Needed

2005-08-26 Thread Mark Rees
http://uk2.php.net/manual/en/function.mssql-query.php

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



[PHP] Re: upload file - clients path to file?

2005-08-30 Thread Mark Rees
> Hi all.
>
> I havent found an answer after looking at the manual. I'm trying to find
> out if it possible to find the path of the file on the clients pc once
> a  form has been submitted with the file upload form.


No, this would be a security risk. If  all your users are on an intranet,
you may be able to implement some kind of client-side scripting to discover
the location, then post it as part of the form. Even this will probably
involve amending local security settings on each machine.


> I know its possible to get the file name but I need the whole path.


What do you need it for? Perhaps there is another way to solve this problem?


> is this possible?
> thanks in advance.
>
> --
>
> Angelo Zanetti
>
>
>
>
> 
> This message was sent using IMP, the Internet Messaging Program.

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



Re: [PHP] Re: upload file - clients path to file?

2005-08-30 Thread Mark Rees
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Thanks for the replies.
>
> Well basically i need it for an "add products" page and if the users
doesnt fill
> in all the fields correctly I display some error message as well as
populate the
> textfields and dropdown lists with the values they previously entered, so
if
> they entered/selected the file I want to display it again so they don't
have to
> upload the file again. I know that I could do it without the user knowing
> (backed) but then they might think they have to select the file again
because
> the upload field will be blank.
>


If that's the problem, you might find it easier to solve by going for two
separate forms - one to enter all the details, and the second just to upload
the file.


>
> Quoting Mark Rees <[EMAIL PROTECTED]>:
>
> > > Hi all.
> > >
> > > I havent found an answer after looking at the manual. I'm trying to
find
> > > out if it possible to find the path of the file on the clients pc once
> > > a  form has been submitted with the file upload form.
> >
> >
> > No, this would be a security risk. If  all your users are on an
intranet,
> > you may be able to implement some kind of client-side scripting to
discover
> > the location, then post it as part of the form. Even this will probably
> > involve amending local security settings on each machine.
> >
> >
> > > I know its possible to get the file name but I need the whole path.
> >
> >
> > What do you need it for? Perhaps there is another way to solve this
problem?
> >
> >
> > > is this possible?
> > > thanks in advance.
> > >
> > > --
> > >
> > > Angelo Zanetti
> > >
> > >
> > >
> > >
> > > 
> > > This message was sent using IMP, the Internet Messaging Program.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
>
>
> 
> This message was sent using IMP, the Internet Messaging Program.

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



[PHP] Re: (Yet another) I'm blind ... post

2005-08-31 Thread Mark Rees
"Martin S" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> In this code, I'm not getting the value of $list passed to the Mailman
page.
> I've checked this umpteen times by now, but fail to see the error. I've


$list is not to be found in this code sample. $lista is though.


> beaten myself suitably with a steel ruler -- but it didn't help. Nor does
> the cold I'm coming down with I suppose.
>
> Anyone see the error, and feel like pointing it out to me?
>
> Martin S
>
>  print "Join the lists";
> print " ACTION='http://www.bollmora.org/mailman/subscribe/' . $lista . '>'";
> print "Your E-mail address:  value=\"\">";
> print "Your Name (optional):  size=\"30\" value=\"\">";
> print "Lista: ";
> print "Tävling";
> print "JGP";
> print "Styrelse";
> print "";
> print "You may enter a privacy password below. This provides only mild
> security, but should
>  prevent others from messing with your subscription. Do not use a
> valuable password as it
>  will occasionally be emailed back to you in cleartext.
>  If you choose not to enter a password, one will be automatically
generated
> for you, and it will
>  be sent to you once you've confirmed your subscription. You can always
> request a mail-back
>  of your password when you edit your personal options.";
>  print "Would you like to receive list mail batched in a daily digest?
(You
> may choose NoMail after you join.)";
>  print " No  type=radio name=\"digest\" value=\"1\"> Yes";
>  print "";
>  print "";
>  ?>

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



Re: [PHP] String format problem

2005-09-01 Thread Mark Rees
> In fact, this is a poor example since the difference gets larger with
longer
> string and more arguments.  When you use dots, the interpreter has to
> actually concatenate the string, looking for memory to do so and freeing
it
> up afterwards.  This takes time.  With commas, each argument is sent to
the
> output stream as soon as it is found, no further processing is needed in
> between.
>

I have been wondering about this topic for a few months now, so thanks for
this fascinating explanation. Is this the only difference between using .
and , as concatenation operators>


> Then the single vs. double quotes:
>
> echo 'uno ' , ' dos ' , ' tres ': 0.94
> echo "uno " , " dos " , " tres ": 6.76
>
> Notice that when variables are involved, the difference in between echoing
> with arguments separated with commas and separated with dots is more than
9
> times faster for the commas.Using double quotes with variable
expansion
> is almost 4 times slower than the commas, but is still faster than
> concatenating them externaly with dots.   Using heredoc-style strings is
not
> so bad compared to double quotes.

Never heard of heredoc before. What is it for? I have read
http://uk.php.net/types.string

and can only imagine that it is for laying out complex or long strings more
clearly

>
> So, if you are sending out the rule would be:
> Use echo, not print.   Separate arguments with commas.
>
> Now, if you are not using echo, for example, concatenating to a variable,
> the best is to use variable expansion inside double quoted or heredoc
> strings.   Concatenating with dots is more than twice as slow.
>
> Satyam

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



Re: [PHP] ID based on position?

2005-09-01 Thread Mark Rees
> Auugh!!  Why would you want to do this? You're flying in the face of
> relational database theory and practice. Position of a record in the table
> is, or should be irrelevant.

Agreed - "position" is a notional concept. The data is stored physically in
some sort of order, but what order that is is the database's business, not
yours. It could be subject to change when upgrading, and it is very likely
to differ on different platforms or RDBMSs.

You should also be aware that unless you use an order by clause in your
select statement, you don't have a guarantee that all RDBMSs will return the
records in the same row.

I don't know exactly what you want to do, perhaps you can provide more
details?

>
> What if you have twenty thousand records, or two hundred, and the 45th
> record in the table is deleted? Fetching an ID from anything beyond that
> record, based on the order of insertion (position), is instantly broken.
>
> Please rethink what you want to do, and if you are not familiar with
> relational databases read some of the excellent tutorials available on the
> 'Net about them and their design. It's pretty straightforward, common
sense
> stuff -- but you can back yourself into an awkward corner.
>
> Regards - Miles
>
>
> At 07:54 PM 8/31/2005, Gustav Wiberg wrote:
> >Hi there!
> >
> >Is there any function in PHP that gives an ID from a MySQL-db based on
> >which position the record has in the table?
> >
> >
> >Let's say, there's a table like this:
> >
> >1. Record1 ID 33
> >2. Record2 ID 76
> >3. Record3 ID 100
> >
> >
> >If I know position 2, I want to get ID 76. Is the only way to loop
through
> >the recordset?
> >
> >/G
> >@varupiraten.se
> >
> >--
> >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] Re: calling PHP self with a text link

2005-09-02 Thread Mark Rees
> Ross wrote:
> > do somehthing
> >
> > this seems to work but can someone explain the syntax to me what does a
'?'
> > and a ',' do in PHP?
> >
> >  I thought you joined strings with a full stop '.' (a period if you are
from
> > the US).
>

There was a long thread on this only yesterday, under the heading "String
format problem". The online archives will carry it shortly, if they don't
already, and it is well worth a read, especially the post by Satyam


> You are passing multiple parameters to the 'echo' language construct.
> The '?' is just a string, and is interpreted just like any other string
> in PHP. That will print out the value of $PHP_SELF followed by
> ?&action=something
>
> By the way, you really shouldn't have register_globals turned on. And
> you also really shouldn't top-post.
>
> --
> Jasper Bryant-Greene
> Freelance web developer
> http://jasper.bryant-greene.name/
>
> If you find my advice useful, please consider donating to a poor
> student! You can choose whatever amount you think my advice was
> worth to you. http://tinyurl.com/7oa5s

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



[PHP] Re: 400 error

2005-09-02 Thread Mark Rees
""Seth Rainsdon"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
when I try to access anything.php it tells me HTTP 400 bad request I have no
clue how to fix this
Seth

Nor do we, yet.

Which OS?
Which web server?
What have you tried so far?
Has it just broken, or did it never work?

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



Re: [PHP] Sessions , expiry times and different time zones

2005-09-07 Thread Mark Rees
Dan Rossi" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> client cookie expires hence no more session ...
>
> On 07/09/2005, at 1:57 AM, Jordan Miller wrote:
>
> > Hi  Dan,
> >
> > Couldn't you store an expiration time directly in the $_SESSION
> > variable, rather than relying on cookie expiration (if I  understand
> > your question correctly)?  Each time a page is loaded, update the
> > expiration time in this variable to +24hr from the current time (all
> > times relative to the server's time). Then, it shouldn't matter from
> > which time zone the user is browsing.


Read what he said again. Instead of expiring the session itself, store the
time of session expiry in the session (with a longer expiry time than 1 day)
and check that.

When you say a day, do you mean 24 hours or a calendar day? Are you trying
to say:

"Today is Tuesday, so expire this session at midnight on Tuesday?"

If that's what you need to do, you need to use a client-side solution -
after all, only the client knows what time it is where the client is! Be
prepared for people who have their time zone set incorrectly.

> >
> > Jordan
> >
> >
> >
> > On Sep 6, 2005, at 10:37 AM, Dan Rossi wrote:
> >
> >
> >> hi there I have run into problems with sessions , cookies and expiryt
> >> times with different time zones. Ie our server is in the States
> >> however I am browsing from Koala land downunder. I have been trying
> >> to get the session to expire in a day, however for ppl in the states
> >> this is ok, but for me its already expired so i have been
> >> experiencing issues. How do i solve this ?
> >>
> >> --
> >> 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] regular expression for integer range

2005-09-08 Thread Mark Rees
""Murray @ PlanetThoughtful"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > Hi all,
> >
> >
> > I want to write regular expression for checking the string format
entered
> > by user.
> >
> > the allowed formats are
> >
> > examples:
> > 10
> > 10,
> > 10,12-10
> > 12-10
> >
> > that is the valid strings are:
> > 1. only integer
> > 2. an integer, range of integers example 3
> >
> > and no other characters must be allowed.

You could simplify the matter by replacing all "-" and "," with, say, 0 and
then using the simple "\d+" (I think) regexp.

>
> Hi babu,
>
> As you've pointed out, you have 4 distinct scenarios to deal with, and it
> may be very difficult, without a great deal of tuning and tweaking, to
> define a regular expression that can effectively match all 4 scenarios
> without including false matches as well.
>
> One way of dealing with this is to build more specialized and exact
regular
> expressions for each possible scenario and group them together in an if
> statement.
>
> Eg.
>
> if (preg_match('/^\d+$/',$subject) || preg_match('/^\d+,$/',$subject) ||
> preg_match('/^\d+,\d+-\d+$/', $subject) || ){
>
> // code for successful match of valid data in $subject
>
> } else {
>
> // code for invalid data in $subject
>
> }
>
> Basically, the if/else statement is testing each distinct possible pattern
> and executing code if any of those distinct possible patterns match.
>
> It may not ultimately be the most graceful way of dealing with the
> situation, but having spent many hours attempting to tweak complex regular
> expressions looking for the magic combination, I've learned that breaking
> scenarios down this way can save a lot of development time and
frustration.
> This doesn't mean there isn't a benefit to finding the perfect regular
> expression for your needs, just that it can often be difficult to
guarantee
> your code won't be plagued by false matches or false exclusions as your
> expression becomes more and more complex.
>
> Hope this helps a little.
>
> Much warmth,
>
> Murray
> ---
> "Lost in thought..."
> http://www.planetthoughtful.org

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



Re: [PHP] Inserting records question

2005-09-09 Thread Mark Rees
> > Still learning, so sorry if this sounds really simply noobish.  But as I
> > understand things currently this should work.  But doesn't.  I've been
> > looking over tutorials but just don't see whatever the problem is.
> >
> > I created a simple table with the following fields (in order)
> > tc_id (auto nmbr)
> > lname
> > fname
> > machine_name
> > email_addr
> > problem
> > date_time_submitted (timestamp)
> >
> > And I'm trying to run this insert from form input.
> >
> > $username="somename";
> > $password="somepass";
> > $database="somedb";
> > $table="sometable";
> > mysql_connect(localhost,$username,$password);
> > @mysql_select_db("$database") or die("Unable to Connect to DB");
> > $tc_query = "INSERT INTO $tablel VALUES(NULL, $lname, $fname,
$machine_name,
> > $email_addr, $problem, NULL)";
> > $result = mysql_query($tc_query);
> > mysql_close();
> >
> > So what exactly do I seem to be missing here?

As well as what other posters have said (and pay special attention to the
suggestions on using mysql_error and single quotes), you are trying to
insert a NULL into an autonumber field. You don't need to insert anything
here, as the name suggests, it will be populated automatically.

You may find it helps you in the future to specify the fields you are
inserting. For example, if you add columns to the table, you may see
unexpected behaviour.

INSERT INTO mytable (
firstname,
surname,
address,
city
)
VALUES(
'Guus',
'Hiddink',
'National Stadium',
'Sydney'
)

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



[PHP] Re: Round with ONE-decimal... always...

2005-09-12 Thread Mark Rees
>
> I want to adjust the round() -function a little...
>
> If I put round(6,0) there will be an output of 6
> If I put round(6,32) there will be an output of 6,3
>
> I want it to have 6,0 instead of just 6... I guess there is an easy
solution
> to this? Suggestions?

Have a look at this.

http://uk2.php.net/manual/en/function.number-format.php






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



[PHP] Re: Best way to mass mail

2005-09-12 Thread Mark Rees
""Ryan A"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
> My client has a dating site and now he wants to mail all his members,
> he does not want to use any of the already installed mailing lists but
wants
> us to make one
> for him, he's on a dedicated server.
>
> Presently he does not have too many members, just a few thousand (around
3k
> i guess),
> I remember reading sometime back on the list that using the mail() may not
> be the best
> option...not sure if thats still true.
>
> The thing that bothers me the most is if the program times out..., how do
I
> start again from
> the ones that have not been sent?

phplist handles this well

www.phplist.com

Even if you decide not to use it, the code will probably help you out

>
> eg:
> (10 members)
> mail gets sent to first 4 members then times out
> we re-click on the send button and it starts again from one...again times
> out
> (this happens 5 times)
>
> that means members 1-4 will get the same email 5 times
>
> Doing this the hard way would be to connect to the db after each
successful
> mail and "mark"
> each member with todays date or something...but I would like to avoid so
> many calls to the
> DB if possible...esp if the site grows.
>
> Ideas/suggestions?
>
> Thanks in advance,
> Ryan

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



[PHP] Re: PHP 5, LDAP/Active Directory

2005-09-13 Thread Mark Rees
> I've looked through php.net and scoured Google for a solution to an
> issue I'm having with PHP and LDAP but have so far found nothing. I'm
> trying to build an intranet site that uses the company LDAP (Active
> Directory really) service but I can't seem to get around the
> "Operations error" and other such messages when trying to bind.
>
> On my server I'm running:
> Fedora Core 4
> Apache 2
> PHP 5 compiled with OpenLDAP

I have this working with PHP5, Apache2 and Windows 2000

>
> I must confess that I'm very new to LDAP so it is likely that my
> problem is inexperience, but it seems that this issue has been
> resolved by others so I'm trying to figure out what I'm doing wrong.

Same here!

>
> To shed more light on the topic, bug #30670 [ http://bugs.php.net/
> bug.php?id=30670&edit=0 ] seems to fit my situation perfectly. As
> some of the posts on that bug suggest, I've tried using
> ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION,3);
> ldap_set_option($ldap, LDAP_OPT_REFERRALS,0);
> between ldap_connect and ldap_bind but I still get the "Operations
> error" message. Everyone seems to be able to get this to work as long
> as they are running PHP4, but I have yet to see (or realize I've
> seen) a solution from someone using PHP5. I've also found where
> "blizzards at libero dot it" has posted "When querying a windows
> 2000/2003 AD you MUST use only SASL and not TLS (non supported)."
> - Is this true?

Are you doing an anonymous bind? If you are supplying login credentials, be
sure that you are supplying them correctly. This was the problem I had. If
this doesn't help, how about supplying some code?

I found this to be a very useful resouce
http://www.computerperformance.co.uk/Logon/LDAP_attributes_active_directory.
htm
>
> Another thing worth mentioning here is that the company I work for
> has allowed us to build our own intranet system for our Dept and
> offers little to no support for server specs and settings, but I will
> try to get any information to the list that might be helpful.

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



Re: [PHP] Re: PHP 5, LDAP/Active Directory

2005-09-14 Thread Mark Rees
> >> On my server I'm running:
> >> Fedora Core 4
> >> Apache 2
> >> PHP 5 compiled with OpenLDAP

> >> To shed more light on the topic, bug #30670 [ http://bugs.php.net/
> >> bug.php?id=30670&edit=0 ] seems to fit my situation perfectly. As
> >> some of the posts on that bug suggest, I've tried using
> >> ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION,3);
> >> ldap_set_option($ldap, LDAP_OPT_REFERRALS,0);
> >> between ldap_connect and ldap_bind but I still get the "Operations
> >> error" message. Everyone seems to be able to get this to work as long
> >> as they are running PHP4, but I have yet to see (or realize I've
> >> seen) a solution from someone using PHP5. I've also found where
> >> "blizzards at libero dot it" has posted "When querying a windows
> >> 2000/2003 AD you MUST use only SASL and not TLS (non supported)."
> >> - Is this true?
>  $ds = ldap_connect('ad.server.com');

make sure this is working by doing this:

if($ds){


> $lb = ldap_bind($ds, 'username', 'password');

 then this:
 echo "Bind result is " . $lb . "";

(should show 1)

> // At this point the bind looks successful
> // so we'll try a query
>
> $res = ldap_search($ds, 'o=My Company,c=US','sn=S*');

Are you certain that this is the correct distinguished name? This is the bit
I struggled with. It will be the name at the very top of your active
directory (or the bit you are trying to search). To find this, I went onto
the windows box in question, and opened the "active directory users and
computers". The top level entry, which the Groups and Users are directly
beneath, is what you are looking for. In my case, it was mydomain.com, so my
distinguished name looked like this:
"DC=mycompany, DC=com"

If I tried anything else here, it gave me an "operations error"

> So since you've got it working with PHP5 can you verify that SASL is/
> is not needed to communicate to an AD 2003 server from linux? I keep
> leaning towards the possibility that I need that, but can't seem to
> find any way to tell for sure since the ldap_sasl_bind()  function
> isn't documented yet.


No, I'm using windows 200, can't help with that I'm afraid

Good luck

Mark

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



Re: [PHP] whats wrong in this program.

2005-09-14 Thread Mark Rees

> I tried to use the final array values in a insert statement, but the
values are not inserted.
> the code is
>
> foreach ($final as $subnum){
>  $res = $db->query("INSERT INTO
substrate_protocoll(substrate_type,substrate_num,operator,location,solvent,u
ltrasonic,duration,cdate,ctime,comment)
>
VALUES('$substrate_type1',$subnum,'$operator','$location','$solvent',$uv,$du
ration,'$cdate','$sctime','$comment')");
> if(!$res){
>  echo "insert failed";
>  }
> }
> the values of array ($subnum)are not inserted , can you tell me where the
problem is.

the problem is probably in this line:

echo ("INSERT INTO
substrate_protocoll(substrate_type,substrate_num,operator,location,solvent,u
ltrasonic,duration,cdate,ctime,comment)

VALUES('$substrate_type1',$subnum,'$operator','$location','$solvent',$uv,$du
ration,'$cdate','$sctime','$comment')");

and the problem is that you haven't done this to see what is wrong with the
SQL.

The next problem is that this line is also missing:

echo mysql_error();




>
> Jordan Miller <[EMAIL PROTECTED]> wrote:
> I think I finally understand what you are trying to do. I don't see
> any reason why you need to use the token functions, and I would
> recommend using array functions instead (also, it is exceedingly easy
> to sort the elements of an array... see the end).
>
> I believe this will do what you are trying to do:
> //Tokenizer for Babu
> $str = '10,12,14-18';
> $commas = explode(',', $str); // $commas will be an array of three
> items in this case
>
> // Final Values will go into the $final array
> $final = array();
> foreach ($commas as $value) {
> // If one of the $commas elements contains a dash, we need to
> get the range between them!
> if (strstr($value, '-')) {
> // Explode based on the dash. This code assumes there will
> only be a single dash
> $rangeValues = explode('-', $value);
> foreach (range($rangeValues[0], $rangeValues[1]) as $number) {
> $final[] = $number;
> }
> } else {
> // If $value does not contain a dash, add it directly to the
> $final array
> $final[] = $value;
> }
> }
> echo "All your values in the range $str are ".implode(' ', $final);
> // Prints "All your values in the range 10,12,14-18 are 10 12 14 15
> 16 17 18"
>
>
> In your last email, you had some of the values given out of order:
> 1. 20,21-24
> 2. 21-24,20
> 3. 10,20,21-24,25,26,30
>
> To make sure the $final values are always ascending, just do this at
> the end:
> sort($final);
>
> Done!!
>
> Jordan
>
>
>
>
> On Sep 13, 2005, at 7:16 PM, babu wrote:
>
> > $str=10,12,14-18;
> >
> > $tok = strtok($str, ',');
> > while ($tok !== false) {
> > $toks[] = $tok;
> > $tok = strtok(',');
> > }
> >
> > foreach ($toks as $token){
> > if (strpos($token,'-')){
> > stringtokenize($token);
> > }else{
> > $finaltokens[]= $token;
> > }
> > }
> >
> > function stringtokenize($nstr){
> > $ntok1= strtok($nstr,'-');
> > $ntok2=strtok('-');
> > for($i=$ntok1;$i<=$ntok2;$i++){
> > $finaltokens[]= $i;
> > }
> > }
> >
> > foreach ($finaltokens as $ftoken){
> > echo $ftoken;
> > echo "
> ";
> > }
> >
> > the ouput prints only 10,12 but not 14,15,16,17,18. where is the
> > problem.
> >
> >
> >
> > -
> > To help you stay safe and secure online, we've developed the all
> > new Yahoo! Security Centre.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
> -
> How much free photo storage do you get? Store your holiday snaps for FREE
with Yahoo! Photos. Get Yahoo! Photos

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



Re: [PHP] mysql query

2005-09-15 Thread Mark Rees
On Wednesday 14 September 2005 07:36 pm, Jesús Alain Rodríguez Santos wrote:
> I have a table colum in mysql with two fields: day and month. I
> would like to know if it's possible to make a query where I can
> determine if exist days before to a selected day, for example:
> if I have in my table:
> day 19 - month 05, I wish to know if there are previous days
> inserted at the 19, the days they are not inserted in the table,
> they are inserted according your selection, what I want to get is
> that every time that you insert a day, I want to check if there
> are days previous to the one already inserted in the table in the
> same month, in case that there are not them then they owe you
> to insert together with the one selected,

I haven't tried this, but the logic should work according to the manual:

You don't have to check, you can just insert all the data. If the row
already exists, the data will not be inserted. This assumes that you have a
constraint on the table which prevents duplicate values!

$day=19;
$month=5;
for($i=1;i<=$day;i++){
$result=mysql_query("INSERT INTO table (month,day) VALUES (5,$i)");
}




If you don't have a constraint, then you will have to loop over the data for
that month and insert the rows where they don't already exist.


> I wait they understand me what I want:
> I work php/mysql.
create table tableA (
 day int,
 month int
);



select * from tableA where month=5 and day < 19;

This will select everything from the 5th month and before the 19th day of
the
5th month.

Is that what you were going for?


>
> sorry for my english i'm cuban
> Thank you and excuse the nuisances
>
>
>
> --
> Este mensaje ha sido analizado por MailScanner
> en busca de virus y otros contenidos peligrosos,
> y se considera que está limpio.

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



  1   2   >