[PHP-DB] Limit chars from select

2006-01-29 Thread Gavin Amm
How do I limit the characters a Select statement returns?
In Seudo code:
SELECT * FROM myTable LIMITCHARS 30;

I'm using MySQL.

Thanks.

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



RE: [PHP-DB] Limit chars from select

2006-01-29 Thread Gavin Amm
I'd like to avoid having to manually add all of the cols to the select
statement if possible, so if there's a universal command I can put in
that'd be best.

Basically most of the fields are short.. 2 cols action and comments
are text so can be a bit lengthy. The 1st page is a sumary page of a
number of the rows, so what I'm wanting to do is limit the display on
initial sumary page to say 100 chars per field and then if they click on
the row for more info I can then display the full info.

-Original Message-
Sent: Monday, January 30, 2006 12:51 PM
To: Gavin Amm; php-db@lists.php.net
Subject: Re: [PHP-DB] Limit chars from select


Gavin Amm wrote:
 How do I limit the characters a Select statement returns?
 In Seudo code:
 SELECT * FROM myTable LIMITCHARS 30;
 
 I'm using MySQL.
 
 Thanks.
 

Do you want to limit the characters from an individual field?  If so,
then

SELECT SUBSTRING(FIELD1 FROM 1 FOR 30) FROM myTable;

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



RE: [PHP-DB] Re: Just can't get it to work.. variables

2005-04-07 Thread Gavin Amm
Yeah, you did explain it clearly, I just couldn't get the casting to
work in PHP..
I found 2 or 3 ways of doing it in PHP, but I just couldn't get any of
them to work..

I even looked at casting in MySQL, though I couldn't find an int cast.

At any rate, it's working fine based on my previous e-mail, so all's
well.

Cheers,
Gavin


-Original Message-
From: David Robley [mailto:[EMAIL PROTECTED] 
Sent: Friday, 1 April 2005 12:06 AM
To: php-db@lists.php.net
Subject: RE: [PHP-DB] Re: Just can't get it to work.. variables


Gavin Amm wrote:

 Yeah, I ended up doing that (associative array) then reading your 
 e-mail.. Oh well, thanks. I couldn't cast the var as an int. in the 
 database it's setup as a
 timestamp(8) (mmdd), not sure why I set it up as such..
 
 Cheers,
 Gavin

I guess I didn't fully explain that I meant cast as an int in php :-)

David

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

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



RE: [PHP-DB] Re: Just can't get it to work.. variables

2005-03-30 Thread Gavin Amm
Yeah, I ended up doing that (associative array) then reading your
e-mail.. Oh well, thanks.
I couldn't cast the var as an int. in the database it's setup as a
timestamp(8) (mmdd), not sure why I set it up as such..

Cheers,
Gavin

-Original Message-
From: Martin Norland [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 31, 2005 12:43 AM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Re: Just can't get it to work.. variables


David Robley wrote:
 Gavin Amm wrote:
[snip]
 That would indicate that you are actually saying:
  $monthVal = $monthName[04];
 
 where the 04 is actually a string; you have no element '04' in your 
 array. Cast $monthInt to an integer before you use it as an array 
 element.
 
 Alternatively, if you are using MySQL, you can use DATE_FORMAT to 
 achieve the same result.
 
### ORIGINAL CODE ###
while ($row = mysql_fetch_array($result)){
$monthName = array (, Jan, Feb, Mar, Apr, May, Jun, 
Jul, Aug, Sep, Oct, Nov, Dec); echo 
pb.$monthName[substr($row['start'], 4, 2)]. 
.substr($row['start'], 6, 
2)./bbr\n.$row['details'].\n/p\n\n;
}

Yep, also - no need to redeclare $monthName each iteration.  If you 
wanted you could also just declare it thusly:

$monthName = array (01 = Jan, 02 = Feb, 03 = Mar, 04 =

Apr, 05 = May, 06 = Jun, 07 = Jul, 08 = Aug, 09 
= Sep, 10 = Oct, 11 = Nov, 12 = Dec);

... incidentally, Oct/Nov/Dec should have worked previously afaik, PHP 
is fairly forgiving.  You can probably also get away with just using 
round() to get your integers where you need them, instead of the 
declaration above.

cheers,
-- 
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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

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


[PHP-DB] Just can't get it to work.. variables

2005-03-29 Thread Gavin Amm
Hi All,

I just can't for the life of me get the variable to output a value from
the array:
(all preceding script in place to make this work..)

The start date retrieved from the database is, for example, 20050412
(mmdd).

The example output for each variable (w/o quotes) is:
$monthInt outputs 04
$monthVal outputs 

### CODE FOR DEBUGGING PURPOSES ###
while ($row = mysql_fetch_array($result)){
$monthName = array (, Jan, Feb, Mar, Apr, May,
Jun, Jul, Aug, Sep, Oct, Nov, Dec);
$monthInt = substr($row['start'], 4, 2);
echo \$monthInt = $monthIntbr;
$monthVal = $monthName[$monthInt];
echo \$monthVal = $monthValbr;
echo pb.$monthVal. .substr($row['start'], 6,
2)./bbr\n.$row['details'].\n/p\n\n;
}


### ORIGINAL CODE ###
while ($row = mysql_fetch_array($result)){
$monthName = array (, Jan, Feb, Mar, Apr, May,
Jun, Jul, Aug, Sep, Oct, Nov, Dec);
echo pb.$monthName[substr($row['start'], 4, 2)].
.substr($row['start'], 6, 2)./bbr\n.$row['details'].\n/p\n\n;
}


Cheers,
Gavin

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



RE: [PHP-DB] Generate Menu based on database structure

2004-10-19 Thread Gavin Amm
Thanks for the link.
I've got a working JavaScript menu system; I wanted a PHP script that
runs once/day to generate the tree structure in the JavaScript config
file. That way each time I added a page to the database, it would be
automatically added to the menu system.

I'm still interested in the menu class to store each record as an object
of the class if anyone can point me to any sites or offer any hints.

Cheers,
Gav


-Original Message-
From: Leo G. Divinagracia III [mailto:[EMAIL PROTECTED] 
Sent: Friday, 15 October 2004 11:29 AM
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Generate Menu based on database structure




graeme wrote:

 Hi,
 
 Rather than writing a recursive function I'd suggest that you create a

 menu class and store each record as an object of the class. 

why reinvent the wheel:

http://www.destroydrop.com/javascripts/tree/

-- 
Leo G. Divinagracia III
[EMAIL PROTECTED]

z

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

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



RE: [PHP-DB] Generate Menu based on database structure

2004-10-11 Thread Gavin Amm
Ok, sounds good.
Any hints? I've not touched this stuff before..

Will using classes allow multiple objects to be running at the same time
making the script faster?

Cheers,
Gav


-Original Message-
From: graeme [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, 6 October 2004 7:05 PM
To: Gavin Amm
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Generate Menu based on database structure


Hi,

Rather than writing a recursive function I'd suggest that you create a 
menu class and store each record as an object of the class. The menu 
class will have variables of id, parent, title, children, and tree. The 
children will be initialised to 0 and tree will be initialised to 1. You

will need to write a function to find any menu object given the menu's 
ID, should be easy if you store each object in an array (keyed on the
ID)

1) Read in a record and create a menu object
2) Get the parent object, using the parent variable and the find method
3) Increment the children variable in the parent menu object by one
4) Set the tree variable in the new menu object to the tree object in 
the parent object plus the value in the children object.

Now add method to display the menu items and your problem should be
solved.

Gavin Amm wrote:

Hi guys,

I need to generate a menu based on the content structure of my
database.

The data is structured using an 'id'  'parent' relationship, for eg:

id

parent

title

1

0

Home Page

6

1

My Page 2

9

6

My Page 3

15

9

My Page 4

21

6

My Page 5

22

9

My Page 6

23

22

My Page 7

24

22

My Page 8

25

1

My Page 9

28

25

My Page 10

