forked from s4n7h0/xvwa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.php
executable file
·47 lines (37 loc) · 1.67 KB
/
setup.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
// setup xvwa
/* Database Structure & Queries
CREATE DATABASE `xvwa` ;
Comments
CREATE TABLE `xvwa`.`comments` (
`id` INT NOT NULL ,
`user` VARCHAR( 20 ) NOT NULL ,
`comment` TEXT NOT NULL ,
`date` DATE NOT NULL ,
PRIMARY KEY ( `id` )
) ENGINE = MYISAM ;
INSERT INTO comments (id,user,comment,date) VALUES ('1', 'admin', 'Keep posting your comments here ', '2015-08-10');
===================================================
//connection successfull.
$dbselect=mysql_select_db($dbname,$conn);
if($dbselect){
echo "<span class=\"glyphicon glyphicon-star\"></span> ";
echo "Connected to database Sucessfully.<br>";
// creating tables
$table_comment=mysql_query('create table comments(id int,comment varchar(100),date date)',$conn);
if(table_comment){
$insert_comment=mysql_query('INSERT INTO comments (id,user,comment,date) VALUES ('1', 'admin', 'Keep posting your comments here ', '2015-08-10');
',$conn);
if(insert_comment){
echo "<span class=\"glyphicon glyphicon-star\"></span> ";
echo "Table comments sucessfully.<br>";
}else{
echo "<span class=\"glyphicon glyphicon-star\"></span> ";
echo "Can not create table comment. Try submit/reset again. <br>";
}
}else{
echo "<span class=\"glyphicon glyphicon-star\"></span> ";
echo "Failed to use/select database. Check the configuration file.<br>";
}
}
?>