Re: [PHP-DB] Why use MySQL with PHP

2001-11-16 Thread Sheridan Saint-Michel

Oh PHP itself isn't to blame at all, and I never intended to infer that.  If
you point the W3C validator at www.foxjet.com you will get a clean rating
and that page is generated via PHP.  Someone mentioned that they got errors
in Netscape and I was just pointing out that for some reason the people who
built www.php.net didn't make the page W3C compliant.

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


- Original Message - 
From: Nally, Tyler G. [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, November 16, 2001 8:36 AM
Subject: RE: [PHP-DB] Why use MySQL with PHP


 Hmm it's not PHP functionality that makes
 html ugly as shown at validator.w3.org.  It's the person's
 html/php coding ability to avoid coding mistakes.
 
 Basically, PHP gives functionality.  A part of that functionality
 is for the php programmer to make correct HTML as output so
 the browser will render a page as output correctly.  If the
 php programmer is a real bonehead and he/she can't instruct
 php to return good HTML that doesn't make a HTML validator 
 from coughing up errors, it's not PHP's fault, it's the coders.
 
 I've been programming PHP for quite a while now and I can't
 think of a single regular thing in PHP that'd cause any 
 browser (Netscape or IE) to hang.  Any time that I've had
 problems, it's because I didn't know the limits of what I
 was coding to try and do something that is outside the 
 possibilities.
 
 Whether it's storing information in a database, retrieving
 information from a database, sending PHP headers to redirect
 to another page or sending PHP headers to set a cookie, etc.
 You have to know when you can do things in PHP and when you
 can't.  If web pages hang in a browser, it's the buggy PHP 
 code that is interpreted that's causing the problems.  Not 
 PHP itself.
 
 It's like putting gasoline w/ water in a gas tank.  It's not
 the engine's fault it's spitting and sputtering.  It's the
 fuel supply.
 
 Tyler Nally
 [EMAIL PROTECTED]
 American Legion Website
 
  -Original Message-
  From: Sheridan Saint-Michel [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, November 15, 2001 6:02 PM
  To: B. van Ouwerkerk; [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] Why use MySQL with PHP
  
  
  Tell me about it.  You ever try running php.net through
  http://validator.w3.org ?
  
  It's not pretty.
  
  Sheridan Saint-Michel
  Website Administrator
  FoxJet, an ITW Company
  www.foxjet.com
  
  
  - Original Message -
  From: B. van Ouwerkerk [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Thursday, November 15, 2001 12:28 PM
  Subject: Re: [PHP-DB] Why use MySQL with PHP
  
  
  
   I just remembered, the only bad thing I can think of about MySQL...
  their
   website locks up Netscape =)
  
   PHP qualifies for this too. www.php.net looks pretty messy in NS.
  
   By the way, both doesn't break NS..
  
   Bye,
  
  
  
   B.
  
  
   --
   PHP Database Mailing List (http://www.php.net/)
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   To contact the list administrators, e-mail: 
  [EMAIL PROTECTED]
  
  
  -- 
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: 
  [EMAIL PROTECTED]
  
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Why use MySQL with PHP

2001-11-15 Thread Sheridan Saint-Michel

I use PHP/MySQL for a few reasons.

1) Ease of Use - I am a Computer Science student and a Web Programmer.  As
such have been exposed to a wide variety of programming languages and
environments.  PHP/MySQL is one of the easiest to work with and learn, and
is THE easiest to do Web related things with (and yes, I have used and am
including ASP in that statement).

2) Availability - By this I mean not only that both PHP and MySQL are free
(which is a big factor for us starving student types), but that they setup
very easily on a variety of platforms.  This means I can test scripts on a
copy of the MySQL DB from my Linux Server on my windows box before uploading
them.

3) Support - Both PHP and MySQL have very good Manuals which are very easily
accessable (both online and downloadable).  In addition, I have received
extremely valuable help from the PHP mailling lists on both PHP and MySQL
questions.  In most cases I have gotten faster and better responses than I
get from professors at school (who I am asking things concerning their
class...not PHP  =P ) who I am paying to teach me.  That alone is quite a
strong arguement.

4) Good Balance between Flexibility and Readability - In PERL they have a
saying There's More Than One Way To Do It.  I think this is a good
philosophy, but PERL takes this to more of an extreme than I like (this is
not to say that this extreme is not right for some people).  When I read
through a 50 line program in a language that I am fairly skilled at I
shouldn't have to refer to the manual more than say a dozen times...right?
In Perl I often find myself having to refer to manuals a dozen times for two
or three lines!  For example:

perl -we '$_ = q ?4a75737420616e6f74686572205065726c204861636b65720as?;??;
  for (??;(??)x??;??)
  {??;s;(..)s?;qq ?print chr 0x$1 and \161 ss?;excess;??}'

Any idea what that one does?  Without running it?  Paste it into a
terminal... it should run as is (does on my Linux box with PERL 5 anyway).

On the other hand, having to write in languages where you have strict types
(You want to treat a variable as an int and then as a string?!?!?!?) and
very structured design is just as distasteful to me.  PHP strikes a very
good balance between the two even when working with MySQL (I won't paste any
of the kludge needed to interface with CGI and DB in other languages... but
if you have some free time look some of these programs up).

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


- Original Message -
From: søren eriksen [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, November 15, 2001 2:34 PM
Subject: [PHP-DB] Why use MySQL with PHP


 Hi everybody
 I'm writing a synopsis about PHP and mySQL.
 I'm hoping someone can help me, and tell me why
 the combination og PHP and MySQL is so common.
 What makes MySQL such a good choice when using PHP?
 What seperates MySQL from others dbms?
 -Søren Eriksen-


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Why use MySQL with PHP

2001-11-15 Thread Sheridan Saint-Michel

Tell me about it.  You ever try running php.net through
http://validator.w3.org ?

It's not pretty.

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


- Original Message -
From: B. van Ouwerkerk [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, November 15, 2001 12:28 PM
Subject: Re: [PHP-DB] Why use MySQL with PHP



 I just remembered, the only bad thing I can think of about MySQL...
their
 website locks up Netscape =)

 PHP qualifies for this too. www.php.net looks pretty messy in NS.

 By the way, both doesn't break NS..

 Bye,



 B.


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] UPDATE table1 FROM table2

2001-11-02 Thread Sheridan Saint-Michel

This is actually one of the more common MySQL problems which doesn't have an
easy answer.

The best I can offer is a bit of a kludge... but it does work.  The trick is
to use the Replace...Select command.  The problem with this is that you can
not select from the table you are replacing.  But if you make a temporary
copy of the tabe you are updating, then what you are wanting to do can be
done with

$query = create temporary table temp select * from table1; replace table1
select temp.id,table2.value2,temp.colname from table2 left join temp
using(id);

You just have to make sure all of the columns in table1 you don't want
changed appear as temp.colname.  The temp table will only exist as long as
the thread does, since it was created with the temporary keyword.

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


- Original Message -
From: m0sh3 [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, November 02, 2001 5:14 AM
Subject: [PHP-DB] UPDATE table1 FROM table2


 In MySQL 3.23, how to update one table using information from another
table.

 update table1 set value1=t2.value2
 from table1 as t inner join table2 as t1 using(pk_key) ???

 or

 update table1 as t1 inner join table2 as t2 using(pk_key)
 set t1.value1=t2.value2 ???

 Is it possible at all?

 Thank you



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Embedding Perl

2001-10-24 Thread Sheridan Saint-Michel

You have to put the actual command in the exec or backticks as you would
type it in your shell, not just the filename.  So instead of

$out = `convert-pdf.pl Blank.gif`;

Try

$out = `perl convert-pdf.pl Blank.gif`;

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


- Original Message -
From: Terry Romine [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, October 24, 2001 3:23 PM
Subject: Re: [PHP-DB] Embedding Perl


 Ok, I found snippets that talk about using either exec() or backticks.
 The problem is that it still doesn't call the perl script. Or at least
 doesn't seem to.

 exec(convert-pdf.pl Blank.gif,$out);
 echo(implode(\n,$out));
 $out = `convert-pdf.pl Blank.gif`;
 echo($out);

 If I run
 perl convert-pdf.pl Blank.gif
 from the shell, it responds with 135x105 and creates a secondary file.
 This is what the script is meant to do. Calling it in either of the
 example above, results in either an Array or nothing being displayed. No
 secondary file gets created.


 On Wednesday, October 24, 2001, at 11:05 AM, Terry Romine wrote:

  I have a small situation where it would be good to be able to embed a
  perl routing in a php script. Is this possible? Or do I need to pass
  control from php to a perl script and return?
 
  A quick synopsis would be (in pseudo code)
 
  ?php
  if($theFileType == pdf {
  // call convert.pl to get a thumbnail
  }
  else {
  // other file type processing
  }
  ?
 
 
  Alternatively, is there a module that can take a pdf file and make a
  thumbnail of the first page?
 
 
  Thanks,
  Terry


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] MySQL Last Modified

2001-10-24 Thread Sheridan Saint-Michel

Is there any way to tell when a TABLE in MySQL was last modified?
I don't want to add a timestamp field as there are thousands of rows, 
and I just need to know when ANYTHING in the table was last modified.

I haven't been able to find anything on this, and thought I would ask before
kludging together a workaround  =P

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com



Re: [PHP-DB] Howto make a double LEFT JOIN

2001-10-05 Thread Sheridan Saint-Michel

- Original Message -
From: Bas Jobsen [EMAIL PROTECTED]
To: Sheridan Saint-Michel [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, October 04, 2001 7:17 PM
Subject: Re: [PHP-DB] Howto make a double LEFT JOIN


 Hello Sheridan Saint-Michel,

 Well it works fine, tnx!!!

 But now i want to understand it too.

 bit_count(bit_or(1table1.sid)) ??

okay... 1table1.sid is leftshift the number 1 table1.sid times.
Your result will be a binary number... which will be the number 1 followed
by table1.sid 0's.  Once you have this you do a bitwise or of all the
numbers you have shifted.  This means any two rows where sid was the same
will be combined, as there is no difference between (1 or 1) and (1 or 0).
The last step, then, is to count the 1 bits and see how many different sid's
there were.

Make Sense?  The problem before was that there was no way to differentiate
one row from another, and thus no way to combine identical rows  =P

 What does bit mean? I thougt 1table1.sid was something like a backward
 bit(e)swich stepsize 1??

 I creat my sid by:
 srand((double)microtime()*100);
 $sid = md5(uniqid(rand()));

 a the sid-field as varchar(32) (i realise now, maybe better use char(32))
 (Maybe you will ask why i don't use a auto_increment sid (int(9) or
 something like that). Cause I don't want the table will be full ever
 (sid999.999.999))

ACK!  Don't do this.  You do know that an unsigned int (using a signed int
in an auto_increment field is pointless anyway) has a max value of
4294967295, right?  To put this into perspective... if you had one million
customers, they would have more than 4294 transactions EACH before sid
filled up.  If you are still worried about running out of numbers in your
sid field make it an unsigned bigint.  The max value for an unsigned bigint
is 18446744073709551615... so that should give you lots of space to play in,
and sid will only be 8 bytes per row... not 33 (Also incidentally, if you do
want to save an md5 value to a row in the future... use char not varchar as
you know it will be 32 bytes and are adding a wasted 33rd byte).

(If you need more than 18 Quintillion transactions, which comes out to
around 3 billion transactions for EVERY PERSON ON EARTH, please let me know
what kind of business you are in... as I am obviously in the wrong one  =P )

 Now i thougth bit_count(bit_or(32table1.sid)) should do the trick, but
it
 doesn't?

See my explanation above.  All you are trying to do is shift a 1 digit to a
different place for each unique value of sid.  The above definately won't
work if sid is an md5 value as md5 includes a-z characters.

 Best regards,

 Bas

 Again, hope that helps  =)

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Auto_increment field size (was: Howto make a double LEFT JOIN)

2001-10-05 Thread Sheridan Saint-Michel

- Original Message -
From: Bas Jobsen [EMAIL PROTECTED]
To: Sheridan Saint-Michel [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, October 05, 2001 9:50 AM
Subject: Re: [PHP-DB] Howto make a double LEFT JOIN


snip
  ACK!  Don't do this.  You do know that an unsigned int (using a signed
int
  in an auto_increment field is pointless anyway) has a max value of
  4294967295, right?  To put this into perspective... if you had one
million
  customers, they would have more than 4294 transactions EACH before sid
  filled up.  If you are still worried about running out of numbers in
your
  sid field make it an unsigned bigint.  The max value for an unsigned
 bigint
  is 18446744073709551615... so that should give you lots of space to play
 in,

 Well, oke. I'm builing some pageviewcounter.  Maybe count more then
 1 million pageview a day in future :) You're right it will take many days
 before i have counted 18446744073709551615 views :). But in some way it
feel
 like wasting. The first day using the first milion ids, the second day the
 next milion and never reuse that numbers. (Yes i realize 8bytes a row is
 much better then 32 (or 33 if you do stupid things :)))

 Maybe there is a better implemention? I dont i the first one solving this?

This is usually viewed as a non-issue.  The reason is you are using 8 bytes
whether sid=1 or (2^64-1) (which is the really big number above).  In
addition (2^64-1) is a REALLY big number.  If you had a Billion hits a day,
you would not run out of possible sid's for approximately 50.5 million
years.  Finally, since you are deleting rows after a certain amount of time
you can always reset the auto_increment value (I think that is as simlple as
set insert_id=1; but you may want to double check as this is off the top
of my head).


  and sid will only be 8 bytes per row... not 33 (Also incidentally, if
you
 do
  want to save an md5 value to a row in the future... use char not varchar
 as
  you know it will be 32 bytes and are adding a wasted 33rd byte).

 Oke, i see.
snip

 Best regards,

 Bas

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Howto make a double LEFT JOIN

2001-10-04 Thread Sheridan Saint-Michel

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


- Original Message -
From: Bas Jobsen [EMAIL PROTECTED]
To: Sheridan Saint-Michel [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, October 03, 2001 2:52 PM
Subject: Re: [PHP-DB] Howto make a double LEFT JOIN


 Hello Sheridan Saint-Michel,

 Let's see.

 Table2 contains data with a unique identifier (id)
 b.e
 id|url

 Table1 and Table3 contain the same identifier (id) but it isn't unique
now.
 Table1 and Table3 contain couting of action. Cause i want to count only
the
 actions of the last X hours, each count is on a row apart. Each row in
this
 table contains a timestamp, so i could do something like DELETE FROM
Table1
 WHERE timeY (Oke, so Table1 (Table3 ) must have an other unique
identifier
 (sid)).

 Table1 and Table3:
 sid|id|count|time

 count is always 1

You probably don't need count, as each entry implies one event, unless you
are using
it for something else I don't know about... otherwise this looks good.

 Oke, what do i want?

 First i want to know which id's  are in Table1 and how many times (know
not
 all the id's from Table2 have to be in Table1(or in Table3, and not all
the
 id's from Table1 have to be in Table3))

 something like: SELECT DISTINCT id, SUM(count) FROM table1 GROUP BY id

 For each id found in Table1 i want to know two things:

 1) the url from Table2
 2) is there any row in Table3 where table1.id=table3.id and if so, how
many
 are there?

 This is it.

 thanks!!!,

 Bas

Okay, now that you have added a unique Primary Key to each table this
becomes a doable task.  The query to do everything you list here should be:

