|
CS479/579 - Web Programming II
|
Displaying ./code/Sessions/newdb.php
DROP TABLE IF EXISTS `session`;
CREATE TABLE `session` (
`sid` varchar(128) NOT NULL DEFAULT '',
`webkey` varchar(64) NOT NULL DEFAULT '',
`username` varchar(64) NOT NULL DEFAULT '',
`domain` ENUM('ISU','CS') NOT NULL DEFAULT 'ISU',
`usrinfo` varchar(1024) NOT NULL DEFAULT '',
`ipaddr` char(16) NOT NULL DEFAULT '0.0.0.0',
`created` timestamp DEFAULT CURRENT_TIMESTAMP(),
`expire` bigint(24) NOT NULL DEFAULT 0,
`atime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY ( `sid` )
);
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`uid` int(10) NOT NULL AUTO_INCREMENT,
`username` varchar(64) NOT NULL DEFAULT '',
`password` varchar(256) NOT NULL DEFAULT 'x',
`usrinfo` text NOT NULL DEFAULT '',
`created` timestamp DEFAULT CURRENT_TIMESTAMP(),
`atime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY ( `uid` ),
INDEX `username` ( `username` )
) AUTO_INCREMENT=1000;
<?php
$hash = crypt("adminpw", "\$6\$rounds=5000\$somesalt");
?>
INSERT INTO `user` (`uid`, `username`, `password`) VALUES
(1, 'admin', '<?php echo "$hash"; ?>');
|