PHP Classes

File: tests/create_test_pending_user.php

Recommend this page to a friend!
  Packages of Matthew Asham   Binkterm PHP   tests/create_test_pending_user.php   Download  
File: tests/create_test_pending_user.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Binkterm PHP
Bulletin board system based on the Web
Author: By
Last change:
Date: 5 days ago
Size: 904 bytes
 

Contents

Class file image Download
<?php

require_once __DIR__ . '/../vendor/autoload.php';

use
BinktermPHP\Database;

$db = Database::getInstance()->getPdo();

echo
"Creating a test pending user for rejection testing:\n";

$username = 'testpending_' . time();
$insertStmt = $db->prepare("
    INSERT INTO pending_users (username, password_hash, email, real_name, reason, ip_address, user_agent, status)
    VALUES (?, ?, ?, ?, ?, ?, ?, 'pending')
"
);

$insertStmt->execute([
   
$username,
   
password_hash('testpassword', PASSWORD_DEFAULT),
   
'testpending@example.com',
   
'Test Pending User',
   
'Testing the rejection system in admin interface',
   
'127.0.0.1',
   
'Test User Agent'
]);

$newUserId = $db->lastInsertId();

echo
"? Created pending user:\n";
echo
" ID: $newUserId\n";
echo
" Username: $username\n";
echo
" Status: pending\n";
echo
"\nYou can now test rejecting user ID $newUserId in the admin interface.\n";