Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/symfony.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Symfony

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

permissions:
contents: read

jobs:
symfony-tests:
runs-on: ubuntu-latest
steps:
# To automatically get bug fixes and new Php versions for shivammathur/setup-php,
# change this to (see https://github.com/shivammathur/setup-php#bookmark-versioning):
# uses: shivammathur/setup-php@v2
- uses: shivammathur/setup-php@2cb9b829437ee246e9b3cac53555a39208ca6d28
with:
php-version: '8.0'
- uses: actions/checkout@v3
- name: Copy .env.test.local
run: php -r "file_exists('.env.test.local') || copy('.env.test', '.env.test.local');"
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Create Database
run: |
mkdir -p data
touch data/database.sqlite
- name: Execute tests (Unit and Feature tests) via PHPUnit
env:
DATABASE_URL: sqlite:///%kernel.project_dir%/data/database.sqlite
run: vendor/bin/phpunit
1 change: 1 addition & 0 deletions dataApp/UDEMY.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dataApp : https://www.udemy.com/course/advanced-php-web-development-w-mysql-github-bootstrap-4/learn/lecture/15808034#overview
Empty file added dataApp/css/site.css
Empty file.
32 changes: 32 additions & 0 deletions dataApp/db/conn.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
// Development Connection
// $host = '127.0.0.1';
// $db = 'attendance_db';
// $user = 'root';
// $pass = '';
// $charset = 'utf8mb4';

//Remote Database Connection
$host = 'remotemysql.com';
$db = 'NC1HPsPMvA';
$user = 'NC1HPsPMvA';
$pass = 'rqUDdNcsXH';
$charset = 'utf8mb4';

$dsn = "mysql:host=$host;dbname=$db;charset=$charset";

try{
$pdo = new PDO($dsn, $user, $pass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

} catch(PDOException $e) {
throw new PDOException($e->getMessage());
}

require_once 'crud.php';
require_once 'user.php';
$crud = new crud($pdo);
$user = new user($pdo);

$user->insertUser("admin","password");
?>
131 changes: 131 additions & 0 deletions dataApp/db/crud.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
<?php
class crud{
// private database object\
private $db;

//constructor to initialize private variable to the database connection
function __construct($conn){
$this->db = $conn;
}

// function to insert a new record into the attendee database
public function insertAttendees($fname, $lname, $dob, $email,$contact,$specialty,$avatar_path){
try {
// define sql statement to be executed
$sql = "INSERT INTO attendee (firstname,lastname,dateofbirth,emailaddress,contactnumber,specialty_id,avatar_path) VALUES (:fname,:lname,:dob,:email,:contact,:specialty,:avatar_path)";
//prepare the sql statement for execution
$stmt = $this->db->prepare($sql);
// bind all placeholders to the actual values
$stmt->bindparam(':fname',$fname);
$stmt->bindparam(':lname',$lname);
$stmt->bindparam(':dob',$dob);
$stmt->bindparam(':email',$email);
$stmt->bindparam(':contact',$contact);
$stmt->bindparam(':specialty',$specialty);
$stmt->bindparam(':avatar_path',$avatar_path);

// execute statement
$stmt->execute();
return true;

} catch (PDOException $e) {
echo $e->getMessage();
return false;
}
}

public function editAttendee($id,$fname, $lname, $dob, $email,$contact,$specialty){
try{
$sql = "UPDATE `attendee` SET `firstname`=:fname,`lastname`=:lname,`dateofbirth`=:dob,`emailaddress`=:email,`contactnumber`=:contact,`specialty_id`=:specialty WHERE attendee_id = :id ";
$stmt = $this->db->prepare($sql);
// bind all placeholders to the actual values
$stmt->bindparam(':id',$id);
$stmt->bindparam(':fname',$fname);
$stmt->bindparam(':lname',$lname);
$stmt->bindparam(':dob',$dob);
$stmt->bindparam(':email',$email);
$stmt->bindparam(':contact',$contact);
$stmt->bindparam(':specialty',$specialty);

// execute statement
$stmt->execute();
return true;
}catch (PDOException $e) {
echo $e->getMessage();
return false;
}

}

public function getAttendees(){
try{
$sql = "SELECT * FROM `attendee` a inner join specialties s on a.specialty_id = s.specialty_id";
$result = $this->db->query($sql);
return $result;
}catch (PDOException $e) {
echo $e->getMessage();
return false;
}

}

public function getAttendeeDetails($id){
try{
$sql = "select * from attendee a inner join specialties s on a.specialty_id = s.specialty_id
where attendee_id = :id";
$stmt = $this->db->prepare($sql);
$stmt->bindparam(':id', $id);
$stmt->execute();
$result = $stmt->fetch();
return $result;
}catch (PDOException $e) {
echo $e->getMessage();
return false;
}
}

public function deleteAttendee($id){
try{
$sql = "delete from attendee where attendee_id = :id";
$stmt = $this->db->prepare($sql);
$stmt->bindparam(':id', $id);
$stmt->execute();
return true;
}catch (PDOException $e) {
echo $e->getMessage();
return false;
}
}

public function getSpecialties(){
try{
$sql = "SELECT * FROM `specialties`";
$result = $this->db->query($sql);
return $result;
}catch (PDOException $e) {
echo $e->getMessage();
return false;
}

}

public function getSpecialtyById($id){
try{
$sql = "SELECT * FROM `specialties` where specialty_id = :id";
$stmt = $this->db->prepare($sql);
$stmt->bindparam(':id', $id);
$stmt->execute();
$result = $stmt->fetch();
return $result;
}catch (PDOException $e) {
echo $e->getMessage();
return false;
}

}




}
?>
80 changes: 80 additions & 0 deletions dataApp/db/user.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php

class user{
// private database object\
private $db;

//constructor to initialize private variable to the database connection
function __construct($conn){
$this->db = $conn;
}

public function insertUser($username,$password){
try {
$result = $this->getUserbyUsername($username);
if($result['num'] > 0){
return false;
} else{
$new_password = md5($password.$username);
// define sql statement to be executed
$sql = "INSERT INTO users (username,password) VALUES (:username,:password)";
//prepare the sql statement for execution
$stmt = $this->db->prepare($sql);
// bind all placeholders to the actual values
$stmt->bindparam(':username',$username);
$stmt->bindparam(':password',$new_password);

// execute statement
$stmt->execute();
return true;
}


} catch (PDOException $e) {
echo $e->getMessage();
return false;
}
}

public function getUser($username,$password){
try{
$sql = "select * from users where username = :username AND password = :password ";
$stmt = $this->db->prepare($sql);
$stmt->bindparam(':username', $username);
$stmt->bindparam(':password', $password);
$stmt->execute();
$result = $stmt->fetch();
return $result;
}catch (PDOException $e) {
echo $e->getMessage();
return false;
}
}

public function getUserbyUsername($username){
try{
$sql = "select count(*) as num from users where username = :username";
$stmt = $this->db->prepare($sql);
$stmt->bindparam(':username',$username);

$stmt->execute();
$result = $stmt->fetch();
return $result;
}catch (PDOException $e) {
echo $e->getMessage();
return false;
}
}

public function getUsers(){
try{
$sql = "SELECT * FROM users";
$result = $this->db->query($sql);
return $result;
}catch(PDOException $e){
echo $e->getMessage();
return false;
}
}
}
?>
5 changes: 5 additions & 0 deletions dataApp/includes/auth_check.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php
if(!isset($_SESSION['username'])){
header("Location: login.php");
}
?>
3 changes: 3 additions & 0 deletions dataApp/includes/errormessage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="alert alert-danger" role="alert">
Operation Encountered An Error. Please retry.
</div>
27 changes: 27 additions & 0 deletions dataApp/includes/footer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

<div id="footer" class="p-3 bg-primary text-white fixed-bottom">
<p class="text-center">Copyright &copy; - IT Conference Attendance System <?php echo date('Y'); ?></p>

</div>

</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>

<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$( function() {
$( "#dob" ).datepicker( {
changeMonth: true,
changeYear: true,
yearRange: "-100:+0",
dateFormat: "yy-mm-dd"
});
} );
</script>
</body>
</html>
46 changes: 46 additions & 0 deletions dataApp/includes/header.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php
//This includes the session file. This file contains code that starts/resumes a session.
//By having it in the header file, it will be included on every page, allowing session capability to be used on every page across the website.
include_once 'includes/session.php'?>

<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">

<link rel="stylesheet" href="css/site.css" />

<title>Attendance - <?php echo $title ?></title>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<a class="navbar-brand" href="index.php">IT Conference</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav mr-auto">
<a class="nav-item nav-link active" href="index.php">Home <span class="sr-only">(current)</span></a>
<a class="nav-item nav-link" href="viewrecords.php">View Attendees</a>
</div>
<div class="navbar-nav ml-auto">
<?php
if(!isset($_SESSION['userid'])){
?>
<a class="nav-item nav-link" href="login.php">Login <span class="sr-only">(current)</span></a>
<?php } else { ?>
<a class="nav-item nav-link" href="#"><span>Hello <?php echo $_SESSION['username'] ?>! </span> <span class="sr-only">(current)</span></a>
<a class="nav-item nav-link" href="logout.php">Logout <span class="sr-only">(current)</span></a>
<?php } ?>
</div>
</div>
</nav>
<div class="container">

<br/>
3 changes: 3 additions & 0 deletions dataApp/includes/session.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php
session_start();
?>
3 changes: 3 additions & 0 deletions dataApp/includes/successmessage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="alert alert-success" role="alert">
Operation has been completed
</div>
Binary file added dataApp/uploads/1789654123.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dataApp/uploads/187654233214.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dataApp/uploads/blank.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading