prepare("INSERT INTO users (id, student_id, name, email, password_hash, role) VALUES (?, ?, ?, ?, ?, ?)"); $stmt->execute([$id, $student_id, $name, $email, $hash, $role]); $_SESSION['user_id'] = $id; $_SESSION['user_role'] = $role; audit_log('User registered', 'users', $id); header('Location: index.php'); exit; } catch (PDOException $e) { if ($e->getCode() == 23000) { $error = 'Student ID or Email already exists.'; } else { $error = 'An error occurred: ' . $e->getMessage(); } } } } ?> Signup - Online Election System

Voter Registration

Already have an account? Login