- Introduction
- Prerequisites
- Installation Steps
- Database Configuration
- Running the PHP Server
- Using the Application
This guide will walk you through the steps to set up a PHP server, configure the database, and run the necessary PHP scripts (create_db.php
, upload.php
, and view.php
) to upload and view data.
Before you begin, ensure you have the following installed:
- PHP (version 7.0 or higher)
- MySQL or MariaDB
- Web server (e.g., Apache, Nginx)
-
Download the Project Files Download the project files and ensure you have the following PHP scripts:
create_db.php
upload.php
view.php
-
Place Files in the Web Server Directory Move the downloaded PHP files to your web server's root directory. For example, in Apache, this is typically
/var/www/html
. -
Edit Database Configuration Open each PHP file (
create_db.php
,upload.php
,view.php
) and enter your database details:- Database name
- Server name
- Username
- Password
Example:
// Database configuration $servername = "your_server_name"; $username = "your_username"; $password = "your_password"; $dbname = "your_database_name";
Use an FTP client or SCP to upload the PHP files (create_db.php
, upload.php
, view.php
) to your VPS's web server directory (e.g., /var/www/html
).
Ensure your web server (e.g., Apache, Nginx) is configured to serve the PHP files. Restart the web server if necessary.
Open your web browser and navigate to your VPS's IP address or domain name, followed by the PHP script name (e.g., http://your_vps_ip/upload.php
).
That's it! You have successfully set up a PHP server, configured your database, and run the necessary scripts to upload and view data.
- 🛠️ Prerequisites
- Getting Discord Token and Spotify Client Secret
- Installation Instructions
- Compile to Executable (Optional)
- 🔧 Configuration
-
Create a Discord Application:
- Go to the Discord Developer Portal.
- Click on New Application and give your application a name.
- Navigate to the Bot tab on the left sidebar.
- Click Add Bot and confirm.
- Under the Token section, click Copy to get your bot token.
-
Keep Your Token Secure:
- Treat your token like a password. Do not share it publicly or commit it to version control.
-
Create a Spotify Application:
- Go to the Spotify Developer Dashboard.
- Log in or sign up for a Spotify Developer account.
- Click on Create an App and fill out the necessary details for your application.
-
Retrieve Client ID and Client Secret:
- Once your application is created, you'll see your Client ID displayed.
- Click on Show Client Secret to reveal and copy your Client Secret.
-
Keep Your Client Secret Secure:
- Treat your Client Secret like a password. Do not share it publicly or commit it to version control.
-
Use Tokens and Secrets in Your Application:
- Store your Discord Token and Spotify Client Secret securely in environment variables or a configuration file (e.g.,
.env
file) not included in your code repository.
- Store your Discord Token and Spotify Client Secret securely in environment variables or a configuration file (e.g.,
-
References:
OR
-
Clone or Download the Repository:
- Clone the repository using Git:
git clone https://github.com/haydenbanz/HadesConnect.git
- Alternatively, download the repository from HadesConnect download.
- Clone the repository using Git:
-
Navigate to the Directory:
- Open a terminal or command prompt.
- Change directory to HadesConnect:
cd HadesConnect
-
Install Required Python Packages:
- Install the necessary packages using pip:
pip install -r requirements.txt
- Install the necessary packages using pip:
-
Modify
bot.py
Configuration:- Open
bot.py
file in a text editor. - Add your Discord bot token, Spotify client ID, Spotify client secret:
- Discord bot token: Update on line 1182.
- Spotify client ID and client secret: Update on lines 74 & 75.
- Channel ID for voice (if applicable): Update on line 520.
- Open
-
Start HadesConnect:
- Launch HadesConnect by running:
python bot.py
- Launch HadesConnect by running:
-
Check Discord Server:
- Verify that the bot appears and functions correctly on your Discord server for remote access.
-
Install PyInstaller:
- Install PyInstaller using pip:
pip install pyinstaller
- Install PyInstaller using pip:
-
Install PyWin32 (if not installed):
- Install PyWin32 using pip:
pip install pywin32
- Install PyWin32 using pip:
-
Compile to Executable:
- Navigate to your project directory in the terminal or command prompt.
- Run one of the following commands:
- For Windows:
or
pyinstaller --onefile --add-data "*.py;." bot.py
pyinstaller --onefile --exclude-module pythoncom bot.py
- For Windows:
- This will create a standalone executable file in the
dist
directory.
- Configure the bot by editing the
bot.py
file. - Replace with your Discord token by changing
text_channel_id = # Replace with your desired text channel ID
. - Replace with your Discord token
bot.run('YOUR_TOKEN')
.
Ensure your web server (e.g., Apache, Nginx) is configured to serve the PHP files. Restart the web server if necessary.
Open your web browser and navigate to your VPS's IP address or domain name, followed by the PHP script name (e.g., http://your_vps_ip/upload.php
).
That's it! You have successfully set up a PHP server, configured your database, and run the necessary scripts to upload and view data.