I need to create a recursive loop that will create the menu. The text
in
the brackets is what I'm trying to achieve, the rest is just for
aesthetics  ease of reading.
(The children of the row id=1 are the top of the menu tree, ie they
will
be the menu categories at the top of the web page to display the menu
when the mouse hovers over it.)
(Each menu item, being a menu, will have a href to it's id number.)

My Page 2 (Menu_1)
My Page 3 (Menu_1_1)
My Page 4 (Menu_1_1_1)
My Page 6 (Menu_1_1_2)
My Page 7 (Menu_1_1_2_1)
My Page 8 (Menu_1_1_2_2)
My Page 5 (Menu_1_2)
My Page 9 (Menu_2)
My Page 10 (Menu_2_1)

I just can't for the life of me get the numbering to work correctly in
the recursion.
I seem to get things like (1_1_2_1_2_3_1_2_3_4) which I can see the
pattern in, but it's obviously not what I'm after..

Appreciate your help.
Thanks, Gav.


  


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



Re: [PHP-DB] Safe / Secure Login Script

2004-10-05 Thread Gavin Amm
Sorry, I always forget to reply all...
Original message bellow...

-Original Message-
From: Gavin Amm 
Sent: Tuesday, 5 October 2004 3:55 PM
Subject: RE: [PHP-DB] Safe / Secure Login Script


1. Personal preference, but you may find sessions a better option (does
not store user data (like passwords) on workstation) -
http://au2.php.net/manual/en/ref.session.php

2. In MySQL you can use the BINARY keyword to tighten the password
string comparison.

3. In addition, if you're not already using one, you could use an SSL
connection to further tighten security  prevent passwords from being
transmitted in clear text.

Cheers,
Gav


-Original Message-
From: Wendell Frohwein [mailto:[EMAIL PROTECTED] 
Sent: Monday, 4 October 2004 6:11 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Safe / Secure Login Script


I have been writing php code for about 2 years now. I have a login
script that I have written for my clients. I just would like to know if
there is a better / safer way of logging people into websites. This is
my current method.
 
1.) Username and Password are entered in an html / php form using
field names user, pass and submit button named do_login.
2.) Form is submitted to the same page (PHP_SELF).
3.) Login script is triggered by $_POST[do_login].
4.) Form is validated to make sure the fields user and pass are
not empty.
5.) Password is then encrypted using base64_encode()
6.) MySql Select Statement To find $_POST[user].
7.) If found, Verify that $result[pass] ===
base64_encode($_POST[pass]).
8.) If No username is found, Message is sent to end user stating
username does not exist.
9.) If $result[pass] === base64_encode($_POST[pass]) send user
to a page called wait.php
10.) At wait.php, a cookie is set containing the user id, user name, and
encrypted pass.
11.) Wait.php contains a (meta http-equiv=refresh
content=5;URL=/?echo($dir);?/welcome.php) meta tag which directs
user to directory
12.) Inside $dir, there is a script called validate.php which is
included inside header.php. So the script actions of validate.php tag
along with every page.
13.) This functions makes sure you have a cookie set with the names
user_id, user_name, user_pass.
14.) It then validates this information though mysql.
15.) If the information is sound, user is allowed to browse that page
and or do whatever they are supposed to be doing in that directory.
16.) If the information is not sound, user is redirected to the home
page using header(Location http://some_domain/some_file.php;);



This works great for me, but I want to perfect it. If anyone out there
knows any better way to login, validate a user and so on. Please let me
know
 
 
Thanks a lot people.
 
 
-Wendell Frohwein

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



[PHP-DB] Generate Menu based on database structure

2004-10-05 Thread Gavin Amm
Hi guys,

I need to generate a menu based on the content structure of my database.

The data is structured using an 'id'  'parent' relationship, for eg:

id

parent

title

1

0

Home Page

6

1

My Page 2

9

6

My Page 3

15

9

My Page 4

21

6

My Page 5

22

9

My Page 6

23

22

My Page 7

24

22

My Page 8

25

1

My Page 9

28

25

My Page 10

I need to create a recursive loop that will create the menu. The text in
the brackets is what I'm trying to achieve, the rest is just for
aesthetics  ease of reading.
(The children of the row id=1 are the top of the menu tree, ie they will
be the menu categories at the top of the web page to display the menu
when the mouse hovers over it.)
(Each menu item, being a menu, will have a href to it's id number.)

My Page 2 (Menu_1)
My Page 3 (Menu_1_1)
My Page 4 (Menu_1_1_1)
My Page 6 (Menu_1_1_2)
My Page 7 (Menu_1_1_2_1)
My Page 8 (Menu_1_1_2_2)
My Page 5 (Menu_1_2)
My Page 9 (Menu_2)
My Page 10 (Menu_2_1)

I just can't for the life of me get the numbering to work correctly in
the recursion.
I seem to get things like (1_1_2_1_2_3_1_2_3_4) which I can see the
pattern in, but it's obviously not what I'm after..

Appreciate your help.
Thanks, Gav.



RE: [PHP-DB] LAMP

2004-08-08 Thread Gavin Amm
Thank you all for your input.
I will try Suse 9.1.
If that doesn't work, I can try the http://www.apachefriends.org/en/
distro.

Regards,
Gavin


-Original Message-
From: Gavin Amm 
Sent: Tuesday, 3 August 2004 10:40 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] LAMP


I'd really like to find a Linux distro that is a LAMP system right out
of the box.
(Linux, Apache, MySQL, PHP)
Are there any out there?

Cheers,
Gav

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

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



[PHP-DB] LAMP

2004-08-02 Thread Gavin Amm
I'd really like to find a Linux distro that is a LAMP system right out
of the box.
(Linux, Apache, MySQL, PHP)
Are there any out there?

Cheers,
Gav

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



RE: [PHP-DB] Multiple SQL queries...?

2004-06-03 Thread Gavin Amm
Have you tried - GROUP BY email - ?



 Nope...
 HHmmm, this is really getting to me...
 I can do distinct, I can count, but I can't combine the two?
 Can't be that hard ;-)

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

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



RE: [PHP-DB] Re: Multi search function (help)

2004-05-28 Thread Gavin Amm
For what it's worth, if you store your form fields in an array, you can
loop through the array to search for isset  empty on each array element
and have the array add the fields that are relevant to your sql
statement.

Doing this will also ensure that you won't have to modify your script
(that generates the sql statement) regarding how many form fields you
have every time you add a new form field to the form page.

Gav

-Original Message-
From: nabil [mailto:[EMAIL PROTECTED] 
Sent: Thursday, 27 May 2004 10:57 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Re: Multi search function (help)


yes, this is true, we should add empty() function too.

Ross Honniball [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I'm not 100% sure, but you may want to also check if the field is
empty
 (using empty() function) before including in your search. (in addition
to
 isset)

 Also, just a caution, you will need to take some care in figuring when
and
 where to place your 'and' statements linking the various parts of the
query.

 At 08:01 AM 27/05/2004, you wrote:
 Nabil wrote:
 
   David Robley [EMAIL PROTECTED] wrote in message
   news:[EMAIL PROTECTED]
   Nabil wrote:
  
 hi all
   
Is there a way to condition your search:
   
-I have a form for four text boxes for search my Mysql...
-I don't want to write 4 conditions and for SQL statements
incase
he
decided not to search with all keywords (fields)
- I have by example : name, lastname , nickname and phone
form...
I need a way to select my records even one or more field were
null
(searching only on of the above)
   
because the following SQL will generate null result
   
   
$name=$_POST['naame'];
$lastname=$_POST['lastname'];
$nickname=$_POST['nickname'];
$m_date=$_POST['m_dateY'];
echo $name.$lastname.$nickname.$m_date;
   
SELECT id, name , lastname , m_date from users
where
name like binary '%$name%' and lastname like binary
'%$lastname%'
and
nickname like binary  '%$nickname%' and m_date= YEAR('$m_date')
order
   by
id ASC ) or die(mysql_error());
   
   
   
Thanks in advanced
  
   Use isset to test whether the POST values are set and only
include in
the
   query if there is a value.
 
   thanks .. but my question is not for isset... i m thinking
consider
that i
   have 10 search fields... if i have to do a combination then i need
a
day
   to right the various SQL statements
 
 So do something like:
 
 $query = SELECT id, name , lastname , m_date from users where 1 ;
 if (isset($_POST['name'])) {
$query .= AND name like binary '%{$-POST['name']}%' ;
 }
 if (isset($_POST['lastname'])) {
$query .= AND name like binary '%{$_post['lastname']}%' ;
 }
 //etc etc
 $query .=  order by id ASC ;
 $sql = mysql_query($query) or die(mysql_error());
 
 
 --
 David Robley
 
 Only cosmetologists give make-up exams.
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

 .
 . Ross Honniball. JCU Bookshop Cairns, Qld, Australia.
 .

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

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



[PHP-DB] MySQL - counting number of instances of a word in a field

2004-04-27 Thread Gavin Amm
Hi guys,
 
I'm trying to find a MySQL function(s) that will allow me to count the
number of words in a field.
 
For eg:
 
[table: pages]
id - title - keywords - body
1 - Home - home, page - This is my home page. p Enjoy your stay.
2 - Feedback - feedback, form, contact - Please enter any feedback or
comments in the form below.brYour feedback will be used to improve our
service.
 
How do I, for example, count the number of instances of a word such as
feedback in say the BODY field?
I'm putting together a search engine  I'd like to 'rank' the results
based on the number of instances of each word found in a few fields.
 
In this example, if they search for the words feedback and improve,
the count would result in the row id, word searched and the number of
instances of that word:
(formatting doesn't matter, it's just to give you an idea)
  id 2: feedback count = 2
  id 2: improve count = 1
 
I can play with the weightings later, just need to figure out the
counting...
 
Thanks guys,
Gav


RE: [PHP-DB] Pass database id through href

2004-04-14 Thread Gavin Amm
Thanks John,

Pointed me in the right direction.
This was the actual code I ended up needing.

(! Ignore this e-mail if it will offend you containing JavaScript info
rather than php/db info; I did need to figure this out for my db to be
updated appropriately...)

(1st you need to define the variable as a hidden field in the form)
input type=hidden name=parent value=

(2nd, we need to use both the href attribute as well as, and separately
to, the onClick JavaScript reference, so the html output looks like:)
a name=2 href=JavaScript: document.myForm.submit();
onClick=document.myForm.parent.value=2;Me/a

The onClick event changes the value of the hidden field, the href
attribute submits the form with the submit() function.

I couldn't get it to work by calling a function, because the onClick
reference needed to be associated with that anchor tag and needed to be
a separate event to the href pointing to the submit() function.
I guess I could have 2 separate functions for each... But since it's
generated by the php script is easy enough like this.

Cheers,
Gav


-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, 14 April 2004 12:48 PM
To: Gavin Amm
Cc: PHP-mailist
Subject: Re: [PHP-DB] Pass database id through href


Gavin Amm wrote:

 EXAMPLE:
 (I know you can't use value with the a tag, but bear with me for
 illustration purposes in this pseudo-code)
 
 
 form name=theForm
 
 input type=text name=title
 !-- etc with the fields --
 
 input type=text name=formInput
 a href=javascript:document.theForm.submit(); name=parent
 value=23Auditing Home/a
 a href=javascript:document.theForm.submit(); name=parent
 value=17Finance Home/a
 a href=javascript:document.theForm.submit(); name=parent
 value=122Planning Home/a
 a href=javascript:document.theForm.submit(); name=parent
 value=231Tax Home/a
 
 /form
 
 
 When the admin clicks on one of the parent hyperlinks, the form is
 submitted with (in this example) (say they click on the Tax Home
link)
 the values:
   $title == [whatever the user types into the text field]
   $parent == 231
 
 How do I get this $parent value from the html page??

Instead of calling theForm.submit(), all another function that sets a 
form variable before submitting the form.

a href=javascript:mysubmit(231);Tax Home/a

script
function mysubmit(var)
{
   document.theForm.parent.value = var;
   document.theForm.submit();
}
/script

parent might be a reserved word, so watch out for that. I'm no JS wiz,

but I think that's something along the lines of what you want to do. You

basically use JS to add a form element based upon what link was clicked.

-- 
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals - www.phparch.com

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



[PHP-DB] Pass database id through href

2004-04-13 Thread Gavin Amm
Hi.

I want to update mysql database with parent value of page.
I have several fields in my form.
I have a generated map of web site pages as hyperlinks at end of form.
(generated recursively)
I want to be able to click on hyperlink  have it pass the parent
value to the next PHP script.

The point of this is to select the parent page of the new/modified
page


EXAMPLE:
(I know you can't use value with the a tag, but bear with me for
illustration purposes in this pseudo-code)


form name=theForm

input type=text name=title
!-- etc with the fields --

input type=text name=formInput
a href=javascript:document.theForm.submit(); name=parent
value=23Auditing Home/a
a href=javascript:document.theForm.submit(); name=parent
value=17Finance Home/a
a href=javascript:document.theForm.submit(); name=parent
value=122Planning Home/a
a href=javascript:document.theForm.submit(); name=parent
value=231Tax Home/a

/form


When the admin clicks on one of the parent hyperlinks, the form is
submitted with (in this example) (say they click on the Tax Home link)
the values:
  $title == [whatever the user types into the text field]
  $parent == 231

How do I get this $parent value from the html page??

Any help would be appreciated.

Regards,
Gav

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



[PHP-DB] Keeping the mailing list sain

2003-12-21 Thread Gavin Amm
Hi guys,

So that I don't drive members of the mailing list insane:

In Outlook XP (2002), I want to enable the Out of office feature; what
I don't want to do is have it reply to every message posted to the PHP
mailing list.

Does anyone know how to create a rule, to do this?
I really don't want to unsubscribe  subscribe to the list every time I
go out of the office...

Thanks,
Gav

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



RE: [PHP-DB] Decent Search Engine (for MySQL)

2003-12-08 Thread Gavin Amm
Shall I resign myself to using a search with like %var%?
Are there no other better methods?
Maybe REGEXP has something to offer?


-Original Message-
From: Gavin Amm 
Sent: Thursday, 27 November 2003 4:00 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Decent Search Engine (for MySQL)


Hi All,

I'm after a tutorial, if you can point me to one I'd appreciate it.

I want to create a search script that will look through tables/fields
(that I specify) in a MySQL database.

I don't want to use the MySQL full text searching (as I'm using an ISP
database  the default min word length is 3, we have a number of words
that are 3 chars  need them to be picked up in the search)  I really
hope there are better options than the LIKE command (These seem to be
very popular from my searching).

Regards,
Gavin

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

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



[PHP-DB] Decent Search Engine (for MySQL)

2003-11-26 Thread Gavin Amm
Hi All,

I'm after a tutorial, if you can point me to one I'd appreciate it.

I want to create a search script that will look through tables/fields
(that I specify) in a MySQL database.

I don't want to use the MySQL full text searching (as I'm using an ISP
database  the default min word length is 3, we have a number of words
that are 3 chars  need them to be picked up in the search)  I really
hope there are better options than the LIKE command (These seem to be
very popular from my searching).

Regards,
Gavin

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



RE: [PHP-DB] Reserve Username while Confirming Signup

2003-06-03 Thread Gavin Amm
I'm inexperienced with db's, but here are my thoughts:
Maybe add a TIMESTAMP(14) field in your temp table, then run a script
periodically to delete any rows stored that are more than, say, 20 mins
old?

Gav


-Original Message-
From: Dewi Wahyuni [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, 3 June 2003 1:48 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Reserve Username while Confirming Signup 


Hi All,

I have a sign up page and when the user submit, it goes to a
confirmation page, before the person actually submits.

The confirmation page stores the username and password in the Session
variable and the submit page stores it into the database by getting it
from the session. The rest of the information (eg. address) is
resubmited via hidden input type.

The question is : I want to reserve the username for the person(say A)
while he/she is in the confirmation page and perhaps going back to edit
some stuff. What is the best way to do that?


I tried putting it in my database in a Logintemp table. With the same
fields as the Login table. When the user submits, the Logintemp contents
is moved to the Login table.

The problem is what if while A is staring at the screen the computer
hangs. How do I know if he/she closes the page altogether. I need to
delete the contents of Logintemp since it was not moved to Login.

Is there any other better way to do this?  



Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail!
http://login.mail.lycos.com/r/referral?aid=27005

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


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



RE: [PHP-DB] PHP mail() question?

2003-04-01 Thread Gavin Amm
mmm, could you use a foreach loop?
I think you will need to send separate mail items for each e-mail
address you have stored in the database if you want to address it to
them personally.

Eg in seudo code:
foreach($row_returned_from_database){
  # variables  headers etc here
  # eg, $contactemail = $row['email']
  mail($contactemail, $subject, $message, $headers);
}


Cheers,
Gav



-Original Message-
From: JeRRy [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, 1 April 2003 9:05 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] PHP mail() question?


Hi,

I am trying to get PHP mail() to do the following:

1) Grab email addresses from a database and put in the
BCC of the email. (hidding their email address)

2) Grab first names from a database and put in the
body of the email.

Below is a script I am using, does not do any queries
to any database because I am not sure how to do it in
the function.  I have tried but have failed so thought
I'd ask here.  Can anyone help?  Here is the code I am
using...  

?php

$myname = Me Myself; 
$myemail = [EMAIL PROTECTED]; 

$contactname = Mister Contact; 
$contactemail = [EMAIL PROTECTED]; 

$message = hello from .$contactname.; 
$subject = A email; 

$headers .= MIME-Version: 1.0\r\n; 
$headers .= Content-type: text/html;
charset=iso-8859-1\r\n; 
$headers .= From: .$myname. .$myemail.\r\n; 
$headers .= To: .$contactname.
.$contactemail.\r\n; 
$headers .= Reply-To: .$myname.
$myreplyemail\r\n; 
$headers .= X-Priority: 1\r\n; 
$headers .= X-MSMail-Priority: High\r\n; 
$headers .= X-Mailer: Just My Server; 

mail($contactemail, $subject, $message, $headers); 

?

Maybe I need a different function? If so could someone
show me a example of how it can be achieved please? 

Thanks!

Jerry

P.S. I am using mysql database.

http://mobile.yahoo.com.au - Yahoo! Mobile
- Check  compose your email via SMS on your Telstra or Vodafone mobile.

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


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



RE: [PHP-DB] PHP and Sendmail

2003-03-13 Thread Gavin Amm
Chris,

Just a thought.
You could set up a linux system on an old pentium box  just use it as
your mail server, thus no need to change your code if it is hard coded,
just point to the new server.

Gav



-Original Message-
From: Chris Payne [mailto:[EMAIL PROTECTED] 
Sent: Friday, 14 March 2003 8:13 AM
To: php
Subject: [PHP-DB] PHP and Sendmail


Hi there everyone,

I might soon be moving my server from Linux to Windows, and I was
wondering if I will have to rewrite my PHP - Sendmail code to work on
Windows Apache?  Or is there a better system than sendmail for PHP on
Windows?

Oh BTW it has to support HTML.

Please help. if I do have to rewrite my form code it will take weeks LOL
:-)

Thanks

Chris

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



RE: [PHP-DB] Members area

2003-01-28 Thread Gavin Amm
Hi,

If anyone else has any further ideas, please let me know - thanks.

Thanks Jim for the nuke idea, I've downloaded it  am looking through
it... very exhaustive though...

Thanks Jeff on your thoughts.
I've been thinking along very similar lines to what you suggested...

- I have a contents table  plan to add a column authlevel (Authority
Level), so that each page will have a defined minimum access.
- I was thinking of creating a members table with username,
password, authaccess.
  I liked the idea of leaving room for further growth, and the 'x = y'
control rather than the 'if x = y' or case equivalent.
- Establish an SSH session between the browser  server for the
session/cookie establishment when the username  password are submitted
(a lot of reading may be needed for this one I think...).
- use either sessions to control the access, or cookies (from what I've
read, people seem to favour sessions, I will have to do some reading
before I make my choice).

