Skip to content

Instantly share code, notes, and snippets.

//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
//
// Copyright (c) 2010-2013 Diego Perini (http://www.iport.it)
//
// Permission is hereby granted, free of charge, to any person
<?php
/**
* Checks if a string is a valid timestamp.
*
* @param string $timestamp Timestamp to validate.
*
* @return bool
*/
function is_timestamp($timestamp)
vim replace sql in php old connected way to PDO
match
cond. 1:
"xxxx $userid='{$userid}' AND $date='{$date}'" =>
:.s/'{$\w*}'\{-1,}/?/g
cond. 2:
"xxxx $userid='{$userid}' AND $date='{$date} '" =>
:.s/'{$\w*}\s\='\{-1,}/?/g
@lanxan
lanxan / login.html
Created April 29, 2012 12:39
login & register with ajax
<html>
<head>
<title>login</title>
<script type="text/javascript" >
function id(id){
return document.getElementById(id);
}
function setCookie(c_name,value,expiredays){
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);