Skip to content

Instantly share code, notes, and snippets.

View i-Clyde's full-sized avatar
🏠
Working from home

Mikołaj Chodorowski i-Clyde

🏠
Working from home
View GitHub Profile
<?php
// Before user can access the website, TasteWP will activate plugins.
// You can check for hook: "tastewp_activate_plugins"
// Or for function named: "__tastewp_initialization" ---
// if (function_exists('__tastewp_initialization')) { ... }
/* ———————————————————————————————————————————————————————— */
/**
@i-Clyde
i-Clyde / some.php
Created April 7, 2022 07:02
TasteWP hook integration
<?php
// Add hook which will be initialized by TasteWP
add_action('tastewp_activate_plugins', function () {
// Prevent from calling this function multiple times
if (get_option('my_plugin_slug_pre_initialized', false)) return;
else update_option('my_plugin_slug_pre_initialized', true);
// Include some files, at this point anything you want.
// $nrs = range($from,$to) - There you can set the compartment of your numbers e.g. range(10,992);
// $from == which number will be the lowest possibility
// $to == which number will be the highest possibility
// $scope == how many numbers from ($from,$to) will be displayed
function rnum($scope) {
$nrs = range(1,70);
$nr = array_rand($nrs,$scope);
shuffle($nr);
@i-Clyde
i-Clyde / check.php
Last active March 6, 2018 15:13
Skrypt logowania bez użycia bazy danych oparty na PHP.
<?php
session_start();
if ((!isset($_POST['login'])) || (!isset($_POST['haslo']))) {
header('Location: index.php');
exit(); }
require_once 'users.php';
$postlog = $_POST['login']; $postlog = htmlentities($postlog, ENT_QUOTES, "UTF-8");
$postpass = $_POST['haslo']; $postpass = htmlentities($postpass, ENT_QUOTES, "UTF-8");