- Customizable sidebar - adding different panels, changing its order.
- Ranks system - admin, mod and user. Custom ranks.
- Permissions
- Forum-specific - global and for each forum and its childs separately.
- can see
- can read
- can reply
- Forum-specific - global and for each forum and its childs separately.
- can create thread
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
1. Bierzemy dane z formularza i je przypisujemy do zmiennych | |
2. Escape'ujemy je, żeby ochronić się przed SQL Injection (najlepiej to zrobić dzięki prepared statements) | |
3. Pobieramyz bazy dane zarejestrowanego już użytkownika na podstawie emaila czy loginu (w bazie jest oczywiście ZAKODOWANE, NIEMOŻLIWE do odkodowania hasło) | |
4. Kodujemy hasło z formularza tą samą metodą co to zapisane w bazie | |
5. Porównujemy oba zakodowane hasła. Jak są te same - idziemy dalej. Jak nie, wyświetlamy błąd, złe dane. | |
6. Zapisujemy w zmiennej sesyjnej ID użytkownika | |
7. Zalogowany! | |
Jak sprawdzić czy ktoś jest zalogowany? | |
1. Sprawdzamy czy istnieje zmienna sesyjna z ID |
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
<?php | |
namespace Albert221\LennyMemes\Entity; | |
use Doctrine\Common\Collections\ArrayCollection; | |
/** @Entity(repositoryClass="Albert221\LennyMemes\Repository\Database\MemeRepository") @Table(name="memes") */ | |
class Meme | |
{ | |
/** @Id @Column(type="integer") @GeneratedValue */ |
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
<?php | |
namespace App\Controller; | |
use Psr\Http\Message\ServerRequestInterface as Request; | |
use Psr\Http\Message\ResponseInterface as Response; | |
class DogController extends BaseController | |
{ | |
// (...) |
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
<?php | |
try { | |
$pdo = new PDO('mysql:host=localhost;port=3307;dbname=test', 'root', '', [ | |
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8' | |
]); | |
} catch (PDOException $e) { | |
echo 'Błąd przy łączeniu z bazą danych: ' . $e->getMessage(); | |
} |
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
<?php | |
$pdo = new PDO(...); | |
$pdo->exec('CREATE TABLE users(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, username VARCHAR(255) NOT NULL) ENGINE=InnoDB'); |
Dajmy dwa scenariusze, niepodąrzający za DIP i taki z nim zgodny. Na początek klasa którą będziemy chcieli przetestować:
<?php
class Authenticator
{
private $userRepository;
public function __construct(UserRepository $userRepository)
Do you want to have a simple, static website that the only dynamic thing is a contact form? You don't want to go serverless and/or use formspree.io, AWS Lambda or similar? I got your back.
With this Contact form endpoint all you need is a hosting with PHP (cheapest one will do) and a text editor to configure few things (or leave it with defaults).
What you also need is a basic knowledge of HTML to connect the form to the endpoint or some knowledge about XHR to take advantage of the JSON support to make your contact form work without a refresh!
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
# Run as administrator - https://stackoverflow.com/a/57035712/3158312 | |
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { | |
Start-Process PowerShell -Verb RunAs "-NoProfile -ExecutionPolicy Bypass -Command `"cd '$pwd'; & '$PSCommandPath';`""; | |
exit; | |
} | |
$adapterName = 'Ethernet' | |
$status = Get-NetAdapter -Name $adapterName | Format-List -Property "Status" | Out-String |
OlderNewer