Skip to content

Instantly share code, notes, and snippets.

View relliv's full-sized avatar
no time for caution

Eyüp relliv

no time for caution
View GitHub Profile
@relliv
relliv / connection.php
Created April 26, 2018 05:50
PHP PDO Basic MySQL Database Connection Class
<?php
class Connection{
// database configuration
public $db = 'testa';
public $host = 'localhost';
public $user = 'root';
public $pass = '';
// MySQL Connection Function
@relliv
relliv / common.php
Last active August 4, 2024 13:03
Secure GET & POST Methods
<?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
@relliv
relliv / seflink.php
Created April 26, 2018 06:38
Content Based Sef Link Fonctions
@relliv
relliv / .htaccess
Created April 26, 2018 08:34
SEO Sef Link Basic Example
<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>
@relliv
relliv / license-key-generator.php
Created April 28, 2018 08:08
PHP Unique License Key Generator
<?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}/";
@relliv
relliv / updatecheck.php
Last active April 28, 2018 18:07
PHP Basic Update Check Example
<?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){
@relliv
relliv / mainwindow.xaml.cs
Created April 28, 2018 19:48
C# Basic App Updater
using System;
using System.ComponentModel;
using System.IO;
using System.Net;
using System.Windows;
namespace Basic_Updater_Example
{
/// <summary>
/// Interaction logic for MainWindow.xaml
@relliv
relliv / fileexistscheck.cs
Created May 4, 2018 21:07
C# Folder & File Exists Checks
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
}
@relliv
relliv / createfileandwrite.cs
Created May 8, 2018 08:44
C# Create Text File And Write Content And Read Content
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.");
@relliv
relliv / ReversingClass.cs
Last active June 6, 2018 01:10
C# Deformat method for String.Format (Extented Method)
/// <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>