PHP Classes

File: registration_examples.php

Recommend this page to a friend!
  Classes of Dariusz   PHP Registration and Login   ???   Download  
File: ???
Role: Example script
Content type: text/plain
Description: Exaples of using Registration class
Class: PHP Registration and Login
Manage user registrations and authentication
Author: By
Last change:
Date: 11 years ago
Size: 935 bytes
 

Contents

Class file image Download
<?php
   
require_once "Registration.php";

   
header("Content-Type: text/html; charset=UTF-8");
   
   
$dsn = "mysql:host=.....;dbname=.....";
   
$username = ".....";
   
$password = ".....";
   
    try {
       
$pdo = new PDO($dsn, $username, $password);
       
$pdo->query("SET NAMES utf8");
       
$pdo->query("SET CHARACTER_SET utf8_polish_ci");
       
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
   
       
$registration = new Registration($pdo);
       
$registration->setEmailHandler(function($id, $username, $password, $email, $token) {
           
var_dump(func_get_args());
               
            return
true;
        });
   
           
$err = $registration->register(".....", ".....", ".....", "[email protected]");
   
            if (
$registration->hasErrors()) {
               
var_dump($err);
            }
   
           
/* $reg = $registration->activeAccount(1, "vh9@Y8MXtHT4phg");
   
            var_dump($reg); */
   
}
    catch(
PDOException $e) {
        echo
"Wystapil blad biblioteki PDO: " . $e->getMessage();
    }
?>