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 | |
class Connection{ | |
// database configuration | |
public $db = 'testa'; | |
public $host = 'localhost'; | |
public $user = 'root'; | |
public $pass = ''; | |
// MySQL Connection Function |
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 | |
class Common | |
{ | |
/*--------------------- $_GET & $_POST ----------------- START */ | |
/** | |
* Get $_GET content, array or array item in filtered way | |
* | |
* @param object $parameter could be array or array item |
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 | |
/*--------------------- SEF Link ----------------- START */ | |
// Conversation title to better link string | |
public function sefLink($str){ | |
$str = $this->parentSefLink($str); | |
if ($str !== mb_convert_encoding(mb_convert_encoding($str, 'UTF-32', 'UTF-8'), 'UTF-8', 'UTF-32')) | |
$str = mb_convert_encoding($str, 'UTF-8', mb_detect_encoding($str)); | |
$str = htmlentities($str, ENT_NOQUOTES, 'UTF-8'); | |
$str = preg_replace('`&([a-z]{1,2})(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig);`i', '1', $str); |
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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
# POSTS URL | |
RewriteRule ^([0-9-]+)/([0-9-A-z-]+)/([0-9-A-z-]+)(.*)$ post.php?date=$1&category=$2&sef_link=$3 | |
</IfModule> |
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 | |
// some input and date | |
$date = date("Y-m-d H:i:s"); | |
$hashsubject = "email@email.email - {$date}"; | |
$hash = strtoupper(hash('sha512', $hashsubject)); | |
// parse hash with pettern | |
$blocksize = 5; | |
$licpettern = "/(([A-Z0-9]{".$blocksize."})){5}/"; |
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 | |
// app current version | |
$appversiyon = "2.2"; | |
if($_GET["version"]){ | |
// GET client vresion | |
$client_version = $_GET["version"]; | |
// compare with app version | |
if($appversiyon > $client_version){ |
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
using System; | |
using System.ComponentModel; | |
using System.IO; | |
using System.Net; | |
using System.Windows; | |
namespace Basic_Updater_Example | |
{ | |
/// <summary> | |
/// Interaction logic for MainWindow.xaml |
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
if (File.Exists(@"C:\Users\usename\Documents\Folder\File.cs")) { | |
// File exists | |
} | |
else if (!File.Exists(@"C:\Users\usename\Documents\Folder\File.cs")) { | |
// File does not exists | |
} |
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
public void CreateFileaAndWrite() | |
{ | |
// get path | |
string filepath = @"textfile.txt"; | |
// open or create file | |
FileStream streamfile = new FileStream(filepath, FileMode.OpenOrCreate, FileAccess.Write); | |
// create stream writer | |
StreamWriter streamwrite = new StreamWriter(streamfile); | |
// add some lines | |
streamwrite.WriteLine("Forbidden speak in this line."); |
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
/// <summary> | |
/// Reversing class | |
/// </summary> | |
public static class ReversingClass | |
{ | |
/// <summary> | |
/// String.Format reverser | |
/// </summary> | |
/// <param name="string">string value</param> | |
/// <param name="template">format template</param> |
OlderNewer