CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets matching tags of php
function twitter_twitrpix_page($query) {  
    if (user_type() == 'oauth') {  
        //TwitrPix API version 2.01 allows for OAuth  
        //http://twitrpix.com/api/2  
 
        //Has the user submitted an image and message?  
        if ($_POST['message']) {  
            $twitrpixURL = 'http://api.twitrpix.com/2/upload.json'; 
 
            //Set the initial headers  
by @deniahmad   January 31, 2012 @ 9:06pm
17 Views
no comments
 
//add function in twitter.php
 
function ratelimit(){
$request = API_URL."account/rate_limit_status.json";
return twitter_process($request);
}
 
//thema.php
function theme_limit() {
                $limit = ratelimit();
by deni ahmad hidayat   January 31, 2012 @ 8:53pm
12 Views
no comments
 
<?php
 
function Pinyin($_String, $_Code='UTF8') { //GBK页面可改为gb2312,其他随意填写为UTF8
    $_DataKey = "a|ai|an|ang|ao|ba|bai|ban|bang|bao|bei|ben|beng|bi|bian|biao|bie|bin|bing|bo|bu|ca|cai|can|cang|cao|ce|ceng|cha".
        "|chai|chan|chang|chao|che|chen|cheng|chi|chong|chou|chu|chuai|chuan|chuang|chui|chun|chuo|ci|cong|cou|cu|".
        "cuan|cui|cun|cuo|da|dai|dan|dang|dao|de|deng|di|dian|diao|die|ding|diu|dong|dou|du|duan|dui|dun|duo|e|en|er".
        "|fa|fan|fang|fei|fen|feng|fo|fou|fu|ga|gai|gan|gang|gao|ge|gei|gen|geng|gong|gou|gu|gua|guai|guan|guang|gui".
        "|gun|guo|ha|hai|han|hang|hao|he|hei|hen|heng|hong|hou|hu|hua|huai|huan|huang|hui|hun|huo|ji|jia|jian|jiang".
        "|jiao|jie|jin|jing|jiong|jiu|ju|juan|jue|jun|ka|kai|kan|kang|kao|ke|ken|keng|kong|kou|ku|kua|kuai|kuan|kuang".
        "|kui|kun|kuo|la|lai|lan|lang|lao|le|lei|leng|li|lia|lian|liang|liao|lie|lin|ling|liu|long|lou|lu|lv|luan|lue".
by clark   August 02, 2011 @ 4:45am
Tags: php, encode,
71 Views
no comments
 
<?php
 
/*php提供的URL编码函数是基于字节的对由ie的javascript函数escape编码的数据就无能为力了。*/
 
function escape($str) {
    preg_match_all("/[\x80-\xff].|[\x01-\x7f]+/", $str, $r);
    $ar = $r[0];
    foreach($ar as $k=>$v) {
        if(ord($v[0]) < 128)
            $ar[$k] = rawurlencode($v);
by clark   August 01, 2011 @ 4:04am
107 Views
no comments
 
<?php
    class class_mysql{
    
        //Инициализируем переменные
        private $mysql_host = "localhost";
        private $mysql_login = "qwerty";
        private $mysql_passwd = "123456";
        private $mysql_database;
        private $mysql_connect;
        private $sql_error;
by systemIV   June 01, 2011 @ 3:57am
Tags: mysql, php, oop
83 Views
no comments
 
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script> 
<script type="text/javascript" src="scripts/scripts.js"></script>
 
 <br />
<b>Notice</b>:  Undefined index:  action in <b>/home/s3221686/public_html/3tfs/register.php</b> on line <b>7</b><br />
 
<div id="signup">
 
    <form action="" method="POST" name="signupform" id="signup">
        <fieldset>
by traveller11024   May 06, 2011 @ 5:55am
Tags: php, register
91 Views
no comments
 
<?php
//Configuration
$cache_time = 60*3;        //second
$cache_file = "cache/".md5($_SERVER['REQUEST_URI']); 
 
if(file_exists($cache_file)) {
    if((time()-filemtime($cache_file)) < $cache_time) {
        $cache_data = file_get_contents($cache_file);
        if (!(strlen($cache_data) < 18 || strcmp(substr($cache_data,0,2),"\x1f\x8b"))) header( 'Content-Encoding: gzip' );
        echo $cache_data;
by Aummua   February 01, 2011 @ 6:59am
Tags: php, cache
112 Views
no comments
 
Genel kullandığım db fonksiyonları
 
$table sadece table adı olabildiği gibi genelde eğer $where  false verilirse sorgu 
değişkeni olarak da kullanılabilir.
 
dbDelete fonksiyonu kesinlikle $where bekler. Bilirsiniz SQL en çok update ve delete'de 
where kullanılmadan oluşan hatalara açık olduğundan eleştirilir. Program tarafında kendimi
 güvene almak istedim  (bu yanlış silme ve güncellemeyi 2 kez yaşadım, korkusu yeter :) ).
 
Fonksiyonlarıma genelde dönüş değerlerine göre isim veririm. Mesela dbResult tek sonuç döner, 
by erkin   January 07, 2011 @ 1:28am
174 Views
no comments
 
<form action="procesar.php" method="get">
Primer valor: <input type="text" name="valor1" />
Segundo valor: <input type="text" name="valor2" /><br />
<input type="radio" name="radio" value="sumar" />Sumar<br />
<input type="radio" name="radio" value="restar" />Restar<br />
<input type="radio" name="radio" value="dividir" />Dividir<br />
<input type="submit" name="enviar" value="Enviar">
</form>
by M1ST3R10   December 03, 2010 @ 12:53pm
111 Views
no comments
 
<?php
if ($_REQUEST['radio'] == "sumar"){
    $suma = $_REQUEST['valor1'] + $_REQUEST['valor2'];
    echo $suma;
    } elseif ($_REQUEST['radio'] == "restar"){
    $resta = $_REQUEST['valor1'] - $_REQUEST['valor2'];
    echo $resta;
    } elseif ($_REQUEST['radio'] == "dividir"){
        $dividir = $_REQUEST['valor1'] / $_REQUEST['valor2'];
        echo $dividir; }
by M1ST3R10   December 03, 2010 @ 12:53pm
109 Views
no comments
 
[PHP]
 
;;;;;;;;;;;;;;;;;;;
; About php.ini   ;
;;;;;;;;;;;;;;;;;;;
; This file controls many aspects of PHP's behavior.  In order for PHP to
; read it, it must be named 'php.ini'.  PHP looks for it in the current
; working directory, in the path designated by the environment variable
; PHPRC, and in the path that was defined in compile time (in that order).
; Under Windows, the compile-time path is the Windows directory.  The
by Nasser Hadjloo   June 10, 2010 @ 1:18am
Tags: php.ini
535 Views
no comments
 
C#
/* Usage 
string test1 = StripTags("<p>George</p><b>W</b><i>Bush</i>", new string[]{"i","b"});
string test2 = StripTags("<p>George <img src='someimage.png' onmouseover='someFunction()'>W <i>Bush</i></p>", new string[]{"p"});
string test3 = StripTags("<a href='http://www.dijksterhuis.org'>Martijn <b>Dijksterhuis</b></a>", new string[]{"a"});

*/
 
 
 
by tarasn   March 31, 2010 @ 9:21am
Tags: php html
219 Views
no comments
 
 /*database name here*/
 $database = '';
 /*host name for MySQL*/
 $hostname = 'localhost';
 /*user name for MySQL*/
 $username = '';
 /*password for MySQL*/
 $password = '';
 
 //Get the h3fileid
by CodeMonkey76   February 10, 2010 @ 10:58pm
214 Views
no comments
 
<?php
class Ragnarok 
{
 
    var $db;
    var $error;
 
    function add_userid($userid, $user_pass, $sex, $email) {
        global $mysql;
by Aummua   February 01, 2010 @ 8:06am
554 Views
2 comments
 
<?php
function search_string($start , $end , $from, $number=1){
    if($number<1){
        $number=1;
    }
    $from = trim(str_replace("\r\n","",$from));
    $i = 0;
    $ans = $from;
    if(!stristr($ans , $start)){
        return false;
by b123400   January 31, 2010 @ 11:57am
499 Views
no comments
 
abstract class FsNode {
  public $path;
 
  public function __construct($path) {
    $this->path = $path;
  }
 
  public function rename($newname) {
    rename($this->path, $newname);
    $this->path = $newname;
by yuyu1984   September 28, 2009 @ 1:19am
Tags: php
218 Views
no comments
 
<?php
// An example callback function
function my_callback_function() {
    echo 'hello world!';
}
 
// An example callback method
class MyClass {
    function myCallbackMethod() {
        echo 'Hello World!';
by yuyu1984   September 27, 2009 @ 12:49am
Tags: php
209 Views
no comments
 
define("MAX", 134);
 
for ($i = 0; $i < MAX; $i ++) {
  system("wget 'http://webqq.qq.com/images/Face2/{$i}.gif'");
}
by yuyu1984   September 22, 2009 @ 12:57am
Tags: php, qq
379 Views
no comments
 
//Pagina
                        <?php
                            $turno = new Turno();
                            echo "Turnos para la fecha ".date("Y-m-d")."</br>";
                            echo "<br/>";
                            $arrayTurnos = $turno->Buscar(date("Y-m-d"));
                            if($arrayTurnos){
                                foreach($arrayTurnos as $value){
                                    echo $value."<br>";
                                }
by Sebastian Pereira   July 22, 2009 @ 5:31am
Tags: php
250 Views
no comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate