-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.php
More file actions
58 lines (50 loc) · 1.33 KB
/
Copy pathsetup.php
File metadata and controls
58 lines (50 loc) · 1.33 KB
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
48
49
50
51
52
53
54
55
56
57
58
<?php
/**
* Created by PhpStorm.
* @author Zachary Hughes
<zhughes3@gmail.com>
* Date: 3/15/2016
* Time: 10:42 PM
* Description: Set up the MySQL tables to use in the social networking site.
* Tables created are:
* 1) members: username 'user' (indexed), password 'pass'
* 2) messages: ID 'id' (indexed), author 'auth' (indexed), recipient 'recip', message type 'pm', message 'message'
* 3) friends: username 'user' (indexed), friend's username 'friend'
* 4) profiles: username 'user' (indexed), "about me" 'text'
*/
?>
<!DOCTYPE html>
<html>
<head>
<title>Setting up database</title>
</head>
<body>
<h3>Setting up...</h3>
<?php
require_once 'functions.php';
createTable('members',
'user VARCHAR(16),
pass VARCHAR(16),
INDEX(user(6))');
createTable('messages',
'id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
auth VARCHAR(16),
recip VARCHAR(16),
pm CHAR(1),
time INT UNSIGNED,
message VARCHAR(4096),
INDEX(auth(6)),
INDEX(recip(6))');
createTable('friends',
'user VARCHAR(16),
friend VARCHAR(16),
INDEX(user(6)),
INDEX(friend(6))');
createTable('profiles',
'user VARCHAR(16),
text VARCHAR(4096),
INDEX(user(6))');
?>
<br> ...done.
</body>
</html>