The RequirementsThe idea here is to make a free alternative to Dropbox but essentially have unlimited space to store files for online access. I have a long list of code that I am giving away to you to use, free of charge! That's right it doesn't get better than this. Here is a list of programs that I used in order to get this all working: XAMPP No-IP My Code --Found on the top right of this page (currently incomplete but there is already a lot of cool functionality in it) Here are the steps that you will need to go through in order to get everything working. I will be going into depth about each of these topics: 1. Setup XAMPP (Special setups required for my code) 2. Allow outside web access 3. Securing those connections Setup XAMPP Part 1/3 -- MySQL Database Setup 1. First download XAMPP (PHP version 5.6) 2. Click next through the setup. The picture below are the essential install requirements to get everything working. 3. When it asks at the end of the install start the control panel. 4. Click start on both "Apache" and "MySQL" 5. Click the "Admin" button on MySQL -- this will open the following webpage: 6. Click on User accounts 7. Click Add New User a. This user will be your new administrative user for any future changes b. For this example I made a user called "setup" 8. To make things easy for now give this user all privilages I would suggest making this user a little more limited but for first time users this will be okay for now. 9. Now you should see your user added. 10. Do the same thing but this time make a "generic user except only give him the following rights(this is important its part of my code) -- this user and password also need to be added into the connection.php file found in dropFilesBacked/protected/config/connection.php 11. When you are done a new generic user should be part of this list 12. Now open a windows file explorer and navigate to C:\xampp\phpMyAdmin\config.inc.php a. Open this with notepad or something equivalent (For this example I'm using Notepad++) 13. Navigate to where it says "$cfg['Servers'][$i]['user'] = 'root'" and change that to the administrative user you just made a. In this example it is "setup" for me 14. Do the same for the password -- enter the password you used to make the administrative account. 15. There is also a line that is commented out that says "User for advanced features" change the username and password to the same one you used previously. 16. When done it should look similar to this: -- noticed one mistake here in the it says to not allow a password. I will have to change this to 'false' and see what happens but if you don't want to mess around with that then just leave it 'true'. 17. Go back to the MySQL Admin and delete all of the users except the two that you made. When done it should look similar to this: 18. Awesome! Now lets setup a database that my code will use. Click "New" on the left side of the page and create a database called "files_db". 19. Now create two tables in this database. One called "users" and the other called "login_status". 20. Setup the users table like the following: 21. Setup the "login_status" table like the following: PHEW! Well you have done it. for the MySQL setup. Great Job! I know it was a lot of work but you are well on your way. Part 2/3 -- Apache Web Server Setup Now that a MySQL Database is done lets move onto setting things up with Apache. 1. On the XAMPP Control panel click the "Config" button with Apache and select "php.ini" 2. Change all of the following lines to match the pictures 3. The above will help to make my code work the way it should. The following changes will be related more towards the security of your website. Open XAMPP control panel -> config, this time click "httpd.conf" 4. Make all of the changes shown in the pictures 5. Save the file and close it. 6. Navigate to C:\xampp\htdocs 7. Delete EVERYTHING inside it. 8. Copy the code I gave you into this folder (There are "dropFiles" and a "dropFileBackend" folders) 9. Go To the XAMPP control panel and click "Start" on Apache & MySQL 10. Open a Web Browser and type "localhost" 11. If you setup everything correctly you should be greeted by this screen: 12. If you got that then great! Now make sure you copied everything over good by typing in "localhost/dropfiles" in your browser. If everything was copied over good then you should be presented with the following screen: 13. If you get this then your Apache setup is now complete YAY! The next step is to setup a personal user that can access your protected files. Part 3/3 -- Setting Up Personal Users 1. Open the XAMPP control panel 2. Click Start on MySQL then click the Admin button 3. Navigate to files_db database and the users table 4. Click the "SQL" button 5. Now before we continue we have to generate a password. This can be done by starting your Apache server and navigating to the following URL (replace "<PASSWORD>" with the password you want to log in with). localhost/dropfilesBackend/index.php/main/ReturnHash?PASSWORD=<PASSWORD> 6. The output show show a jumbled mess of letters and numbers: 7. Copy this mess and go back to your MySQL page SQL Tab. Then input the following SQL statement (Replace "<USERNAME>" with the username you want to log in with and "<PASSWORD>" with the copied hash (that jumbled mess of letters and numbers) ). INSERT INTO `users`(`USERNAME`, `PASSWORD`) VALUES ('<USERNAME>','<PASSWORD>') 8. An example below shows you what you should be seeing. 9. Now click the go button on the bottom right corner of the page. If everything worked then it should present you with a green box saying it was successful. If not fix the problems it tells you it has.
10. Now go to your users table and verify that you see the new user and hashed password. 11. Final step make a folder named the same thing as your username in dropFilesBackend/FILES/<USERNAME> 12. DONE! Do this for every user that you want. When done it is highly suggested that you comment out that section of code in the dropFilesBackend that produces these hashed passwords. Continue on to part 2 "Allow Outside Web Access" Part 2 - Allow Outside Web Access
0 Comments
|
ArchivesCategories
|