select table1.id,bit_count(bit_or(1table1.sid)) as
count1,bit_count(bit_or(1table3.sid)) as count2,table2.url as url from
table1 left join table3 using(id) left join table2 using(id) group by
table1.id;

As you can see, count is never used... which is why I said you probably
don't need it.

Let me know if this helps

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] what's the current URL

2001-10-03 Thread Sheridan Saint-Michel

I don't think there is a predefined variable that actually contains the URL
as it appears in the user's address bar, but it would be easy to make a URL
from the Globals.  Check the variables listed on your server in a phpinfo.
It will probably be as simple as:

$url = http://; . $HTTP_HOST . $SCRIPT_NAME;

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


- Original Message -
From: Francisco Carvalho [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, October 03, 2001 3:50 PM
Subject: [PHP-DB] what's the current URL


 Is there a way for PHP to know the current URL?

 I have am include file that a TOC, I want to change the color of a
specific
 link in the TOC to ilustrate that that is the corrent page the user is at.
 Any sugestions?

 Thanks a bunch :-)
 Franky



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] old news SQL help needed

2001-10-01 Thread Sheridan Saint-Michel

Try this instead:

Delete league_news FROM leagues 
where  news_date + interval 7 day = now(); 

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


- Original Message - 
From: Larry Linthicum [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, September 29, 2001 8:26 PM
Subject: [PHP-DB] old news SQL help needed


 I have a MySql table for news on the site
 the date the news is inserted goes in  column  news_date
 the text of the news itself, goes in columnleague_news
 
 
 I want to DELETE all news older than 7 days
 I looked in the MySql documentation at the date functions and tried the
 following but it produced an error ...help?
 
 
 Delete league_news
 FROM leagues
 WHERE TO_DAYS(NOW()) - TO_DAYS(news_date) = 7
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Storing code in a mysql database

2001-09-19 Thread Sheridan Saint-Michel

Try this
eval(\$sql=\select * from vehicle where company=$company_code\;);

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


- Original Message -
From: Mark Newnham [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, September 19, 2001 4:34 PM
Subject: RE: [PHP-DB] Storing code in a mysql database


 I've now progressed to the point where I'm not getting eval errors. The
next
 problem is that is doesn't substitute the variable names: so the code

 $company_code=1;

 eval($sql='select * from vehicle where company=$company_code';);

 ends up $sql equal to 'select * from vehicle where company=$company_code'

 and not 'select * from vehicle where company=1'

 Any clues?

 TIA

 Mark

  -Original Message-
  From: Mark Newnham [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, September 19, 2001 2:54 PM
  To: '[EMAIL PROTECTED]'
  Subject: [PHP-DB] Storing code in a mysql database
 
 
  I'm trying to store SQL code in a blob field in a mysql
  database, but i'm
  having a problem.
 
  The code looks like this $sql='select * from vehicle where
  company=$company_code';;
 
  After I retrieve it from the db i eval() it to get the result.
 
  I can make this work if i store the code in a variable, but
  not if i store
  it in a database table and retrieve it. I am sure i am
  missing the right
  combination of addslashes/striplashes etc.
 
  can anyone help on this problem?
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail:
  [EMAIL PROTECTED]
 

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Re: NEWBIE - Needs Assistance with Joins

2001-09-17 Thread Sheridan Saint-Michel

No, the only time you need a semicolon within the query string is if you are
performing
multiple commands.

ie $query=Set @count=0; Select name,@count=@count+1 as count from people;

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


- Original Message -
From: Vera Algoet [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; Cecily Walker Kidd [EMAIL PROTECTED]
Sent: Monday, September 17, 2001 12:10 PM
Subject: [PHP-DB] Re: NEWBIE - Needs Assistance with Joins


 Cecily,
 I'm sure you probably heard from others about your parse error. I know
 it looks weird, but you need to have two semicolons, so instead of:

  $CDList =mysql_query(
  SELECT artist_name, album_title .
  FROM artists, album_titles WHERE artist_id = aid);

 you would have
 $CDList =mysql_query(
 SELECT artist_name, album_title .
 FROM artists, album_titles WHERE artist_id = aid;);

 (Note the semicolon after aid). This is because the first one is to
 complete the SQL statement, while the one after the parenthisis is to
 complete the PHP statement.

 Vera
 ---
 Madness takes its toll. Please have exact change.

 Vera Algoet, Web Developer
 Monterey County Office of Education
 831-784-4169



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] SQL combine to summations queries?

2001-09-06 Thread Sheridan Saint-Michel

 Hello,

  I don't understand the following, who can help?

  I have got two queries:
 SELECT SUM(fielda) FROM table1
 and
 SELECT SUM(fieldb) FROM table2

 I thought this would be the same as:
 SELECT SUM(fielda.table1),SUM(fieldb.table2)   FROM table1, table2.
 But, itn't, why?


 Tnx,

 Bas Jobsen

You have to remember the table1,table2 is the same as table1 JOIN table2.
What does this mean?
Try this code and I think you will get a better idea of what is happening

Select table1.fielda,table2.fieldb from table1,table2;

Say table1.fielda is an int with values 1-5 and table2.fieldb is an int with
values 1-7.

The above Select would return 35 rows, because the join (,) tells it to
return a set with every combination
of fielda and fieldb (1,1 2,1 3,1 4,1 5,1 1,2 etc)  So

SELECT SUM(fielda.table1),SUM(fieldb.table2)   FROM table1, table2.

Will calculate every possible combination of fielda and fieldb and then give
you the sums of each column in that set
(105 and 140 in my example).  Does that make sense?

To do what I think you are trying to do you would use something like:
Select sum(table1.fielda),sum(table2.fieldb) from table1 LEFT JOIN table2 ON
table1.id=table2.id;

if table1.fielda has more rows.
If table2.fieldb has more rows use:

Select sum(table1.fielda),sum(table2.fieldb) from table2 LEFT JOIN table1 ON
table1.id=table2.id;

Hope that helps

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Previous | Next (Again)

2001-08-31 Thread Sheridan Saint-Michel

 I don't know of a way to do the insert in a single query (anyone?!?) with
 this... but

 assuming the fields in pic are
 id int PRI
 location varchar(30)
 picnumber int
 user varchar(20)

 $query = Select max(picnumber) from pics where user=\$user\;
 $dbq = mysql_query($query,$dblink) or die(D'OH!);

 $picnum = mysql_result($dbq,0) + 1;

 $query = Insert into pics values (\\,\$fileloc\,$picnum,\$user\);
 $dbq = mysql_query($query,$dblink) or die(Great Googley Moogley!);

 Should get the new pic at the top (or bottom depending on how you look at
 it)
 of the order.

 Now if someone tells your program to delete the pic, I would call a
function
 which
 would unlink the file then do

 //$id should be passed to function DeletePic()
 $query = Select picnumber from pics where id = $id;
 $dbq = mysql_query($query,$dblink) or die(Looks like I picked the wrong
day
 to quit smoking!);

 $number = mysql_result($dbq,0);

 $query = Update pics set picnumber=picnumber-1 where user=\$user\ and
 picnumber  $number;
 $dbq = mysql_query($query,$dblink) or die(Looks like I picked the wrong
day
 to quit smoking!);

 $query = Delete from pics where id=$id;
 $dbq = mysql_query($query,$dblink) or die(Looks like I picked the wrong
day
 to start coding!);

 Get the idea?  Then if they wanted to rearrange the pics, you could just
 swap the picnumbers of the
 two pics they want to swap... or do something similar to the update line
 above.

 Sheridan Saint-Michel
 Website Administrator
 FoxJet, an ITW Company
 www.foxjet.com


 - Original Message -
 From: Jeff Oien [EMAIL PROTECTED]
 To: PHP-DB [EMAIL PROTECTED]
 Sent: Friday, August 31, 2001 1:38 PM
 Subject: RE: [PHP-DB] Previous | Next (Again)


  Sorry but I'm just not getting this. I'm not sure how to get the order
  of the pics in the first place or what do with the picnumber
  column. If someone deletes a pic wouldn't the picnumbers higher than
  it also need to be changed? I'm understanding everything else, even
  the password stuff but this I'm just clueless.
  Jeff Oien
 
   I would add the field picnumber int or something to your DB.
   This is where the pic falls in the order of pics in the album.
  
   The the previous and next should be as simple as doing
   select picnumber,piclocation from album where user=$user and
   (picnumber=$number-1 or picnumber=$number+1);
  
   Then just check numrows.  If two make both prev and next links,
   if one make prev link if $return[0]  $number else make next link.
  
   If none, no links.
  
   This way, if the person wants to change the order of their pictures
   it is quite easy to write a function that allows them to swap the
place
   of two pics.
  
   Make sense?
  
   Sheridan Saint-Michel
   Website Administrator
   FoxJet, an ITW Company
   www.foxjet.com
  
  
   - Original Message -
   From: Jeff Oien [EMAIL PROTECTED]
   To: PHP-DB [EMAIL PROTECTED]
   Sent: Thursday, August 30, 2001 8:18 PM
   Subject: [PHP-DB] Previous | Next (Again)
  
  
I'm having a hard time figuring this out. I have a photo album that
   displays
one image at a time. I want to have Previous and Next links for
images
 in
a users album. This was suggested:
http://www.phpbuilder.com/columns/rod2221.php3
but it seems to be more for a number of results instead of one.
   
At first I used the id field which is auto_increment and did -1 for
previous +1 for next but then realized if they delete an image in
the album the id field is no longer successive by 1. I can count
the number of images in an album but not sure how to know which
is the first, which is the second etc. and know which the current
one is if the id field has gaps in it. Not sure if that made any
 sense.
Jeff Oien
   
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail:
 [EMAIL PROTECTED]
  
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Selection an id from a table where it doesn't exisit inanother

2001-08-30 Thread Sheridan Saint-Michel

- Original Message -
From: Scott Mebberson [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, August 29, 2001 8:16 PM
Subject: [PHP-DB] Selection an id from a table where it doesn't exisit in
another


 Hi Guys,

 I have two tables, words and searchwords. words contains a list of words
 with an id number next to them and searchwords contains a page id with a
 word id (from the words table). I want to select all of the id's from the
 words table which does not exist in the word_id feild in the searchwords
 table.

 Make sense, it is for searching? Let me know if it doesn't.

 This is the SQL query I am running on MySQL (3.22) - SELECT id FROM words,
 searchwords WHERE words.id != searchwords.word_id;

Try this instead

select words.id from words LEFT JOIN searchwords ON words.id = searchword
s.word_id where searchwords.word_id is NULL;

 It isn't working. All it does it return a list of results which are
totally
 incorrect.

 Thanks

 Scott.

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] MD5 (' ')

2001-08-29 Thread Sheridan Saint-Michel

MD5 doesn't use a salt.
http://www.faqs.org/rfcs/rfc1321.html

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


- Original Message -
From: Andrey Hristov [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, August 29, 2001 10:10 AM
Subject: Re: [PHP-DB] MD5 (' ')


 I'm not so sure, but there is another parameter to md5() - the salt.

 Andrey Hristov
 IcyGEN Corporation
 http://www.icygen.com
 99%

 - Original Message -
 From: Ignat Ikryanov [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, August 29, 2001 4:45 PM
 Subject: [PHP-DB] MD5 (' ')


 Hi!
 I use md5 function to encrypt users password stored in MySql database.
When I try encrypt string 'asdf' using md5 function I
 retrieve:
 912ec803b2ce49e4a541068d495ab570
 But in 'shodow' file of my linux (Debian 2.2 used MD5 to encrypt users
password) 'asdf' string looks like:
 $1$arjq575D$rnHVFfcQE7.h2EgSU7yzQ1

 Why results are different?




 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] MD5 (' ')

2001-08-29 Thread Sheridan Saint-Michel

 - Original Message -
 From: Ignat Ikryanov [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, August 29, 2001 4:45 PM
 Subject: [PHP-DB] MD5 (' ')


 Hi!
 I use md5 function to encrypt users password stored in MySql database.
 When I try encrypt string 'asdf' using md5 function I
 retrieve:
 912ec803b2ce49e4a541068d495ab570
 But in 'shodow' file of my linux (Debian 2.2 used MD5 to encrypt users
 password) 'asdf' string looks like:
 $1$arjq575D$rnHVFfcQE7.h2EgSU7yzQ1

 Why results are different?

Unix Shadow passwords are actually computed using an alogrithm, md5 is part
of that algorithm but not the entire thing.  You can immediately tell that
$1$arjq575D$rnHVFfcQE7.h2EgSU7yzQ1
is not an md5 hash because all md5 hashes are 32 characters and this is 35.

Shadow passwords computed with this algorithm are start $1 and then have a 8
character salt surrounded by $'s.  The last part of the hash is 22
characters which
are computed by the algorithm.  So in the above string $1$ indicates that it
is a shadow
password, and arjq575D is the salt followed by $.  I looked around on google
for a bit, but
could not find the specifc algoritm Debian uses to compute the last 22
characters.  I'll let
you know if I find it.  You might also want to try this script:

http://limonez.net/~jure/php/md5crypt.phps

I noticed it in the user notes for md5.  It says it makes FreeBSD style
shadow passwords
though, and I am not sure if FreeBSD uses the same algorithm as Debian or
not.
(I also have not actually verified that the above script does ANYTHING =P )

Good luck.  I'll let you know if I find anything specific on Debian.

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Re: Photo Album Schema

2001-08-24 Thread Sheridan Saint-Michel

He suggested a DB redesign to allow a Many to Many relationship between
users and images.
I was trying to show that there was no reason to do so and at least one good
reason not to do so  =)

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


- Original Message -
From: Hugh Bothwell [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, August 23, 2001 8:02 PM
Subject: Re: [PHP-DB] Re: Photo Album Schema



 Sheridan Saint-Michel [EMAIL PROTECTED] wrote in message
 03a901c12c02$c60d4640$[EMAIL PROTECTED]">news:03a901c12c02$c60d4640$[EMAIL PROTECTED]...
  I don't know if having multiple users associated with a single image is
  at all beneficial, and I can see where it might cause all sorts of
 problems.
 
  For example, you and I both have the same image in our album (we are
   both assciated with it in the DB).  What happens when I change the
  description?  Do you change the description field, thus changing the
  description on both our pages?  Do you now have to create another entry
  in your Image table?

 Just to be nitpicky: I don't see where this would be
 useful - allowing users to share/transfer pictures? - but
 it's not overly difficult either.  Just split the information
 between an Image table and an ImageOwner
 table.




 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Re: Photo Album Schema

2001-08-23 Thread Sheridan Saint-Michel

just using id.gif immediately becomes problematic as each user is, by
design, going to have multiple images.  I know you could add a count
to id, or mangle it, or any number of other things.  But that takes us
back into unnecessary complexity.

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


- Original Message -
From: Bill Zeller [EMAIL PROTECTED]
To: Steve Brett [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, August 23, 2001 10:28 AM
Subject: Re: [PHP-DB] Re: Photo Album Schema


 Hi,

 I can see absolutely no reason to store the name of
 the image with the picture?

 Why not, whether using one directory or one for each
 user, just do id.gif?

 Best Regards,
 Bill Zeller
 --- Steve Brett [EMAIL PROTECTED] wrote:
  that would generally work on the assumption that
  many photos can belong to
  many albums. possibly a bad thing.
 
   table 1
-userid (primary key)
-username
-password
-album_title
-creation_date
  
   table 2
-photoid (primary key)
-photo (jpg or gif)
-date
-photo_title
-description (limited length)
-userid (foreign key)
 
  would give you 1 album contains many photos, each
  photo relating to one
  album only.
 
  Steve
 
 
 
  Tatare [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   I'd rather do it like this (but I'm not sure it's
  ok...)
  
   table 1
-userid (primary key)
-username
-password
-album_title
-creation_date
  
   table 2
-photoid (primary key)
-photo (jpg or gif)
-date
-photo_title
-description (limited length)
  
   table 3
-userid (primary key)
-photoid (primary key)
  
   reguards.
   tatare,
   http://www.memoroo.fr.st
   (not already available in english - could anyone
  help me to translate it
  ?)
  
   Jeff Oien [EMAIL PROTECTED] a écrit dans le
  message :
  
  [EMAIL PROTECTED]
I want to make a photo album that will have
  users who sign up
to create an album and then have the albums open
  to the public.
I was thinking of doing it like this but I've
  never done a relational
database before so if anyone thinks of anything
  I should change
please let me know. Thanks.
Jeff Oien
   
Table1:
-username
-password
-album_title
-creation_date
-id
   
Table2:
-id (from Table1)
-photo (jpg or gif)
-date
-photo_title
-description (limited length)
  
  
 
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, e-mail:
  [EMAIL PROTECTED]
  For additional commands, e-mail:
  [EMAIL PROTECTED]
  To contact the list administrators, e-mail:
  [EMAIL PROTECTED]
 


 __
 Do You Yahoo!?
 Make international calls for as low as $.04/minute with Yahoo! Messenger
 http://phonecard.yahoo.com/

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Re: Photo Album Schema

2001-08-23 Thread Sheridan Saint-Michel

I don't know if having multiple users associated with a single image is
at all beneficial, and I can see where it might cause all sorts of problems.

For example, you and I both have the same image in our album (we are
 both assciated with it in the DB).  What happens when I change the
description?  Do you change the description field, thus changing the
description on both our pages?  Do you now have to create another entry
in your Image table?  In effect anytime I change the description either both
of us have to live with my new description or you have to do a lot of work
around code (checking to see if more than one person is associated with the
image, Adding a new entry into image, changing all my info to reflect the
new
Image_Name) to avoid this.

Therefore, I think for this project, the original DB structure works much
better.

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com

- Original Message -
From: grant [EMAIL PROTECTED]
To: Sheridan Saint-Michel [EMAIL PROTECTED]
Cc: Bill Zeller [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, August 23, 2001 1:48 PM
Subject: Re: [PHP-DB] Re: Photo Album Schema


 The most useful schema would be to have the name of the document be system
 generated, like i123456789.img and make the database as follows:

 Image
 Image_Name varchar(50) primary key
 Original_Name varchar(50)
 Description text

 User
 User_ID int8 primary key
 Login char(8) uniques index
 password varchar(50) encrypted

 relation
 User_ID
 Image_Name

 Now you have duplicate anems OK, multiple users associated with any
 picture.  You just rename the file as it comes and goes.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] listing

2001-08-23 Thread Sheridan Saint-Michel

I think what you want is

?php
$query = Select * from companies;
  if( !($dbq = mysql_query($query,$dblink)))
  {
echo Error querying database.;
exit;
  }

while( $row = mysql_fetch_array ($dbq) ) {
?
table
tr
td
?php
// php code to output your entry information
?
/td
/tr
/table
? } ?

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


- Original Message -
From: Andrius Jakutis [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, August 23, 2001 11:22 PM
Subject: Re: [PHP-DB] listing


 This gives 25 the same entries. I need to list all entries from the table,
 but with loop.

 More solutions?


 Chris Hobbs [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Something like:
 
  ? for($i=1; $i25; $i++) { ?
  table
  tr
  td
  ?
  // php code to output your entry information
  ?
  /td
  /tr
  /table
 
  ? } ?
 
  Andrius Jakutis wrote:
 
   Hello again,
  
   Is there oportunity to write this:
  
   some php command to loop entries, the way is written bellow
   HTML  php coding.+ MYSQL -  1 entries information
   end of loop
  
   Something like that:
  
   here loop begins
   table
   tr
   td
   first entry information from table companies (name, telephone...)
   /td
   /tr
   /table
   loop ends
  
  
  
   THanks.
  
  
   --
   Su pagarba,
  
   Andrius Jakutis
   InternetMedia
   http://www.internetmedia.lt
   GSM: 370 82 31332
  
  
  
  
  
 
 
  --
  Chris Hobbs   Silver Valley Unified School District
  Head geek:  Technology Services Coordinator
  webmaster:   http://www.silvervalley.k12.ca.us/~chobbs/
  postmaster:   [EMAIL PROTECTED]
 



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] listing

2001-08-23 Thread Sheridan Saint-Michel

Then you start reading  =)
http://www.mysql.com/doc/

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


- Original Message -
From: Andrius Jakutis [EMAIL PROTECTED]
To: Rick Emery [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, August 23, 2001 11:50 PM
Subject: Re: [PHP-DB] listing


 Okay, but what if I want to use data from two tables not only from
 companies ?





  Assuming you've opened a MySQL connection and stored connection in
 $connect:
 
  $query=SELECT * FROM mytable;
  $result = mysql_query($query,$connect) or die(ERROR);
 
  print TABLE;
  while( $row = mysql_fetch($result)
  {
  print
 

TRTD.$row['field1'].TD.$row['field2'].TD.$row['field3']./TR
  ;
  }
  print /TABLE;
  mysql_free_result($result);
 
  The above will create a table and output one table row per row in
 database.
  Change field1, fiedl2, field3 to the names of fields in the database.
 
  Richard Emery
  Excel Communications, Inc.
  IT Sr. Project Manager
  (972) 478-3398
  (972) 944-0542 (pager)
 
  There is no trying...
  There is only Do or Not Do
 
 
 
  -Original Message-
  From: Andrius Jakutis [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, August 23, 2001 11:22 PM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] listing
 
 
  This gives 25 the same entries. I need to list all entries from the
table,
  but with loop.
 
  More solutions?
 
 
  Chris Hobbs [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   Something like:
  
   ? for($i=1; $i25; $i++) { ?
   table
   tr
   td
   ?
   // php code to output your entry information
   ?
   /td
   /tr
   /table
  
   ? } ?
  
   Andrius Jakutis wrote:
  
Hello again,
   
Is there oportunity to write this:
   
some php command to loop entries, the way is written bellow
HTML  php coding.+ MYSQL -  1 entries information
end of loop
   
Something like that:
   
here loop begins
table
tr
td
first entry information from table companies (name, telephone...)
/td
/tr
/table
loop ends
   
   
   
THanks.
   
   
--
Su pagarba,
   
Andrius Jakutis
InternetMedia
http://www.internetmedia.lt
GSM: 370 82 31332
   
   
   
   
   
  
  
   --
   Chris Hobbs   Silver Valley Unified School District
   Head geek:  Technology Services Coordinator
   webmaster:   http://www.silvervalley.k12.ca.us/~chobbs/
   postmaster:   [EMAIL PROTECTED]
  
 
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Photo Album Schema

2001-08-21 Thread Sheridan Saint-Michel

Rick: I don't see any .php tags there... plus just because someone
else has done it doesn't mean he can't do it as well  =)

Jeff: The only critique I would give from the description you have
given us thus far is the fact that you appear to be storing the photo 
in the DB.

The biggest bottleneck in a server-side script is usually the DB calls.
With this in mind, you want to limit these calls as much as possible.

I would suggest setting up a naming and/or directory scheme to store
the pictures on the website, and then store the URL of the picture in the
DB, rather than the image itself.

Then when outputing the page just do something like

echo Img src=\$queryresult['location']\;

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com

- Original Message - 
From: Rick Emery [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; PHP-DB [EMAIL PROTECTED]
Sent: Tuesday, August 21, 2001 10:19 AM
Subject: RE: [PHP-DB] Photo Album Schema


 This has been done.  see http://www.photopoint.com
 
 This is a free service available to the public.
 
 rick
 
 Richard Emery
 Excel Communications, Inc.
 IT Sr. Project Manager
 (972) 478-3398
 (972) 944-0542 (pager)
 
 There is no trying...
 There is only Do or Not Do
 
 
 
 -Original Message-
 From: Jeff Oien [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, August 21, 2001 10:12 AM
 To: PHP-DB
 Subject: [PHP-DB] Photo Album Schema
 
 
 I want to make a photo album that will have users who sign up
 to create an album and then have the albums open to the public.
 I was thinking of doing it like this but I've never done a relational
 database before so if anyone thinks of anything I should change
 please let me know. Thanks.
 Jeff Oien
 
 Table1:
 -username
 -password
 -album_title
 -creation_date
 -id
 
 Table2:
 -id (from Table1)
 -photo (jpg or gif)
 -date
 -photo_title
 -description (limited length)



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Photo Album Schema

2001-08-21 Thread Sheridan Saint-Michel

I suggested a naming scheme, but as I think about it
that may be overcomplicating things.

You may want to, instead, create a directory for each user
with their name.  This has several benefits.  The first is that it
is an easy way to avoid conflicts.  If Rick and I both upload
an image 'beach.jpg' one won't be overwritten.

The second is that if you also create an index.php page (as
simple as copying a template) when you create the directory
the user will be able to see their album by simply visiting
www.youralbum.com/username

Finally, this opens up a variety of possibilities for the future.
Things like FTP access, and having random pictures on the
user's initial album page wouldn't be too dificult with this setup.

Well, I guess that's enough rambling for one e-mail  =P

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com

- Original Message -
From: Rick Emery [EMAIL PROTECTED]
To: PHP-DB [EMAIL PROTECTED]
Sent: Tuesday, August 21, 2001 10:55 AM
Subject: RE: [PHP-DB] Photo Album Schema


 I vote for a single directory.  Then use Sheridan's naming suggestion.

 Richard Emery
 Excel Communications, Inc.
 IT Sr. Project Manager
 (972) 478-3398
 (972) 944-0542 (pager)

 There is no trying...
 There is only Do or Not Do



 -Original Message-
 From: Jeff Oien [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, August 21, 2001 10:49 AM
 To: PHP-DB
 Subject: RE: [PHP-DB] Photo Album Schema


 I should have said photo_filename. That was what I intended to do.
 Would you suggest one directory for all photos or separate directories
 for each user?
 Jeff Oien

  Rick: I don't see any .php tags there... plus just because someone
  else has done it doesn't mean he can't do it as well  =)
 
  Jeff: The only critique I would give from the description you have
  given us thus far is the fact that you appear to be storing the photo
  in the DB.
 
  The biggest bottleneck in a server-side script is usually the DB calls.
  With this in mind, you want to limit these calls as much as possible.
 
  I would suggest setting up a naming and/or directory scheme to store
  the pictures on the website, and then store the URL of the picture in
the
  DB, rather than the image itself.
 
  Then when outputing the page just do something like
 
  echo Img src=\$queryresult['location']\;
 
  Sheridan Saint-Michel
  Website Administrator
  FoxJet, an ITW Company
  www.foxjet.com
 
  - Original Message -
  From: Rick Emery [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]; PHP-DB [EMAIL PROTECTED]
  Sent: Tuesday, August 21, 2001 10:19 AM
  Subject: RE: [PHP-DB] Photo Album Schema
 
 
   This has been done.  see http://www.photopoint.com
  
   This is a free service available to the public.
  
   rick
  
   Richard Emery
   Excel Communications, Inc.
   IT Sr. Project Manager
   (972) 478-3398
   (972) 944-0542 (pager)
  
   There is no trying...
   There is only Do or Not Do
  
  
  
   -Original Message-
   From: Jeff Oien [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, August 21, 2001 10:12 AM
   To: PHP-DB
   Subject: [PHP-DB] Photo Album Schema
  
  
   I want to make a photo album that will have users who sign up
   to create an album and then have the albums open to the public.
   I was thinking of doing it like this but I've never done a relational
   database before so if anyone thinks of anything I should change
   please let me know. Thanks.
   Jeff Oien
  
   Table1:
   -username
   -password
   -album_title
   -creation_date
   -id
  
   Table2:
   -id (from Table1)
   -photo (jpg or gif)
   -date
   -photo_title
   -description (limited length)
 
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Photo Album Schema

2001-08-21 Thread Sheridan Saint-Michel

That is a good point.  I see two obvious answers.

Instead of
id . filename
he could use
id . + . filename

(or any non alphanumeric character instead of +)

first running the filename through an ereg
to strip any non-alphanumeric characters.

The other is to require that the first character
in the filename be alpha... which is also easily
enforcable with a simple ereg.

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com

- Original Message -
From: Justin Buist [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, August 21, 2001 11:50 AM
Subject: Re: [PHP-DB] Photo Album Schema


 I'm going to play Devil's advocate a little bit more here.

 Lets say user #1 uploads 1family.jpg, and user 11 uploads family.jpg.

 1 . 1family.jpg == 11family.jpg
 11 . family.jpg == 11family.jpg

 You run into stuff like this anytime you let users upload files of any
 sort.

 Justin Buist
 Trident Technology, Inc.
 4700 60th St. SW, Suite 102
 Grand Rapids, MI  49512
 Ph. 616.554.2700
 Fx. 616.554.3331
 Mo. 616.291.2612

 On Tue, 21 Aug 2001, Sheridan Saint-Michel wrote:

  If you are going to use a single directory with a filename
  convention I would suggest something simple, yet unique
  like
 
  id . filename
 
  Where id is the unique userid from the DB and filename
  is the original name of the file.
 
  This would avoid conflicts (which is the point of a naming convention)
  and be fairly easy to implement.
 
  Sheridan Saint-Michel
  Website Administrator
  FoxJet, an ITW Company
  www.foxjet.com
 
 
  - Original Message -
  From: Anthony Carlos [EMAIL PROTECTED]
  To: Rick Emery [EMAIL PROTECTED]; PHP-DB [EMAIL PROTECTED]
  Sent: Tuesday, August 21, 2001 11:47 AM
  Subject: RE: [PHP-DB] Photo Album Schema
 
 
   I vote for one directory to simplify the programming side of things.
What
  do
   you guys recommend for the filename convention?
  
   Would you let users determine it or would you force them into
something
  like
   a primary key?
  
   Anthony Carlos
  
   -Original Message-
   From: Rick Emery [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, August 21, 2001 11:55 AM
   To: PHP-DB
   Subject: RE: [PHP-DB] Photo Album Schema
  
  
   I vote for a single directory.  Then use Sheridan's naming suggestion.
  
   Richard Emery
   Excel Communications, Inc.
   IT Sr. Project Manager
   (972) 478-3398
   (972) 944-0542 (pager)
  
   There is no trying...
   There is only Do or Not Do
  
  
  
   -Original Message-
   From: Jeff Oien [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, August 21, 2001 10:49 AM
   To: PHP-DB
   Subject: RE: [PHP-DB] Photo Album Schema
  
  
   I should have said photo_filename. That was what I intended to do.
   Would you suggest one directory for all photos or separate directories
   for each user?
   Jeff Oien
  
Rick: I don't see any .php tags there... plus just because someone
else has done it doesn't mean he can't do it as well  =)
   
Jeff: The only critique I would give from the description you have
given us thus far is the fact that you appear to be storing the
photo
in the DB.
   
The biggest bottleneck in a server-side script is usually the DB
calls.
With this in mind, you want to limit these calls as much as
possible.
   
I would suggest setting up a naming and/or directory scheme to store
the pictures on the website, and then store the URL of the picture
in
  the
DB, rather than the image itself.
   
Then when outputing the page just do something like
   
echo Img src=\$queryresult['location']\;
   
Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com
   
- Original Message -
From: Rick Emery [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; PHP-DB [EMAIL PROTECTED]
Sent: Tuesday, August 21, 2001 10:19 AM
Subject: RE: [PHP-DB] Photo Album Schema
   
   
 This has been done.  see http://www.photopoint.com

 This is a free service available to the public.

 rick

 Richard Emery
 Excel Communications, Inc.
 IT Sr. Project Manager
 (972) 478-3398
 (972) 944-0542 (pager)

 There is no trying...
 There is only Do or Not Do



 -Original Message-
 From: Jeff Oien [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, August 21, 2001 10:12 AM
 To: PHP-DB
 Subject: [PHP-DB] Photo Album Schema


 I want to make a photo album that will have users who sign up
 to create an album and then have the albums open to the public.
 I was thinking of doing it like this but I've never done a
relational
 database before so if anyone thinks of anything I should change
 please let me know. Thanks.
 Jeff Oien

 Table1:
 -username
 -password
 -album_title
 -creation_date
 -id

 Table2:
 -id (from Table1)
 -photo (jpg or gif)
 -date
 -photo_title
 -description

Re: [PHP-DB] Photo Album Schema

2001-08-21 Thread Sheridan Saint-Michel

- Original Message - 
From: Hugh Bothwell [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, August 21, 2001 12:23 PM
Subject: Re: [PHP-DB] Photo Album Schema


 
 Sheridan Saint-Michel [EMAIL PROTECTED] wrote in message
 036e01c12a62$22947200$[EMAIL PROTECTED]">news:036e01c12a62$22947200$[EMAIL PROTECTED]...
  You may want to, instead, create a directory for each user
  with their name.  This has several benefits.  The first is that it
  is an easy way to avoid conflicts.  If Rick and I both upload
  an image 'beach.jpg' one won't be overwritten.
 
 I would prefer to store the picture's original name in
 the database and on your site use unique generated
 names... this would allow a single user to have
 a number of pictures all named 'beach' (for instance).

The name that is shown with the picture when the Album is 
viewed should be determined by the photo_title field in
his DB, and not by filename.  The actual filename should
only be visible to the person who owns the album.  It would
be inappropriate to present him with half a dozen filenames
which are all beach when he is trying to delete a specific
picture from the album  =P
 
 I would not use per-user directories; rather, I
 would split them by upload time and/or sessionID.
 This should give a more even distribution, and be
 directly useful for load balancing etc.

  I just suggested per-user directories for ease of access for the 
user.  Any number of other possibilities do, of course, exist.
 
  Finally, this opens up a variety of possibilities for the future.
  Things like FTP access, and having random pictures on the
  user's initial album page wouldn't be too dificult with this setup.
 
 Here's a question - how hard is it to set up
 a virtual ftp dir, linked to arbitrary specified files?

I would imagine it would be more difficult than setting up a virtual ftp
to a specific directory... but I will admit that I may be wrong as this is 
not my area of expertise.

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Member authentication with PHP and MySQL

2001-08-13 Thread Sheridan Saint-Michel

I would use either cookies or sessions for this.  
First Check for the cookie, and verify its contents.
If there isn't a cookie then do the login prompt like you
are doing now.

Here's some pseudocode to give you a quick idea of what I mean

if (isset($cookie)
{
  if (CheckCookie())
  {
SiteContent();
  }  else {
Kill Cookie
GiveLoginPrompt();
  }
} elseif (isset($login) {
  if (CheckLogin())
SetCookie();
} else {
  GiveLoginPrompt
}

On all the other pages on the site you just have a header check the
cookie and redirect to the login page if it doesn't check out
ie:

if (!isset($cookie))
{
  header(Location: http://www.yourdomain.com/login.php;);
  exit;
}

if (!CheckCookie())
{
  header(Location: http://www.yourdomain.com/login.php;);
  exit;
}

If you want to use sessions just replace cookie with session  =P

Here is an example script I wrote a while back if you want to
see more than metacode
http://www.zend.com/codex.php?id=393single=1

And here is the header for other files on the site using the above script
http://www.zend.com/codex.php?id=397single=1

Let me know if this helps

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


- Original Message - 
From: Cato Larsen [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, August 12, 2001 6:47 PM
Subject: [PHP-DB] Member authentication with PHP and MySQL


 Hi!
 
 I'm trying to authenticate members by using php and MySQL.
 
 This is what I've come to so far:
 
 ?php
 
 $auth = false; // Assume user is not authenticated
 
 if (isset( $email )  isset($password)) {
 
 // Connect to MySQL
 
 mysql_connect( 'localhost', 'Xephiroth', 'lordoftherings' )
 or die ( 'Unable to connect to server.' );
 
 // Select database on MySQL server
 
 mysql_select_db( 'members' )
 or die ( 'Unable to select database.' );
 
 // Formulate the query
 
 $sql = SELECT * FROM memberinfo WHERE
 email = '$email' AND
 password = '$password';
 
 // Execute the query and put results in $result
 
 $result = mysql_query( $sql )
 or die ( 'Unable to execute query.' );
 
 // Get number of rows in $result.
 
 $num = mysql_numrows( $result );
 
 if ( $num != 0 ) {
 
 // A matching row was found - the user is authenticated.
 
 $auth = true;
 
 }
 
 }
 
 if ( ! $auth ) {
 
 header( 'WWW-Authenticate: Basic realm=Members only' );
 header( 'HTTP/1.0 401 Unauthorized' );
 echo 'Authorization Required to enter the member area';
 exit;
 
 } else {
 
 echo '
 
 -SITE CONTENT-
 
 
 '; } ?
 
 
 How do I make the authentication to go to site:
 members.php?charnick=$charnick
 
 Where $charnick is brung from the DB line who was authenticated?
 
 So that Peter won't end up at John 's membersite?
 
 Thanks for your time and expertese!
 
 Best regards Cato
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Member authentication with PHP and MySQL

2001-08-13 Thread Sheridan Saint-Michel

If you note the part of the script where the cookie is set

//make unique session id and store it in Database
  $timer = md5(time());
  $sid = $UserID . + . $timer;
  SetCookie(Cookiename,$sid,time()+2592000); file://Set Cookie for 30 days
  $query = update members set sid=\$timer\ where UserID=\$UserID\;

I set the cookie with the user id and a Session ID I create... then when it
checks
the cookie it just does

  $sidarray = explode(+, $Cookiename);
  $query = select * from members where UserID = \$sidarray[0]\ and sid =
\$sidarray[1]\;

So using this script you could put whatever else you wanted in the cookie.
You would just change
  $sid = $UserID . + . $timer;
to
  $sid = $UserID . + . $timer . + . $email;

for example.  Then when you do
  $sidarray = explode(+, $Cookiename);

You would have
$sidarray[0] = $UserID
$sidarray[1] = $timer
$sidarray[2] = $email

You could continue adding additional variables (or plain strings for that
matter) in this manner.
The only thing to keep in mind is that cookies have a 4K file size
limitation and anything beyond
4K will be lost.  Check under additional notes on this page for details on
cookie limitations

http://www.netscape.com/newsref/std/cookie_spec.html

I hope all that is clear.  Let me know if you have any more questions

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


- Original Message -
From: Cato Larsen [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, August 13, 2001 9:06 AM
Subject: Re: [PHP-DB] Member authentication with PHP and MySQL


 Thanks a mill Sheridan!
 This was accually what I was looking for, but gave up since the other
 tutorials and script examples where too complicated for me to grasp.

 One question to the code on the site:

 Is it possible to insert info to be grabbed on other sites?
 Like
 email
 password
 name

 So you can grab like name, instead of having to querity the DB all the
time
 you need the name of the person and so on?
 And if yes, how do you get it from the cookie and insert it into the page
 like $name ?

 Best regards

 Cato Larsen



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Member authentication with PHP and MySQL

2001-08-13 Thread Sheridan Saint-Michel

My Script uses a Session ID Variable when verifying the user
You don't have a field setup for this.  So either change the code
in this section

 $timer = md5(time());
 $sid = $email . + . $timer;
 SetCookie(ElectrocutedClanRemains,$sid,time()+2592000);
 $query = update members set sid=\$timer\ where email=\$email\;

or Add to your DB
sid char(32)

(md5 always returns a 32 character long string)

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


- Original Message -
From: Cato Larsen [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, August 13, 2001 10:10 AM
Subject: Re: [PHP-DB] Member authentication with PHP and MySQL


 Arg...

 I get this error:


 Unable to update database. Please contact [EMAIL PROTECTED]



 Am I missing something in my DB?

 Fields in DB:

 id, email, password, name, loc, aim, icq, msn, yahoo, charname ,charsname,
 charnick, tit, lvl, picurl, born, appearance, charac, streng, bio, breed,
 prof, posn.



 This is the current source:



 ?php

 file://Put in your own info for username, password, DB, email@address,
 Cookiename,
 file://the name of this page (currently login.php) and the name of your
subscribe
 file://or new user page (currently new.php).  I went ahead and included
all the
 HTML
 file://so this page should work as is, with only the changes described
above
 needed
 // - Lysander ([EMAIL PROTECTED])

 $dblink = mysql_pconnect(localhost,Xephiroth,lordoftherings);
 mysql_select_db(members);

 $headers=0; file://Make Sure HTML Headers are in place before the form


 file://after Authenticating the script automatically sends the browser to
 file://the webpage of your choice (note if your page calls this
 file://script with ?redirect=foobar.php it will automatically
 file://redirect to foobar.php after authenticating.  Set the default
 file://redirect page here

 if ( !isset($redirect))
{
  $redirect = default.php;
}

 if (isset($email)  isset($password)) {

   $query = select * from memberinfo where email = \$email\ and password
=
 \$password\;

   if ( !($dbq = mysql_query($query, $dblink))) {
 echo Unable to query database.  Please Contact a
 href=\mailto:[EMAIL PROTECTED]\;[EMAIL PROTECTED]/a.\n;
 exit;
   }

   $lim = mysql_num_rows( $dbq );

   if ($lim != 1) {

   $headers=1; file://HTML headers in place
 echo html;
 echo head;
 echo titleMember logon/title;
 echo meta http-equiv=\Content-Type\ content=\text/html;
 charset=iso-8859-1\;
 echo /head;
 echo body bgcolor=\#00\ text=\#FF\ leftmargin=\0\
 topmargin=\0\ marginwidth=\0\ marginheight=\0\
 background=\../images/back.gif\  bgproperties=\fixed\ link=\#CC\
 vlink=\#CC\ alink=\#CC\;
 echo BInvalid E-Mail adress and/or Password. Please Try again/BBR;

   }

   if ($lim == 1) {

 file://make unique session id and store it in Database
   $timer = md5(time());
   $sid = $email . + . $timer;
   SetCookie(ElectrocutedClanRemains,$sid,time()+2592000); file://Set
Cookie for
 30 days
   $query = update members set sid=\$timer\ where email=\$email\;

   if( !($dbq = mysql_query( $query, $dblink))) {
 echo Unable to update database.  Please contact a
 href=\[EMAIL PROTECTED]\[EMAIL PROTECTED]/a.\n;
   exit;
   }

   $headers=1;
   header(Location: $redirect);
   exit;
   }

 }

 if (isset($ElectrocutedClanRemains)) {
   $headers=1; file://make sure HTML headers are in place before the form
   $sidarray = explode(+, $ElectrocutedClanRemains);
   $query = select * from memberinfo where email = \$sidarray[0]\ and
sid
 = \$sidarray[1]\;

   if ( !($dbq = mysql_query($query, $dblink))) {
 echo Unable to find database.  Please Contact a
 href=\mailto:[EMAIL PROTECTED]\;[EMAIL PROTECTED]/a.\n;
 exit;
   }

   if (mysql_num_rows( $dbq ) == 1) {
 echo html;
 echo head;
 echo titleMember logon/title;
 echo meta http-equiv=\Content-Type\ content=\text/html;
 charset=iso-8859-1\;
 echo /head;
 echo body bgcolor=\#00\ text=\#FF\ leftmargin=\0\
 topmargin=\0\ marginwidth=\0\ marginheight=\0\
 background=\../images/back.gif\  bgproperties=\fixed\ link=\#CC\
 vlink=\#CC\ alink=\#CC\;
 echo You are already logged in as $sidarray[0].BR;
 echo You may logon as another user or simply begin using our services
with
 your current session.BR;
   }
 }

 if ($headers == 0) {
 echo html;
 echo head;
 echo titleMember logon/title;
 echo meta http-equiv=\Content-Type\ content=\text/html;
 charset=iso-8859-1\;
 echo /head;
 echo body bgcolor=\#00\ text=\#FF\ leftmargin=\0\
 topmargin=\0\ marginwidth=\0\ marginheight=\0\
 background=\../images/back.gif\  bgproperties=\fixed\ link=\#CC\
 vlink=\#CC\ alink=\#CC\;
 }

 echo table width=\846\ border=\0\ cellspacing=\0\
 cellpadding=\0\;
 echo tr;
 echo td width=\80\ height=\30\nbsp;/td;
 echo td height=\30\nbsp;/td;
 echo /tr;
 echo tr;
 echo td width=\80\nbsp;/td;
 echo td;
 echo table width=\766\ border=\0\ cellpadding=\0\
 cellspacing=\0\;
 echo tr;
 echo td colspan=\3

Re: [PHP-DB] Attachment

2001-08-10 Thread Sheridan Saint-Michel

I have actually done several projects with different kinds or e-mailing
features.

In a nutshell, you need the appropriate MIME headers for the type of mail,
and sections of body divided by MIME Boundaries.  (You also need to encode
any files you are sending as attachments.  Check the base64_encode function
at php.net for this)

RFC1341 and the revised version: RFC1521 give you all the specifics you need
to do this in almost any situation.

I would suggest skimming through 1521, paying special attention to the
section on
Multipart/Mixed (as that is what you would usually use for an e-mail with
attachments)

I would also suggest sending yourself a couple of e-mails with attachments,
and then
telneting to your mail server and viewing them there.  Doing this has
probably helped
more more than anything when working on a complex mail program.  Don't
reinvent
the wheel, see how the other guys made theirs  =P

If you have any specific questions let me know.

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


- Original Message -
From: WNLeong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, August 10, 2001 2:55 AM
Subject: RE: [PHP-DB] Attachment



 Can you explain more to me about RFC1341?  Please tell me where can I get
 more info about this function?

 Actually what I want is to send a mail with a list of attachment files.

 Thanks.


  -Original Message-
  From: Patrice Garbe [SMTP:[EMAIL PROTECTED]]
  Sent: Thursday, August 09, 2001 7:42 PM
  To: WNLeong
  Cc: [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] Attachment
 
  You must look at the RFC1341 (if you have not already did so) to learn
  about
  mime types. It is also very useful to send (you) messages with attached
  files
  and the look at the source.
 
  A tip : to send you own forged mail you must use the mail() function
like
  this :
  maiil($to,$subject,,$your_forged_content);
 
  If you don't want to develop your own solution look at
www.freshmeat.net,
  I'm
  sure you will find something.
 
  That's it !
 
  Patrice
 
  Le jeu, 09 aoû 2001, vous avez écrit :
   I would like to send attachment file through mail by using php.
Please
   help me.!!
  
   Thanks.
  
  
  
  
   Wen Ni Leong
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]