-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.xml
More file actions
74 lines (74 loc) · 9.81 KB
/
Copy pathsearch.xml
File metadata and controls
74 lines (74 loc) · 9.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?xml version="1.0" encoding="utf-8"?>
<search>
<entry>
<title><![CDATA[PHP防止跨域提交表单[非 http_referer 验证]]]></title>
<url>%2F2018%2F01%2F31%2FPHP-Prevent-Cross-Domain-Submit-Form%2F</url>
<content type="text"><![CDATA[PHP开发中跨域表单提交解决办法,网上很多办法都是这样写的,通过判断HTTP_REFERER来验证来源,这个等于没做,别人既然都知道跨域提交了,随便写一段代码就模拟出referer,而你写的这一段验证等于0,下面介绍一个不通过使用验证码的手段来验证跨域提交,使用 session+token 验证 我们通过使用 session+token 凭证来设置一段 form 的唯一性,为每一个form都生成一个随机并加密的 token 验证数据,当完成提交,我们就销毁掉这个 token 从而达到form的有效性只有一次 1.编辑 form.php,开启session,并产生一个加密token保存到 session 中,并在form表单中加入一个隐藏域用来提交token12345678910<?php session_start(); $token = md5(mt_rand()); $_SESSION['token'] = $token;?><form action="form.php" method="post"><input type="text" name="name"><input type="hidden" name="token" value="<?php echo $token?>"><input type="submit" value="submit"></form> 2.编辑 post.php, 首先验证 token 是否合法,合法则处理请求,并销毁token,不合法则提示 bad request 123456789<?phpif(isset($_POST['token'])){ if($_POST['token'] == $_SESSION['token']){ echo $_POST['name']; unset($_SESSION['token']); }else{ echo 'bad request<br>'; }}]]></content>
<categories>
<category>PHP</category>
</categories>
<tags>
<tag>PHP</tag>
<tag>Cross Domain</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Linux VMWare Device eth0 does not seem to be present,delaying initialization]]></title>
<url>%2F2018%2F01%2F11%2FLinux-VMWare-Device-eth0-does-not-seem-to-be-present-delaying-initialization%2F</url>
<content type="text"><![CDATA[虚拟机Vmware上克隆了一个CentOS Linx启动时发现找不到网卡,在命令窗口启动网络服务就会遇到”Device eth0 does not seem to be present, delaying initialization“错误。 错误原因:克隆的Linux系统在新的机器上运行,新服务器网卡物理地址已经改变。而/etc/udev/rules.d/70-persistent-net.rules这个文件确定了网卡和MAC地址的信息之间的绑定,克隆后的网卡的MAC已经发生了变化,所以导致系统认为网络设备不存在,网络不能正常启动。另外一个就是/etc/sysconfig/network-scripts/ifcfg-eth0里面MAC地址也是以前的旧信息。 关于/etc/udev/rules.d/70-persistent-net.rules这个文件,系统在启动时会自动监测变化,然后由/lib/udev/write_net_rules写入到/etc/udev/rules.d/70-persistent-net.rules中一个新的配置节,网卡的的序号依次递增(如原来为eth0,则修改第一后生成一个eth1,再次修改后生成一个eth2…),且其ATTR{address}的值为当前网卡对应的mac地址。 解决方法:1.编辑/etc/sysconfig/network-scripts/ifcfg-eth0配置文件,将ifcfg-eth0的配置文件里里面以前的关于MAC地址这一行删除掉或修改。另外克隆的服务器的IP设置的是静态IP,要么修改为一个其它的IP地址或设置为动态IP,重启网卡服务。 2.找到/etc/udev/rules.d/70-persistent-net.rules删除后重启机器,系统会自动生成一个70-persistent-net.rules文件。因为这个文件绑定了网卡和MAC地址,换了网卡以后MAC地址变了,所以不能正常启动,也可以直接编辑这个配置文件把里面的网卡和MAC地址修改成对应的,不过这样多麻烦,直接删除重启,它会自动生成个一个新的文件。]]></content>
<categories>
<category>Linux</category>
</categories>
<tags>
<tag>Linux</tag>
<tag>VMWare</tag>
<tag>网络配置</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Travis CI自动构建hexo博客可能遇到的坑]]></title>
<url>%2F2017%2F12%2F25%2FTravis-CI-Build-Hexo-Faqs%2F</url>
<content type="text"><![CDATA[坑1:travis CI构建一直提示github账户授权失败psersonal token问题,重新产生,并使用travis whoami判断token有效之后再配置travis CI environment variable 坑2:travis CI构建一直提示hexo-renderer-sass错误在本地deploy并没有发生此问题,在travis vm中出现此问题,解决方式是在.travis.yml中增加1npm install hexo-renderer-sass --save 坑3:travis CI自动构建部署之后,博客页面空白,什么也没有将主题换回默认的landscape则可以正常显示内容。则锁定是next theme配置问题,check发现themes/next 中的内容被ignore了,并没有push到raw branch.解决方法有二: 使用.gitmodules,该方法会直接将next theme repository import进来,这样的好处是可以使用最新的next theme,坏处是没法客制化自己的主题配置文件 123[submodule "next"] path = themes/next url = https://github.com/iissnan/hexo-theme-next 删除themes/next的.git和.gitignore,然后就可以讲themes/next的内容push到repository中了 Others1.在.travis.yml中将node_modules添加到cache中,可以加快构建速度123cache: directories: - node_modules 2.如果想在github的README.md显示构建成功与否的标示,可以修改README.md:1[build-info](https://travis-ci.org/userName/repoName.svg)]]></content>
<categories>
<category>Travis</category>
</categories>
<tags>
<tag>Travis</tag>
</tags>
</entry>
<entry>
<title><![CDATA[git删除文件夹/文件,但不删除本地文件]]></title>
<url>%2F2017%2F12%2F23%2FGithub-Delete-Folder-and-Files-But-not-Delete-Local-Files%2F</url>
<content type="text"><![CDATA[实质就是删除缓冲区里的文件,然后再提交给服务器端。1.首先进入要删除的文件夹或文件的根目录下,如E:\Hexo2.执行下面的语句”directory-name”是相对于本地根目录下的文件夹/文件路径123git rm -r --cached directory-namegit commit -m 'Remove directory "directory-name"'git push origin master git pull --rebase origin master 这句的意思是:把github上最新的文件下载下来。]]></content>
<categories>
<category>Github</category>
</categories>
<tags>
<tag>Github</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Notes On Creating A Hexo Theme]]></title>
<url>%2F2016%2F01%2F02%2F2016-01-02-Notes-On-Creating-A-Hexo-Theme%2F</url>
<content type="text"><![CDATA[SetupTo Update NPM: npm install npm@latest -g. In 2015 it makes sense to use NVM. NVM InstallationInstructions. Update NPM: npm install npm@latest -g Hexo: why can’t you use helper functions in source code?This should be in docs. Creating a Custom Index File in HexoTrying to generate a custom index file in source, hexo would ignoresource/index.md no matter what I did. What I had to do was uninstallhexo-generator-index. Seehere. Then it works. So, thatwill be part of the setup for my theme. But, it’s worth it in order to properlyseperate the theme from the content, I think. Having everyone edit the themeindex.ejs template is no good. Hexo Rendering Raw EJS File Problem I EncounteredSometimes the server would keep rendering an old version of my code, but astext. So I’d see stuff like <% if (site.tags.length){ %> The raw ejs, essentially. Restarting the server or running hexo clean didn’tdo anything. After some time, I realized it was due to the gedit swap files being read byhexo as the actual layout files: for example, tag.ejs~. My partial helperslooked like: <%- partial('_partials/tag') %>, and apparently hexo was readingin tag.ejs~ instead of tag.ejs. And therefore, the ejs wasn’t rendering. To fix this, I simply changed my partial helper to <%- partial('_partials/tag.ejs') %>. Problem solved. Hexo Excerpt VariableI was confused by the behavior of the hexo excerpt variable. If you defineexcerpt: something in the front matter, hexo ignores that. Instead, to get itto work, one needs to add a <!-- more --> comment in the source of the post.Or, you can install a plugin that allows you to define custom excerpt in thefront matter. Scripts DirectoryOne of the things I really discovered too late is the “Scripts” directory in thetheme folder. In Hexo, the various plugins drive the structure of the site, asopposed to the placement of different files and directories, as in Jekyll. Theplugins programatically create folder structure, etc, where in Jekyll I mostlyused the liquid markup to structure the site. The problem is, then, that the user wants to extend hexo to do some sort ofcustom thing. If one had to publish a new plugin, that’d be too much work. Butthe theme level scripts folder allows one to extend the base hexo functionalityin ‘user space’ effectively.]]></content>
<categories>
<category>Hexo</category>
</categories>
<tags>
<tag>Programming</tag>
<tag>Design</tag>
</tags>
</entry>
<entry>
<title><![CDATA[Welcome To Hexo]]></title>
<url>%2F2014%2F02%2F23%2F2014-02-23-hello-world%2F</url>
<content type="text"><![CDATA[Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub. Quick StartCreate a new post1$ hexo new "My New Post" More info: Writing Run server1$ hexo server More info: Server Generate static files1$ hexo generate More info: Generating Deploy to remote sites1$ hexo deploy More info: Deployment]]></content>
<categories>
<category>Hexo</category>
</categories>
<tags>
<tag>Welcome</tag>
<tag>How-To</tag>
</tags>
</entry>
</search>