STnavi 情報館 ver.2.12

F = datas/functions.inc
2014-11-28 00:50:18 更新
INDEX
mb_language("ja");
mb_internal_encoding("UTF-8");

$dbhost = 'localhost';
$dbuser = 'stnavi';
$dbpass = 'cubie';
$dbname = 'stnavi';

function getparam($n, $d) {
$ret = $_POST[$n] ? $_POST[$n] : $d;
$ret = $_GET[$n] ? $_GET[$n] : $ret;
return $ret;
}


function checkuser($id, $pw) {

$dbhost = 'localhost';
$dbuser = 'stnavi';
$dbpass = 'cubie';
$dbname = 'stnavi';
$dbtable = 'user';

$db = mysql_connect($dbhost, $dbuser, $dbpass);
if (!$db) die('データベースに接続できませんでした。' . mysql_error());
mysql_query('SET NAMES utf8', $db);

$db_selected = mysql_select_db($dbname, $db);
if (!$db_selected) die('データベースの選択ができませんでした。' . mysql_error());

$query = 'SELECT * FROM `' . $dbtable . '`';
$result = mysql_query($query);
if (!$result) die('データベースの読み出しを失敗しました。' . mysql_error());

$ret = 'ゲスト';
while ($row = mysql_fetch_assoc($result)) {
if ($id == $row['uid']) {
$crypted = crypt($pw, "stripnavigator");
if ($crypted == $row['pw']) {
$ret = $row['kubun'];
} else {
}
break;
}
}
mysql_close($db);
return $ret;
}

function footer($uid, $pw, $filename) {
$ret = '';
$ret .= 'Copyright © ';
if (date('Y') > 2014) $ret .= '2014-';
$ret .= date('Y') . ' STrip NAVIgator.   ';
$ret .= 'All Rights Reserved.';
if (checkuser($uid, $pw) == '管理者') {
$ret .= '  ' . $filename;
$ret .= ' lastupdate ' . date('Y-m-d H:i', filemtime($filename));
}
$ret .= '
';
$ret .= '
';
return $ret;
}

function linkbutton($anc, $text, $uid, $pw) {
$ret = '
';
$ret .= '';
$ret .= '';
$ret .= '';
$ret .= '
';
return $ret;
}

function checkcookie($str, $val) {
if (isset($_COOKIE[$str])) {
if ($val) {
if ($val != $_COOKIE[$str]) {
setcookie($str, $val);
}
} else {
$val = $_COOKIE[$str];
}
} else {
if ($val) {
setcookie($str, $val);
}
}
return $val;
}


?>

Copyright ©2013-2025 Libra0977.   All Rights Reserved.   last updated 2014.8/25.
Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)