Skip to content

Instantly share code, notes, and snippets.

View dilaouid's full-sized avatar
🦉
0x6f776c

dilaouid dilaouid

🦉
0x6f776c
View GitHub Profile
@dilaouid
dilaouid / bbcode.js
Created September 5, 2023 16:14
regex for global XSS protection and bbCode check
const bbCodeMatch = /\[(b|i|u|s)\](.*?)\[\/\1\]/gs;
const XSSMatch = /[<]*<[\s\u200B]*script[\s\u200B]*>.*[/]*[<]*<[\s\u200B]*\/[\s\u200B]*script[\s\u200B]*>/ig;
@dilaouid
dilaouid / username.php
Created September 1, 2022 13:10
Creating username with firstname and lastname (first letter of firstname + lastname)
<?php
function parse_login($start, $firstname, $lastname) {
$prefix = substr($firstname, 0, $start + 1);
$login = substr($prefix . $lastname, 0, 10);
return strtolower($login);
}
function define_login($mysql, $firstname, $lastname) {
$idx = 0;
$login = parse_login($idx, $firstname, $lastname);