📄 searchresult.txt
字号:
<?php global $user; ?>
<?php if ($user->uid) : ?>
Welcome: <?php print l($user->name,'user/'.$user->uid); ?>
<?php print l("logout","logout"); ?>
<?php else : ?>
<?php print l("Login","user/login"); ?>
<?php endif; ?>
<?php
global $user;
function strGameType($type)
{
switch($type)
{
case 'P':return "play";
break;
case 'R': return "join";
break;
case 'C' :return "closed";
break;
default: return "error";
}
}
function strLink($type)
{
switch($type)
{
case 'P':
if($user->uid)
return "<a href='http://localhost/drupal-5.x/?q=eTreasureHunt/play''>" ;
else return "<a href='http://127.0.0.1/drupal-5.x/?q=user/login' >" ;
break;
case 'R': if($user->uid)
{return "<a href='http://localhost/drupal-5.x/?q=eTreasureHunt/play&game_id=$curID' ' method='get'>";
// mysql_query("insert into sms_hunt_mobiles values(select game_id,user_phone from sms_user where user_id=$curID' )");
}
else return "<a href='http://127.0.0.1/drupal-5.x/?q=user/login' >" ;
break;
case 'C' :return "";
break;
default: return "error";
}
}
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db( 'etreasure1' );
$query="SELECT * FROM sms_game";
if($_COOKIE['game_name'] || $_COOKIE['game_location'] )
{
$query.=" where ";
if($_COOKIE['game_name'])
{ $query.=" game_name like '%".$_COOKIE['game_name']."%' ";
if($_COOKIE['game_location']) $query.=" and game_location='".$_COOKIE['game_location']."'";
}
else
$query.=" game_location='".$_COOKIE['game_location']."'";
if($_COOKIE['day']||$_COOKIE['month']||$_COOKIE['year']||$_COOKIE['type_public']||$_COOKIE['type_restricted']||$_COOKIE['type_closed']) $query.= " and ";
}
else if($_COOKIE['day']||$_COOKIE['month']||$_COOKIE['year']||$_COOKIE['type_public']||$_COOKIE['type_restricted']||$_COOKIE['type_closed']) $query.= " where ";
if($_COOKIE['day']||$_COOKIE['month']||$_COOKIE['year'])
{
if(!$_COOKIE['year']) $query.="Creationdate like '%".$_COOKIE['year']."%".$_COOKIE['month']."%".$_COOKIE['day']."%'";
if($_COOKIE['type_public']||$_COOKIE['type_restricted']||$_COOKIE['type_closed']) $query.=" and ";
}
if($_COOKIE['type_public']||$_COOKIE['type_restricted']||$_COOKIE['type_closed'])
{
$query.="game_type in ('".$_COOKIE['type_public']."' ,'".$_COOKIE['type_restricted']."', '".$_COOKIE['type_closed']."')";
}
$result = mysql_query($query);
//echo "<form name='play' action='' method='get'>";
echo "<table border='1'>
<tr>
<th>Date Creation</th>
<th>Name</th>
<th>SMS_String</th>
<th>Action</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
$curID = $row['game_id'];
echo "<td>" . $row['CreationDate'] . "</td>";
echo "<td>" . "<a href='http://localhost/drupal-5.x/?q=eTreasureHunt/description/&game_id=$curID' method='get'>" . $row['game_name'] . "</a>" . "</td>";
if($user->uid&&$row['game_type']!='C'||$row['game_type']=='P' )
{echo "<td >" . $row['game_password'] . "</td>"; }
else
{echo "<td> //////</td>"; }
echo "<td>" .strLink($row['game_type']) . strGameType($row['game_type'])."</a>" . "</td>";
}
echo "</table>";
//echo "</form>";
echo $query;
mysql_close($con);
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -