Skip to content

Instantly share code, notes, and snippets.

@mesbahulalam
mesbahulalam / functions.php
Last active October 8, 2022 05:30
Wordpress custom login and registration mechanism
<?php
add_filter( 'logout_url', 'change_logout_url', 10, 2 );
function change_logout_url( $logout_url, $redirect ){
$logout_url = site_url( '/logout/', 'login' );
if ( ! empty( $redirect ) ) {
$logout_url = add_query_arg( 'redirect_to', urlencode( $redirect ), $logout_url );
}
return $login_url;
}
<?php
class jsondb
{
public $result;
private $file;
private $data;
function __construct($file = "test43"){
if(!file_exists($file)) fclose(fopen($file, "w+"));
if(!$this->file) $this->file = $file;
@mesbahulalam
mesbahulalam / JSKeyCodes
Created August 2, 2020 08:12 — forked from tylerbuchea/JSKeyCodes
List of JavaScript key codes.
backspace 8
tab 9
enter 13
shift 16
ctrl 17
alt 18
pause/break 19
caps lock 20
escape 27
page up 33
@mesbahulalam
mesbahulalam / php-ftp-download-auto-resume.php
Created July 22, 2020 16:31 — forked from cballou/php-ftp-download-auto-resume.php
Download a file via FTP with auto-resume functionality in case of any disconnects.
<?php
/**
* Copyright (C) <2012> <Corey Ballou>
* @author Corey Ballou <http://www.craftblue.com>
* @license MIT License
*/
/**
* Handles FTP download of a remote file and stores it in a local file.
*
@mesbahulalam
mesbahulalam / resumable-download.php
Created July 21, 2020 12:39 — forked from kosinix/resumable-download.php
PHP - resumable download
<?php
class ResumeDownload {
private $file;
private $name;
private $boundary;
private $delay = 0;
private $size = 0;
function __construct($file, $delay = 0) {
if (! is_file($file)) {
<?php
$data = file("data");
$total = count($data);
$limit = 10;
$page = intval($_GET["page"]);
if($page<=0) $page = 1;
$pages = ($total) ? ceil($total/$limit) : 1;