Commit 90d14eee authored by Adarsh's avatar Adarsh

minor backend changes

parent fb0d8522
# See http://help.github.com/ignore-files/ for more about ignoring files.
/users
# compiled output
/dist
/tmp
......
-- phpMyAdmin SQL Dump
-- version 5.0.3
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Dec 06, 2020 at 03:21 PM
-- Server version: 10.4.14-MariaDB
-- PHP Version: 7.4.11
-- Generation Time: Dec 07, 2020 at 06:55 AM
-- Server version: 10.4.13-MariaDB
-- PHP Version: 7.4.8
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
......@@ -23,49 +23,51 @@ SET time_zone = "+00:00";
-- --------------------------------------------------------
--
-- Table structure for table `userdata`
--
CREATE TABLE `userdata` (
`username` varchar(50) NOT NULL,
`n_files` int(11) DEFAULT NULL,
`img_url` text DEFAULT NULL,
`n_attempts` int(11) DEFAULT NULL,
`correct_timeline` text DEFAULT NULL,
`rating` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`username` varchar(50) NOT NULL,
`name` varchar(50) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL
`email` varchar(255) DEFAULT NULL,
`img_url` text DEFAULT 'https://bain.design/wp-content/uploads/2014/08/People-Avatar-Set-Rectangular-12.jpg',
`n_attempts` int(11) NOT NULL DEFAULT 0,
`correct_timeline` text DEFAULT '[]',
`rating` int(11) NOT NULL DEFAULT 0,
`n_files` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Indexes for dumped tables
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `username`, `name`, `password`, `email`, `img_url`, `n_attempts`, `correct_timeline`, `rating`, `n_files`) VALUES
(26, 'adarsh', 'adarsh', '$2y$10$PT.s983qY0EjVx2w1JBRT.y3XO3kd4wnWIng7t4.udLeWAizHDfDi', 'a@g.com', 'https://bain.design/wp-content/uploads/2014/08/People-Avatar-Set-Rectangular-12.jpg', 0, '[]', 0, 0);
--
-- Indexes for table `userdata`
-- Indexes for dumped tables
--
ALTER TABLE `userdata`
ADD PRIMARY KEY (`username`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`username`);
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=27;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
\ No newline at end of file
......@@ -9,6 +9,7 @@ if (isset($postData) && !empty($postData)) {
$email = mysqli_real_escape_string($mysqli, trim($request->email));
$username = mysqli_real_escape_string($mysqli, trim($request->username));
$sql = "INSERT INTO users(name,password,email,username) VALUES ('$name','$pwd','$email','$username')";
$sql1 = "INSERT INTO users(n_files,img_url,n_attempts,correct_timeline,rating) VALUES (0,'https://bain.design/wp-content/uploads/2014/08/People-Avatar-Set-Rectangular-12.jpg',0,'[]',0)";
if ($mysqli->query($sql) === TRUE) {
$authData = [
......@@ -19,8 +20,7 @@ if (isset($postData) && !empty($postData)) {
'username' => $username
];
mkdir('../users/' . $authData['username']);
$sql1 = "INSERT INTO userdata(username,n_files,img_url,n_attempts,correct_timeline,rating) VALUES ('$username',0,'https://bain.design/wp-content/uploads/2014/08/People-Avatar-Set-Rectangular-12.jpg',0,'[]',0)";
mkdir('../users/' . $authData['username'], 0755, true);
$mysqli->query($sql1);
echo json_encode($authData);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment