index.html
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<style>
body {
margin: 0;
padding: 0;
background-color: #F7F7F7;
}
form {
max-width: 640px;
width: 100%;
margin: 24px auto;
font-size: 16px;
font-family:Microsoft YaHei;
}
td
{
text-align:center;
}
font
{
font-size: 20px;
font-family:Microsoft YaHei;
}
input.fo{
font-family:Microsoft YaHei;
}
textarea{
resize: none;width: 100%;height: 100px;font-size: 19px;margin-top: 10px;font-family:Microsoft YaHei;
}
</style>
</head>
<body>
<form action="getdata.php" method="post">
<fieldset>
<legend><font>QQ空间-说说生成器</font></legend>
<br />
说说内容:
<textarea name="qtext" style="resize: none;width: 100%;height: 100px;font-size: 19px;margin-top: 10px;" type="text" id="content" placeholder="请输入说说内容"></textarea>
<br />
<br />
选择后缀类型:
<br />
<div align="center">
<table width="350">
<tr>
<td>
红包
</td>
<td>
点赞
</td>
<td>
超级赞
</td>
<td>
定位
</td>
<td>
祈福
</td>
<td>
锁
</td>
<td>
蓝字说说
</td>
</tr>
<tr>
<td>
<input type="radio" name="typeset" value="1" >
</td>
<td>
<input type="radio" name="typeset" value="2" >
</td>
<td>
<input type="radio" name="typeset" value="3" >
</td>
<td>
<input type="radio" name="typeset" value="4" >
</td>
<td>
<input type="radio" name="typeset" value="5" >
</td>
<td>
<input type="radio" name="typeset" value="6" >
</td>
<td>
<input type="radio" name="typeset" value="7" >
</td>
</tr>
</table>
</div>
<br />
输入后缀内容:(举例:选择赞或超级赞时后缀内容输入任意名称,用顿号隔开,选择定位时后缀内容输入任意地址等,输入蓝字说说时不需要输入后缀)
<br />
<textarea name="houzhui" type="text" id="houzhui" placeholder="请输入后缀内容"></textarea>
<br />
<br />
<input class="fo" type="submit" value="提交">
<input class="fo" type="reset" value="重新输入">
</fieldset>
</form>
</body>
</html>
getdata.php
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<script type="text/javascript">
//copy函数
function copy(){
var content=document.getElementById("tarea");
content.select();
document.execCommand("Copy");
}
</script>
<style>
body {
margin: 0;
padding: 0;
background-color: #F7F7F7;
}
fieldset {
max-width: 640px;
width: 100%;
margin: 24px auto;
font-size: 16px;
font-family:Microsoft YaHei;
}
textarea{
resize: none;width: 100%;height: 170px;font-size: 19px;margin-top: 10px;font-family:Microsoft YaHei;
}
input{
font-family:Microsoft YaHei;
}
</style>
</head>
<body>
<?php
//通过post获取传递的数据
$qtext=$_POST['qtext'];
$qtype=$_POST['typeset'];
$houzhui=$_POST['houzhui'];
//判断是否输正确输入
if(empty($qtext))
{
echo "<script>alert('说说内容不能为空,请重新输入!');location.href='index.html';</script>";
exit();
}
if(empty($qtype))
{
echo "<script>alert('请选择后缀类型!');location.href='index.html';</script>";
exit();
}
//蓝字做特殊处理
if($qtype==7)
{
$qq="{uin:1,nick:".$qtext."}";
}
else
{
//非特殊情况下$houzhui变量为必须内容,检测是否正确输入
if(empty($houzhui))
{
echo "<script>alert('请输入后缀内容!');location.href='index.html';</script>";
exit();
}
$qq=$qtext."\n\n\n".ctext($qtype)."{uin:1,nick:".$houzhui."}";
}
//返回系统图代码函数,根据index传来的单选值
function ctext($t)
{
switch($t)
{
case '1':
return '[em]e10033[/em]';
break;
case '2':
return '[em]e10030[/em]';
break;
case '3':
return '[em]e10017[/em]';
break;
case '4':
return '[em]e10021[/em]';
break;
case '5':
return '[em]e10010[/em]';
break;
case '6':
return '[em]e10001[/em]';
break;
}
}
?>
<!--html布局-->
<fieldset>
<legend><font>QQ空间-说说生成器</font></legend>
<br />
生成成功!请复制以下字段,或点击复制按钮一键复制!(部分手机浏览器不支持复制功能,请手动复制)
<br />
<textarea id="tarea" name="tarea" readonly><?php echo $qq;?></textarea>
<br />
<br />
<input type="button" onClick="copy();" value="全选并复制" />
</fieldset>
</body>
</html>