Time:
Scotland: Wed, 11:31 am
Rhode Island: Wed, 6:31 am
Florida: Wed, 6:31 am
New Mexico: Wed, 4:31 am
California: Wed, 3:31 am

Click here to visit Livelife365.com

Click here to visit nmdarts.com



Buy this Ad Space.

180px wide.

Please get in touch with KH@ if you are interested and make an offer.

CLICK HERE TO GET AUCTION BAR NOW
US$10 per year - Save $100s!
The Fabulously Unfair
WebX Auction Bar. For Ebay etc.
Ro-Sham-Bo the opposition. Laugh like Eric Cartman when you win! CLICK HERE NOW!


More information and sign-up.

WebXpertz Hosting.
Custom fit from $5pm. PHP/MySQL
You'll save money, we'll save money. Seems fair to me. Interested? If so Please PM me here and tell me what you need. Thanks!


Please click here for more information


For continued disscussion on this topic : Creating a password field


diades
06-24-2004, 10:26 PM
Hi Guys

I am spending a couple of hours playing with mySQL and wondered if there is a specific data type for a password field or is it placed in plain text in a table?

fivesidecube
06-25-2004, 10:21 AM
MYSql uses a varchar field for passwords, but it isn't stoerd as plain text! It uses the PASSWORD() function to calculate a check sum, preventing the DB Admin. from being able to view the password.

diades
06-25-2004, 10:42 AM
but it isn't stoerd as plain text!:D
So something like this?
<?
$sql = "CREATE TABLE ".$tableName." (
ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
user TEXT NOT NULL,
pw VARCHAR NOT NULL,
permissions INT NOT NULL)";
if(@mysql_query($sql)){
echo("<p>Table successfully created</p>");
} else {
die("<p>Error creating table: ".mysql_error()."</p>");
}
?>
But where would the Pw function come in? is that on auto-pilot( :rolleyes: )? I did a search on it and all the links that I see come back as info on the root password which is not what I want.

fivesidecube
06-25-2004, 12:03 PM
:D
So something like this?
<?
$sql = "CREATE TABLE ".$tableName." (
ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
user TEXT NOT NULL,
pw VARCHAR NOT NULL,
permissions INT NOT NULL)";
?>

Yes, but you can see how MYSql's table is built (and the SQL command required!) by using the mysql client. Once connected to the database and you have the mysql> prompt, type use mysql; selecting the mysql internal database, then the command show create table user;. This will display the CREATE TABLE neede to create it! This can be used on any mysql table!But where would the Pw function come in? is that on auto-pilot( :rolleyes: )? I did a search on it and all the links that I see come back as info on the root password which is not what I want.The PASSWORD function is used when you're accessing the table/field. It isn't a paramater to the table definition, the password field is just a straight text field. IE in your insert/update SQL statement you would use the PASSWORD function to create the appropriate value for the password field and again when you come to the select SQL statement.

I think my last reply may have confused! :tdown:

diades
06-25-2004, 09:24 PM
Hi Stewart,

I am not certain that I have expressed myself clearly:eek: This would be for a security system to access a site, not mysql. Would that make any difference?

cpradio
06-25-2004, 10:11 PM
Keith to answer your question you would encrypt the person's password before you insert it into the database or during. IE: (`pw`) VALUES (PASSWORD('{$value}')

or

$value = md5($value);
INSERT INTO table (`pw`) VALUES ('{$value}')

fivesidecube
06-28-2004, 09:37 AM
Hi Stewart,

I am not certain that I have expressed myself clearly:eek: This would be for a security system to access a site, not mysql. Would that make any difference?Got that! I'm suggesting that you use the same method as MySQL uses to control access to it's database tables. You see?

diades
06-28-2004, 12:14 PM
Hi Stewart

Yep, I am only playing "'tween times" so it is slow on this end:) but I have the tables operational now with three related in use. Ah! The heady days of normalisation, I remember them well:D