It is good to know there are others out there that are thinking in the
same mannor for this... Let me know how you progress.

Cheers,
Gav



-Original Message-
From: Baumgartner Jeffrey [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, 23 January 2003 9:05 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Members area


I'm working on a similar project - I'm also a newbie - here's my
approach - which is fairly simple really.

Create a database of all members that includes columns for login,
name and paymentStatus as well as any other info you need for your
database. paymentStatus would be an integer with values of 2 and 5
initially (this allows room for the creation of other levels in the
future) in which 2 is for paid members and 5 is for free members.

Once members log-in, their paid status is saved as a session variable:
$paymentStatus. 

All member-area pages will start with session_start(); at the beginning
and a check of the value of $paymentStatus. If it is null, they are sent
to the log-in page. If the page is for members only, then the value of
$paymentStatus must be =2. If it is for any member, then $paymentStatus
will have to be =5 (this all gives room for different levels of
membership in the future, you see).

Likewise content, which is stored on tables, includes a $paid variable
which indicates who is able to view it. This way, you can deliver
dynamic content, links and other information according to the
$paymentStatus value of each visiting member. In my case, I will have
index pages with links to content pages. All links will be visible, but
links for paid members will be clearly indicated. The purpose of this is
to show freeloaders what they are missing!

I hope this is clear. More experienced members of this list may well
find flaws with my method.

Good luck,

Jeffrey Baumgartner

eBusiness Consultant - ITP Europe
http://www.itp-europe.com
[EMAIL PROTECTED]
+32 2 721 51 00

 -Original Message-
 From: Gavin Amm [SMTP:[EMAIL PROTECTED]]
 Sent: Thursday, January 23, 2003 2:03 AM
 To:   [EMAIL PROTECTED]
 Subject:  [PHP-DB] Members area
 
 Hi All,
 
 I'm about to start development on a members area for a site. The 
 members area will have 2 levels - Paid  Free, with the Paid members 
 having access to more pages.
 
 I have not created a members area before  am after any advice or 
 links I can get... I think a lot of reading is in order...
 
 Particularly:
 - DB structure  fields (I'll be using MySQL if that's relevant)
 - Sessions (I've seen quite a few threads covering sessions over the 
 last couple of months, so should have some links in my 'inbox' 
 somewhere... But the more the merrier...)
 - Any PHP suggestions/advice/links
 - Anything else you can think is relevant...
 
 
 Thanks, this will be a big help.
 
 Cheers,
 Gav
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

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


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




[PHP-DB] Members area

2003-01-22 Thread Gavin Amm
Hi All,

I'm about to start development on a members area for a site.
The members area will have 2 levels - Paid  Free, with the Paid members
having access to more pages.

I have not created a members area before  am after any advice or links
I can get... I think a lot of reading is in order...

Particularly:
- DB structure  fields (I'll be using MySQL if that's relevant)
- Sessions (I've seen quite a few threads covering sessions over the
last couple of months, so should have some links in my 'inbox'
somewhere... But the more the merrier...)
- Any PHP suggestions/advice/links
- Anything else you can think is relevant...


Thanks, this will be a big help.

Cheers,
Gav

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




[PHP-DB] Breaking up new lines for e-mail

2003-01-07 Thread Gavin Amm
Hi guys,

Would someone mind pointing me to a function, or some code, or give me a
seudo-code start for the following:

I'm using the mail() function.
If someone submits the form with text in the multi-line textarea, any
carrige returns (ie, by pressing ENTER) are taken out  the body is sent
as a single line.
I'm sending the e-mail in plain text.

Thanks,
Gav

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




RE: [PHP-DB] Re: Breaking up new lines for e-mail

2003-01-07 Thread Gavin Amm
Thanks for your reply.

Word wrap seems to be ok.
What does seem to be a problem is the line breaks...

For example, they might type in the following (between the dashed
lines):
--
  Hi,

  Please send me some info.

  Thanks,
  Gav
--

When I receive the mail, however, it looks like this:
--
  Hi, Please send me some info. Thanks, Gav
--

This is fine for such a short message, but lengthy messages would be
horrid to read if all the line breaks were taken out...

Cheers,
Gav



-Original Message-
From: Manuel Lemos [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, 8 January 2003 11:32 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: Breaking up new lines for e-mail


Hello,

On 01/07/2003 10:11 PM, Gavin Amm wrote:
 Would someone mind pointing me to a function, or some code, or give me

 a seudo-code start for the following:
 
 I'm using the mail() function.
 If someone submits the form with text in the multi-line textarea, any 
 carrige returns (ie, by pressing ENTER) are taken out  the body is 
 sent as a single line. I'm sending the e-mail in plain text.

There is wordwrap() but that function is broken in several PHP versions 
and even had a buffer overflow security problem, so I gave up on using 
it at all.

What I use is a function that is part of a message composing and sending

class that basically does the same as wordwrap except that it works well

in all PHP versions without any security problems. Check out the 
function WrapText() of the email_message_class here:

http://www.phpclasses.org/mimemessage

-- 

Regards,
Manuel Lemos


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


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




[PHP-DB] Inserting a number into a list moving all other numbers down

2002-12-09 Thread Gavin Amm
Hi,
I'd like your opinion as to whether you think this code is reasonable, or if
there is a better way to do this...

I'd like to insert data in a particular order, so that i would take this eg:
  num  val
  1x
  2y
  3z

and insert a as number 2 (from 2 text boxes), so the resulting list would
end up:
  num  val
  1x
  2a
  3y
  4z


suedo-code so far is:
(i haven't proof read this or tested it yet...)

$num_insert = $_GET(num_insert);
$val_insert = $_GET(val_insert);
$result = mysql_query(SELECT num FROM table);
$num_rows = mysql_num_rows($result);
while($num_rows = $num_insert){
  mysql_query(UPDATE table SET num='$num+1' val='$val');
  $num--;
}
UPDATE table SET num='$num_insert' val='$val';


Cheers,
Gav


This e-mail and any attachments are intended solely for the named addressee,
are confidential and may contain legally privileged information. 

The copying or distribution of them or of any information they contain, by
anyone other than the addressee, is prohibited. If you received this e-mail
in error, please notify us immediately by return e-mail or telephone +61 2
9413 2944 and destroy the original message. Thank you. 

As Email is subject to viruses we advise that all Emails and any attachments
should be scanned by an up to-date Anti Virus programme automatically by
your system. It is the responsibility of the recipient to ensure that all
Emails and any attachments are cleared of Viruses before opening. KSG can
not accept any responsibility for viruses that maybe contained here in.
Please advise KSG by return Email if you believe any Email sent by our
system may contain a virus. It should be noted that most Anti Virus
programmes can not scan encrypted file attachments (example - documents
saved with a password). Thus extra care should be taken when opening these
files. 

Liability limited by the Accountants Scheme, approved under the Professional
Standards Act 1994 (NSW). 



Level 4 
54 Neridah StreetPO Box 1290 
CHATSWOOD   NSW   2067   CHATSWOOD   NSW   2057 


Ph: +61 2 9413 2944  Fax: +61 2 9413 9901

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




[PHP-DB] calling function on submit instead of going to a new script

2002-12-04 Thread Gavin Amm
Hi,

I'm using some form fields on a page to pick up existing data from a MySQL
database, make any changes, and update the database when i hit submit.
I've picked up the data ok, now i want to process the update...

How do i call a function(?) on the same page rather than use another page
through action=somescript.php?
what i'd like to do (in seudo-code) is:

form action=myfunction()
  ...
  input type=submit
/form
myfunction(){
  process update  send user back to homepage
}


cheers,
Gav


This e-mail and any attachments are intended solely for the named addressee,
are confidential and may contain legally privileged information. 

The copying or distribution of them or of any information they contain, by
anyone other than the addressee, is prohibited. If you received this e-mail
in error, please notify us immediately by return e-mail or telephone +61 2
9413 2944 and destroy the original message. Thank you. 

As Email is subject to viruses we advise that all Emails and any attachments
should be scanned by an up to-date Anti Virus programme automatically by
your system. It is the responsibility of the recipient to ensure that all
Emails and any attachments are cleared of Viruses before opening. KSG can
not accept any responsibility for viruses that maybe contained here in.
Please advise KSG by return Email if you believe any Email sent by our
system may contain a virus. It should be noted that most Anti Virus
programmes can not scan encrypted file attachments (example - documents
saved with a password). Thus extra care should be taken when opening these
files. 

Liability limited by the Accountants Scheme, approved under the Professional
Standards Act 1994 (NSW). 



Level 4 
54 Neridah StreetPO Box 1290 
CHATSWOOD   NSW   2067   CHATSWOOD   NSW   2057 


Ph: +61 2 9413 2944  Fax: +61 2 9413 9901

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




RE: [PHP-DB] foreach loop from MySQL select query to HTML select list

2002-11-28 Thread Gavin Amm
hmm, interesting to know the mysql_fetch_array() by default returns an array
that's associative AND numeric - very useful to know  something i'll have
to look into more, thanks Jason.

Thanks also John, puting curley braces around the variables is a valuable
lesson - works wonderfully - cheers.

i do have one more problem though, i need to run the loop a 2nd time later
in the page in exactly the same way, but nothing is returned.
i just copied  pasted the code from one section of the page to the next.
do i need to reset one of the vaiables? 


select name=dept
  option-select-/option
  ?PHP
  while($row = mysql_fetch_array($result_dept)){
echo option value=\{$row['dept']}\{$row['dept']}/option\n;
  }
  ?
/select


cheers, Gav



-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: Friday, 29 November 2002 2:59 AM
To: 'Gavin Amm'; 'Php-Db (E-mail)'
Subject: RE: [PHP-DB] foreach loop from MySQL select query to HTML
select list


 i've looked around the web a bit more  it would appear you can't just
use
 a
 foreach function, apparently you need to use a while{foreach{}}
structure.
 i
 was hoping you could just use the foreach function?
 
 so this is the code now:
 
 select name=deptsub_select
   option-select-/option
 ?PHP
 while ($row = mysql_fetch_array($result_deptsub)){
   foreach ($row as $value) {
 echo option value=\$value\$value/option\n;

Where did you get the idea to use foreach? Your select statement is only
selecting one column, so $row is only going to have one column in it for
each mysql_fetch_*. 

Use something like this:

while($row = mysql_fetch_array($result_deptsub))
{ echo option
value=\{$row['deptsub']}\{$row['deptsub']}/option\n; }

---John Holmes...



This e-mail and any attachments are intended solely for the named addressee,
are confidential and may contain legally privileged information. 

The copying or distribution of them or of any information they contain, by
anyone other than the addressee, is prohibited. If you received this e-mail
in error, please notify us immediately by return e-mail or telephone +61 2
9413 2944 and destroy the original message. Thank you. 

As Email is subject to viruses we advise that all Emails and any attachments
should be scanned by an up to-date Anti Virus programme automatically by
your system. It is the responsibility of the recipient to ensure that all
Emails and any attachments are cleared of Viruses before opening. KSG can
not accept any responsibility for viruses that maybe contained here in.
Please advise KSG by return Email if you believe any Email sent by our
system may contain a virus. It should be noted that most Anti Virus
programmes can not scan encrypted file attachments (example - documents
saved with a password). Thus extra care should be taken when opening these
files. 

Liability limited by the Accountants Scheme, approved under the Professional
Standards Act 1994 (NSW). 



Level 4 
54 Neridah StreetPO Box 1290 
CHATSWOOD   NSW   2067   CHATSWOOD   NSW   2057 


Ph: +61 2 9413 2944  Fax: +61 2 9413 9901

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




RE: [PHP-DB] foreach loop from MySQL select query to HTML select list

2002-11-28 Thread Gavin Amm
thanks John,
i was thinking along similar lines.
that should work well.
cheers,
Gav


-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: Friday, 29 November 2002 4:08 PM
To: 'Gavin Amm'; 'Php-Db (E-mail)'
Subject: RE: [PHP-DB] foreach loop from MySQL select query to HTML
select list


 hmm, interesting to know the mysql_fetch_array() by default returns an
 array
 that's associative AND numeric - very useful to know  something i'll
have
 to look into more, thanks Jason.
 
 Thanks also John, puting curley braces around the variables is a
valuable
 lesson - works wonderfully - cheers.
 
 i do have one more problem though, i need to run the loop a 2nd time
later
 in the page in exactly the same way, but nothing is returned.
 i just copied  pasted the code from one section of the page to the
next.
 do i need to reset one of the vaiables?
 
 
 select name=dept
   option-select-/option
   ?PHP
   while($row = mysql_fetch_array($result_dept)){
 echo option value=\{$row['dept']}\{$row['dept']}/option\n;
   }
   ?
 /select

Put the options into a variable and just echo it out where you need it.

$options = option-select-/option\n;
while($row = mysql_fetch_row($result))
{ $options .= option value=\{$row[0]}\{$row[0]}/option\n; }

And wherever you need a select statement, just 

select name=dept
?=$options?

---John Holmes...



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


This e-mail and any attachments are intended solely for the named addressee,
are confidential and may contain legally privileged information. 

The copying or distribution of them or of any information they contain, by
anyone other than the addressee, is prohibited. If you received this e-mail
in error, please notify us immediately by return e-mail or telephone +61 2
9413 2944 and destroy the original message. Thank you. 

As Email is subject to viruses we advise that all Emails and any attachments
should be scanned by an up to-date Anti Virus programme automatically by
your system. It is the responsibility of the recipient to ensure that all
Emails and any attachments are cleared of Viruses before opening. KSG can
not accept any responsibility for viruses that maybe contained here in.
Please advise KSG by return Email if you believe any Email sent by our
system may contain a virus. It should be noted that most Anti Virus
programmes can not scan encrypted file attachments (example - documents
saved with a password). Thus extra care should be taken when opening these
files. 

Liability limited by the Accountants Scheme, approved under the Professional
Standards Act 1994 (NSW). 



Level 4 
54 Neridah StreetPO Box 1290 
CHATSWOOD   NSW   2067   CHATSWOOD   NSW   2057 


Ph: +61 2 9413 2944  Fax: +61 2 9413 9901

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




[PHP-DB] foreach loop from MySQL select query to HTML select list

2002-11-27 Thread Gavin Amm
Hi,

I'm trying to pick up data from my MySQL database, use a foreach loop to
extact the data from the result  put that data into a select list.

I have tried the following code with  without the $row = ... line, both
unsucessfully:

?PHP
$db = mysql_connect(myhost, username, );
mysql_select_db(mydatabase, $db);

## FETCH INFO
$sql_dept = SELECT dept FROM content GROUP BY dept;
$sql_deptsub = SELECT deptsub FROM content GROUP BY deptsub;

mysql_close($db);
?


select name=dept
  option-select-/option
?PHP
$result = mysql_query($sql_dept, $db);
$row = mysql_fetch_array($result);
foreach ($row as $value) {echo option
value=\$value\$value/option\n;}
?
/select


I get the following error message in my HTML output code:

bWarning/b:  1 is not a valid MySQL-Link resource in
b/home/.../public_html/content.php/b on line b48/bbr
br
bWarning/b:  Invalid argument supplied for foreach() in
b/home/.../public_html/content.php/b on line b49/bbr

Line 48 is the line begining with: foreach...


Any help would be appreciated.
Thanks,
Gav


This e-mail and any attachments are intended solely for the named addressee,
are confidential and may contain legally privileged information. 

The copying or distribution of them or of any information they contain, by
anyone other than the addressee, is prohibited. If you received this e-mail
in error, please notify us immediately by return e-mail or telephone +61 2
9413 2944 and destroy the original message. Thank you. 

As Email is subject to viruses we advise that all Emails and any attachments
should be scanned by an up to-date Anti Virus programme automatically by
your system. It is the responsibility of the recipient to ensure that all
Emails and any attachments are cleared of Viruses before opening. KSG can
not accept any responsibility for viruses that maybe contained here in.
Please advise KSG by return Email if you believe any Email sent by our
system may contain a virus. It should be noted that most Anti Virus
programmes can not scan encrypted file attachments (example - documents
saved with a password). Thus extra care should be taken when opening these
files. 

Liability limited by the Accountants Scheme, approved under the Professional
Standards Act 1994 (NSW). 



Level 4 
54 Neridah StreetPO Box 1290 
CHATSWOOD   NSW   2067   CHATSWOOD   NSW   2057 


Ph: +61 2 9413 2944  Fax: +61 2 9413 9901

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




RE: [PHP-DB] foreach loop from MySQL select query to HTML select list

2002-11-27 Thread Gavin Amm
good point! whoops.
ok, i've moved the $result_dept  $result_deptsub queries,
now i'm getting 2 of the same entries in my html code:

select name=dept
  option-select-/option
  option value=auditaudit/option
  option value=auditaudit/option
/select

any thoughts?
Gav

-Original Message-
From: John Coder [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 28 November 2002 3:44 PM
To: Gavin Amm
Cc: Php-Db (E-mail)
Subject: Re: [PHP-DB] foreach loop from MySQL select query to HTML
select list


On Wed, 2002-11-27 at 23:33, Gavin Amm wrote:
 Hi,
 
 I'm trying to pick up data from my MySQL database, use a foreach loop to
 extact the data from the result  put that data into a select list.
 
 I have tried the following code with  without the $row = ... line, both
 unsucessfully:
 
 ?PHP
 $db = mysql_connect(myhost, username, );
 mysql_select_db(mydatabase, $db);
 
 ## FETCH INFO
 $sql_dept = SELECT dept FROM content GROUP BY dept;
 $sql_deptsub = SELECT deptsub FROM content GROUP BY deptsub;
 
 mysql_close($db);

How can run a query when it's closed? move this to after the select and
see if it works.
 ?
 
 
 select name=dept
   option-select-/option
 ?PHP
   $result = mysql_query($sql_dept, $db);
   $row = mysql_fetch_array($result);
   foreach ($row as $value) {echo option
 value=\$value\$value/option\n;}
 ?
 /select

Put your mysql_close here if you want to close it.

John Coder


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


This e-mail and any attachments are intended solely for the named addressee,
are confidential and may contain legally privileged information. 

The copying or distribution of them or of any information they contain, by
anyone other than the addressee, is prohibited. If you received this e-mail
in error, please notify us immediately by return e-mail or telephone +61 2
9413 2944 and destroy the original message. Thank you. 

As Email is subject to viruses we advise that all Emails and any attachments
should be scanned by an up to-date Anti Virus programme automatically by
your system. It is the responsibility of the recipient to ensure that all
Emails and any attachments are cleared of Viruses before opening. KSG can
not accept any responsibility for viruses that maybe contained here in.
Please advise KSG by return Email if you believe any Email sent by our
system may contain a virus. It should be noted that most Anti Virus
programmes can not scan encrypted file attachments (example - documents
saved with a password). Thus extra care should be taken when opening these
files. 

Liability limited by the Accountants Scheme, approved under the Professional
Standards Act 1994 (NSW). 



Level 4 
54 Neridah StreetPO Box 1290 
CHATSWOOD   NSW   2067   CHATSWOOD   NSW   2057 


Ph: +61 2 9413 2944  Fax: +61 2 9413 9901

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




RE: [PHP-DB] foreach loop from MySQL select query to HTML select list

2002-11-27 Thread Gavin Amm
ok,

i've looked around the web a bit more  it would appear you can't just use a
foreach function, apparently you need to use a while{foreach{}} structure. i
was hoping you could just use the foreach function?

so this is the code now:

select name=deptsub_select
  option-select-/option
?PHP
while ($row = mysql_fetch_array($result_deptsub)){
  foreach ($row as $value) {
echo option value=\$value\$value/option\n;
  }
}
?
/select


but now the output HTML code is doubling up:

select name=dept
option-select-/option
option value=auditaudit/option
option value=auditaudit/option
option value=consultingconsulting/option
option value=consultingconsulting/option
...
/select


cheers,
Gav


This e-mail and any attachments are intended solely for the named addressee,
are confidential and may contain legally privileged information. 

The copying or distribution of them or of any information they contain, by
anyone other than the addressee, is prohibited. If you received this e-mail
in error, please notify us immediately by return e-mail or telephone +61 2
9413 2944 and destroy the original message. Thank you. 

As Email is subject to viruses we advise that all Emails and any attachments
should be scanned by an up to-date Anti Virus programme automatically by
your system. It is the responsibility of the recipient to ensure that all
Emails and any attachments are cleared of Viruses before opening. KSG can
not accept any responsibility for viruses that maybe contained here in.
Please advise KSG by return Email if you believe any Email sent by our
system may contain a virus. It should be noted that most Anti Virus
programmes can not scan encrypted file attachments (example - documents
saved with a password). Thus extra care should be taken when opening these
files. 

Liability limited by the Accountants Scheme, approved under the Professional
Standards Act 1994 (NSW). 



Level 4 
54 Neridah StreetPO Box 1290 
CHATSWOOD   NSW   2067   CHATSWOOD   NSW   2057 


Ph: +61 2 9413 2944  Fax: +61 2 9413 9901

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




RE: [PHP-DB] $_get 2 variables

2002-11-20 Thread Gavin Amm
Thanks Ryan, Ignatius.

-Original Message-
From: Ryan Gallagher [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 20 November 2002 5:37 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] $_get 2 variables


Quoting Gavin Amm [EMAIL PROTECTED]:

 Hi,
 
 I'm wanting to retrieve data from my database using 2 conditions in the
 WHERE clause.
 How do i pick up 2 different variables from the URL?
 
 i can get just 1 variable easily (eg:
 http://localhost/myscript.php?var1=blah)
 My question essentially is: what string do do i need to type into the URL
to
 pick up the 2 variables like this:
   $var1 = $_GET['var1'];
   $var2 = $_get['var2'];
 
 Do I need to start messing around with strings? or is there an easy way?
 
 Thanks,
 Gav

Try:
http://localhost/myscript.php?var=foovar2=bar
'' is the default url parameter seperator.  The rest of your code looks
fine. 
(course there are lots of other ways to go about it).

--Ryan


-- 
Ryan T. Gallagher
[EMAIL PROTECTED]
International Studies Abroad
http://www.studiesabroad.com
(512)480-8522



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


This e-mail and any attachments are intended solely for the named addressee,
are confidential and may contain legally privileged information. 

The copying or distribution of them or of any information they contain, by
anyone other than the addressee, is prohibited. If you received this e-mail
in error, please notify us immediately by return e-mail or telephone +61 2
9413 2944 and destroy the original message. Thank you. 

As Email is subject to viruses we advise that all Emails and any attachments
should be scanned by an up to-date Anti Virus programme automatically by
your system. It is the responsibility of the recipient to ensure that all
Emails and any attachments are cleared of Viruses before opening. KSG can
not accept any responsibility for viruses that maybe contained here in.
Please advise KSG by return Email if you believe any Email sent by our
system may contain a virus. It should be noted that most Anti Virus
programmes can not scan encrypted file attachments (example - documents
saved with a password). Thus extra care should be taken when opening these
files. 

Liability limited by the Accountants Scheme, approved under the Professional
Standards Act 1994 (NSW). 



Level 4 
54 Neridah StreetPO Box 1290 
CHATSWOOD   NSW   2067   CHATSWOOD   NSW   2057 


Ph: +61 2 9413 2944  Fax: +61 2 9413 9901

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




[PHP-DB] Check data exists in MySQL

2002-11-20 Thread Gavin Amm
Hi,

I'd like to test to see if data exists in my table (count), and if not
insert some:


This is seudo code of what I'd like:
$sql = SELECT num FROM count WHERE col1=$var1 AND col2=$var2;
IF $sql returns an EMPTY SET {
  INSERT INTO count VALUES('$var1', '$var2', 0);
}


This is the code i have atm:
$sql=SELECT num FROM count where col1='$var1' AND col2='$var2';
$page_count = mysql_query($sql,$db);
if (!$page_count){
  $sql = INSERT INTO count VALUES('$var1', '$var2', '0');
}


Thanks,
Gav


This e-mail and any attachments are intended solely for the named addressee,
are confidential and may contain legally privileged information. 

The copying or distribution of them or of any information they contain, by
anyone other than the addressee, is prohibited. If you received this e-mail
in error, please notify us immediately by return e-mail or telephone +61 2
9413 2944 and destroy the original message. Thank you. 

As Email is subject to viruses we advise that all Emails and any attachments
should be scanned by an up to-date Anti Virus programme automatically by
your system. It is the responsibility of the recipient to ensure that all
Emails and any attachments are cleared of Viruses before opening. KSG can
not accept any responsibility for viruses that maybe contained here in.
Please advise KSG by return Email if you believe any Email sent by our
system may contain a virus. It should be noted that most Anti Virus
programmes can not scan encrypted file attachments (example - documents
saved with a password). Thus extra care should be taken when opening these
files. 

Liability limited by the Accountants Scheme, approved under the Professional
Standards Act 1994 (NSW). 



Level 4 
54 Neridah StreetPO Box 1290 
CHATSWOOD   NSW   2067   CHATSWOOD   NSW   2057 


Ph: +61 2 9413 2944  Fax: +61 2 9413 9901

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




RE: [PHP-DB] Email Encryption?

2002-11-20 Thread Gavin Amm
ok,

here's an idea:

Either use a script off the web, or write your own:
During the initial SSL session setup:
 - send an e-mail to the client with a web page attached.
   (include instructions in the e-mail)
   Put javascript into the page to decrypt RC5 (apparently you can get a
patch for MySQL to enable RC5 functionality)
 - During the session put the client's key  encrypted login details into a
text file  have them save it to their hard disk
 - When the client wishes to view their login information, instruct the
client to:
  - open the web page atached to the e-mail
  - use a form in the web page to browse for the text file they saved to
their hard disk
  - use the RC5 decryption script embedded in the web page to decrypt
the client login info

or something like that...

cheers,
Gav



-Original Message-
From: Aaron Wolski [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 20 November 2002 1:01 AM
To: 'Jeremy Wilson'; 'Jason Vincent'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Email Encryption?


Hi All,

I want to thank everyone for their suggestion.

A short term solution we're simply going to remove the username from
the email. This way if a hacker does obtain the email they don't have
the complete details to gain access to the users account.

I would like to know more about the code supplied below though.

How does this work?

As long as they HAVE a string that gets compared in the DB then what
good is this? They can still gain access to the users account.

Thanks again.

Aaron

-Original Message-
From: Jeremy Wilson [mailto:[EMAIL PROTECTED]]
Sent: November 16, 2002 1:08 PM
To: 'Aaron Wolski'; 'Jason Vincent'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Email Encryption?

$encrypted_string = md5(base64_encode($var.'secret key'));

Pass the user name or password to $var and place text in to replace the
words 'secret key'.

-Original Message-
From: Aaron Wolski [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 15, 2002 8:45 AM
To: 'Jason Vincent'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Email Encryption?

Well.

Its not what they want.. it what one of their clients want (very big
corporation with very unrealistic security standards - you'd think they
were NASA or something *grumble*)

Their thought is that someone could hack the received email, login to
the store using the publically displayed logins details and reek havoc
on the store, etc.

*shrugs* Sadly this isn't open for debate as a solutions IS required.

Any thoughts?

Aaron

-Original Message-
From: Jason Vincent [mailto:[EMAIL PROTECTED]]
Sent: November 15, 2002 11:42 AM
To: Aaron Wolski; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Email Encryption?

Why email? If the Admin tool uses SSL, that is all you need.
Regards,
J

-Original Message-
From: Aaron Wolski [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 15, 2002 11:39 AM
To: 'Aaron Wolski'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Email Encryption?

Just thinking here..

PGP is not an option as it would mean EACH user being setup would need
the company's public key to decrypt. Not possible as they setup a few
hundred accounts each month.
Hmm.. anything else?
Argh :(
Aaron
-Original Message-
From: Aaron Wolski [mailto:[EMAIL PROTECTED]]
Sent: November 15, 2002 11:36 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Email Encryption?
OFFTOPIC
 
Sorry for the off topic guys..
 
But I've just been informed that an application we developed for a
client whereby they use an Admin tool to setup user accounts into their
store needs to have the login (username and password) encrypted.
 
I am thinking PGP for this but to be honest I've never really worked
with PGP and wouldn't have the first clue.
 
Does anyone have any experience with this or can offer and advise at
all?
 
Again, sorry for the OT discussion.
 
Aaron

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



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




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


This e-mail and any attachments are intended solely for the named addressee,
are confidential and may contain legally privileged information. 

The copying or distribution of them or of any information they contain, by
anyone other than the addressee, is prohibited. If you received this e-mail
in error, please notify us immediately by return e-mail or telephone +61 2
9413 2944 and destroy the original message. Thank you. 

As Email is subject to viruses we advise that all Emails and any attachments
should be scanned by an up to-date Anti Virus programme automatically by
your system. It is the responsibility of the recipient to ensure that all
Emails and any attachments are cleared of Viruses before opening. KSG can
not accept any responsibility for viruses that maybe contained here in.
Please advise KSG by return Email if you believe 

RE: [PHP-DB] Check data exists in MySQL

2002-11-20 Thread Gavin Amm
Hi,

for some reason i'm getting an error when I try to run this query:
__

  $sql=SELECT num FROM count where dept='$dept' AND deptsub='$deptsub';
  $page_count = mysql_query($sql,$db);

  # If does not exist in the database, insert a new entry
  if (!mysql_num_rows($page_count)){
$sql = INSERT INTO count VALUES('$dept', '$deptsub', '0');
$result = mysql_query($sql,$db);
  }

  #Update the count in the database
  $page_count = $page_count + 1;
  $sql=UPDATE count SET num='$page_count' WHERE dept='$dept' AND
deptsub='$deptsub';
  $result = mysql_query($sql, $db);
__

My table looks like this:
  count:
 dept VARCHAR(32)
 deptsub VARCHAR(32)
 num INT(10)
__

I'm getting the following error message:
  Parse error: parse error in /home/./public_html/public/index.php on
line 25
(Which is the line: $sql=UPDATE count...)


Any thoughts would b most helpful.
Thanks,
Gav


-Original Message-
From: Tatang Widyanto [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 21 November 2002 3:33 PM
To: PHP Database
Subject: Re: [PHP-DB] Check data exists in MySQL


 if (!$page_count){
   $sql = INSERT INTO count VALUES('$var1', '$var2', '0');
 }
 

 if (!mysql_num_rows($page_count)){
   $sql = INSERT INTO count VALUES('$var1', '$var2', '0');
 }


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


This e-mail and any attachments are intended solely for the named addressee,
are confidential and may contain legally privileged information. 

The copying or distribution of them or of any information they contain, by
anyone other than the addressee, is prohibited. If you received this e-mail
in error, please notify us immediately by return e-mail or telephone +61 2
9413 2944 and destroy the original message. Thank you. 

As Email is subject to viruses we advise that all Emails and any attachments
should be scanned by an up to-date Anti Virus programme automatically by
your system. It is the responsibility of the recipient to ensure that all
Emails and any attachments are cleared of Viruses before opening. KSG can
not accept any responsibility for viruses that maybe contained here in.
Please advise KSG by return Email if you believe any Email sent by our
system may contain a virus. It should be noted that most Anti Virus
programmes can not scan encrypted file attachments (example - documents
saved with a password). Thus extra care should be taken when opening these
files. 

Liability limited by the Accountants Scheme, approved under the Professional
Standards Act 1994 (NSW). 



Level 4 
54 Neridah StreetPO Box 1290 
CHATSWOOD   NSW   2067   CHATSWOOD   NSW   2057 


Ph: +61 2 9413 2944  Fax: +61 2 9413 9901

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




[PHP-DB] $_get 2 variables

2002-11-19 Thread Gavin Amm
Hi,

I'm wanting to retrieve data from my database using 2 conditions in the
WHERE clause.
How do i pick up 2 different variables from the URL?

i can get just 1 variable easily (eg:
http://localhost/myscript.php?var1=blah)
My question essentially is: what string do do i need to type into the URL to
pick up the 2 variables like this:
  $var1 = $_GET['var1'];
  $var2 = $_get['var2'];

Do I need to start messing around with strings? or is there an easy way?

Thanks,
Gav


This e-mail and any attachments are intended solely for the named addressee,
are confidential and may contain legally privileged information. 

The copying or distribution of them or of any information they contain, by
anyone other than the addressee, is prohibited. If you received this e-mail
in error, please notify us immediately by return e-mail or telephone +61 2
9413 2944 and destroy the original message. Thank you. 

As Email is subject to viruses we advise that all Emails and any attachments
should be scanned by an up to-date Anti Virus programme automatically by
your system. It is the responsibility of the recipient to ensure that all
Emails and any attachments are cleared of Viruses before opening. KSG can
not accept any responsibility for viruses that maybe contained here in.
Please advise KSG by return Email if you believe any Email sent by our
system may contain a virus. It should be noted that most Anti Virus
programmes can not scan encrypted file attachments (example - documents
saved with a password). Thus extra care should be taken when opening these
files. 

Liability limited by the Accountants Scheme, approved under the Professional
Standards Act 1994 (NSW). 



Level 4 
54 Neridah StreetPO Box 1290 
CHATSWOOD   NSW   2067   CHATSWOOD   NSW   2057 


Ph: +61 2 9413 2944  Fax: +61 2 9413 9901

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




RE: [PHP-DB] Email Encryption?

2002-11-17 Thread Gavin Amm
 
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

ookey,

(i think Richard Hutchins' idea is a good one, and secure enough that
most sites use this method... but if you want an alternative...)
now i am a newby to security and PHP, but here's my logic:

 1. During the account setup (presuming this is on-line?) they put in
their username, password, e-mail address  other details over a
'secure' 128 bit SSL session.

 2. During this secure SSL session, you could generate a key pair (be
it from your own code or a script you found on the web... or PGP?
maybe you could e-mail PGP  ask them if it is possible to create
dynamic key pairs through scripting...).

 3. a) Store both key pairs securely in your database using MD5
 3. b) Provide the Client's key as a file for them to save to their
HD during the SSL session
   (Remember, you are only as secure as your weakest link - if
their system is weak, yours will also be weak)

 4. E-Mail them a link (instead of their details) that they can click
on to retrieve their details
When they click on the link have it start up an SSL session,
allow them to put in their username and provide a browse button to
select the key pair file they saved to their HD.

 5. Compare the contents of the file to the key pair in the database
associated with the username, if it checks out ok, return the
client's details (over the SSL connection).


Gav



- -Original Message-
From: Peter Beckman [mailto:[EMAIL PROTECTED]]
Sent: Saturday, 16 November 2002 7:12 AM
To: Aaron Wolski
Cc: 'Jason Vincent'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Email Encryption?


At the time of the account setup, you'll have the unencrypted and
encrypted
password.  Send the email before it gets encrypted.

Still, this is a little silly, since the email is unencrypted.  I
guess you
could base64 encode the email, but that'd take an extra step.

Oooh, what about this?  Send an email that takes you to an https:
page that
only can be viewed by entering a valid code sent in another email? 
This
https page, given the right code, will give you your username and
password?

The two separate emails provides a bit of obscurity, and the password
is
always encrypted.

On the server side, if these accounts would only be accessed from
certain
IP blocks, you can block other requests.

Peter

On Fri, 15 Nov 2002, Aaron Wolski wrote:

 My client is the one doing the setup of accounts.

 How would the account holder know of his password before it got
 encrypted?

 Hense the email.

 Aaron

 -Original Message-
 From: Peter Beckman [mailto:[EMAIL PROTECTED]]
 Sent: November 15, 2002 12:35 PM
 To: Aaron Wolski
 Cc: 'Jason Vincent'; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] Email Encryption?

 Why not encrypt the password in the DB?  If they lose their
 password, it cannot be sent to them.  They chose it, so it doesn't
 need to be sent to them in their email.  If they lose it, it is
 changed, and they have to change it again.  That way, only if they
 are stupid do they have an extra
 step.

 The passwords in the DB are encrypted, so only if someone gets a
 hold of the DB can the passwords be cracked by brute force.

 md5 would work fine for this.  It is the same security that FreeBSD
 uses in
 their password file.

 Peter

 On Fri, 15 Nov 2002, Aaron Wolski wrote:

  Well.
 
  Its not what they want.. it what one of their clients want (very
  big corporation with very unrealistic security standards - you'd
  think 
 they
  were NASA or something *grumble*)
 
  Their thought is that someone could hack the received email,
  login to the store using the publically displayed logins details
  and reek havoc on the store, etc.
 
  *shrugs* Sadly this isn't open for debate as a solutions IS
  required. 
 
  Any thoughts?
 
  Aaron
 
  -Original Message-
  From: Jason Vincent [mailto:[EMAIL PROTECTED]]
  Sent: November 15, 2002 11:42 AM
  To: Aaron Wolski; [EMAIL PROTECTED]
  Subject: RE: [PHP-DB] Email Encryption?
 
  Why email? If the Admin tool uses SSL, that is all you need.
  Regards,
  J
 
  -Original Message-
  From: Aaron Wolski [mailto:[EMAIL PROTECTED]]
  Sent: Friday, November 15, 2002 11:39 AM
  To: 'Aaron Wolski'; [EMAIL PROTECTED]
  Subject: RE: [PHP-DB] Email Encryption?
 
  Just thinking here..
 
  PGP is not an option as it would mean EACH user being setup would
  need the company's public key to decrypt. Not possible as they
  setup a few hundred accounts each month.
  Hmm.. anything else?
  Argh :(
  Aaron
  -Original Message-
  From: Aaron Wolski [mailto:[EMAIL PROTECTED]]
  Sent: November 15, 2002 11:36 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] Email Encryption?
  OFFTOPIC
 
  Sorry for the off topic guys..
 
  But I've just been informed that an application we developed for
  a client whereby they use an Admin tool to setup user accounts
  into 
 their
  store needs to have the login (username and password) encrypted.
 
  I am thinking PGP for this but to be honest I've 

RE: [PHP-DB] Email Encryption?

2002-11-17 Thread Gavin Amm
 
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

Check out this link:
  http://www.pgpi.org/dev/

It is not exactly PHP material, but maybe if you wanted to contact
them  ask them about supporting PHP you might get a response (i'd be
interested if you get a responce, as i think having that
functionality in PHP would be useful).


Also, here are some mail lists  news groups:
  http://www.pgpi.org/products/pgp/support/


Gav

-BEGIN PGP SIGNATURE-
Version: PGP 7.0.4

iQA/AwUBPdhNjJX+fmrkFTroEQKrbQCg6Rj6S2xrRzbZuLchfQ5/FqkjwvkAn30B
aAPHNEreUBHF5VQugdMGacE3
=qRHI
-END PGP SIGNATURE-


This e-mail and any attachments are intended solely for the named addressee,
are confidential and may contain legally privileged information. 

The copying or distribution of them or of any information they contain, by
anyone other than the addressee, is prohibited. If you received this e-mail
in error, please notify us immediately by return e-mail or telephone +61 2
9413 2944 and destroy the original message. Thank you. 

As Email is subject to viruses we advise that all Emails and any attachments
should be scanned by an up to-date Anti Virus programme automatically by
your system. It is the responsibility of the recipient to ensure that all
Emails and any attachments are cleared of Viruses before opening. KSG can
not accept any responsibility for viruses that maybe contained here in.
Please advise KSG by return Email if you believe any Email sent by our
system may contain a virus. It should be noted that most Anti Virus
programmes can not scan encrypted file attachments (example - documents
saved with a password). Thus extra care should be taken when opening these
files. 

Liability limited by the Accountants Scheme, approved under the Professional
Standards Act 1994 (NSW). 



Level 4 
54 Neridah StreetPO Box 1290 
CHATSWOOD   NSW   2067   CHATSWOOD   NSW   2057 


Ph: +61 2 9413 2944  Fax: +61 2 9413 9901

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




[PHP-DB] Warning - newby question -- $_GET

2002-11-06 Thread Gavin Amm
Hi,

I'm trying to call a script with the ?= after the php script name in the
URL, but can't seem to pick up the variable to use in my script...
any help would be greatly appreciated :)

I'm calling the script with this url:
http://localhost/Data/test/dbconnect2c.php?id=TestPage

The section of the script i'm using is:
$id = $_GET['id'];
$sql=SELECT * FROM content where title=$id;
$result=mysql_query($sql,$db);

Error message returned:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
resource in...


Thanks,
Gav


This e-mail and any attachments are intended solely for the named addressee,
are confidential and may contain legally privileged information. 

The copying or distribution of them or of any information they contain, by
anyone other than the addressee, is prohibited. If you received this e-mail
in error, please notify us immediately by return e-mail or telephone +61 2
9413 2944 and destroy the original message. Thank you. 

As Email is subject to viruses we advise that all Emails and any attachments
should be scanned by an up to-date Anti Virus programme automatically by
your system. It is the responsibility of the recipient to ensure that all
Emails and any attachments are cleared of Viruses before opening. KSG can
not accept any responsibility for viruses that maybe contained here in.
Please advise KSG by return Email if you believe any Email sent by our
system may contain a virus. It should be noted that most Anti Virus
programmes can not scan encrypted file attachments (example - documents
saved with a password). Thus extra care should be taken when opening these
files. 

Liability limited by the Accountants Scheme, approved under the Professional
Standards Act 1994 (NSW). 



Level 4 
54 Neridah StreetPO Box 1290 
CHATSWOOD   NSW   2067   CHATSWOOD   NSW   2057 


Ph: +61 2 9413 2944  Fax: +61 2 9413 9901

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




RE: [PHP-DB] Warning - newby question -- $_GET

2002-11-06 Thread Gavin Amm
i wrote a really basic script sucessfully to echo the url variable to the
screen... will go from there. thanks beau.

EXCELLENT :)
The single quotes around the $id variable in the select statement worked
wonderfully. thanks John.

Gav



-Original Message-
From: John W. Holmes [mailto:holmes072000;charter.net]
Sent: Thursday, 7 November 2002 1:20 PM
To: 'Gavin Amm'; 'Php-Db (E-mail)'
Subject: RE: [PHP-DB] Warning - newby question -- $_GET


 I'm trying to call a script with the ?= after the php script name in
the
 URL, but can't seem to pick up the variable to use in my script...
 any help would be greatly appreciated :)
 
 I'm calling the script with this url:
 http://localhost/Data/test/dbconnect2c.php?id=TestPage
 
 The section of the script i'm using is:
 $id = $_GET['id'];
 $sql=SELECT * FROM content where title=$id;
 $result=mysql_query($sql,$db);

Well, for your example, $id is going to equal TestPage, so you are
making an invalid query: where title=TestPage. If you echo
mysql_error(), it'll probably say something about unknown column
TestPage.

At the very least, use quotes:

where title='$id'

 Error message returned:
 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
 result
 resource in...

This means your query failed. Echo mysql_error() to determine why. Get
used to using mysql_error for good debugging.

---John Holmes...



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


This e-mail and any attachments are intended solely for the named addressee,
are confidential and may contain legally privileged information. 

The copying or distribution of them or of any information they contain, by
anyone other than the addressee, is prohibited. If you received this e-mail
in error, please notify us immediately by return e-mail or telephone +61 2
9413 2944 and destroy the original message. Thank you. 

As Email is subject to viruses we advise that all Emails and any attachments
should be scanned by an up to-date Anti Virus programme automatically by
your system. It is the responsibility of the recipient to ensure that all
Emails and any attachments are cleared of Viruses before opening. KSG can
not accept any responsibility for viruses that maybe contained here in.
Please advise KSG by return Email if you believe any Email sent by our
system may contain a virus. It should be noted that most Anti Virus
programmes can not scan encrypted file attachments (example - documents
saved with a password). Thus extra care should be taken when opening these
files. 

Liability limited by the Accountants Scheme, approved under the Professional
Standards Act 1994 (NSW). 



Level 4 
54 Neridah StreetPO Box 1290 
CHATSWOOD   NSW   2067   CHATSWOOD   NSW   2057 


Ph: +61 2 9413 2944  Fax: +61 2 9413 9901

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




RE: [PHP-DB] Warning - newby question -- $_GET

2002-11-06 Thread Gavin Amm
Hi,

For some reason the page worked the 1st few times, now I get the error
message (after making no changes to the code from when it worked...):
(line 5 references the $db = mysql_co... line of code)

Warning: Unknown MySQL Server Host 'mysql.db.*.net.au' (2) in
/home/.../public_html/public/index2.php on line 5

I've got the following code at the start of my script:
(i've replaced username and ** with the appropriate username 
password...)

?php
$db = mysql_connect(mysql.db.*.net.au, username, **);
mysql_select_db(kandtsg,$db);
...


cheers,
Gav


This e-mail and any attachments are intended solely for the named addressee,
are confidential and may contain legally privileged information. 

The copying or distribution of them or of any information they contain, by
anyone other than the addressee, is prohibited. If you received this e-mail
in error, please notify us immediately by return e-mail or telephone +61 2
9413 2944 and destroy the original message. Thank you. 

As Email is subject to viruses we advise that all Emails and any attachments
should be scanned by an up to-date Anti Virus programme automatically by
your system. It is the responsibility of the recipient to ensure that all
Emails and any attachments are cleared of Viruses before opening. KSG can
not accept any responsibility for viruses that maybe contained here in.
Please advise KSG by return Email if you believe any Email sent by our
system may contain a virus. It should be noted that most Anti Virus
programmes can not scan encrypted file attachments (example - documents
saved with a password). Thus extra care should be taken when opening these
files. 

Liability limited by the Accountants Scheme, approved under the Professional
Standards Act 1994 (NSW). 



Level 4 
54 Neridah StreetPO Box 1290 
CHATSWOOD   NSW   2067   CHATSWOOD   NSW   2057 


Ph: +61 2 9413 2944  Fax: +61 2 9413 9901

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