-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
227 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Laravel | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
jobs: | ||
laravel-tests: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e | ||
with: | ||
php-version: '8.0' | ||
- uses: actions/checkout@v3 | ||
- name: Copy .env | ||
run: php -r "file_exists('.env') || copy('.env.example', '.env');" | ||
- name: Install Dependencies | ||
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | ||
- name: Generate key | ||
run: php artisan key:generate | ||
- name: Directory Permissions | ||
run: chmod -R 777 storage bootstrap/cache | ||
- name: Create Database | ||
run: | | ||
mkdir -p database | ||
touch database/database.sqlite | ||
- name: Execute tests (Unit and Feature tests) via PHPUnit | ||
env: | ||
DB_CONNECTION: sqlite | ||
DB_DATABASE: database/database.sqlite | ||
run: vendor/bin/phpunit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
-- phpMyAdmin SQL Dump | ||
-- version 4.9.1 | ||
-- https://www.phpmyadmin.net/ | ||
-- | ||
-- Host: localhost | ||
-- Generation Time: Jan 06, 2024 at 09:46 AM | ||
-- Server version: 8.0.17 | ||
-- PHP Version: 7.3.10 | ||
|
||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; | ||
SET AUTOCOMMIT = 0; | ||
START TRANSACTION; | ||
SET time_zone = "+00:00"; | ||
|
||
|
||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; | ||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; | ||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; | ||
/*!40101 SET NAMES utf8mb4 */; | ||
|
||
-- | ||
-- Database: `paymentdetails` | ||
-- | ||
|
||
-- -------------------------------------------------------- | ||
|
||
-- | ||
-- Table structure for table `admin` | ||
-- | ||
|
||
CREATE TABLE `admin` ( | ||
`username` varchar(20) COLLATE utf8mb4_general_ci NOT NULL, | ||
`password` varchar(20) COLLATE utf8mb4_general_ci NOT NULL | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | ||
|
||
-- -------------------------------------------------------- | ||
|
||
-- | ||
-- Table structure for table `payment_logs` | ||
-- | ||
|
||
CREATE TABLE `payment_logs` ( | ||
`Date` datetime NOT NULL, | ||
`Admission_Number` varchar(11) COLLATE utf8mb4_general_ci NOT NULL, | ||
`Name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL, | ||
`Fees_Type` varchar(25) COLLATE utf8mb4_general_ci NOT NULL, | ||
`Amount_paid` decimal(10,0) NOT NULL, | ||
`Date_of_payment` date NOT NULL, | ||
`UTR_Number` bigint(20) NOT NULL | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | ||
|
||
-- -------------------------------------------------------- | ||
|
||
-- | ||
-- Table structure for table `studentdetails` | ||
-- | ||
|
||
CREATE TABLE `studentdetails` ( | ||
`ID` int(11) NOT NULL, | ||
`Admission_Number` varchar(100) COLLATE utf8mb4_general_ci NOT NULL, | ||
`Scholorship_Id` bigint(50) DEFAULT NULL, | ||
`Name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL, | ||
`Year` int(11) NOT NULL, | ||
`Branch` varchar(100) COLLATE utf8mb4_general_ci NOT NULL, | ||
`Jvd` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | ||
`Phone_Number` bigint(20) DEFAULT NULL, | ||
`Admission_Fees` int(20) DEFAULT NULL, | ||
`Admission_Special_Fee` int(40) NOT NULL, | ||
`Tution_fee` bigint(20) DEFAULT NULL, | ||
`Special_fee` bigint(20) DEFAULT NULL, | ||
`UCS_fee` bigint(20) DEFAULT NULL, | ||
`Accommodation` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | ||
`Email_Id` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | ||
`CET_Qualified` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | ||
`Due_Amount` int(11) DEFAULT NULL, | ||
`Hostel_Fee` int(10) DEFAULT NULL | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | ||
|
||
-- | ||
-- Triggers `studentdetails` | ||
-- | ||
DELIMITER $$ | ||
CREATE TRIGGER `update_due_amoun` BEFORE UPDATE ON `studentdetails` FOR EACH ROW BEGIN | ||
SET NEW.Due_Amount = COALESCE(NEW.Tution_fee, 0) + COALESCE(NEW.Special_fee, 0) + COALESCE(NEW.UCS_fee, 0); | ||
END | ||
$$ | ||
DELIMITER ; | ||
DELIMITER $$ | ||
CREATE TRIGGER `update_due_amount` BEFORE UPDATE ON `studentdetails` FOR EACH ROW BEGIN | ||
IF NEW.Tution_fee <> OLD.Tution_fee OR NEW.Special_fee <> OLD.Special_fee OR NEW.UCS_fee <> OLD.UCS_fee THEN | ||
SET NEW.Due_Amount = COALESCE(NEW.Tution_fee, 0) + COALESCE(NEW.Special_fee, 0) + COALESCE(NEW.UCS_fee, 0); | ||
END IF; | ||
END | ||
$$ | ||
DELIMITER ; | ||
|
||
-- | ||
-- Indexes for dumped tables | ||
-- | ||
|
||
-- | ||
-- Indexes for table `payment_logs` | ||
-- | ||
ALTER TABLE `payment_logs` | ||
ADD KEY `fk_admission_number` (`Admission_Number`); | ||
|
||
-- | ||
-- Indexes for table `studentdetails` | ||
-- | ||
ALTER TABLE `studentdetails` | ||
ADD PRIMARY KEY (`Admission_Number`), | ||
ADD UNIQUE KEY `ID` (`ID`); | ||
|
||
-- | ||
-- AUTO_INCREMENT for dumped tables | ||
-- | ||
|
||
-- | ||
-- AUTO_INCREMENT for table `studentdetails` | ||
-- | ||
ALTER TABLE `studentdetails` | ||
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=778; | ||
|
||
-- | ||
-- Constraints for dumped tables | ||
-- | ||
|
||
-- | ||
-- Constraints for table `payment_logs` | ||
-- | ||
ALTER TABLE `payment_logs` | ||
ADD CONSTRAINT `fk_admission_number` FOREIGN KEY (`Admission_Number`) REFERENCES `studentdetails` (`Admission_Number`) ON DELETE CASCADE ON UPDATE CASCADE; | ||
COMMIT; | ||
|
||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; | ||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; | ||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,63 @@ | ||
<?php | ||
// Check if the form is submitted via POST method | ||
if ($_SERVER["REQUEST_METHOD"] == "POST") { | ||
// Create a new connection to the database | ||
require 'config.php'; | ||
|
||
// Fetch the Admission Number from the form | ||
$adi = $_POST['Admission_Number']; | ||
echo "" . $adi; // Outputting the Admission Number | ||
|
||
// Get the edited data from the form | ||
$AdmissionNumber = $_POST['Admission_Number']; | ||
$Name = $_POST['Name']; | ||
$Year = $_POST['Year']; | ||
$Branch = $_POST['Branch']; | ||
$Scholarship = $_POST['Scholarship']; | ||
$Phone_Number = $_POST['Phone_Number']; | ||
$Tution_fee = $_POST['Tution_fee']; | ||
$Special_fee = $_POST['Special_fee']; | ||
$Other_fee = $_POST['Other_fee']; | ||
$Accommodation = $_POST['Accommodation']; | ||
$Email_Id = $_POST['Email_Id']; | ||
$Cet_Qualified = $_POST['Cet_Qualified']; | ||
|
||
// Prepare SQL query for updating studentdetails table | ||
$sql = "UPDATE `studentdetails` SET | ||
`Admission_Number`='$AdmissionNumber', | ||
`Name`='$Name', | ||
`Year`='$Year', | ||
`Branch`='$Branch', | ||
`Scholarship`='$Scholarship', | ||
`Phone_Number`='$Phone_Number', | ||
`Tution_fee`='$Tution_fee', | ||
`Special_fee`='$Special_fee', | ||
`Other_fee`='$Other_fee', | ||
`Accommodation`='$Accommodation', | ||
`Email_Id`='$Email_Id', | ||
`Cet_Qualified`='$Cet_Qualified' | ||
WHERE Admission_Number='$AdmissionNumber'"; | ||
|
||
// Execute the SQL query | ||
$u = mysqli_query($conn, $sql); | ||
|
||
// Check if the query executed successfully | ||
if ($u === true) { | ||
// Redirect to the admin_student.php page with a success message | ||
$success_message = "Record Updated successfully"; | ||
header("Location: admin_student.php#?success_message=" . urlencode($success_message)); | ||
|
||
|
||
// updateuser.php | ||
|
||
// Include the database configuration file | ||
require 'config.php'; | ||
|
||
// Check if the form is submitted | ||
if ($_SERVER['REQUEST_METHOD'] === 'POST') { | ||
// Initialize an array to store user data | ||
$userData = array(); | ||
|
||
// Collect form data | ||
foreach ($_POST as $key => $value) { | ||
// Ensure the key is not empty and starts with a letter (to avoid potential security issues) | ||
if (!empty($key)) { | ||
// Sanitize and store the data | ||
$userData[$key] = mysqli_real_escape_string($conn, $value); | ||
} | ||
} | ||
|
||
// Check if there is any data to update | ||
if (!empty($userData)) { | ||
// Build the SQL query to update data in the database | ||
$updateData = array(); | ||
foreach ($userData as $key => $value) { | ||
$updateData[] = "`$key` = '$value'"; | ||
} | ||
$updateValues = implode(', ', $updateData); | ||
|
||
// Ensure that there is a valid 'id' value in the $userData array | ||
if (isset($userData['ID'])) { | ||
$query = "UPDATE `studentdetails` SET $updateValues WHERE `id` = {$userData['ID']}"; | ||
|
||
// Perform the query | ||
$result = mysqli_query($conn, $query); | ||
|
||
// Check if the query was successful | ||
if ($result) { | ||
// Redirect or display a success message | ||
header("Location:admin_student.php?status=1"); | ||
echo "done"; | ||
} else { | ||
echo "Error: " . mysqli_error($conn); | ||
header("Location:admin_student.php?status=2"); | ||
} | ||
} else { | ||
echo "Error: No valid 'id' provided for the update."; | ||
} | ||
} else { | ||
// Output the error message if the query encountered an error | ||
echo "error: " . mysqli_error($conn); | ||
echo "Error: No data provided for the update."; | ||
header("Location:admin_student.php?status=2"); | ||
} | ||
|
||
// Close the database connection | ||
mysqli_close($conn); | ||
} else { | ||
// Redirect to the form page if accessed directly without submitting the form | ||
header("Location: viewStudent.php"); | ||
exit(); | ||
} | ||
?> |