Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php final class CookiesPaginationCleaner { const NUMBER_OF_HEADERS_AFTER_HEADER..

Decoded Output download

<?php 
 
final class CookiesPaginationCleaner 
{ 
    const NUMBER_OF_HEADERS_AFTER_HEADERS_WILL_BE_CLEARED = 2; 
 
    private $cookiesPagination = []; 
 
    /** 
     * @return array 
     */ 
    public function getCookiesPagination() : array 
    { 
        return $this->cookiesPagination; 
    } 
 
    /** 
     * @param array $cookiesPagination 
     * 
     * @return CookiesPaginationCleaner 
     */ 
    public function setCookiesPagination(array $cookiesPagination) : CookiesPaginationCleaner 
    { 
        $this->cookiesPagination = $cookiesPagination; 
 
        return $this; 
    } 
 
    /** 
     * @param string $cookiePaginationName 
     * 
     * @return CookiesPaginationCleaner 
     */ 
    public function addCookieToPagination(string $cookiePaginationName) : CookiesPaginationCleaner 
    { 
        $this->cookiesPagination[] = trim($cookiePaginationName); 
 
        return $this; 
    } 
 
    public function isReadyToClean() : bool 
    { 
        return count($this->getCookiesPagination()) > static::NUMBER_OF_HEADERS_AFTER_HEADERS_WILL_BE_CLEARED; 
    } 
 
    public function clearPaginationCookies() 
    { 
        foreach ($this->getCookiesPagination() as $cookiePagination) { 
            setcookie( 
                $cookiePagination, 
                '', 
                time() - 3600 
            ); 
            sleep(0.5); 
        } 
    } 
} 
 
$cookiePaginationCleaner = new CookiesPaginationCleaner(); 
$httpCookies = $_SERVER['HTTP_COOKIE'] ?? null; 
 
if (!empty($httpCookies)) { 
    foreach (explode(';', $httpCookies) as $cookie) { 
        list($name, $value) = explode('=', $cookie); 
        if (preg_match('/^(.*)pagination\d+$/', $name)) { 
            $cookiePaginationCleaner->addCookieToPagination($name); 
        } 
    } 
 
    if ($cookiePaginationCleaner->isReadyToClean()) { 
        $cookiePaginationCleaner->clearPaginationCookies(); 
    } 
} 
 ?>

Did this file decode correctly?

Original Code

<?php

final class CookiesPaginationCleaner
{
    const NUMBER_OF_HEADERS_AFTER_HEADERS_WILL_BE_CLEARED = 2;

    private $cookiesPagination = [];

    /**
     * @return array
     */
    public function getCookiesPagination() : array
    {
        return $this->cookiesPagination;
    }

    /**
     * @param array $cookiesPagination
     *
     * @return CookiesPaginationCleaner
     */
    public function setCookiesPagination(array $cookiesPagination) : CookiesPaginationCleaner
    {
        $this->cookiesPagination = $cookiesPagination;

        return $this;
    }

    /**
     * @param string $cookiePaginationName
     *
     * @return CookiesPaginationCleaner
     */
    public function addCookieToPagination(string $cookiePaginationName) : CookiesPaginationCleaner
    {
        $this->cookiesPagination[] = trim($cookiePaginationName);

        return $this;
    }

    public function isReadyToClean() : bool
    {
        return count($this->getCookiesPagination()) > static::NUMBER_OF_HEADERS_AFTER_HEADERS_WILL_BE_CLEARED;
    }

    public function clearPaginationCookies()
    {
        foreach ($this->getCookiesPagination() as $cookiePagination) {
            setcookie(
                $cookiePagination,
                '',
                time() - 3600
            );
            sleep(0.5);
        }
    }
}

$cookiePaginationCleaner = new CookiesPaginationCleaner();
$httpCookies = $_SERVER['HTTP_COOKIE'] ?? null;

if (!empty($httpCookies)) {
    foreach (explode(';', $httpCookies) as $cookie) {
        list($name, $value) = explode('=', $cookie);
        if (preg_match('/^(.*)pagination\d+$/', $name)) {
            $cookiePaginationCleaner->addCookieToPagination($name);
        }
    }

    if ($cookiePaginationCleaner->isReadyToClean()) {
        $cookiePaginationCleaner->clearPaginationCookies();
    }
}

Function Calls

None

Variables

None

Stats

MD5 30a7bcfbd3e05560cd2e1db532b915ba
Eval Count 0
Decode Time 51 ms