# Project export: Side Project

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: CruzHacks 2024
- Tagline: SideProject is your one-stop shop for all things collaboration. From carpentry and C++ to genomic mapping and graphic design, you can find peers to work with on SideProject.
- Devpost: https://devpost.com/software/side-project
- GitHub: https://github.com/Bod1eF/side-project-reborn
- Demo: https://side-project.in/
- Team: 4 GitHub contributor(s) — Bodie Feinberg (56 commits), katelynsun (30 commits), Mira Prabhakar (27 commits), Bhavya-212 (5 commits)

## Devpost submission (written by the team)

### Inspiration

We were inspired ##

### What it does

Side Project is a Full Stack CRUD app, that allows users to post about projects they are working on/want to work on to a public board. They can find people to collaborate with this board. ##

### How we built it

We built it with a PHP and MySQL backend, with a vanilla HTML, CSS, and JS frontend. ##

### Challenges we ran into

We originally tried to make the app in React and FireBase but decided to switch after being unable to do so for 6 hours. ##

### Accomplishments we're proud of

We're proud of having a finished project after such a large setback and making something for all of our' first-ever hackathon. ##

### What we learned

We learned a great deal about work delegation, having lots of back up plans, and using the underlying technologies. ##

### What's next

An expansion of features such as profile pages, which we planned to make but lacked time.

## README (from the GitHub repository)

cruzhacks project, reborn ^_^


## Detected evidence (automated analysis)

Indexed codebase: 12 recognized source files, 38 KB.
- CSS (language) — detected in the code
- HTML (language) — detected in the code
- JavaScript (language) — detected in the code
- PHP (language) — detected in the code
- SQL (language) — detected in the code

## Codebase structure (from repository index)

### Files (12 of 12)

```
databse.sql
form.php
index.css
index.php
js/minimal-theme-switcher.js
loggedin.html
login.php
logout.php
myprofile.html
profile.php
README.md
signup.php
```

### Dependencies

No dependency index available.

### Recent commits (newest first)

- mild fixes
- updated png
- Merge branch 'main' of https://github.com/Bod1eF/side-project-reborn
- live
- updated final
- updated png
- live
- logged in
- update
- added cats
- update profile
- Merge branch 'main' of https://github.com/Bod1eF/side-project-reborn
- ignore
- stlyed sign up
- Update login.php
- Merge branch 'main' of https://github.com/Bod1eF/side-project-reborn
- Update index.php
- my profile
- Update index.php
- rwq

## Key source files (fetched from GitHub, selected and truncated for size)

### profile.php

```php
<!doctype html>
<html lang="en">
<head>
 <title>Side Project</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<link href="index.css" rel="stylesheet" type="text/css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="cssandjs/home.js"></script>
</head>
<body>
  <h1> Side Project </h1>
  <a href="signin.php">Sign In</a>

</body>
</html>
```

### logout.php

```php
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Sign Out</title>
    <link rel="stylesheet" href="style.css">
  </head>
  <body>
      <?php
      session_start();
      session_destroy();
      session_unset();
      header("Location: index.php");
      ?>
  </body>
</html>
```

### databse.sql

```sql
CREATE TABLE IF NOT EXISTS `user` (
  `id` int NOT NULL AUTO_INCREMENT,
  `isAdmin` boolean,
  `email` text,
  `password` text,
  `schoolyear` int,
  PRIMARY KEY (`id`)
);

CREATE TABLE IF NOT EXISTS `posts` (
`id` int NOT NULL AUTO_INCREMENT,
`title` varchar(32),
`body` varchar(300),
`name` varchar(18),
`category` varchar(16),
`num_collaborators` int,
`date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`user_id` int,

 PRIMARY KEY (`id`)
);

```

### index.css

```css
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=swap');


/* Grid */
body>main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: calc(100vh - 7rem);
    padding: 1rem 0;
  }
  
  article {
    padding: 0;
    overflow: hidden;
  }
  
  article div {
    padding: 1rem;
  }
  
  @media (min-width: 576px) {
    body>main {
      padding: 1.25rem 0;
    }
  
    article div {
      padding: 1.25rem;
    }
  }
  
  @media (min-width: 768px) {
    body>main {
      padding: 1.5rem 0;
    }
  
    article div {
      padding: 1.5rem;
    }
  }
  
  @media (min-width: 992px) {
    body>main {
      padding: 1.75rem 0;
    }
  
    article div {
      padding: 1.75rem;
    }
  }
  
  @media (min-width: 1200px) {
    body>main {
      padding: 2rem 0;
    }
  
    article div {
      padding: 2rem;
    }
  }
  
  /* Nav */
  summary[role="link"].secondary:is([aria-current], :hover, :active, :focus) {
    background-color: transparent;
    color: var(--secondary-hover);
  }
  
  /* Hero Image */
  article div:nth-of-type(2) {
    display: none;
    background-color: #374956;
    background-image: url("img/alessio-soggetti-8jeWeKdygfk-unsplash-1000x1200.jpg");
    background-position: center;
    background-size: cover;
  }
  
  @media (min-width: 992px) {
    .grid>div:nth-of-type(2) {
      display: block;
    }
  }
  
  /* Footer */
  body>footer {
    padding: 1rem 0;
  }
```

### signup.php

```php
<!doctype html>
<html lang="en">
<head>
 <title>Side Project</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="index.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="cssandjs/home.js"></script>
<style>

body {
 background-color: #e2d5ed;
}
    
#logged_in {
  display:flex;
  justify-content:center;

}

body,h1,h2,h3,h4,h5 {font-family: "Poppins", sans-serif}
body {font-size:16px;}
.w3-half img{margin-bottom:-6px;margin-top:16px;opacity:0.8;cursor:pointer}
.w3-half img:hover{opacity:1}
</style>
</head>

<body>

<!-- Sidebar/menu -->
<nav class="w3-sidebar w3-silver w3-collapse w3-top w3-large w3-padding" style="z-index:3;width:300px;font-weight:bold;" id="mySidebar"><br>
    <a href="javascript:void(0)" onclick="w3_close()" class="w3-button w3-hide-large w3-display-topleft" style="width:100%;font-size:22px">Close Menu</a>
    <div class="w3-container">
    </div>
    <div class="w3-bar-block">
      <h1> Side Project </h1>
      <h1> Register an Account </h1>
<form action="login.php" method="POST">

<div>
<label for="email"> Email: </label>
<input required type="email" name="email" id="email">
</div>

<div>
<label for="password"> Password: </label>
<input required type="password" name="password" id="password">
</div>

<input type="submit" value="Create Account">
</form>
<div id="links">
<a href="signup.php">Don't have an account? Register one here</a>
    </div>
  </nav>    

<!-- Top menu on small screens -->
<header class="w3-container w3-top w3-hide-large w3-white w3-xlarge w3-padding">
    <a href="javascript:void(0)" class="w3-button w3-white w3-margin-right" onclick="w3_open()">☰</a>
    <span>Side Project</span>
  </header>
  
<!-- Overlay effect when opening sidebar on small screens -->
<div class="w3-overlay w3-hide-large" onclick="w3_close()" style="cursor:pointer" title="close side menu" id="myOverlay"></div>
  
<!-- !PAGE CONTENT! -->
<div class="w3-main" style="margin-left:340px;margin-right:40px">
<img src="Untitled_Artwork.png"
    width="900"
    height="500">
    <p style="color:#383436">The #1 website to find collaborators for any project!</p>
</body>
</html>
```

### login.php

```php
<?php
session_start();
require_once "sql_config.php";

//account register
$new_account = false;

if (isset($_POST["email"]) && isset($_POST["password"]) == true) { //if coming from register, update user table to create account
  if (filter_var(htmlspecialchars($_POST["email"]), FILTER_VALIDATE_EMAIL)) { //validates email is legit

    echo "registering account";
    try {
      $dbh = new PDO($DB_DSN, $DB_USER, $DB_PASSWORD);
      $sth = $dbh->prepare("INSERT INTO user (`email`, `password`, `isAdmin`)
      VALUES (:reg_email, :reg_password, false);"); //store account info into database
      $sth->bindValue(':reg_email', htmlspecialchars($_POST["email"]));
      $sth->bindValue(':reg_password', password_hash(htmlspecialchars($_POST["password"]), PASSWORD_DEFAULT));
      $sth->execute();
      $sth_id = $dbh->prepare("SELECT * FROM user WHERE `email`=:reg_email"); //gets user row of newly created account
      $sth_id->bindValue(':reg_email', htmlspecialchars($_POST["email"]));
      $sth_id->execute();
      $reg_id = $sth_id->fetch();
      $new_account = true;
      echo "<<h1 id='logged_in'>Account registered</h1>";
    } 
    catch(PDOException $e) {
      echo "Connection failed: " . $e->getMessage();
    }
}
}
?>
<!doctype html>
<html lang="en">
<head>
 <title>Side Project</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="index.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="cssandjs/home.js"></script>
<style>

body {
 background-color: #e2d5ed;
}
    
#logged_in {
  font-size:16px;
  color: #000000;
  display:flex;
  justify-content:center;

}

body,h1,h2,h3,h4,h5 {font-family: "Poppins", sans-serif}
body {font-size:16px;}
.w3-half img{margin-bottom:-6px;margin-top:16px;opacity:0.8;cursor:pointer}
.w3-half img:hover{opacity:1}
</style>
</head>

<body>

<!-- Sidebar/menu -->
<nav class="w3-sidebar w3-silver w3-collapse w3-top w3-large w3-padding" style="z-index:3;width:300px;font-weight:bold;" id="mySidebar"><br>
    <a href="javascript:void(0)" onclick="w3_close()" class="w3-button w3-hide-large w3-display-topleft" style="width:100%;font-size:22px">Close Menu</a>
    <div class="w3-container">
    </div>
    <div class="w3-bar-block">
      <h1> Side Project </h1>
  <form action="form.php" method="POST">
<div>
<label for="user_login"> Email: </label>
<input type="email" name="user_login" id="user_login">
</div>
<br><br>
<div>
<label for="pass_login"> Password: </label>
<input type="password" name="pass_login" id="pass_login">
</div>
<br><br>
<input type="submit" value="Login">
</form>
<div id="links">
<a href="signup.php">Don't have an account? Register one here</a>
    </div>
  </nav>    

<!-- Top menu on small screens -->
<header class="w3-container w3-top w3-hide-large w3-white w3-xlarge w3-padding">
    <a href="javascript:void(0)" class="w3-button w3-white w3-margin-right" onclick="w3_open()">☰</a>
    <span>Side Project</span>
  </header>
  
<!-- Overlay effect when opening sidebar on small screens -->
<div class="w3-overlay w3-hide-large" onclick="w3_close()" style="cursor:pointer" title="close side menu" id="myOverlay"></div>
  
<!-- !PAGE CONTENT! -->
<div class="w3-main" style="margin-left:340px;margin-right:40px">
<a href="index.php">
<img src="Untitled_Artwork.png"
    width="900"
    height="500">
    <p style="color:#383436">The #1 website to find collaborators for any project!</p>
</a>
</body>
</html>
```

### myprofile.html

```html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Side Project</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins">
<style>

body {
 background-color: #e2d5ed; /* For browsers that do not support gradients */
 background-image: linear-gradient(#e2d5ed, #665375);
}

body,h1,h2,h3,h4,h5 {font-family: "Poppins", sans-serif}
body {font-size:16px;}
.w3-half img{margin-bottom:-6px;margin-top:16px;opacity:0.8;cursor:pointer}
.w3-half img:hover{opacity:1}
</style>
</head>
<body>

<!-- Sidebar/menu -->
<nav class="w3-sidebar w3-silver w3-collapse w3-top w3-large w3-padding" style="z-index:3;width:300px;font-weight:bold;" id="mySidebar"><br>
  <a href="javascript:void(0)" onclick="w3_close()" class="w3-button w3-hide-large w3-display-topleft" style="width:100%;font-size:22px">Close Menu</a>
  <div class="w3-container">
    <img src="Untitled_Artwork.png"
        width="200"
        height="100">
  </div>
  <div class="w3-bar-block">

    <a href="index.php" onclick="w3_close()" class="w3-bar-item w3-button w3-hover-white">Recent Posts</a> 
    <a href="index.php" onclick="w3_close()" class="w3-bar-item w3-button w3-hover-white">Contact</a>
    <a href="#designers" onclick="w3_close()" class="w3-bar-item w3-button w3-hover-white">Designers</a>    
  </div>
</nav>

<!-- Top menu on small screens -->
<header class="w3-container w3-top w3-hide-large w3-white w3-xlarge w3-padding">
  <a href="javascript:void(0)" class="w3-button w3-white w3-margin-right" onclick="w3_open()">☰</a>
  <span>Side Project</span>
</header>

<!-- Overlay effect when opening sidebar on small screens -->
<div class="w3-overlay w3-hide-large" onclick="w3_close()" style="cursor:pointer" title="close side menu" id="myOverlay"></div>

<!-- !PAGE CONTENT! -->
<div class="w3-main" style="margin-left:340px;margin-right:40px">

  <!-- Header -->
  <div class="w3-container" style="margin-top:80px" id="showcase">
  </div>
  
  <!-- Photo grid (modal) -->
  <div class="w3-row-padding">
  </div>

  <!-- Modal for full size images on click-->
  <div id="modal01" class="w3-modal w3-black" style="padding-top:0" onclick="this.style.display='none'">
    <span class="w3-button w3-black w3-xxlarge w3-display-topright">×</span>
    <div class="w3-modal-content w3-animate-zoom w3-center w3-transparent w3-padding-64">
      <img id="img01" class="w3-image">
      <p id="caption"></p>
    </div>
  </div>

  <!-- Services -->
  <div class="w3-container" id="services" style="margin-top:0px">
    <h1 class="w3-xxxlarge w3-text-white"><b>Your Profile</b></h1>
    <hr style="width:50px;border:5px solid whitesmoke" class="w3-round">
    <p style="color:whitesmoke">Your most recent posts.</p>
  </div>
  
  <!-- Recent Posts 3x6 Grid -->
  <div class="w3-row-padding w3-grayscale">
    <div class="w3-col m4 w3-margin-bottom">
      <div class="w3-light-grey">
        <img src="Bio_Cat.png" alt="John" style="width:100%">
        <div class="w3-container">
          <h3>John Doe</h3>
          <p class="w3-opacity">CEO & Founder</p>
          <p>(Insert link to GitHub/Project)</p>
        </div>
      </div>
    </div>
    <div class="w3-col m4 w3-margin-bottom">
      <div class="w3-light-grey">
        <img src="Tech_Cat.png" alt="Jane" style="width:100%">
        <div class="w3-container">
          <h3>Jane Doe</h3>
          <p class="w3-opacity">Designer</p>
          <p>(Insert link to GitHub/Project)</p>
        </div>
      </div>
    </div>
    <div class="w3-col m4 w3-margin-bottom">
      <div class="w3-light-grey">
        <img src="Art_Cat.png" alt="Mike" style="width:100%">
        <div class="w3-container">
          <h3>Mike Ross</h3>
          <p class="w3-opacity">Architect</p>
          <p>(Insert link to GitHub/Project)</p>
        </div>
      </div>
    </div>
  </div>
  <div class="w3-row-padding w3-grayscale">
    <div class="w3-col m4 w3-margin-bottom">
      <div class="w3-light-grey">
        <img src="Art_Cat.png" alt="John" style="width:100%">
        <div class="w3-container">
          <h3>John Doe</h3>
          <p class="w3-opacity">CEO & Founder</p>
          <p>(Insert link to GitHub/Project)</p>
        </div>
      </div>
    </div>
    <div class="w3-col m4 w3-margin-bottom">
      <div class="w3-light-grey">
        <img src="Bio_Cat.png" alt="Jane" style="width:100%">
        <div class="w3-container">
          <h3>Jane Doe</h3>
          <p class="w3-opacity">Designer</p>
          <p>(Insert link to GitHub/Project)</p>
        </div>
      </div>
    </div>
    <div class="w3-col m4 w3-margin-bottom">
      <div class="w3-light-grey">
        <img src="Bio_Cat.png" alt="Mike" style="width:100%">
        <div class="w3-container">
          <h3>Mike Ross</h3>
          <p class="w3-opacity">Architect</p>
          <p>(Insert link to GitHub/Project)</p>
        </div>
      </div>
    </div>
  </div>

  

<!-- End page content -->
</div>


<script>
// Script to open and close sidebar
function w3_open() {
  document.getElementById("mySidebar").style.display = "block";
  document.getElementById("myOverlay").style.display = "block";
}
 
function w3_close() {
  document.getElementById("mySidebar").style.display = "none";
  document.getElementById("myOverlay").style.display = "none";
}

// Modal Image Gallery
function onClick(element) {
  document.getElementById("img01").src = element.src;
  document.getElementById("modal01").style.display = "block";
  var captionText = document.getElementById("caption");
  captionText.innerHTML = element.alt;
}
</script>

</body>
</html>

```

### loggedin.html

```html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Side Project</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins">
<style>

body {
 background-color: #e2d5ed; /* For browsers that do not support gradients */
 background-image: linear-gradient(#e2d5ed, #665375);
}

body,h1,h2,h3,h4,h5 {font-family: "Poppins", sans-serif}
body {font-size:16px;}
.w3-half img{margin-bottom:-6px;margin-top:16px;opacity:0.8;cursor:pointer}
.w3-half img:hover{opacity:1}
</style>
</head>
<body>

<!-- Sidebar/menu -->
<nav class="w3-sidebar w3-silver w3-collapse w3-top w3-large w3-padding" style="z-index:3;width:300px;font-weight:bold;" id="mySidebar"><br>
  <a href="javascript:void(0)" onclick="w3_close()" class="w3-button w3-hide-large w3-display-topleft" style="width:100%;font-size:22px">Close Menu</a>
  <div class="w3-container">
    <img src="Untitled_Artwork.png"
        width="210"
        height="125">
  </div>
  <div class="w3-bar-block">
    <a href="loggedin.html" onclick="w3_close()" class="w3-bar-item w3-button w3-hover-white">Profile</a> 
    <a href="#showcase" onclick="w3_close()" class="w3-bar-item w3-button w3-hover-white">Recent Posts</a> 
    <a href="frontpage.html" onclick="w3_close()" class="w3-bar-item w3-button w3-hover-white">Log Out</a>
  </div>
</nav>

<!-- Top menu on small screens -->
<header class="w3-container w3-top w3-hide-large w3-white w3-xlarge w3-padding">
  <a href="javascript:void(0)" class="w3-button w3-white w3-margin-right" onclick="w3_open()">☰</a>
  <span>Side Project</span>
</header>

<!-- Overlay effect when opening sidebar on small screens -->
<div class="w3-overlay w3-hide-large" onclick="w3_close()" style="cursor:pointer" title="close side menu" id="myOverlay"></div>


<!-- !PAGE CONTENT! -->
<div class="w3-main" style="margin-left:340px;margin-right:40px">

    <!-- Header -->
    <div class="w3-container" style="margin-top:80px" id="showcase">
      <center><img src="Untitled_Artwork.png"
          width="600"
          height="300"></center>
    </div>
    
    <!-- Photo grid (modal) -->
    <div class="w3-row-padding">
    </div>
  
    <!-- Modal for full size images on click-->
    <div id="modal01" class="w3-modal w3-black" style="padding-top:0" onclick="this.style.display='none'">
      <span class="w3-button w3-black w3-xxlarge w3-display-topright">×</span>
      <div class="w3-modal-content w3-animate-zoom w3-center w3-transparent w3-padding-64">
        <img id="img01" class="w3-image">
        <p id="caption"></p>
      </div>
    </div>
  
    <!-- Services -->
    <div class="w3-container" id="services" style="margin-top:0px">
      <h1 class="w3-xxxlarge w3-text-white"><b>Recent Posts</b></h1>
      <hr style="width:50px;border:5px solid whitesmoke" class="w3-round">
      <p style="color:whitesmoke">See the most recent posts by fellow coders!</p>
    </div>
    
    <!-- Recent Posts 3x6 Grid -->
    <div class="w3-row-padding w3-grayscale">
      <div class="w3-col m4 w3-margin-bottom">
        <div class="w3-light-grey">
          <img src="Bio_Cat.png" alt="John" style="width:100%">
          <div class="w3-container">
            <h3>Observing UCSC raccoon behavior</h3>
            <p class="w3-opacity">John Doe </p>
            <p class="w3-opacity">JohnDoe@gmail.com</p>
            <p class="w3-opacity">Biology</p>
            <p>They are abnormally larger than normal racoons!</p>
          </div>
        </div>
      </div>
      <div class="w3-col m4 w3-margin-bottom">
        <div class="w3-light-grey">
          <img src="Tech_Cat.png" alt="Jane" style="width:100%">
          <div class="w3-container">
            <h3>Coding a Project database for UCSC students!</h3>
            <p class="w3-opacity">Jane Doe </p>
            <p class="w3-opacity">Jane Doe@gmail.com</p>
            <p class="w3-opacity">Tech</p>
            <p>(Insert link to GitHub/Project)</p>
          </div>
        </div>
      </div>
      <div class="w3-col m4 w3-margin-bottom">
        <div class="w3-light-grey">
          <img src="Art_Cat.png" alt="Mike" style="width:100%">
          <div class="w3-container">
            <h3>Drawing Cats</h3>
            <p class="w3-opacity">Mike Ross</p>
            <p class="w3-opacity">MikeRoss@gmail.com</p>
            <p class="w3-opacity">Art</p>
            <p>(Insert link to GitHub/Project)</p>
          </div>
        </div>
      </div>
    </div>
    <div class="w3-row-padding w3-grayscale">
      <div class="w3-col m4 w3-margin-bottom">
        <div class="w3-light-grey">
          <img src="Chainsaw_Cat.png" alt="John" style="width:100%">
          <div class="w3-container">
            <h3>Observing UCSC raccoon behavior</h3>
            <p class="w3-opacity">John Doe </p>
            <p class="w3-opacity">JohnDoe@gmail.com</p>
            <p class="w3-opacity">Biology</p>
            <p>They are abnormally larger than normal racoons!</p>
          </div>
        </div>
      </div>
      <div class="w3-col m4 w3-margin-bottom">
        <div class="w3-light-grey">
          <img src="Tech_Cat.png" alt="Jane" style="width:100%">
          <div class="w3-container">
            <h3>Coding a Project database for UCSC students!</h3>
            <p class="w3-opacity">Jane Doe </p>
            <p class="w3-opacity">Jane Doe@gmail.com</p>
            <p class="w3-opacity">Tech</p>
            <p>(Insert link to GitHub/Project)</p>
          </div>
        </div>
      </div>
      <div class="w3-col m4 w3-margin-bottom">
        <div class="w3-light-grey">
          <img src="Art_Cat.png" alt="Mike" style="width:100%">
          <div class="w3-container">
            <h3>Drawing Cats</h3>
            <p class="w3-opacity">Mike Ross</p>
            <p class="w3-opacity">MikeRoss@gmail.com</p>
            <p class="w3-opacity">A
[truncated — 1223 more characters]
```

### index.php

```php
<script>
    if ( window.history.replaceState ) {
        window.history.replaceState( null, null, window.location.href );
    }
</script>
<?php
session_start();
require_once "sql_config.php";
if (isset($_POST["title"]) && isset($_POST["body"]) && isset($_POST["category"]) && isset($_POST["name"]) && isset($_SESSION["user_id"])  == true) {//if coming from create post, add post to database
    
  try {
    $dbh = new PDO($DB_DSN, $DB_USER, $DB_PASSWORD);
    $acceptable_categories = ["tech", "bio", "crafts", "art"];
    if (!in_array(htmlspecialchars($_POST["category"]), $acceptable_categories)) {
      header("Location: logout.php");
      exit;
    }
    $sth = $dbh->prepare("INSERT INTO posts (`title`, `body`, `category`, `name`,`num_collaborators`, `user_id`)
    VALUES (:reg_title, :reg_body, :reg_category, :reg_name, 1, :reg_user_id);"); //store post data in posts db
    $sth->bindValue(':reg_title', htmlspecialchars($_POST["title"]));
    $sth->bindValue(':reg_body', htmlspecialchars($_POST["body"]));
    $sth->bindValue(':reg_category', htmlspecialchars($_POST["category"]));
    $sth->bindValue(':reg_name', htmlspecialchars($_POST["name"]));
    $sth->bindValue(':reg_user_id', htmlspecialchars($_SESSION["user_id"]));
    $sth->execute();
    echo '<script>alert("Post Submitted!")</script>'; 
  }
  catch (PDOException $e) {
    echo "<p>Error: {$e->getMessage()}</p>";
  }
}

try { //fetch all posts in the posts table 
  $dbh = new PDO($DB_DSN, $DB_USER, $DB_PASSWORD);
  $sth_posts= $dbh->prepare("SELECT email, title, body, name, category, date, num_collaborators FROM posts INNER JOIN user
  ON posts.user_id = user.id ORDER BY date DESC;");
  $sth_posts->execute();
  $arr_of_posts = $sth_posts->fetchAll(PDO::FETCH_ASSOC);  
}
catch (PDOException $e) {
  echo "<p>Error: {$e->getMessage()}</p>";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Side Project</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins">
<style>

body {
 background-color: #e2d5ed; /* For browsers that do not support gradients */
 background-image: linear-gradient(#e2d5ed, #665375);
}

body,h1,h2,h3,h4,h5 {font-family: "Poppins", sans-serif}
body {font-size:16px;}
.w3-half img{margin-bottom:-6px;margin-top:16px;opacity:0.8;cursor:pointer}
.w3-half img:hover{opacity:1}
</style>
</head>
<body>

<!-- Sidebar/menu -->
<nav class="w3-sidebar w3-silver w3-collapse w3-top w3-large w3-padding" style="z-index:3;width:300px;font-weight:bold;" id="mySidebar"><br>
  <a href="javascript:void(0)" onclick="w3_close()" class="w3-button w3-hide-large w3-display-topleft" style="width:100%;font-size:22px">Close Menu</a>
  <div class="w3-container">
    <h3 class="w3-padding-64"><b>Welcome!</b></h3>
  </div>
  <div class="w3-bar-block">
 <?php 

    try {
        if (isset($_SESSION["user_id"])) {
            echo '<a href="logout.php" onclick="w3_close()" class="w3-bar-item w3-button w3-hover-white">Log Out</a>';

      }
       else {
        echo '<a href="login.php" onclick="w3_close()" class="w3-bar-item w3-button w3-hover-white">Log In</a>';
      }
}

catch (PDOException $e) {
    echo "<p>Error: {$e->getMessage()}</p>";
  }


?>
    <a href="form.php" class="w3-bar-item w3-button w3-hover-white">Post a Project</a> 
    <a href="#showcase" onclick="w3_close()" class="w3-bar-item w3-button w3-hover-white">Recent Posts</a> 
    <a href="#designers" onclick="w3_close()" class="w3-bar-item w3-button w3-hover-white">Designers</a>
  
  </div>
</nav>

<!-- Top menu on small screens -->
<header class="w3-container w3-top w3-hide-large w3-white w3-xlarge w3-padding">
  <a href="javascript:void(0)" class="w3-button w3-white w3-margin-right" onclick="w3_open()">☰</a>
  <span>Side Project</span>
</header>

<!-- Overlay effect when opening sidebar on small screens -->
<div class="w3-overlay w3-hide-large" onclick="w3_close()" style="cursor:pointer" title="close side menu" id="myOverlay"></div>

<!-- !PAGE CONTENT! -->
<div class="w3-main" style="margin-left:340px;margin-right:40px">

  <!-- Header -->
  <div class="w3-container" style="margin-top:80px" id="showcase">
    <center><img src="Untitled_Artwork.png"
        width="600"
        height="300"></center>
  </div>
  
  <!-- Photo grid (modal) -->
  <div class="w3-row-padding">
  </div>

  <!-- Modal for full size images on click-->
  <div id="modal01" class="w3-modal w3-black" style="padding-top:0" onclick="this.style.display='none'">
    <span class="w3-button w3-black w3-xxlarge w3-display-topright">×</span>
    <div class="w3-modal-content w3-animate-zoom w3-center w3-transparent w3-padding-64">
      <img id="img01" class="w3-image">
      <p id="caption"></p>
    </div>
  </div>

  <!-- Services -->
  <div class="w3-container" id="services" style="margin-top:0px">
    <h1 class="w3-xxxlarge w3-text-white"><b>Recent Posts</b></h1>
    <hr style="width:50px;border:5px solid whitesmoke" class="w3-round">
    <p style="color:whitesmoke">See the most recent posts by fellow coders!</p>
  </div>
  
  <?php

  try {
  $count = 4;
  foreach($arr_of_posts as $post) {
    if ($count % 3 == 1) {
      echo "<div class='w3-row-padding w3-grayscale'>";
      echo "<p id='seperator'></p>";
    }
    echo '<div class="w3-col m4 w3-margin-bottom"><div class="w3-light-grey">';
    if ($post['category'] == "art") {
      echo '<img src="Art_Cat.png" alt="John" style="width:100%">';
    }
    elseif ($post['category'] == "bio") {
      echo '<img src="Bio_Cat.png" alt="John" style="width:100%">';
    }
    elseif ($post['category'] == "tech") {
      echo '<img src="Tech_Cat.png" alt="John" style="width:100%">';
    }
    else  {
      echo '<img src="Chainsaw_Cat.png" alt="John" style="width:100%">';
    }
    echo '<div class="w3-container">';
    echo '<h3>'  . $post['title'] .  '</h3>';
    echo '<p
[truncated — 1373 more characters]
```

### form.php

```php
<?php
  session_start();
  require_once "sql_config.php";

  try {
    if (isset($_SESSION["user_id"])) {
    }
    elseif (isset($_POST["user_login"]) && isset($_POST["pass_login"])) {//checks that user came from login
        $dbh =  new PDO($DB_DSN, $DB_USER, $DB_PASSWORD);
        $sth_password = $dbh->prepare("SELECT * FROM user WHERE email=:login_email");//find pass_hash where id matches login id
        $sth_password->bindValue(':login_email', htmlspecialchars($_POST["user_login"]));
        $sth_password->execute();
        $login_row = $sth_password->fetch();
        $user_id = $login_row["id"]; 
        $_SESSION["user_id"] = $user_id; //store user id in session

      if (password_verify(htmlspecialchars($_POST["pass_login"]), $login_row['password'])) { //verify password agaisnt hash
        echo "<h1 id='logged_in'> Succesfully Logged in as " . htmlspecialchars($_POST["user_login"]) . "</h2>";
      }
    else { //if password doesn't match send to sign in
      header('Location: index.php');
      exit;
    }
   }
   else { //if password doesn't match send to sign in
    header('Location: login.php');
    exit;
  }
  }
 
  catch (PDOException $e) {
    echo "<p>Error: {$e->getMessage()}</p>";
    }
    ?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Side Project</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins">
<style>
#logged_in {
  display:flex;
  justify-content:center;

}

#area {
  padding:10px;
}
body {
 background-color: #e2d5ed; /* For browsers that do not support gradients */
 background-image: linear-gradient(#e2d5ed, #665375);
}

body,h1,h2,h3,h4,h5 {font-family: "Poppins", sans-serif}
body {font-size:16px;}
.w3-half img{margin-bottom:-6px;margin-top:16px;opacity:0.8;cursor:pointer}
.w3-half img:hover{opacity:1}
</style>
</head>
<body>

<!-- Sidebar/menu -->
<nav class="w3-sidebar w3-silver w3-collapse w3-top w3-large w3-padding" style="z-index:3;width:300px;font-weight:bold;" id="mySidebar"><br>
  <a href="javascript:void(0)" onclick="w3_close()" class="w3-button w3-hide-large w3-display-topleft" style="width:100%;font-size:22px">Close Menu</a>
  <div class="w3-container">
    <a href="index.php">
    <img src="Untitled_Artwork.png"
        width="210"
        height="125">
</a>
  </div>

  <div class="w3-bar-block">
    <a href="loggedin.html" onclick="w3_close()" class="w3-bar-item w3-button w3-hover-white">Profile</a> 
    <a href="#showcase" onclick="w3_close()" class="w3-bar-item w3-button w3-hover-white">Recent Posts</a> 
    <a href="#contact" onclick="w3_close()" class="w3-bar-item w3-button w3-hover-white">Contact</a>
    <a href="logout.php" onclick="w3_close()" class="w3-bar-item w3-button w3-hover-white">Log Out</a>
  </div>
</nav>

<!-- Top menu on small screens -->
<header class="w3-container w3-top w3-hide-large w3-white w3-xlarge w3-padding">
  <a href="javascript:void(0)" class="w3-button w3-white w3-margin-right" onclick="w3_open()">☰</a>
  <span>Side Project</span>
</header>

<!-- Overlay effect when opening sidebar on small screens -->
<div class="w3-overlay w3-hide-large" onclick="w3_close()" style="cursor:pointer" title="close side menu" id="myOverlay"></div>


<!-- !PAGE CONTENT! -->
<div class="w3-main" style="margin-left:340px;margin-right:40px">

    <!-- Header -->
    <div class="w3-container" style="margin-top:80px" id="showcase">
    </div>
    
    <!-- Photo grid (modal) -->
    <div class="w3-row-padding">
    </div>
  
    <!-- Modal for full size images on click-->
    <div id="modal01" class="w3-modal w3-black" style="padding-top:0" onclick="this.style.display='none'">
      <span class="w3-button w3-black w3-xxlarge w3-display-topright">×</span>
      <div class="w3-modal-content w3-animate-zoom w3-center w3-transparent w3-padding-64">
        <img id="img01" class="w3-image">
        <p id="caption"></p>
      </div>
    </div>
  
    <!-- Post -->
    <div class="w3-container" id="Post" style="margin-top:75px">
      <h1 class="w3-xxxlarge w3-text-white"><b>Post</b></h1>
      <hr style="width:50px;border:5px solid white" class="w3-round">
      <p style="color:white">Share your projects with other students and join the Side Project community!</p>
      <form action="index.php" method="POST">
        <div class="w3-section">
          <label><p style="color:white">Name</p></label>
          <input class="w3-input w3-border" type="text" name="name" required>
        </div>
        <div class="w3-section">
          <label><p style="color:white">Title</p></label>
          <input class="w3-input w3-border" type="text" name="title" required maxlength='32'>
        </div>
        <input type="radio" id="Art" name="category" value="art">
        <label for="Art" style="color:white">Art</label><br>
        <input type="radio" id="Tech" name="category" value="tech">
        <label for="Tech" style="color:white">Tech</label><br>
        <input type="radio" id="Biology" name="category" value="bio">
        <label for="Biology" style="color:white">Biology</label><br>
        <input type="radio" id="Craftsmenship" name="category" value="crafts">
        <label for="Craftsmenship" style="color:white">Craftsmanship</label><br>

        <div class="w3-section">
          <label><p style="color:white">Body</p></label>
          <textarea id="area" rows="4" cols="100" maxlength="300" name="body" placeholder="Enter your Text Here"> 
          </textarea>
          <p class="result" style="color:white"> 
            <span id="word" style="color:white">0</span> Words and
              <span id="char" style="color:white">0</span> Characters 
          </p>
        </div>
        <script> 
            let area = document.getElementById('area'); 
            let char = document.getElementById('char'); 
            let word = document.getElementById
[truncated — 1709 more characters]
```

[1 more indexed source files omitted to keep this export small. The full file list is in the Codebase structure section above.]