isset

Laravel How to Isset _GET

匿名 (未验证) 提交于 2019-12-03 01:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm still very new at Laravel. I got problem how can I use Isset($_GET) ? How to get for example: http://virtualhost.com/flytrap/public/location?city=25 ? Usually when at pure PHP, I always use: if (isset($_GET["submit"])) { $location = $_GET["city"]; } to get city value. So I can use it for query at database. If I use Core PHP method I got an error. 回答1: You can use below code $location = Request::query('city', false); //insed of $_GET['city']; 回答2: This is Laravel equivalent (see http://laravel.com/docs/4.2/requests ): if (Input::has(

word下载

匿名 (未验证) 提交于 2019-12-03 00:43:02
/** * 批量下载简历 */ public function batch() { $str = $this->_param[‘str‘]; $arr = json_decode($str, 1); $time = date(‘YmdHis‘); $filedir = ROOT_PATH . "public/docx/delivery/"; //删除不是当天创建的文件 $arrfile = $this->getFileName($filedir); foreach ($arrfile as $val) { if (is_dir($filedir . $val)) { $str = substr($val, 0, 8); if (date(‘Ymd‘) > $str) { $this->delSelfDif($filedir . $val . ‘/‘); } } } $fileNameArr = array(); foreach ($arr as $val) { $fileNameArr[] = $this->downLoadWords($val, $time); } $filename = ROOT_PATH . "public/docx/delivery/" . $time . "/" . $time . ".zip"; // 最终生成的文件名(含路径) // 生成文件 $zip

Fatal error: 'continue' not in the 'loop' or 'switch' context in /dedecms/include/comm

匿名 (未验证) 提交于 2019-12-02 23:34:01
Fatal error: 'continue' not in the 'loop' or 'switch' context in /dedecms/include/common.func.php on line 49 找到 include/common.func.php 第49行 if ( isset ( $_helpers [ $helpers ] ) ) { continue ; } 修改成 if ( isset ( $_helpers [ $helpers ] ) ) { return ; } 文章来源: https://blog.csdn.net/guo_qiangqiang/article/details/90403152

POST variable from jquery redirecting but is not set

心不动则不痛 提交于 2019-12-02 22:39:34
问题 I asked a question recently about sending a POST variable off of jquery to another php page, redirecting to that page, doing some action with the sent information, and redirecting off of the original page. jQuery post method and directory confusion I am asking for help on almost the exact same code, since the person who commented on it only answered half of my question and marked it as a duplicate. While it did help, it did not solve the problem. I have made edits according what was suggested

CTF中常见的PHP漏洞

匿名 (未验证) 提交于 2019-12-02 22:11:45
1.MD5()漏洞 php在处理字符串时会利用!=,||,==进行hash值的比较 他把每一个“0E’开头的哈希值都解释为0,因此如果两个不同的密码经过hash处理之后都是以‘0e’开头,那么PHP会认为两者是相同的,南京邮电大学一次ctf上就出了一道这个题。一些经md5()后以0e开头的例子 s878926199a 0e545993274517709034328855841020 s155964671a 0e342768416822451524974117254469 s214587387a 0e848240448830537924465865611904 s214587387a 0e848240448830537924465865611904 验证一下这个现象。 <?php if(md5("s155964671a")==md5("s214587387a")) { echo "successful"; } ?> 说到md5就还有一个经典案例就是 数组的MD5值都相等 都为NULL, 这里写了一小段代码 <?php if(isset($_GET['hsy']) and isset($_GET['zyg'])){ if($_GET['hsy']!=$_GET['zyg']) { if(md5($_GET['hsy'])==md5($_GET['zyg'])) echo "yes";

isset函数检测变量是否具有值

旧巷老猫 提交于 2019-12-02 11:35:29
isset()函数检测变量设置值; 1.若变量不存在,返回false 2.若变量存在且值为NULL也返回false 3,若变量不存在且值不为NUll返回true 以上程序在浏览器端打开 如果没有输入转账人员也不会进入if(!_isset($_POST['name'])); 因为当没有输入转账人员的时候$_POST['name']默认是空字符串而不是NULL;当isset 后为true 在取反又变成false了; 可以用if(_isset($_POST['name'])){var_dump($_POST['name'])}来测试一下结果 如下: 来源: https://www.cnblogs.com/pittle-z/p/9792119.html

POST variable from jquery redirecting but is not set

耗尽温柔 提交于 2019-12-02 10:57:06
I asked a question recently about sending a POST variable off of jquery to another php page, redirecting to that page, doing some action with the sent information, and redirecting off of the original page. jQuery post method and directory confusion I am asking for help on almost the exact same code, since the person who commented on it only answered half of my question and marked it as a duplicate. While it did help, it did not solve the problem. I have made edits according what was suggested in the previous attempt to get this problem solved. As you will see, hitting the save button in this

If url variable is empty redirect to home page

坚强是说给别人听的谎言 提交于 2019-12-02 07:48:48
I am not able to get this to work correctly!! I have a view.php page that uses a variable of 'ID' to retrieve db info. So my url is like this: /view.php?id=23 I am trying to get it to "redirect" the user to the home page if they erase the "23" part of the url.. ? so when you visit /view.php?id= It should : if(isset($_GET['id']) == "") { header('Location: /'); exit; } Works if I visit /view.php Try using empty() : if(empty($_GET['id'])) { header('Location: /'); exit; } Another way: if(strlen($_GET['id'])>0) { header('Location: /'); exit; } 来源: https://stackoverflow.com/questions/13848629/if-url

PHP - proper check if $_POST['variable'] is posted

时光毁灭记忆、已成空白 提交于 2019-12-01 22:14:07
I want to check if $_POST['submit'] is posted. My original code was: if ($_POST['submit']) { } But I have a PHP notice with this code - "Undefined index: submit in..." So to remove the notice I have to write this: if (isset($_POST['submit'])) { } But this is pointless because $_POST array is global and it return always true. Also if I want to check if $_POST['submit'] is not 0 without PHP notice I have to write this: if (isset($_POST['submit']) && $_POST['submit'] != 0) { } In this particular case I prefer: if ($_POST['submit']) {} But here I get the PHP notice. So which way is the most proper

Difference between `if (isset($_SESSION))` and `if ($_SESSION)`?

我只是一个虾纸丫 提交于 2019-12-01 19:17:28
I've noticed that frequently people simply write <?php if($_SESSION['username']) {...} ?> while I have been using: <?php if(isset($_SESSION['username'])) {...} ?> Could someone explain the difference when checking if a variable is set (that's what I'd be using it for)? According to PHP.net, isset() does the following: Determine if a variable is set and is not NULL. When writing: <?php if($_SESSION['username']) {...} ?> You are checking to see if $_SESSION['username'] is equal to true. In other words, you are checking if the value does not equal false. According to PHP.net the following are