We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
出题时间:2015-11-26
出题人:Horse Luke
难度:低
招聘岗位:PHP工程师(业务类,非安全岗)
小明的留言板网站在访问量过大的时候总是很缓慢,而且时不时遭受黑客入侵攻击而无法正常访问,为此他找来工程师小吉请教。小吉一看,吓得瓜子都掉了……
请具体阐述这些代码存在哪些问题,并分别给出修复思路和修复代码示例。(15分)
(如不确定php代码怎么写,可写伪代码,或至少要阐明修复思路;代码已经过简化,无需考虑为什么是面向过程写法,这只是为了节约纸张)
PHP代码:
<?php //代码略 $catid = @$_GET['catid']; $sql = "SELECT * FROM `tc_guestbook` WHERE catid = ". $catid; $list = $db->fetchAll($sql); if(empty($list)){exit("该留言列表不存在");} foreach($list as $k => $row){ $list[$k]['user'] = $db->fetchOne("SELECT * FROM `tc_user` WHERE `uid` = '". $row['uid']. "'"); } //代码略 require __DIR__. '/tpl/default/guestbook_list.php';
guestbook_list模板代码:
/*模板代码略*/ <?php foreach($list as $row): ?> <div>[<?php echo $row['user']["username"]; ?>] <?php echo strlen($row["title"]) > 50 ? substr($row["title"], 0, 50). '...' : $row["title"]; ?> </div> <?php endforeach; ?> /*模板代码略*/
The text was updated successfully, but these errors were encountered:
No branches or pull requests
信息摘要
出题时间:2015-11-26
出题人:Horse Luke
难度:低
招聘岗位:PHP工程师(业务类,非安全岗)
题目内容
小明的留言板网站在访问量过大的时候总是很缓慢,而且时不时遭受黑客入侵攻击而无法正常访问,为此他找来工程师小吉请教。小吉一看,吓得瓜子都掉了……
请具体阐述这些代码存在哪些问题,并分别给出修复思路和修复代码示例。(15分)
(如不确定php代码怎么写,可写伪代码,或至少要阐明修复思路;代码已经过简化,无需考虑为什么是面向过程写法,这只是为了节约纸张)
PHP代码:
guestbook_list模板代码:
The text was updated successfully, but these errors were encountered: