MyWeb Tutorials

MyWeb Tutorials: Login to MyWeb

DirectAdmin is a web-based hosting control panel that allows you to manage your website files, databases, and basic site settings through a browser.
At the School of Computer Science, we use DirectAdmin under the name MyWeb to provide students with personal web hosting space.

MyWeb Tutorials: File Manager & HTML page

In this tutorial, we will create a simple HTML page and navigate through the website's files.

Accessing the File Manager

image.png

Understanding the File Structure

Your account contains several folders. The most important ones are:

📁 public_html (Most Important)

This is where your website files go

📁 public_ftp

📁 Other folders you may see

Do not delete folders unless instructed

Creating or Uploading Files

Inside public_html, you can:

Example structure:

public_html/
├── index.html
├── about.html
├── css/
│   └── style.css
├── images/
│   └── logo.png
Website Entry (Starting) Files

When someone visits your website, the web server looks for default index files.

Common starting files:

If both index.html and index.php exist, index.html will win and load first

When to Use HTML vs PHP

Use HTML (.html) when:

Use PHP (.php) when:

Quick Tips & Common Mistakes

Always place website files in public_html
File names are case-sensitive (Index.html ≠ index.html)
One index file per folder is enough
Dont delete system folders
Dont expect files outside public_html to be public

 

 


 

Create Your first HTML page

 

Congratulations! You created your first website :)

 

 

MyWeb Tutorials: Database Creation

This article provides step-by-step instructions for creating a database in MyWeb (DirectAdmin) and a table in phpMyAdmin.

Fill in:

a.     Database Name  (example: projectdb)

b.    User name (can be the same as DB name)

c.     Password (generate or enter your own)

image.png



image.png

image.png



or you can access phpMyAdmin from the left menu:

image.png


 

In the phpMyAdmin page, click on your newly created Database

image.png

image.png


Then define your fields/columns (as shown in the image below as an example)

image.png


Or you can create it using SQL command (the recommended method):

image.png


 Please refer to the following sites for additional information about SQL:

·        https://www.datacamp.com/tutorial/my-sql-tutorial

·        https://www.w3schools.com/MySQL

·        https://www.mysqltutorial.org

 

MyWeb Tutorials: Create PHP/DB application

This tutorial shows how to:

Create a PHP File
  1. Log in to MyWeb (DirectAdmin)
  2. Open File Manager
  3. Go to:
  4. public_html
  5. Create a new file called:
  6. people.php
  7. Edit the file
Database Table Used

We assume the following table already exists: (refer to this tutorial in case you dont have this table)

Persons
--------------------------------
PersonID   INT (Primary Key)
LastName   VARCHAR(255)
FirstName  VARCHAR(255)
Address    VARCHAR(255)
City       VARCHAR(255)
Database Connection

At the top of people.php, add:

<?php
$host = "localhost";
$db   = "testproj1_myDB";
$user = "testproj1_myDB";
$pass = "myPassword";

$conn = new mysqli($host, $user, $pass, $db);

if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
?>

Replace the database credentials with your own.

Display Table Contents (READ)

Add this below the connection code:

<h2>People List</h2>

<table border="1" cellpadding="5">
<tr>
    <th>ID</th>
    <th>First Name</th>
    <th>Last Name</th>
    <th>Address</th>
    <th>City</th>
    <th>Actions</th>
</tr>

<?php
$result = $conn->query("SELECT * FROM Persons");

while ($row = $result->fetch_assoc()) {
    echo "<tr>";
    echo "<td>{$row['PersonID']}</td>";
    echo "<td>{$row['FirstName']}</td>";
    echo "<td>{$row['LastName']}</td>";
    echo "<td>{$row['Address']}</td>";
    echo "<td>{$row['City']}</td>";
    echo "<td>
        <form method='post' style='display:inline;'>
            <input type='hidden' name='delete_id' value='{$row['PersonID']}'>
            <input type='submit' value='Delete'
                   onclick=\"return confirm('Delete this record?');\">
        </form>
      </td>";
    echo "</tr>";
}
?>
</table>
Add New Records (CREATE)

Add this above the table:

<form method="post">
    <label>Person ID:</label><br>
    <input type="number" name="personid" required><br><br>

    <label>First Name:</label><br>
    <input type="text" name="firstname" required><br><br>

    <label>Last Name:</label><br>
    <input type="text" name="lastname" required><br><br>

    <label>Address:</label><br>
    <input type="text" name="address"><br><br>

    <label>City:</label><br>
    <input type="text" name="city"><br><br>

    <input type="submit" name="add" value="Add Person">
</form>

Then add this PHP logic near the top of the file:

if (isset($_POST['add'])) {
    $stmt = $conn->prepare(
        "INSERT INTO Persons (PersonID, FirstName, LastName, Address, City)
         VALUES (?, ?, ?, ?, ?)"
    );

    $stmt->bind_param(
        "issss",
        $_POST['personid'],
        $_POST['firstname'],
        $_POST['lastname'],
        $_POST['address'],
        $_POST['city']
    );

    $stmt->execute();
    $stmt->close();

    header("Location: people.php");
    exit;
}
Delete Records (DELETE)

Add this near the top:

if (isset($_POST['delete_id'])) {
    $id = (int) $_POST['delete_id'];

    $stmt = $conn->prepare("DELETE FROM Persons WHERE PersonID = ?");
    $stmt->bind_param("i", $id);
    $stmt->execute();
    $stmt->close();

    header("Location: people.php");
    exit;
}

Now clicking Delete removes a record.

Full people.php file
<?php
/**
 * Simple PHP CRUD Example
 * Table: Persons
 *
 * Columns:
 *  - PersonID (INT, Primary Key, Auto Increment)
 *  - FirstName (VARCHAR)
 *  - LastName  (VARCHAR)
 *  - Address   (VARCHAR)
 *  - City      (VARCHAR)
 */

/* ===============================
   Database Configuration
   =============================== */
$host = "localhost";
$db   = "testproj1_myDB";
$user = "testproj1_myDB";
$pass = "myPassword";

/* ===============================
   Database Connection
   =============================== */
$conn = new mysqli($host, $user, $pass, $db);

if ($conn->connect_error) {
    die("Database connection failed: " . $conn->connect_error);
}

/* ===============================
   CREATE (Add New Record)
   =============================== */
if (isset($_POST['add'])) {
    $stmt = $conn->prepare(
        "INSERT INTO Persons (PersonID, FirstName, LastName, Address, City)
         VALUES (?, ?, ?, ?, ?)"
    );

    $stmt->bind_param(
        "issss",
        $_POST['personid'],
        $_POST['firstname'],
        $_POST['lastname'],
        $_POST['address'],
        $_POST['city']
    );

    $stmt->execute();
    $stmt->close();

    header("Location: people.php");
    exit;
}


/* ===============================
   DELETE (Remove Record)
   =============================== */
if (isset($_POST['delete_id'])) {
    $id = (int) $_POST['delete_id'];

    $stmt = $conn->prepare("DELETE FROM Persons WHERE PersonID = ?");
    $stmt->bind_param("i", $id);
    $stmt->execute();
    $stmt->close();

    header("Location: people.php");
    exit;
}

?>

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>People CRUD Example</title>
</head>
<body>

<h1>People Database</h1>

<!-- ===============================
     CREATE FORM
     =============================== -->
<h2>Add New Person</h2>

<form method="post">
    <label>Person ID:</label><br>
    <input type="number" name="personid" required><br><br>

    <label>First Name:</label><br>
    <input type="text" name="firstname" required><br><br>

    <label>Last Name:</label><br>
    <input type="text" name="lastname" required><br><br>

    <label>Address:</label><br>
    <input type="text" name="address"><br><br>

    <label>City:</label><br>
    <input type="text" name="city"><br><br>

    <input type="submit" name="add" value="Add Person">
</form>

<hr>

<!-- ===============================
     READ (Display Records)
     =============================== -->
<h2>People List</h2>

<table border="1" cellpadding="6" cellspacing="0">
    <tr>
        <th>ID</th>
        <th>First Name</th>
        <th>Last Name</th>
        <th>Address</th>
        <th>City</th>
        <th>Action</th>
    </tr>

<?php
$result = $conn->query("SELECT * FROM Persons");

while ($row = $result->fetch_assoc()) {
    echo "<tr>";
    echo "<td>{$row['PersonID']}</td>";
    echo "<td>{$row['FirstName']}</td>";
    echo "<td>{$row['LastName']}</td>";
    echo "<td>{$row['Address']}</td>";
    echo "<td>{$row['City']}</td>";
    echo "<td>
        <form method='post' style='display:inline;'>
            <input type='hidden' name='delete_id' value='{$row['PersonID']}'>
            <input type='submit' value='Delete'
                   onclick=\"return confirm('Delete this record?');\">
        </form>
      </td>";
    echo "</tr>";
}
?>

</table>

</body>
</html>

File Location Reminder

File must be in:

public_html/people.php

Access it via:

https://yourname.myweb.cs.uwindsor.ca/people.php

Errors and Logs

During building of your PHP application, you may need to view the errors either on the webpage or via the log.

To view errors on your PHP page, add the following at the top of your PHP file:

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

Put them before any other PHP code.

Once fixed, remove the debug lines.


Or you can access the log file from "Site Summary/Statistics/Logs" 

image.png

image.png



 Summary

MyWeb Tutorials: Git (Version Control)

If you are planning to use GIT, then you need to consider our GitLab server is the source of truth for your website code. You should write and edit your code locally on your own computer using any editor or IDE (such as VS Code). Your local project must be connected to gitlab.cs.uwindsor.ca, where you commit and push your changes. Once your code is pushed to GitLab, you then log in to MyWeb (DirectAdmin) and use Fetch followed by Deploy to publish the latest version of your code to the web server. Do not edit files directly in MyWeb using File Manager or FTP after Git is enabled, as those changes will be overwritten on the next deploy.

 Summary of Workflow:

First-Time Setup (Do Once)

  1. Create an SSH key on the student’s local computer
  2. Add the local SSH key to GitLab (gitlab.cs.uwindsor.ca)
  3. Configure your IDE (e.g., VS Code) to use GitLab
  4. Create a new project on GitLab and copy the SSH remote URL
  5. Initialize the local project and connect it to the GitLab repository
  6. If code already exists on MyWeb, import it into the local project
  7. Commit and push the initial codebase to GitLab
  8. Create a separate SSH key in MyWeb (DirectAdmin) for deployment
  9. Add the MyWeb public SSH key to GitLab
  10. Initialize and connect the Git repository in MyWeb
  11. Perform the first Fetch and Deploy from GitLab to MyWeb

 

Daily / Ongoing Workflow

  1. Edit code locally on the student’s computer
  2. Commit and push changes to GitLab
  3. Log in to MyWeb (DirectAdmin)
  4. Fetch updates from GitLab
  5. Deploy the latest code to the website

1. Create an SSH key on the student’s local computer

Windows (Windows Terminal / PowerShell / Git Bash)

ssh-keygen -t ed25519 -C "yourusername@gitlab.cs.uwindsor.ca"

eval "$(ssh-agent -s)"

ssh-add ~/.ssh/id_ed25519

(or the filename you chose)

 

macOS / Linux

ssh-keygen -t ed25519 -C "yourusername@gitlab.cs.uwindsor.ca"

eval "$(ssh-agent -s)"

ssh-add ~/.ssh/id_ed25519

 

Verify the Key Was Created (All Systems)

ls ~/.ssh

Notes for Students:


 

2. Add the SSH Key to GitLab (gitlab.cs.uwindsor.ca)

image.png

image.png

Copy Your Public Key (from your computer)

cat ~/.ssh/id_ed25519.pub

(If you used a different filename, replace id_ed25519 accordingly.)

Add the Key in GitLab

image.png

image.png

Quick Verification (Optional but Recommended)

ssh -T git@gitlab.cs.uwindsor.ca

Notes for Students


 

3. Configure Your IDE (VS Code) to Use GitLab

Verify Git Is Detected by VS Code

git --version

 

Configure VS Code to Use Your SSH Key

ssh-add -l

VS Code uses the system SSH configuration automatically—no extra setup is required if SSH works in the terminal.

 

(Optional but Recommended) Configure Git Identity

git config --global user.name "Your Full Name"

git config --global user.email "yourusername@uwindsor.ca"

 

(Optional) Test GitLab Access from VS Code

ssh -T git@gitlab.cs.uwindsor.ca

 

Notes for Students


 

4. Create a Project on GitLab and Get the SSH Remote URL

image.png

image.png

image.png

Project Setup


Get the SSH Remote URL

git@gitlab.cs.uwindsor.ca:yourusername/myweb-project.git

image.png

 

Notes for Students


 

5. Initialize the Local Project and Push Code to GitLab

This step connects your local code to the GitLab repository you just created.

 

If You Are Starting with New Code (No Existing MyWeb Files)

git init

git remote add origin git@gitlab.cs.uwindsor.ca:yourusername/myweb-project.git

git add .

git commit -m "Initial commit"

git branch -M main

git push -u origin main


If Code Already Exists on MyWeb (Common Case)

git init

git remote add origin git@gitlab.cs.uwindsor.ca:yourusername/myweb-project.git

git add .

git commit -m "Initial import from MyWeb"

git branch -M main

git push -u origin main

GitLab now contains the full website code
GitLab becomes the source of truth

 

Notes for Students


 

6. Create a Deployment SSH Key in MyWeb (DirectAdmin)

This key is used only by MyWeb to fetch and deploy code from GitLab.
It is separate from the SSH key on your local computer.

image.png

image.png

Fill in the fields

image.png

Copy the Public Key

image.png

To copy the public key, right click on *.pub file and open/edit it and copy the full content (to be used in step 7 below)

Notes for Students


 

7. Add the MyWeb SSH Key to GitLab

This step authorizes MyWeb to access your GitLab repository for Fetch and Deploy.

image.png

Add the MyWeb Public Key

image.png

Notes for Students


 

8. Initialize and Connect the Repository in MyWeb (DirectAdmin)

image.png

image.png

Fill in the Repository Details

image.png

What This Does

 

Notes for Students


 

9. Fetch and Deploy the Code to MyWeb

This step publishes your GitLab code to your MyWeb website.

 

Fetch From GitLab

image.png

What Fetch does:

Deploy to MyWeb

What Deploy does:

 

Verify Deployment

 

Important Notes for Students

 

Setup Complete

You have now:


Daily Workflow Reminder

 

MyWeb Tutorials: Connect to DB remotely

In addition to accessing your database through phpMyAdmin on MyWeb, you may also connect to your database directly from your own computer using tools such as HeidiSQL, MySQL Workbench, DBeaver, or the MySQL command-line client. Remote database access allows you to manage tables, run queries, and test your applications more easily while developing locally. In this guide, you will learn how to enable remote access to your database on MyWeb (DirectAdmin) and how to configure your database client to connect securely to the server.

You can use any client to connect and manage the database from your computer. I recommend HeidiSQL https://www.heidisql.com/download.php

image.png