This file contains hidden or 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 | |
$url='http://software.sopili.net/'; | |
require_once('Sopily.class.php'); | |
$sopily=new Sopily; | |
$sopily->template_dir="/home/www/sopily/demo"; | |
$sopily->assign('url',$url); | |
$sopily->display('index_tpl.php'); |
This file contains hidden or 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
<? | |
require('header_tpl.php'); //relative path, indicated by $sopily->template_dir | |
?> | |
<h1>Demo</h1> | |
url is <?=$url?> <br> | |
url with modifier <?=$_escape($url)?> <br> | |
url with multiple modifier: <?=sopily($url,Array('default'=>'http://www.sopili.net >_<|||','escape'))?> <br> | |
url with multiple modifier2: <?=sopily($url,'default','http://www.sopili.net')?> <br> | |
url with multiple modifier3: <?=$_escape($url)?> <br> |
This file contains hidden or 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
jQuery("ul.sopili-download a").click(function(){ | |
return pageTracker._trackEvent("article",'download'); | |
}); | |
jQuery("ul.sopili-article a").click(function(){ | |
return pageTracker._trackEvent("article",'article'); | |
}); | |
jQuery("ul.sopili-meta a").click(function(){ | |
return pageTracker._trackEvent("article",'meta'); |
This file contains hidden or 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 | |
$HTTP["host"] == "event.sopili.com" { | |
server.document-root = "/home/www/event/" | |
fastcgi.server = ( ".php" => | |
(( | |
"bin-path" => "/usr/local/bin/php-cgi -c /usr/local/etc/php_event.ini", | |
"socket" => "/tmp/event-php-fastcgi.socket", | |
)) | |
) |
This file contains hidden or 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
<label><input name='func' type='radio' value='abc' />abc</label> | |
.... | |
<script type='text/javascript'> | |
jQuery(document).ready(function(){ | |
jQuery("input[name=func][value='abc']").attr('checked',true); | |
}); | |
</script> |
This file contains hidden or 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
<select name='list'> | |
<option value=''>all</option> | |
<option value='abc'>abc</option> | |
</select> | |
<script type='text/javascript'> | |
jQuery(document).ready(function(){ | |
jQuery("select[name=list]").val("abc"); | |
}); | |
</script> |
This file contains hidden or 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 | |
if(empty($_SESSION['id'])) //必需要先登入 | |
die('Please Login First'); | |
save_post($_POST['content'],$_SESSION['id']); //可以進行儲存的動作 |
This file contains hidden or 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 | |
//input可以是單一字串,或是array | |
function must_referer($src){ | |
$src_arr=Array(); | |
if(empty($_SERVER['HTTP_REFERER'])) //一定要有referer url | |
exit; | |
$src_arr=(is_array($src))?$src:Array($src); | |
foreach($src_arr as $url) | |
if(strpos($_SERVER['HTTP_REFERER'],$url)===0) //一定要match到,而且是第一個字元就要match到 |
This file contains hidden or 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 | |
if(empty($_SESSION['id'])) //必需要先登入 | |
die('Please Login First'); | |
must_referer("http://admin.tools.sopili.net"); //來源一定要是從 admin.tools.sopili.net 操作 | |
save_post($_POST['content'],$_SESSION['id']); //可以進行儲存的動作 |
This file contains hidden or 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
<html> | |
<head> | |
</head> | |
<body> | |
<img src="http://pics.blog.yam.com/badimage.jpg" /> | |
<script> | |
function hi(){ | |
var i=new Image(); | |
i.onerror=function(){alert('error and do something');}; | |
i.src="http://pics.blog.yam.com/badimage.jpg"; |