类文件可以实现多少个接口?类文件使用的接口数量是否有限制?提前致谢.
在uploadify中如何将用户输入值传递给uploadify.php这里是我的代码:
$(function() {
$('#file_upload').uploadify({
'buttonText' : 'BROWSE...',
'method' : 'post',
'height' : 50,
'buttonCursor' : 'hand',
'fileSizeLimit' : '100KB',
'formData' : {
'title' :$('input:text[name:title]').val(),
'about' :$('input:text[name:about]').val() },
'auto' : false,
'swf' : 'uploadify.swf',
'checkExisting' : 'check-exists.php',
'uploader' : 'uploadify.php',
'onUploadSuccess' : function(file, data, response) {
$("#message").css("display","block");
$("#message").text("upload process completed successfully");
setTimeout(function() {
$('#message').fadeOut('fast');
}, 5000);
},
'onUploadError' : function(file, errorCode, errorMsg, errorString) {
alert('The file ' + file.name + ' could not be uploaded: ' + errorString);
}
});
}); …Run Code Online (Sandbox Code Playgroud) 在我的服务器上有一张名为/images/pic.jpg的图片.我想跟踪试图通过url lik www.domain.com/images/pic.jpg直接访问该图片的用户的IP地址.我可以通过以下方式跟踪手动用户的IP地址:
<?php $ipAddress = $_SERVER['REMOTE_ADDR']; ?>
Run Code Online (Sandbox Code Playgroud) public function loginAction() {
$auth = Zend_Auth::getInstance();
$DB = Zend_Db_Table_Abstract::getDefaultAdapter();
$request=$this->getRequest();
$authAdapter = new Zend_Auth_Adapter_DbTable($DB);
$authAdapter->setTableName('user')
->setIdentityColumn('uname')
->setCredentialColumn('password');
$uname = $request->getParam('uname');
$pass = $request->getParam('password');
$authAdapter->setIdentity($uname);
$authAdapter->setCredential($pass);
$result = $authAdapter->authenticate($authAdapter);
$this->view->assign('auth',$result);
if($result->isValid()) {
$data = $authAdapter->getResultRowObject(null,'pass');
$auth->getStorage()->write($data);
//$this->view->assign('dbdata',$data);
$userInfo = new Zend_Session_Namespace('userInfo');
$userInfo->userType = 'admin';
//$this->_redirect('/admin/adminhome');
} else {
$this->_redirect('/admin/index?fail=true');
}
$data = $authAdapter->getResultRowObject(null,'pass');
Run Code Online (Sandbox Code Playgroud)
这里$data将返回一个这样的对象:
stdClass Object ( [id] => 12 [uname] => user [password] => user [type] => user )
Run Code Online (Sandbox Code Playgroud)
我想将其转换为数组.刚试过toArray()功能但是徒劳无功.我的要求是检查用户类型如下:
if($data['type']=='admin'){
do something
} else …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用php和htaccess跟踪hotlinkers的ip地址.
.htaccess文件:
RewriteEngine on
RewriteRule images/(.+)\.(jpg|gif|png) images.php
Run Code Online (Sandbox Code Playgroud)
images.php
?php
$ipAddress = $_SERVER['REMOTE_ADDR'];
$statement=$db->prepare("INSERT INTO `ipaddress` (`ip` )
VALUES (?)");
$statement->execute(array($ipAddress));
?>
Run Code Online (Sandbox Code Playgroud)
现在,用户请求像这样的图像www.domain.com/images/image.jpg它将重定向到images.php并跟踪他们的ips.我面临的问题是我的页面内部没有显示图像(原因是htaccess将其重定向到images.php).我该如何解决这个问题?
我不是htaccess的专家所以需要更多的解释
谢谢
这是我的jQuery:
<script src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/thickbox.js"></script>
<script type="text/javascript"
$('#button').click(function(){
$('#TB_window').fadeOut();
});
</script>
Run Code Online (Sandbox Code Playgroud)
HTML:
<input type="submit" id="button" value="clse" >
Run Code Online (Sandbox Code Playgroud)
我尝试过这个功能,但它没有用.
getAllForms($data=null)
getAllForms() and getAllForms("data")
Run Code Online (Sandbox Code Playgroud)
这会奏效.但我想在这样的函数中创建两个可选参数:
getAllForms($arg1=null,$arg2=null)
getAllForms() and getAllForms("data")
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
HTML代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>HTML</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js">
</script>
<script type="text/javascript" src="highlighter.js"></script>
<link rel="stylesheet" type="text/css" href="highlighter.css"
/>
<script>
$(document).ready(function () {
$("pre.htmlCode").snippet("html");
// Finds <pre> elements with the class "htmlCode"
// and snippet highlights the HTML code within.
$("pre.styles").snippet("css", {
style: "greenlcd"
});
// Finds <pre> elements with the class "styles"
// and snippet highlights the CSS code within
// using the "greenlcd" styling.
$("pre.js").snippet("javascript", …Run Code Online (Sandbox Code Playgroud) 标题:
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/timeago.js" ></script>
<script src="js/test_helpers.js" type="text/javascript"></script>
Run Code Online (Sandbox Code Playgroud)
photos.php
$(".cmdclose").click(function(){
var id=this.id;
$.post("cmddel.php" ,{"id":id});
setTimeout(function(){
<?php echo 'var id = '.json_encode($_GET['id']).';'; ?>
$('#cmdz').load('cmdajax.php?id='+id);
},1000);
});
Run Code Online (Sandbox Code Playgroud)
HTML部分:
<div id="cmdz">
<?php
$uid=$_SESSION['uid'];
$query="SELECT *
FROM `cmds`
WHERE `pid` =${id} ORDER BY `id`";
$result=$db->query($query);
?>
<table id="tblcmd">
<tr>
<?
while($result_set=$db->fetch($result)){
// echo $result_set['cmds'];
$uid=$result_set['uid'];
$query2="SELECT * FROM `user` WHERE `id` ='${uid}'";
$result2=$db->query($query2);
$result_set2=$db->fetch($result2);
echo '<td>'.$result_set2['name'].'</td>';
echo '<td>:'.$result_set['cmds'].'</td>';
echo '<td id="'.$result_set['id'] .'"><img src="images/cmd-close.jpg" class="cmdclose" id="'.$result_set['id'] .'" /> </td>';
?>
</tr>
<?php …Run Code Online (Sandbox Code Playgroud) 我在上传时使用uploadify将img上传到服务器我保存了数据库的绝对路径:
/var/www/html/workbench/photogallery/uploads/logo2.jpg
现在我想在浏览器中显示相同的方法,以下方法不起作用
<div id="photos">
<h3>Photo title</h3>
<P class="like"><a href="#">Like</a> </P>
<p class="date">date </p>
<p class="pclear" />
<div id="image">
<img src="<?php echo $result_set['path']; ?>" />
</div>
<p class="about">about image goes here</p>
</div>
Run Code Online (Sandbox Code Playgroud)
上面的代码不起作用.当我手动编辑路径上传/ logo2.jpg它完美无缺
我该如何解决这个问题?
我可以通过以下方式检索Cookie值:
<?php
$cookie=$_COOKIE["cookieName"];
?>
Run Code Online (Sandbox Code Playgroud)
现在我想使用php获取客户端计算机中的所有cookie.我不想要他们的价值观我只想要他们的名字.在这里,我的要求是了解最近访问的特定网站中的客户端Web活动.我只是谷歌搜索它说我们无法访问其他域cookie.任何方式只是想知道有没有办法从客户端计算机获取所有最近访问过的网站?谢谢.