<p class="comment-header"><b>发表评论:</b><a name="respond"></a></p><?php if(ROLE == 'visitor'): ?>
这行下面添加如下php代码:
<!--获取QQ号码及用户资料--> <?php if(isset($_POST['u'])){ header('Content-Type: text/html; charset=utf-8'); $ret = ''; if(preg_match('/\"nickname\":\"([^\"]+)\"/', file_get_contents('http://r.qzone.qq.com/cgi-bin/user/cgi_personal_card?uin='.$_POST['u']), $QQInfo)){ $ret = $QQInfo[1]; } echo '<script>parent.document.getElementsByName("comname")[0].value = "',$ret,'";</script>'; echo '<script>parent.document.getElementsByName("commail")[0].value = "',$_POST['u'],'@qq.com";</script>'; echo '<script>parent.document.getElementsByName("comurl")[0].value = "http://user.qzone.qq.com/',$_POST['u'],'";</script>'; }else{?> <?php } ?> <p> <iframe name="hiddenIframe" style="display:none;"></iframe> <form action="" method="POST" target="hiddenIframe"> <p style="color:#FF262E;">您也可以直接填写QQ到下面的输入框中,点击获取用户资料实现自动调用您的QQ资料</p> <input placeholder="请输入您的QQ号码" value="" type="text" name="u" /> <input style="width:90px;" type="submit" value="获取用户资料"> </form> </p> <!--获取QQ号码及用户资料 end-->