# MyWeb Tutorials

# MyWeb Tutorials: Login to MyWeb

**<span style="font-size: 13.0pt; line-height: 107%;">DirectAdmin</span>**<span style="font-size: 13.0pt; line-height: 107%;"> 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.</span>

- <span style="font-size: 14.0pt; line-height: 107%;">Login to MyWeb using your UWINID and password:   
    [https://www.myweb.cs.uwindsor.ca](https://www.myweb.cs.uwindsor.ca)</span>
    
    [![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/LiRimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/LiRimage.png)
    
    [![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/WMlimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/WMlimage.png)
- <span style="font-size: 13.0pt; line-height: 107%;">If You cannot Log In  
      
    </span>
    
    <p class="callout success"><span style="font-size: 13.0pt; line-height: 107%;">You must **activate or re-sync your password** using the CS authentication portal:</span></p>
    
    <p class="callout success"><span style="font-size: 13.0pt; line-height: 107%;">[https://auth.cs.uwindsor.ca](https://auth.cs.uwindsor.ca) </span></p>

# MyWeb Tutorials: File Manager & HTML page

<span style="font-size: 13.0pt; line-height: 107%;">In this tutorial, we will create a simple HTML page and navigate through the website's files.</span>

##### <span style="text-decoration: underline;">**<span style="font-size: 13.0pt; line-height: 107%;">Accessing the File Manager</span>**</span>

- <span style="font-size: 12.0pt; line-height: 107%;">Log in to [MyWeb](https://www.myweb.cs.uwindsor.ca/) (DirectAdmin)</span>
- <span style="font-size: 12.0pt; line-height: 107%;">From the main dashboard, click File Manager</span>[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/Vjdimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/Vjdimage.png)
- <span style="font-size: 12.0pt; line-height: 107%;">You will see a directory tree showing files and folders associated with your account  
    </span>

[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/cH3image.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/cH3image.png)

##### <span style="text-decoration: underline;">**<span style="font-size: 13.0pt; line-height: 107%;">Understanding the File Structure</span>**</span>

<span style="font-size: 13.0pt; line-height: 107%;">Your account contains several folders. The most important ones are:</span>

**<span style="font-size: 13.0pt; line-height: 107%; font-family: 'Segoe UI Emoji',sans-serif; mso-bidi-font-family: 'Segoe UI Emoji';">📁</span><span style="font-size: 13.0pt; line-height: 107%;"> public\_html (Most Important)</span>**

- <span style="font-size: 13.0pt; line-height: 107%;">This is the **web root**</span>
- <span style="font-size: 13.0pt; line-height: 107%;">Any file placed here is accessible through your website</span>
- <span style="font-size: 13.0pt; line-height: 107%;">Example:</span>
- <span style="font-size: 13.0pt; line-height: 107%;">public\_html/index.html → [https://yourusername.myweb.cs.uwindsor.ca](https://yourusername.myweb.cs.uwindsor.ca) </span>


<span style="font-size: 13.0pt; line-height: 107%;">This is where your website files go</span>

**<span style="font-size: 13.0pt; line-height: 107%; font-family: 'Segoe UI Emoji',sans-serif; mso-bidi-font-family: 'Segoe UI Emoji';">📁</span><span style="font-size: 13.0pt; line-height: 107%;"> public\_ftp</span>**

- <span style="font-size: 13.0pt; line-height: 107%;">Used for **FTP access**</span>
- <span style="font-size: 13.0pt; line-height: 107%;">Typically not used unless you connect using an FTP client</span>
- <span style="font-size: 13.0pt; line-height: 107%;">Does **not automatically publish files to the web**</span>

**<span style="font-size: 13.0pt; line-height: 107%; font-family: 'Segoe UI Emoji',sans-serif; mso-bidi-font-family: 'Segoe UI Emoji';">📁</span><span style="font-size: 13.0pt; line-height: 107%;"> Other folders you may see</span>**

- <span style="font-size: 13.0pt; line-height: 107%;">logs – Website access/error logs</span>
- <span style="font-size: 13.0pt; line-height: 107%;">domains – Used when multiple domains/subdomains exist</span>
- <span style="font-size: 13.0pt; line-height: 107%;">System folders – Should not be modified</span>

*<span style="font-size: 13.0pt; line-height: 107%;">Do not delete folders unless instructed</span>*

##### <span style="text-decoration: underline;">**<span style="font-size: 13.0pt; line-height: 107%;">Creating or Uploading Files</span>**</span>

<span style="font-size: 13.0pt; line-height: 107%;">Inside **public\_html**, you can:</span>

- <span style="font-size: 13.0pt; line-height: 107%;">Upload files (HTML, PHP, images, CSS, JS)</span>
- <span style="font-size: 13.0pt; line-height: 107%;">Create new files</span>
- <span style="font-size: 13.0pt; line-height: 107%;">Create subfolders (e.g., images, css, js)</span>

<span style="font-size: 13.0pt; line-height: 107%;">Example structure:</span>

```
public_html/
├── index.html
├── about.html
├── css/
│   └── style.css
├── images/
│   └── logo.png
```

##### <span style="text-decoration: underline;">**<span style="font-size: 13.0pt; line-height: 107%;">Website Entry (Starting) Files</span>**</span>

<span style="font-size: 13.0pt; line-height: 107%;">When someone visits your website, the web server looks for **default index files**.</span>

**<span style="font-size: 13.0pt; line-height: 107%;">Common starting files:</span>**

- <span style="font-size: 13.0pt; line-height: 107%;">index.html</span>
- <span style="font-size: 13.0pt; line-height: 107%;">index.php</span>

*<span style="font-size: 13.0pt; line-height: 107%; font-family: 'Aptos',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Aptos; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: Arial; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-CA; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;">If both index.html and index.php exist, index.html will win and load first</span>*

##### <span style="text-decoration: underline;">**<span style="font-size: 13.0pt; line-height: 107%;">When to Use HTML vs PHP</span>**</span>

**<span style="font-size: 13.0pt; line-height: 107%;">Use HTML (.html) when:</span>**

- <span style="font-size: 13.0pt; line-height: 107%;">Your site is static</span>
- <span style="font-size: 13.0pt; line-height: 107%;">No database or server logic is needed</span>
- <span style="font-size: 13.0pt; line-height: 107%;">You are learning basic web structure</span>

**<span style="font-size: 13.0pt; line-height: 107%;">Use PHP (.php) when:</span>**

- <span style="font-size: 13.0pt; line-height: 107%;">You need server-side logic</span>
- <span style="font-size: 13.0pt; line-height: 107%;">You connect to a database</span>
- <span style="font-size: 13.0pt; line-height: 107%;">You process forms or user input</span>

##### <span style="text-decoration: underline;">**<span style="font-size: 13.0pt; line-height: 107%;">Quick Tips &amp; Common Mistakes</span>**</span>

<span style="font-size: 13.0pt; line-height: 107%; font-family: 'Segoe UI Symbol',sans-serif; mso-bidi-font-family: 'Segoe UI Symbol';">✔</span><span style="font-size: 13.0pt; line-height: 107%;"> Always place website files in **public\_html**  
</span><span style="font-size: 13.0pt; line-height: 107%; font-family: 'Segoe UI Symbol',sans-serif; mso-bidi-font-family: 'Segoe UI Symbol';">✔</span><span style="font-size: 13.0pt; line-height: 107%;"> File names are **case-sensitive** (Index.html ≠ index.html)  
</span><span style="font-size: 13.0pt; line-height: 107%; font-family: 'Segoe UI Symbol',sans-serif; mso-bidi-font-family: 'Segoe UI Symbol';">✔</span><span style="font-size: 13.0pt; line-height: 107%;"> One index file per folder is enough  
</span><span style="font-size: 13.0pt; line-height: 107%; font-family: 'Segoe UI Emoji',sans-serif; mso-bidi-font-family: 'Segoe UI Emoji';">❌</span><span style="font-size: 13.0pt; line-height: 107%;"> Don</span><span style="font-size: 13.0pt; line-height: 107%; mso-ascii-font-family: Aptos; mso-hansi-font-family: Aptos; mso-bidi-font-family: Aptos;">’</span><span style="font-size: 13.0pt; line-height: 107%;">t delete system folders  
</span><span style="font-size: 13.0pt; line-height: 107%; font-family: 'Segoe UI Emoji',sans-serif; mso-bidi-font-family: 'Segoe UI Emoji';">❌</span><span style="font-size: 13.0pt; line-height: 107%;"> Don</span><span style="font-size: 13.0pt; line-height: 107%; mso-ascii-font-family: Aptos; mso-hansi-font-family: Aptos; mso-bidi-font-family: Aptos;">’</span><span style="font-size: 13.0pt; line-height: 107%;">t expect files outside public\_html to be public</span>

---

##### <span style="text-decoration: underline;">**<span style="font-size: 13.0pt; line-height: 107%;">Create Your first HTML page</span>**</span>

- <span style="font-size: 13.0pt; line-height: 107%;">From "File Manager", go to "public\_html"</span>
- <span style="font-size: 13.0pt; line-height: 107%;">*<span style="text-decoration: underline;">Optional</span>*: backup your current index.html file (rename it to index.html-backup)  
    </span>[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/y0Iimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/y0Iimage.png)
- Create a new file index.html  
    [![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/O2gimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/O2gimage.png)
- Right-click on the newly created index.html file and select "Edit"  
    [![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/SqVimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/SqVimage.png)
- In the new page, place your code, or optionally, copy the following code:  
    ```html
    
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Your Name - Personal Site</title>
        <!-- You can add CSS styling here or link an external CSS file -->
        <style>
            body {
                font-family: sans-serif;
                margin: 40px;
                line-height: 1.6;
            }
            h1 {
                color: #333;
            }
            p {
                color: #666;
            }
        </style>
    </head>
    <body>
        <h1>Hello, I'm [Your Name]</h1>
        <p>Welcome to my personal website!</p>
        <p>I am a student at School of Computer Science at the University of Windsor, and you can learn more about me on this page.</p>
        
        <h2>Interests</h2>
        <ul>
            <li>Coding</li>
            <li>Design</li>
            <li>[Your Other Interest]</li>
        </ul>
    
        <h2>Contact</h2>
        <p>You can reach me via email at [your email address].</p>
    </body>
    </html>
    
    ```
- Then "Save" the page and your refresh your website at [https://yourusername.myweb.cs.uwindsor.ca](https://yourusername.myweb.cs.uwindsor.ca)

Congratulations! You created your first website :)

</body></html>

# MyWeb Tutorials: Database Creation

<span style="font-size: 14.0pt; line-height: 107%;">This article provides step-by-step instructions for creating a database in MyWeb (DirectAdmin) and a table in phpMyAdmin.</span>

- <span style="font-size: 14.0pt; line-height: 107%;">Login to MyWeb using your UWINID and password:   
    [https://www.myweb.cs.uwindsor.ca](https://www.myweb.cs.uwindsor.ca)  
      
    </span>
- <span style="font-size: 14.0pt; line-height: 107%;">From “Account Manager” menu, click on “Databases”  
    </span>  
    [![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/oeIimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/oeIimage.png)
    
    <span style="font-size: 14.0pt; line-height: 107%;">  
      
    </span>
- <span style="font-size: 14pt;">In the “Create Database” section, click on “Advanced mode”</span>

<span style="font-size: 14.0pt; line-height: 107%;">Fill in:</span>

<span style="font-size: 14.0pt; line-height: 107%; mso-bidi-font-family: Aptos; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">a.<span style="font: 7.0pt 'Times New Roman';"> </span></span></span><span style="font-size: 14.0pt; line-height: 107%;">Database Name <span style="mso-spacerun: yes;"> </span>*(example: projectdb)*</span>

<span style="font-size: 14.0pt; line-height: 107%; mso-bidi-font-family: Aptos; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">b.<span style="font: 7.0pt 'Times New Roman';"> </span></span></span><span style="font-size: 14.0pt; line-height: 107%;">User name *(can be the same as DB name)*</span>

<span style="font-size: 14.0pt; line-height: 107%; mso-bidi-font-family: Aptos; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">c.<span style="font: 7.0pt 'Times New Roman';"> </span></span></span><span style="font-size: 14.0pt; line-height: 107%;">Password *(generate or enter your own)*</span>

[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/nyVimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/nyVimage.png)

<span style="font-size: 14.0pt; line-height: 107%;">  
  
</span>

- <span style="font-size: 14.0pt; line-height: 107%;">After creation, you will get a confirmation like the following (record these info)</span>

[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/YqAimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/YqAimage.png)

- <span style="font-size: 14.0pt; line-height: 107%;">To access the Database, you can use phpMyAdmin, you can access it either from the same page where you created the Database (top right)</span>

[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/R7Vimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/R7Vimage.png)

<span style="font-size: 14.0pt; line-height: 107%;">  
  
or you can access phpMyAdmin from the left menu:</span>

[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/1Loimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/1Loimage.png)

<span style="font-size: 14.0pt; line-height: 107%; mso-no-proof: yes;">  
</span>

<span style="font-size: 14.0pt; line-height: 107%;"> </span>

<span style="font-size: 14.0pt; line-height: 107%;">In the phpMyAdmin page, click on your newly created Database</span>

[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/Tcaimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/Tcaimage.png)

- <span style="font-size: 14.0pt; line-height: 107%;">You can create a table either using the “Create new table” wizard </span>

[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/am4image.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/am4image.png)

<span style="font-size: 14.0pt; line-height: 107%; mso-no-proof: yes;">  
</span>

<span style="font-size: 14.0pt; line-height: 107%;">Then define your fields/columns (as shown in the image below as an example)</span>

[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/oC6image.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/oC6image.png)

<span style="font-size: 14.0pt; line-height: 107%; mso-no-proof: yes;">  
</span>

<span style="font-size: 14.0pt; line-height: 107%;">Or you can create it using SQL command (the recommended method):</span>

[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/1tzimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/1tzimage.png)

<span style="font-size: 14.0pt; line-height: 107%; mso-no-proof: yes;">  
</span>

<span style="font-size: 14.0pt; line-height: 107%;"> </span><span style="font-size: 14.0pt; line-height: 107%;">Please refer to the following sites for additional information about SQL:</span>

<span style="font-size: 14.0pt; line-height: 107%; font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt 'Times New Roman';"> </span></span></span><span style="font-size: 14.0pt; line-height: 107%;">[https://www.datacamp.com/tutorial/my-sql-tutorial](https://www.datacamp.com/tutorial/my-sql-tutorial)</span>

<span style="font-size: 14.0pt; line-height: 107%; font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt 'Times New Roman';"> </span></span></span><span style="font-size: 14.0pt; line-height: 107%;">[https://www.w3schools.com/MySQL](https://www.w3schools.com/MySQL)</span>

<span style="font-size: 14.0pt; line-height: 107%; font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt 'Times New Roman';"> </span></span></span><span style="font-size: 14.0pt; line-height: 107%;">[https://www.mysqltutorial.org](https://www.mysqltutorial.org)</span>

<span style="font-size: 14.0pt; line-height: 107%;"></span>

# MyWeb Tutorials: Create PHP/DB application

<span style="font-size: 12.0pt; line-height: 107%;">This tutorial shows how to:</span>

- <span style="font-size: 12.0pt; line-height: 107%;">Create a PHP file</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Connect to a database</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Display table contents</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Add **Create, Read, Update, Delete (CRUD)** functionality</span>

##### **<span style="font-size: 12.0pt; line-height: 107%;">Create a PHP File</span>**

1. <span style="font-size: 12.0pt; line-height: 107%;">Log in to **MyWeb (DirectAdmin)**</span>
2. <span style="font-size: 12.0pt; line-height: 107%;">Open **File Manager**</span>
3. <span style="font-size: 12.0pt; line-height: 107%;">Go to:</span>
4. <span style="font-size: 12.0pt; line-height: 107%;">public\_html</span>
5. <span style="font-size: 12.0pt; line-height: 107%;">Create a new file called:</span>
6. <span style="font-size: 12.0pt; line-height: 107%;">people.php</span>
7. <span style="font-size: 12.0pt; line-height: 107%;">Edit the file</span>

##### **<span style="font-size: 12.0pt; line-height: 107%;">Database Table Used</span>**

<span style="font-size: 12.0pt; line-height: 107%;">We assume the following table already exists: *(refer to this [tutorial ](https://help.cs.uwindsor.ca/books/cs-help/page/myweb-tutorials-database-creation "MyWeb Tutorials: Database Creation")in case you dont have this table)*</span>

```mysql
Persons
--------------------------------
PersonID   INT (Primary Key)
LastName   VARCHAR(255)
FirstName  VARCHAR(255)
Address    VARCHAR(255)
City       VARCHAR(255)

```

##### **<span style="font-size: 12.0pt; line-height: 107%;">Database Connection</span>**

<span style="font-size: 12.0pt; line-height: 107%; font-family: 'Aptos',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Aptos; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: Arial; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-CA; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;">At the **top** of people.php, add:</span>

```php
<?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);
}
?>

```

<span style="font-size: 12.0pt; line-height: 107%;">Replace the database credentials with your own.</span>

##### **<span style="font-size: 12.0pt; line-height: 107%;">Display Table Contents (READ)</span>**

<span style="font-size: 12.0pt; line-height: 107%;">Add this **below the connection code**:</span>

```php
<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>

```

##### **<span style="font-size: 12.0pt; line-height: 107%;">Add New Records (CREATE)</span>**

<span style="font-size: 12.0pt; line-height: 107%;">Add this **above the table**:</span>

```php
<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>
```

<span style="font-size: 12.0pt; line-height: 107%;">Then add this PHP logic **near the top of the file**:</span>

```php
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;
}
```

##### **<span style="font-size: 12.0pt; line-height: 107%;">Delete Records (DELETE)</span>**

<span style="font-size: 12.0pt; line-height: 107%;">Add this **near the top**:</span>

```php
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;
}
```

<span style="font-size: 12.0pt; line-height: 107%;">Now clicking **Delete** removes a record.</span>

##### **<span style="font-size: 12.0pt; line-height: 107%;">Full people.php file</span>**

```php
<?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;
}

?>


<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>

```

**<span style="font-size: 12.0pt; line-height: 107%;">File Location Reminder</span>**

<span style="font-size: 12.0pt; line-height: 107%;">File must be in:</span>

<span style="font-size: 12.0pt; line-height: 107%;">`public_html/people.php`  
</span>

<span style="font-size: 12.0pt; line-height: 107%;">Access it via:</span>

<span style="font-size: 12.0pt; line-height: 107%;">[https://yourname.myweb.cs.uwindsor.ca/people.php](https://yourname.myweb.cs.uwindsor.ca/people.php)  
</span>

##### **<span style="text-decoration: underline;">Errors and Logs</span>**

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:

```php
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](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/A6Kimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/A6Kimage.png)

[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/dN9image.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/dN9image.png)

##### **<span style="font-size: 12.0pt; line-height: 107%;"><span style="mso-spacerun: yes;"> </span>Summary</span>**

- <span style="font-size: 12.0pt; line-height: 107%;">PHP files go in **public\_html**</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Use PHP + MySQLi to access databases</span>
- <span style="font-size: 12.0pt; line-height: 107%;">CRUD means:</span>
- **<span style="font-size: 12.0pt; line-height: 107%;">Create</span>**<span style="font-size: 12.0pt; line-height: 107%;"> – Insert records</span>
- **<span style="font-size: 12.0pt; line-height: 107%;">Read</span>**<span style="font-size: 12.0pt; line-height: 107%;"> – Display records</span>
- **<span style="font-size: 12.0pt; line-height: 107%;">Update</span>**<span style="font-size: 12.0pt; line-height: 107%;"> – Modify records</span>
- **<span style="font-size: 12.0pt; line-height: 107%;">Delete</span>**<span style="font-size: 12.0pt; line-height: 107%;"> – Remove records</span>


</body></html>

# MyWeb Tutorials: Git (Version Control)

**<span style="font-size: 12.0pt; line-height: 107%;">Recommended Workflow (Read First)</span>**

<span style="font-size: 12.0pt; line-height: 107%;">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. **<u>Do not</u>**<u> edit files directly in MyWeb</u> using File Manager or FTP after Git is enabled, as those changes will be overwritten on the next deploy.</span>

<span style="font-size: 12.0pt; line-height: 107%;"> </span>**<u><span style="font-size: 12.0pt; line-height: 107%;">Summary of Workflow:</span></u>**

- <span style="font-size: 12.0pt; line-height: 107%;">Edit locally on your computer</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Commit &amp; push to GitLab</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Fetch &amp; Deploy to MyWeb</span>

**<span style="font-size: 12.0pt; line-height: 107%;">First-Time Setup (Do Once)</span>**

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

<span style="font-size: 12.0pt; line-height: 107%;"> </span>

**<span style="font-size: 12.0pt; line-height: 107%;">Daily / Ongoing Workflow</span>**

1. <span style="font-size: 12.0pt; line-height: 107%;">Edit code locally on the student’s computer</span>
2. <span style="font-size: 12.0pt; line-height: 107%;">Commit and push changes to GitLab</span>
3. <span style="font-size: 12.0pt; line-height: 107%;">Log in to MyWeb (DirectAdmin)</span>
4. <span style="font-size: 12.0pt; line-height: 107%;">Fetch updates from GitLab</span>
5. <span style="font-size: 12.0pt; line-height: 107%;">Deploy the latest code to the website</span>

---

##### **<u><span style="font-size: 12.0pt; line-height: 107%;">1. Create an SSH key on the student’s local computer</span></u>**

- <span style="font-size: 12.0pt; line-height: 107%;">SSH keys are used to connect your computer to GitLab securely</span>
- <span style="font-size: 12.0pt; line-height: 107%;">If you already have an SSH key, you **may reuse it**</span>
- <span style="font-size: 12.0pt; line-height: 107%;">For simplicity and clarity, it is **recommended to create a new SSH key specifically for GitLab**</span>

**<span style="font-size: 12.0pt; line-height: 107%;">Windows (Windows Terminal / PowerShell / Git Bash)</span>**

- <span style="font-size: 12.0pt; line-height: 107%;">Open **Windows Terminal**, **PowerShell**, or **Git Bash**</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Generate a new SSH key:</span>

`<span style="font-size: 12.0pt; line-height: 107%;">ssh-keygen -t ed25519 -C "yourusername@gitlab.cs.uwindsor.ca"</span>`

- <span style="font-size: 12.0pt; line-height: 107%;">When prompted:</span>
- **<span style="font-size: 12.0pt; line-height: 107%;">File location</span>**<span style="font-size: 12.0pt; line-height: 107%;">: press **Enter** to accept default  
    (or use gitlab\_cs if you want a dedicated key)</span>
- **<span style="font-size: 12.0pt; line-height: 107%;">Passphrase</span>**<span style="font-size: 12.0pt; line-height: 107%;">: optional (press Enter to skip)</span>

- <span style="font-size: 12.0pt; line-height: 107%;">Start the SSH agent:</span>

`<span style="font-size: 12.0pt; line-height: 107%;">eval "$(ssh-agent -s)"</span>`

- <span style="font-size: 12.0pt; line-height: 107%;">Add the key to the agent:</span>

`<span style="font-size: 12.0pt; line-height: 107%;">ssh-add ~/.ssh/id_ed25519</span>`

<span style="font-size: 12.0pt; line-height: 107%;">(or the filename you chose)</span>

<span style="font-size: 12.0pt; line-height: 107%;"> </span>

**<span style="font-size: 12.0pt; line-height: 107%;">macOS / Linux</span>**

- <span style="font-size: 12.0pt; line-height: 107%;">Open **Terminal**</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Generate a new SSH key:</span>

`<span style="font-size: 12.0pt; line-height: 107%;">ssh-keygen -t ed25519 -C "yourusername@gitlab.cs.uwindsor.ca"</span>`

- <span style="font-size: 12.0pt; line-height: 107%;">When prompted:</span>
- **<span style="font-size: 12.0pt; line-height: 107%;">File location</span>**<span style="font-size: 12.0pt; line-height: 107%;">: press **Enter** to accept default</span>
- **<span style="font-size: 12.0pt; line-height: 107%;">Passphrase</span>**<span style="font-size: 12.0pt; line-height: 107%;">: optional (press Enter to skip)</span>

- <span style="font-size: 12.0pt; line-height: 107%;">Start the SSH agent:</span>

`<span style="font-size: 12.0pt; line-height: 107%;">eval "$(ssh-agent -s)"</span>`

- <span style="font-size: 12.0pt; line-height: 107%;">Add the key to the agent:</span>

`<span style="font-size: 12.0pt; line-height: 107%;">ssh-add ~/.ssh/id_ed25519</span>`

<span style="font-size: 12.0pt; line-height: 107%;"> </span>

**<span style="font-size: 12.0pt; line-height: 107%;">Verify the Key Was Created (All Systems)</span>**

- <span style="font-size: 12.0pt; line-height: 107%;">List SSH keys:</span>

`<span style="font-size: 12.0pt; line-height: 107%;">ls ~/.ssh</span>`

- <span style="font-size: 12.0pt; line-height: 107%;">You should see:</span>
- <span style="font-size: 12.0pt; line-height: 107%;">id\_ed25519</span>
- <span style="font-size: 12.0pt; line-height: 107%;">id\_ed25519.pub</span>

<p class="callout info">**<span style="font-size: 12.0pt; line-height: 107%;">Notes for Students:</span>**</p>

- <span style="font-size: 12.0pt; line-height: 107%;">.pub file = **public key** (safe to share)</span>
- <span style="font-size: 12.0pt; line-height: 107%;">non-.pub file = **private key** (never share)</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Public key will be added to **GitLab** in the next step</span>
- <span style="font-size: 12.0pt; line-height: 107%;">You do **not** need to repeat this step unless you change computers</span>

---

<span style="font-size: 12.0pt; line-height: 107%;"> </span>

##### **<u><span style="font-size: 12.0pt; line-height: 107%;">2. Add the SSH Key to GitLab (gitlab.cs.uwindsor.ca)</span></u>**

- <span style="font-size: 12.0pt; line-height: 107%;">Open **GitLab** in your browser:</span>
- <span style="font-size: 12.0pt; line-height: 107%;">[https://gitlab.cs.uwindsor.ca](https://gitlab.cs.uwindsor.ca) </span>
- <span style="font-size: 12.0pt; line-height: 107%;">Log in with your CS credentials</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Open **User Preferences**</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Go to **SSH Keys**</span>

[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/dz9image.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/dz9image.png)

[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/cDCimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/cDCimage.png)

**<span style="font-size: 12.0pt; line-height: 107%;">Copy Your Public Key (from your computer)</span>**

- <span style="font-size: 12.0pt; line-height: 107%;">Display the public key:</span>

`<span style="font-size: 12.0pt; line-height: 107%;">cat ~/.ssh/id_ed25519.pub</span>`

*<span style="font-size: 12.0pt; line-height: 107%;">(If you used a different filename, replace id\_ed25519 accordingly.)</span>*

- <span style="font-size: 12.0pt; line-height: 107%;">Select and copy the **entire output** (starts with ssh-ed25519)</span>

**<span style="font-size: 12.0pt; line-height: 107%;">Add the Key in GitLab</span>**

- <span style="font-size: 12.0pt; line-height: 107%;">Paste the key into the **Key** field</span>
- <span style="font-size: 12.0pt; line-height: 107%;">(Optional) Set a descriptive **Title** (e.g., Laptop – CS GitLab)</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Click **Add key** </span>

[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/4fqimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/4fqimage.png)

[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/vgiimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/vgiimage.png)

**<span style="font-size: 12.0pt; line-height: 107%;">Quick Verification (Optional but Recommended)</span>**

- <span style="font-size: 12.0pt; line-height: 107%;">Test the SSH connection:</span>

`<span style="font-size: 12.0pt; line-height: 107%;">ssh -T git@gitlab.cs.uwindsor.ca</span>`

- <span style="font-size: 12.0pt; line-height: 107%;">You should see a success message indicating authentication worked</span>

<p class="callout info">**<span style="font-size: 12.0pt; line-height: 107%;">Notes for Students</span>**</p>

- <span style="font-size: 12.0pt; line-height: 107%;">You can add **multiple SSH keys** to the same GitLab account (one per device)</span>
- <span style="font-size: 12.0pt; line-height: 107%;">This key is for **your local computer only**</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Do **not** upload private keys (id\_ed25519)—only the .pub file</span>

---

<span style="font-size: 12.0pt; line-height: 107%;"> </span>

##### **<u><span style="font-size: 12.0pt; line-height: 107%;">3. Configure Your IDE (VS Code) to Use GitLab</span></u>**

- <span style="font-size: 12.0pt; line-height: 107%;">Install **[Visual Studio Code](https://code.visualstudio.com/download)** if it is not already installed</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Ensure **[Git](https://git-scm.com/install/)** is installed on your system and available in your terminal</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Open **VS Code**</span>

**<span style="font-size: 12.0pt; line-height: 107%;">Verify Git Is Detected by VS Code</span>**

- <span style="font-size: 12.0pt; line-height: 107%;">Open the integrated terminal in VS Code:</span>
- <span style="font-size: 12.0pt; line-height: 107%;">View → Terminal</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Check Git availability:</span>

`<span style="font-size: 12.0pt; line-height: 107%;">git --version</span>`

- <span style="font-size: 12.0pt; line-height: 107%;">If Git is detected, VS Code will automatically enable source control features</span>

<span style="font-size: 12.0pt; line-height: 107%;"> </span>

**<span style="font-size: 12.0pt; line-height: 107%;">Configure VS Code to Use Your SSH Key</span>**

- <span style="font-size: 12.0pt; line-height: 107%;">Ensure the SSH agent is running (from earlier step)</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Confirm your SSH key is loaded:</span>

`<span style="font-size: 12.0pt; line-height: 107%;">ssh-add -l</span>`

- <span style="font-size: 12.0pt; line-height: 107%;">You should see your id\_ed25519 (or chosen key name)</span>

<span style="font-size: 12.0pt; line-height: 107%;">VS Code uses the system SSH configuration automatically—**no extra setup is required** if SSH works in the terminal.</span>

<span style="font-size: 12.0pt; line-height: 107%;"> </span>

**<span style="font-size: 12.0pt; line-height: 107%;">(Optional but Recommended) Configure Git Identity</span>**

- <span style="font-size: 12.0pt; line-height: 107%;">Set your name and email (used in commits):</span>

`<span style="font-size: 12.0pt; line-height: 107%;">git config --global user.name "Your Full Name"</span>`

`<span style="font-size: 12.0pt; line-height: 107%;">git config --global user.email "yourusername@uwindsor.ca"</span>`

<span style="font-size: 12.0pt; line-height: 107%;"> </span>

**<span style="font-size: 12.0pt; line-height: 107%;">(Optional) Test GitLab Access from VS Code</span>**

- <span style="font-size: 12.0pt; line-height: 107%;">From the VS Code terminal, test SSH:</span>

`<span style="font-size: 12.0pt; line-height: 107%;">ssh -T git@gitlab.cs.uwindsor.ca</span>`

- <span style="font-size: 12.0pt; line-height: 107%;">A success message confirms VS Code can authenticate with **GitLab**</span>

<span style="font-size: 12.0pt; line-height: 107%;"> </span>

<p class="callout info">**<span style="font-size: 12.0pt; line-height: 107%;">Notes for Students</span>**</p>

- <span style="font-size: 12.0pt; line-height: 107%;">VS Code does **not** store your SSH key; it uses the system SSH agent</span>
- <span style="font-size: 12.0pt; line-height: 107%;">If Git works in the terminal, it will work in VS Code</span>
- <span style="font-size: 12.0pt; line-height: 107%;">You only need to do this setup **once per computer**</span>

---

<span style="font-size: 12.0pt; line-height: 107%;"> </span>

##### **<u><span style="font-size: 12.0pt; line-height: 107%;">4. Create a Project on GitLab and Get the SSH Remote URL</span></u>**

- <span style="font-size: 12.0pt; line-height: 107%;">Open **GitLab** in your browser:</span>
- <span style="font-size: 12.0pt; line-height: 107%;">[https://gitlab.cs.uwindsor.ca](https://gitlab.cs.uwindsor.ca) </span>
- <span style="font-size: 12.0pt; line-height: 107%;">Log in with your CS credentials</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Click **New Project**</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Choose **Create blank project**</span>

[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/Thzimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/Thzimage.png)

[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/uw9image.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/uw9image.png)

[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/YIWimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/YIWimage.png)

**<span style="font-size: 12.0pt; line-height: 107%;">Project Setup</span>**

- <span style="font-size: 12.0pt; line-height: 107%;">Enter a **Project name** (e.g., myweb-project)</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Leave **Visibility** as default (Private)</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Click **Create project**</span>

<div align="center" class="MsoNormal" id="bkmrk--11" style="text-align: center;">  
</div>**<span style="font-size: 12.0pt; line-height: 107%;">Get the SSH Remote URL</span>**

- <span style="font-size: 12.0pt; line-height: 107%;">After the project is created, open the project page</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Click **Code** (or **Clone**)</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Select **SSH**</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Copy the SSH URL, which looks like:</span>

`<span style="font-size: 12.0pt; line-height: 107%;">git@gitlab.cs.uwindsor.ca:yourusername/myweb-project.git</span>`

[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/d6yimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/d6yimage.png)

<span style="font-size: 12.0pt; line-height: 107%;"> </span>

<p class="callout info">**<span style="font-size: 12.0pt; line-height: 107%;">Notes for Students</span>**</p>

- **<span style="font-size: 12.0pt; line-height: 107%;">Always use the SSH URL</span>**<span style="font-size: 12.0pt; line-height: 107%;">, not HTTPS</span>
- <span style="font-size: 12.0pt; line-height: 107%;">This URL will be used to connect:</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Your **local project**</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Your **MyWeb deployment**</span>

- <span style="font-size: 12.0pt; line-height: 107%;">You only create the GitLab project **once**</span>

---

<span style="font-size: 12.0pt; line-height: 107%;"> </span>

##### **<u><span style="font-size: 12.0pt; line-height: 107%;">5. Initialize the Local Project and Push Code to GitLab</span></u>**

<span style="font-size: 12.0pt; line-height: 107%;">This step connects your **local code** to the **GitLab repository** you just created.</span>

<span style="font-size: 12.0pt; line-height: 107%;"> </span>

**<span style="font-size: 12.0pt; line-height: 107%;">If You Are Starting with New Code (No Existing MyWeb Files)</span>**

- <span style="font-size: 12.0pt; line-height: 107%;">Open a terminal **inside your project folder**</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Initialize Git:</span>

`<span style="font-size: 12.0pt; line-height: 107%;">git init</span>`

- <span style="font-size: 12.0pt; line-height: 107%;">Add the GitLab remote (use the SSH URL you copied):</span>

`<span style="font-size: 12.0pt; line-height: 107%;">git remote add origin git@gitlab.cs.uwindsor.ca:yourusername/myweb-project.git</span>`

- <span style="font-size: 12.0pt; line-height: 107%;">Add all files:</span>

`<span style="font-size: 12.0pt; line-height: 107%;">git add .</span>`

- <span style="font-size: 12.0pt; line-height: 107%;">Commit the initial version:</span>

`<span style="font-size: 12.0pt; line-height: 107%;">git commit -m "Initial commit"</span>`

- <span style="font-size: 12.0pt; line-height: 107%;">Push to GitLab:</span>

`<span style="font-size: 12.0pt; line-height: 107%;">git branch -M main</span>`

`<span style="font-size: 12.0pt; line-height: 107%;">git push -u origin main</span>`

<div align="center" class="MsoNormal" id="bkmrk--14" style="text-align: center;">  
</div>**<span style="font-size: 12.0pt; line-height: 107%;">If Code Already Exists on MyWeb (Common Case)</span>**

- <span style="font-size: 12.0pt; line-height: 107%;">First, make sure your local project folder contains the files from **MyWeb (public\_html)**</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Download them from MyWeb (zip or File Manager)</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Or copy them manually</span>

- <span style="font-size: 12.0pt; line-height: 107%;">Then, inside that folder:</span>

`<span style="font-size: 12.0pt; line-height: 107%;">git init</span>`

`<span style="font-size: 12.0pt; line-height: 107%;">git remote add origin git@gitlab.cs.uwindsor.ca:yourusername/myweb-project.git</span>`

`<span style="font-size: 12.0pt; line-height: 107%;">git add .</span>`

`<span style="font-size: 12.0pt; line-height: 107%;">git commit -m "Initial import from MyWeb"</span>`

`<span style="font-size: 12.0pt; line-height: 107%;">git branch -M main</span>`

`<span style="font-size: 12.0pt; line-height: 107%;">git push -u origin main</span>`

<span style="font-size: 12.0pt; line-height: 107%; font-family: 'Segoe UI Symbol',sans-serif; mso-bidi-font-family: 'Segoe UI Symbol';">✔</span><span style="font-size: 12.0pt; line-height: 107%;"> GitLab now contains the full website code  
</span><span style="font-size: 12.0pt; line-height: 107%; font-family: 'Segoe UI Symbol',sans-serif; mso-bidi-font-family: 'Segoe UI Symbol';">✔</span><span style="font-size: 12.0pt; line-height: 107%;"> GitLab becomes the **source of truth**</span>

<span style="font-size: 12.0pt; line-height: 107%;"> </span>

<p class="callout info">**<span style="font-size: 12.0pt; line-height: 107%;">Notes for Students</span>**</p>

- <span style="font-size: 12.0pt; line-height: 107%;">This initialization happens **once**</span>
- <span style="font-size: 12.0pt; line-height: 107%;">After this step:</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Do **not** treat MyWeb as the main copy</span>
- <span style="font-size: 12.0pt; line-height: 107%;">All future changes start locally</span>


---

<span style="font-size: 12.0pt; line-height: 107%;"> </span><span style="font-size: 12.0pt; line-height: 107%;"> </span>

##### **<u><span style="font-size: 12.0pt; line-height: 107%;">6. Create a Deployment SSH Key in MyWeb (DirectAdmin)</span></u>**

<span style="font-size: 12.0pt; line-height: 107%;">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.</span>

- <span style="font-size: 12.0pt; line-height: 107%;">Log in to **MyWeb (DirectAdmin)**</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Go to **Advanced features** → **SSH Keys**</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Click **Create Key**</span>

[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/L4yimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/L4yimage.png)

[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/hTSimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/hTSimage.png)

**<span style="font-size: 12.0pt; line-height: 107%;">Fill in the fields</span>**

- **<span style="font-size: 12.0pt; line-height: 107%;">Key ID</span>**<span style="font-size: 12.0pt; line-height: 107%;">: gitlab (or any short name)</span>
- **<span style="font-size: 12.0pt; line-height: 107%;">Authorize</span>**<span style="font-size: 12.0pt; line-height: 107%;">: </span><span style="font-size: 12.0pt; line-height: 107%; font-family: 'Segoe UI Symbol',sans-serif; mso-bidi-font-family: 'Segoe UI Symbol';">✔</span><span style="font-size: 12.0pt; line-height: 107%;"> checked</span>
- **<span style="font-size: 12.0pt; line-height: 107%;">Comment</span>**<span style="font-size: 12.0pt; line-height: 107%;">: yourusername@gitlab.cs.uwindsor.ca</span>
- **<span style="font-size: 12.0pt; line-height: 107%;">Key Size</span>**<span style="font-size: 12.0pt; line-height: 107%;">: 2048</span>
- **<span style="font-size: 12.0pt; line-height: 107%;">Password</span>**<span style="font-size: 12.0pt; line-height: 107%;">: leave **empty**</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Click **Create**</span>

[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/OxYimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/OxYimage.png)

**<span style="font-size: 12.0pt; line-height: 107%;">Copy the Public Key</span>**

- <span style="font-size: 12.0pt; line-height: 107%;">After creation, copy the **public key** (the .pub content)</span>
- <span style="font-size: 12.0pt; line-height: 107%;">You will add this key to **GitLab** in the next step</span>

[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/qBcimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/qBcimage.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)*

<p class="callout info">**<span style="font-size: 12.0pt; line-height: 107%;">Notes for Students</span>**</p>

- <span style="font-size: 12.0pt; line-height: 107%;">This key stays on the **server**</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Do **not** download or reuse it on your computer</span>
- <span style="font-size: 12.0pt; line-height: 107%;">One MyWeb key can be reused for multiple repositories</span>

---

<span style="font-size: 12.0pt; line-height: 107%;"> </span><span style="font-size: 12.0pt; line-height: 107%;"> </span>

##### **<u><span style="font-size: 12.0pt; line-height: 107%;">7. Add the MyWeb SSH Key to GitLab</span></u>**

<span style="font-size: 12.0pt; line-height: 107%;">This step authorizes **MyWeb** to access your GitLab repository for **Fetch** and **Deploy**.</span>

- <span style="font-size: 12.0pt; line-height: 107%;">Open **GitLab** in your browser:</span>
- <span style="font-size: 12.0pt; line-height: 107%;">[https://gitlab.cs.uwindsor.ca](https://gitlab.cs.uwindsor.ca) </span>
- <span style="font-size: 12.0pt; line-height: 107%;">Log in with your CS credentials</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Go to **User Preferences**</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Select **SSH Keys**</span>

[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/HaCimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/HaCimage.png)

**<span style="font-size: 12.0pt; line-height: 107%;">Add the MyWeb Public Key</span>**

- <span style="font-size: 12.0pt; line-height: 107%;">Paste the **public SSH key** you copied from **MyWeb**</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Set a clear **Title** (e.g., MyWeb Deployment Key)</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Click **Add key**</span>

[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/l4timage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/l4timage.png)

<p class="callout info">**<span style="font-size: 12.0pt; line-height: 107%;">Notes for Students</span>**</p>

- <span style="font-size: 12.0pt; line-height: 107%;">This key is **server-side only** (deployment)</span>
- <span style="font-size: 12.0pt; line-height: 107%;">It is **different** from your local computer’s SSH key</span>
- <span style="font-size: 12.0pt; line-height: 107%;">GitLab allows **multiple SSH keys** per account</span>

---

<span style="font-size: 12.0pt; line-height: 107%;"> </span><span style="font-size: 12.0pt; line-height: 107%;"> </span>

##### **<u><span style="font-size: 12.0pt; line-height: 107%;">8. Initialize and Connect the Repository in MyWeb (DirectAdmin)</span></u>**

<span style="font-size: 12.0pt; line-height: 107%;">This step links **MyWeb** to your **GitLab repository** so it can deploy your code.</span>

- <span style="font-size: 12.0pt; line-height: 107%;">Log in to **MyWeb (DirectAdmin)**</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Go to **Advanced Features -&gt; Git**</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Click **Create Repository**</span>

[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/OqZimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/OqZimage.png)

[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/cR1image.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/cR1image.png)

**<span style="font-size: 12.0pt; line-height: 107%;">Fill in the Repository Details</span>**

- **<span style="font-size: 12.0pt; line-height: 107%;">Domain</span>**<span style="font-size: 12.0pt; line-height: 107%;">: select your MyWeb domain (auto-filled)</span>
- **<span style="font-size: 12.0pt; line-height: 107%;">Name</span>**<span style="font-size: 12.0pt; line-height: 107%;">: any label (e.g., myweb-site)</span>
- **<span style="font-size: 12.0pt; line-height: 107%;">Remote</span>**<span style="font-size: 12.0pt; line-height: 107%;">: paste the **SSH URL** of your GitLab repository</span>
    - <span style="font-size: 12.0pt; line-height: 107%;">git@gitlab.cs.uwindsor.ca:yourusername/myweb-project.git</span>
- **<span style="font-size: 12.0pt; line-height: 107%;">Keyfile</span>**<span style="font-size: 12.0pt; line-height: 107%;">: select or enter the path to the private key created in MyWeb</span>
    - <span style="font-size: 12.0pt; line-height: 107%;">.ssh/gitlab (the exact file name you have in .ssh folder)</span>

- <span style="font-size: 12.0pt; line-height: 107%;">Click **Create Repository**</span>

[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/qltimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/qltimage.png)

**<span style="font-size: 12.0pt; line-height: 107%;">What This Does</span>**

- <span style="font-size: 12.0pt; line-height: 107%;">Creates a local Git repository on MyWeb</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Links it to GitLab using SSH</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Prepares MyWeb for deployment (no files are changed yet)</span>

<span style="font-size: 12.0pt; line-height: 107%;"> </span>

<p class="callout info">**<span style="font-size: 12.0pt; line-height: 107%;">Notes for Students</span>**</p>

- <span style="font-size: 12.0pt; line-height: 107%;">Always use the **SSH remote**, not HTTPS</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Do not include full /home/... paths in the Keyfile field</span>
- <span style="font-size: 12.0pt; line-height: 107%;">This setup is done **once per project**</span>

---

<span style="font-size: 12.0pt; line-height: 107%;"> </span>

##### **<u><span style="font-size: 12.0pt; line-height: 107%;">9. Fetch and Deploy the Code to MyWeb</span></u>**

<span style="font-size: 12.0pt; line-height: 107%;">This step publishes your GitLab code to your **MyWeb website**.</span>

<span style="font-size: 12.0pt; line-height: 107%;"> </span>

**<span style="font-size: 12.0pt; line-height: 107%;">Fetch From GitLab</span>**

- <span style="font-size: 12.0pt; line-height: 107%;">In **MyWeb (DirectAdmin)**, go to **Git**</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Locate your repository</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Click the **three dots (**</span>**<span style="font-size: 12.0pt; line-height: 107%; font-family: 'Cambria Math',serif; mso-bidi-font-family: 'Cambria Math';">⋯</span><span style="font-size: 12.0pt; line-height: 107%;">)</span>**<span style="font-size: 12.0pt; line-height: 107%;"> next to it</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Click **Fetch**</span>

[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/scaled-1680-/bELimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-02/bELimage.png)

**<span style="font-size: 12.0pt; line-height: 107%;">What Fetch does:</span>**

- <span style="font-size: 12.0pt; line-height: 107%;">Connects to GitLab</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Retrieves the latest commits and branch information</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Does **not** change your website files</span>

**<span style="font-size: 12.0pt; line-height: 107%;">Deploy to MyWeb</span>**

- <span style="font-size: 12.0pt; line-height: 107%;">Click the **three dots (**</span>**<span style="font-size: 12.0pt; line-height: 107%; font-family: 'Cambria Math',serif; mso-bidi-font-family: 'Cambria Math';">⋯</span><span style="font-size: 12.0pt; line-height: 107%;">)</span>**<span style="font-size: 12.0pt; line-height: 107%;"> again</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Click **Deploy**</span>

**<span style="font-size: 12.0pt; line-height: 107%;">What Deploy does:</span>**

- <span style="font-size: 12.0pt; line-height: 107%;">Checks out the latest commit (usually from main)</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Copies files into:</span>
- <span style="font-size: 12.0pt; line-height: 107%;">public\_html/</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Makes the code live on your website</span>

<span style="font-size: 12.0pt; line-height: 107%;"> </span>

**<span style="font-size: 12.0pt; line-height: 107%;">Verify Deployment</span>**

- <span style="font-size: 12.0pt; line-height: 107%;">Open **File Manager**</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Confirm files appear in public\_html</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Visit your website in a browser:</span>
- <span style="font-size: 12.0pt; line-height: 107%;">https://yourproject.myweb.cs.uwindsor.ca/</span>

<span style="font-size: 12.0pt; line-height: 107%;"> </span>

<p class="callout info">**<span style="font-size: 12.0pt; line-height: 107%;">Important Notes for Students</span>**</p>

- <span style="font-size: 12.0pt; line-height: 107%;">Always **Fetch before Deploy**</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Do **not** edit files in File Manager or via FTP after Git is enabled</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Manual changes will be overwritten on the next deploy</span>

<span style="font-size: 12.0pt; line-height: 107%;"> </span>

**<span style="font-size: 12.0pt; line-height: 107%; font-family: 'Segoe UI Emoji',sans-serif; mso-bidi-font-family: 'Segoe UI Emoji';">✅</span><span style="font-size: 12.0pt; line-height: 107%;"> Setup Complete</span>**

<span style="font-size: 12.0pt; line-height: 107%;">You have now:</span>

- <span style="font-size: 12.0pt; line-height: 107%;">Connected your local computer to GitLab</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Connected MyWeb to GitLab</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Deployed your site using Git</span>

---

<p class="callout success">**<span style="font-size: 12.0pt; line-height: 107%;">Daily Workflow Reminder</span>**</p>

- <span style="font-size: 12.0pt; line-height: 107%;">Edit code locally</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Commit and push to GitLab</span>
- <span style="font-size: 12.0pt; line-height: 107%;">Fetch and Deploy from MyWeb</span>

<span style="font-size: 12.0pt; line-height: 107%;"></span>

# MyWeb Tutorials: Connect to DB remotely

<span style="font-size: 12.0pt; line-height: 107%;">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.</span>

- <span style="font-size: 12.0pt; line-height: 107%;">Login to [https://myweb.cs.uwindsor.ca](https://myweb.cs.uwindsor.ca) with your username and password</span>
- <span style="font-size: 12.0pt; line-height: 107%;">From "Account Manager" -&gt; Databases. Select or create the database you want to connect to:  
    </span>  
    [![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-03/scaled-1680-/image.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-03/image.png)
- <span style="font-size: 12.0pt; line-height: 107%;">Click on “Manage”  
    </span>
    
      
    [![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-03/scaled-1680-/3g9image.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-03/3g9image.png)
    
    <span style="font-size: 12.0pt; line-height: 107%;">  
    </span>
- <span style="font-size: 12.0pt; line-height: 107%; font-family: 'Aptos',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Aptos; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: Arial; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-CA; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;">Select the user you want to connect with, and click on “Manage”  
    </span>  
    [![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-03/scaled-1680-/AEcimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-03/AEcimage.png)
- <span style="font-size: 12.0pt; line-height: 107%;">Scroll down to “Allowed Hosts” and add % in the “Allow access from” and click on “Add Host”  
    </span>
    
      
    [![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-03/scaled-1680-/QNeimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-03/QNeimage.png)
    
    *<span style="font-size: 12.0pt; line-height: 107%;">Note: % means any host</span>*
- <span style="font-size: 12.0pt; line-height: 107%;">That’s it.   
      
    </span>
- <span style="font-size: 12.0pt; line-height: 107%;">Now you can test connecting to the database from your computer (after connecting to [VPN](https://help.cs.uwindsor.ca/books/cs-help/page/vpn "VPN")).  
      
    *Example:*</span>
    
    ```
    Host: myweb.cs.uwindsor.ca
    Port: 3306
    Database: testproj1_myDB
    Username: testproj1_myDB
    Password: <DB password> 
    ```

<span style="font-size: 12.0pt; line-height: 107%;">You can use any client to connect and manage the database from your computer. I recommend HeidiSQL [https://www.heidisql.com/download.php](https://www.heidisql.com/download.php)   
  
</span>

[![image.png](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-03/scaled-1680-/KHMimage.png)](https://help.cs.uwindsor.ca/uploads/images/gallery/2026-03/KHMimage.png)