strpos

让安卓用户跳转出微信

强颜欢笑 提交于 2019-12-05 17:16:56
<?php$userAgent = $_SERVER['HTTP_USER_AGENT']; //获取浏览器信息if (!strpos($userAgent, 'MicroMessenger')) { echo '这里是微信外面';}else if(strpos(strtolower($userAgent), 'android')||strpos($userAgent, 'adr')){header('Content-type: application/vnd.ms-word;charset=utf-8');header('Content-Disposition:attachment; filename="/Content/1.docx"');}else {echo '这里是苹果';} 来源: https://www.cnblogs.com/tyqing/p/11936128.html

Using regex in a string for strpos()

旧时模样 提交于 2019-12-05 13:25:21
问题 I want to get the scripts to search the $open_email_msg which different e-mails will have different info but the same format as below. I haven't really used regex much, but what i want to do is whenever i have it to search the string it would search for "Title: [data for title]", "Categories: [data for categories]. I am asking because i don't think something like strpos($open_email_msg, "Title: (*^)"); would even work. This is just a snippet of the whole code, the rest inserts the info into a

代码审计-禅道9.2.1-sql注入

坚强是说给别人听的谎言 提交于 2019-12-05 07:23:05
0x00 前言 审计cms: 禅道开源项目管理软件 版本:9.2.1 工具:phpstorm+xdebug+seay 网站地址:http://localhost/CodeReview/ZenTaoPMS.9.2.1/www/ 严重参考: https://www.cnblogs.com/iamstudy/articles/chandao_pentest_1.html https://www.anquanke.com/post/id/160473 0x01 路由 审计cms,首先要研究cms的路由,关注网站根目录下的 .htaccess文件 。该文件出现: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule (.*)$ index.php/$1 [L] </IfModule> 所有url,除了文件或者目录,都重写到index.php下。既该cms的入口文件是index.php。 查看 index.php 文件。 加载框架类: include '../framework/router.class.php'; include '../framework/control.class.php';

How do I resolve a strpos() “empty delimiter” error?

核能气质少年 提交于 2019-12-05 00:34:28
Here's the error: For: PHP 5.2+ Warning: strpos() [function.strpos]: Empty delimiter in /helper.php on line 445 and here is the code on that line: if($src = $img->getAttribute('src') AND strpos($src,$fgParams->get('base')) === false) { // prevents repeat processing EgivaUtility::profiling('Processing Image SRC: '.$src); // fix rel paths $src = EgivaUtility::encode_url(EgivaUtility::makeAbsUrl($origLink,$src)); if($image_details = @getimagesize($src) AND !in_array($image_details[0],array(1,2)) AND !in_array($image_details[1],array(1,2))) { EgivaUtility::profiling('Image Details: '.print_r(

How would I compare two text files for matches with PHP

谁都会走 提交于 2019-12-04 19:21:23
$domains = file('../../domains.txt'); $keywords = file('../../keywords.txt'); $domains will be in format of: 3kool4u.com,9/29/2013 12:00:00 AM,AUC 3liftdr.com,9/29/2013 12:00:00 AM,AUC 3lionmedia.com,9/29/2013 12:00:00 AM,AUC 3mdprod.com,9/29/2013 12:00:00 AM,AUC 3mdproductions.com,9/29/2013 12:00:00 AM,AUC keywords will be in format of: keyword1 keyword2 keyword3 I guess I would really like to do an array for keywords from a file and search each line of domains.txt for matches. Not sure where to start as I'm confused at the difference of preg_match, preg_match_all, and strpos and more or less

PHP判断是否为手机端的方法

若如初见. 提交于 2019-12-04 10:54:06
PHP判断是否为手机端的方法 private function ismobile() { // 如果有HTTP_X_WAP_PROFILE则一定是移动设备 if (isset($_SERVER['HTTP_X_WAP_PROFILE'])) { return true; } //此条摘自TPM智能切换模板引擎,适合TPM开发 if (isset($_SERVER['HTTP_CLIENT']) && 'PhoneClient' == $_SERVER['HTTP_CLIENT']) { return true; } //如果via信息含有wap则一定是移动设备,部分服务商会屏蔽该信息 if (isset($_SERVER['HTTP_VIA'])) //找不到为flase,否则为true { return stristr($_SERVER['HTTP_VIA'], 'wap') ? true : false; } //判断手机发送的客户端标志,兼容性有待提高 if (isset($_SERVER['HTTP_USER_AGENT'])) { $clientkeywords = array( 'nokia', 'sony', 'ericsson', 'mot', 'samsung', 'htc', 'sgh', 'lg', 'sharp', 'sie-', 'philips',

字符串处理

被刻印的时光 ゝ 提交于 2019-12-04 07:50:54
详情请见手册,好好练习也很简单    一、去除空格或其他字符函数 1.trim $str=' abc '; var_dump($str); var_dump(trim($str)); $str='abcabcdefac'; var_dump($str); var_dump(trim($str,'bac'));//如果要去除多个字符可以连着写! 二、大小写转换函数 $str='test'; var_dump($str); $str1=strtoupper($str); var_dump($str); $str='TeSt'; var_dump($str); var_dump(strtolower($str)); var_dump($str); 三、字符串查找函数 1.substr_count $str='testteste'; var_dump(substr_count($str,'te')); $text2 = 'gcdgcdgcd'; echo substr_count($text2, 'gcdgcd'); $str='testteste'; var_dump(substr_count($str,'te',1,8));//不能超出字符串 2.strpos $str='testteste'; var_dump(strpos($str, 't1')); if(strpos($str,

PHP strpos - search only full words [duplicate]

本秂侑毒 提交于 2019-12-04 06:28:54
问题 This question already has an answer here : How to find a whole word in a string in PHP without accidental matches? (1 answer) Closed 2 years ago . If I have a string containing the word Company and I wish to search for only full words, such as any , I encounter a problem using strpos(), as follows: if (strpos($desc, $row['phrase']) !== false ) { // action } This script will return TRUE because Company contains a substring: any which is unhelpful because the script needs to detect only full

match whole word only without regex

蹲街弑〆低调 提交于 2019-12-04 05:58:57
问题 Since i cant use preg_match (UTF8 support is somehow broken, it works locally but breaks at production) i want to find another way to match word against blacklist. Problem is, i want to search a string for exact match only, not first occurrence of the string. This is how i do it with preg_match preg_match('/\b(badword)\b/', strtolower($string)); Example string: $string = "This is a string containing badwords and one badword"; I want to only match the "badword" (at the end) and not "badwords".

How to Find Next String After the Needle Using Strpos()

北城余情 提交于 2019-12-04 04:37:12
问题 I'm using PHP strpos() to find a needle in a paragraph of text. I'm struggling with how to find the next word after the needle is found. For example, consider the following paragraph. $description = "Hello, this is a test paragraph. The SCREENSHOT mysite.com/screenshot.jpg and the LINK mysite.com/link.html is what I want to return."; I can use strpos($description, "SCREENSHOT") to detect if SCREENSHOT exists, but I want to get the link after SCREENSHOT, namely mysite.com/screenshot.jpg . In a