コード例 #1
0
ファイル: searchplayer.php プロジェクト: andrewroth/winbolo
<?php

require "../php/header.php";
ob_start();
$name = $HTTP_GET_VARS['name'];
if ($name == null) {
    header("Location: index.php");
    exit;
}
openDatabase(false);
$players = getPlayers($name, 50);
if (count($players) == 1) {
    if (getPid($name) != 0) {
        header("Location: playerinfo.php?name=" . urlencode($name));
        closeDatabase();
        exit;
    }
}
ob_end_flush();
$html_title = "WinBolo.net: Search Results for {$name}";
include "{$BASE_FILES}/inc_top.php";
$error_heading = "Search Results";
if (count($players) == 0) {
    $error_body = "Sorry, no matches to your query.";
} else {
    $error_body = "Search Results (Limit 50 matches)<P>";
    $count = 0;
    while ($count < count($players)) {
        $error_body .= "<a href=\"playerinfo.php?name=" . urlencode($players[$count]) . "\">" . $players[$count] . "</A><BR>";
        $count++;
    }
コード例 #2
0
ファイル: header.php プロジェクト: ultramookie/dertyn
<?php

include_once "db.php";
include_once "dertyn.php";
$siteurl = getSiteUrl();
$tagline = getTagline();
$rewriteCheck = getrewriteCheck();
$id = $_GET['id'];
$numEntries = getIndexNum();
$pagenum = 1;
if ($rewriteCheck == 1) {
    $pid = getPid($id);
} else {
    $pid = $id;
}
if ($id) {
    $subject = getSubject($pid);
    $title = "{$subject} - {$sitename}";
    $description = getArticleDesc($pid);
} else {
    $title = $sitename;
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><?php 
echo "{$title}";
?>
コード例 #3
0
ファイル: dertyn.php プロジェクト: ultramookie/dertyn
function printEntry($id, $single)
{
    $siteurl = getSiteUrl();
    $realname = getRealName();
    $permalink = makePermaLink($id, $single);
    $rewriteCheck = getrewriteCheck();
    $params = array('id' => $id);
    if ($rewriteCheck == 1 && $single) {
        $result = query("main.printEntrySingle", $params);
        $pid = getPid($id);
    } else {
        $result = query("main.printEntry", $params);
        $pid = $id;
    }
    $row = mysql_fetch_array($result);
    $text = rn2html($row['body']);
    echo "\n";
    echo "<p class=\"subject\"><a href=\"" . $permalink . "\">" . $row['subject'] . "</a></p>";
    echo "\n";
    echo "<p class=\"timedate\">" . strtolower($row['date']) . " : " . $realname . "</a>";
    if (checkCookie()) {
        echo " <a href=\"{$siteurl}/edit.php?number=" . $row['id'] . "&type=rich\"><img src=\"{$siteurl}/page_edit.gif\" border=\"0\" title=\"edit with rich editor\" width=\"16\" height=\"16\" /></a> ";
        echo "<a href=\"{$siteurl}/edit.php?number=" . $row['id'] . "&type=raw\"><img src=\"{$siteurl}/page_edit_code.gif\" border=\"0\" title=\"edit raw code\" width=\"16\" height=\"16\" /></a> ";
        echo "<a href=\"{$siteurl}/delete.php?number=" . $row['id'] . "&type=post\"><img src=\"{$siteurl}/page_delete.gif\" border=\"0\" title=\"delete entry and all comments\" width=\"16\" height=\"16\" /></a> ";
    }
    echo "</p>";
    echo "\n";
    echo "<p class=\"entry\">" . $text . " </p>";
    echo "\n";
    echo "<hr />";
}
コード例 #4
0
ファイル: functions.php プロジェクト: andrewroth/winbolo
function doCreateTeam($login, $teamName, $editpassword, $editpassword2, $joinpassword, $joinpassword2, $blurb, $website)
{
    if (stristr($teamName, "'") != false || stristr($teamName, "\"") != false || stristr($teamName, "\\") != false) {
        return "Sorry, team names can not contain \\ or ' or \" in them.";
    }
    $teamName = strip_tags($teamName);
    $teamName = trim($teamName);
    $teamName = normalize_whitespace($teamName);
    $teamName = chop($teamName);
    $editpassword = stripslashes($editpassword);
    $editpassword2 = stripslashes($editpassword2);
    $joinpassword = stripslashes($joinpassword);
    $joinpassword2 = stripslashes($joinpassword2);
    $blurb = stripslashes($blurb);
    if (trim($teamName) == "" || trim($joinpassword) == "" || trim($editpassword) == "") {
        return "Missing required information";
    }
    if ($joinpassword != $joinpassword2) {
        return "Join passwords do not match";
    }
    if ($editpassword != $editpassword2) {
        return "Edit passwords do not match";
    }
    if (strlen($teamName) > 32) {
        return "Your team name is too long";
    }
    if (doesTeamExist($teamName) == true) {
        return "Team with this name already exists";
    }
    $pid = getPid($login);
    if ($pid == 0) {
        return "Unexpected error";
    }
    $website = trim($website);
    if (substr(strtolower($website), 0, 7) != "http://") {
        $website = "http://" . $website;
    }
    if ($website == "http://") {
        $website = "";
    }
    $sqlTeamName = mysql_escape_string($teamName);
    $joinpassword = mysql_escape_string($joinpassword);
    $editpassword = mysql_escape_string($editpassword);
    $blurb = mysql_escape_string($blurb);
    $website = mysql_escape_string($website);
    $regdate = date("M d, Y");
    $sql = "insert into stats_team (name, owner_password, join_password, owner, blurb, website, regdate, tourn_score, strict_score) values ('{$sqlTeamName}', '{$editpassword}', '{$joinpassword}', '{$pid}', '{$blurb}', '{$website}', '{$regdate}', 1600, 1600)";
    if (!mysql_query($sql)) {
        return "Database error";
    }
    $tid = getTid($teamName);
    $sql = "insert into team_members values ('{$tid}', '{$pid}')";
    if (!mysql_query($sql)) {
        return "Database Error 2";
    }
    $sql = "insert into view_team (id, view_count) values ({$tid}, 0)";
    if (!mysql_query($sql)) {
        return "Database error";
    }
    return "OK";
}
コード例 #5
0
ファイル: mapdownload.php プロジェクト: andrewroth/winbolo
<?php

require "../php/db.php";
require "../php/functions.php";
$site = "localhost";
$username = $cfg_winbolodb_user;
$password = $cfg_winbolodb_pass;
$dbName = $cfg_winbolodb;
mysql_connect($site, $username, $password) or die("I sux");
mysql_select_db($dbName);
$name = $HTTP_GET_VARS['name'];
$pid = getPid($name);
if ($pid == 0) {
    return;
}
$sql = "select name, map from map where pid = '{$pid}'";
$result = mysql_query($sql);
if (mysql_numrows($result) == 0) {
    closeDatabase();
    return;
}
$name = "Content-Disposition: filename=\"" . mysql_result($result, 0, "name") . ".map\"";
header($name);
header("Content-Description: WinBolo Map");
header("content-type: application/winbolomap");
echo mysql_result($result, 0, "map");
closeDatabase();
コード例 #6
0
ファイル: whatif.php プロジェクト: andrewroth/winbolo
                $listB[0] = $playerB;
            } else {
                $listB = getPlayers($playerB, 50);
            }
        }
    }
    if (sizeof($listA) == 1 && sizeof($listB) == 1) {
        if ($listA[0] == $playerA && $listB[0] == $playerB) {
            #We have found a match
            $found = true;
            if ($isTeam == true) {
                $idA = getTid($listA[0]);
                $idB = getTid($listB[0]);
            } else {
                $idA = getPid($listA[0]);
                $idB = getPid($listB[0]);
            }
            $scoreA = getScore($idA, $gt, $isTeam);
            $scoreB = getScore($idB, $gt, $isTeam);
            $newScoreA_1 = floor(calculateElo($scoreA, $scoreB, true));
            $newScoreB_1 = floor(calculateElo($scoreB, $scoreA, false));
            $newScoreA_2 = floor(calculateElo($scoreA, $scoreB, false));
            $newScoreB_2 = floor(calculateElo($scoreB, $scoreA, true));
        }
    }
}
if ($found == true) {
    include "{$BASE_FILES}/inc_whatif_results.php";
} else {
    include "{$BASE_FILES}/inc_whatif.php";
}
コード例 #7
0
ファイル: test_server.php プロジェクト: halumein/halomatic
    array_shift($ps);
    //в итоге имеем ps[0][0] -> пид и ps[0][6] -> юид
    $piduid_server = $pid . $uid;
    $piduid_local = $ps[0][0] . $ps[0][6];
    if ($piduid_local === $piduid_server) {
        return true;
    } else {
        return false;
    }
}
function resetTask($uid)
{
    echo "меняю статус задания - ";
    require 'src/dbconnection.php';
    $sql = "\r\n    UPDATE  `halomatic`.`server_taskTable`\r\n    SET  `server_taskTable`.`task_status` =  '1' WHERE  `server_taskTable`.`uid` ={$uid};\r\n    ";
    if (mysql_query($sql)) {
        echo "OK\n";
    } else {
        echo "Fail\n";
    }
}
$pids = getPid();
//получаем [pid] и [uid] из таблицы заданий сервера где
foreach ($pids as $pid) {
    if (checkPid($pid['pid'], $pid['uid'])) {
        echo "процесс найден и соответствует \n";
    } else {
        echo "процесс не найден или не соответствует. \n";
        resetTask($pid['uid']);
    }
}
コード例 #8
0
ファイル: mapupload.php プロジェクト: andrewroth/winbolo
 if ($map->readMap($mapfile['tmp_name']) == false) {
     $error = "Not a valid WinBolo Map";
 } else {
     $gif = $map->getImg();
     $tmpfname = tempnam("/tmp", "IMG");
     $name = stripslashes(trim($mapfile['name']));
     $end = substr($name, -4);
     if (strstr(strtolower($end), ".map") != false) {
         # trim off end .map
         $name = substr($name, 0, -4);
     }
     $name = mysql_escape_string($name);
     ImagePng($gif, $tmpfname);
     $sqlMapFile = addslashes(fread(fopen($mapfile['tmp_name'], "r"), filesize($mapfile['tmp_name'])));
     $sqlImgFile = addslashes(fread(fopen($tmpfname, "r"), filesize($tmpfname)));
     $pid = getPid($userdata['username']);
     $pills = $map->getNumPills();
     $bases = $map->getNumBases();
     $starts = $map->getNumStarts();
     $blurb = stripslashes($blurb);
     $blurb = mysql_escape_string($blurb);
     $sql = "delete from map where pid = '{$pid}'";
     if (!mysql_query($sql)) {
         $error = "Database error";
         unlink($tmpfname);
     } else {
         $sql = "INSERT INTO map (pid , name , comment , map, img, bases, pills, starts) VALUES ('{$pid}', '{$name}', '{$blurb}', '{$sqlMapFile}', '{$sqlImgFile}', '{$bases}', '{$pills}', '{$starts}')";
         if (!mysql_query($sql)) {
             $error = "Database error";
         }
         unlink($tmpfname);
コード例 #9
0
ファイル: wp_import.php プロジェクト: ultramookie/dertyn
    $slug = mysql_real_escape_string($row['post_name']);
    $entrytime = mysql_real_escape_string($row['post_date']);
    $query = "insert into main (subject,body,entrytime,slug,published) values ('{$subject}','{$body}','{$entrytime}','{$slug}','1')";
    $status = mysql_query($query);
    $posts_imported++;
}
echo "Dertyn imported {$posts_imported} posts...<br />\n";
while ($row = mysql_fetch_array($wpdrafts)) {
    $subject = mysql_real_escape_string($row['post_title']);
    $body = mysql_real_escape_string($row['post_content']);
    $slug = mysql_real_escape_string($row['post_name']);
    $entrytime = mysql_real_escape_string($row['post_date']);
    $query = "insert into main (subject,body,entrytime,slug,published) values ('{$subject}','{$body}','{$entrytime}','{$slug}','0')";
    $status = mysql_query($query);
    $drafts_imported++;
}
echo "Dertyn imported {$drafts_imported} drafts...<br />\n";
while ($row = mysql_fetch_array($wpcomments)) {
    $name = mysql_real_escape_string($row['comment_author']);
    $url = mysql_real_escape_string($row['comment_author_url']);
    $comment = mysql_real_escape_string($row['comment_content']);
    $ipaddy = mysql_real_escape_string($row['comment_author_IP']);
    $commenttime = mysql_real_escape_string($row['comment_date']);
    $slug = mysql_real_escape_string($row['post_name']);
    $pid = getPid($slug);
    $query = "insert into comments (name,url,comment,ip,commenttime,pid) values ('{$name}','{$url}','{$comment}','{$ipaddy}','{$commenttime}','{$pid}')";
    $status = mysql_query($query);
    $comments_imported++;
}
echo "Dertyn imported {$comments_imported} comments...<br />\n";
echo "Import completed, please removed this file.<br />\n";