function view_name($link) {
require ("connect.php");
$query = "SELECT name FROM `menu1` WHERE id='$link' limit 1";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$name = $row["name"];
echo $name;
}
function view_name_test($link) {
require ("connect.php");
$query = "SELECT name FROM `menu_test` WHERE id='$link' limit 1";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$name = $row["name"];
echo $name;
}
function view_name_test2($link) {
require ("connect.php");
$query = "SELECT name FROM `test` WHERE id='$link' limit 1";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$name = $row["name"];
echo $name;
}
function colvo_test($link) {
require ("connect.php");
$query = "SELECT sum FROM `test` WHERE id='$link' limit 1";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$sum = $row["sum"];
return $sum;
}
function colvo_book($link) {
require ("connect.php");
$query = "SELECT id FROM `info` WHERE parent_menu='$link'";
$result = mysql_query($query);
$n=mysql_numrows($result);
echo $n;
}
function img_resize($src, $dest, $width, $height, $rgb=0xFFFFFF, $quality=75) {
if (!file_exists($src)) return false;
$size = getimagesize($src);
if ($size === false) return false;
$format = strtolower(substr($size['mime'], strpos($size['mime'], '/')+1));
$icfunc = "imagecreatefrom" . $format;
if (!function_exists($icfunc)) return false;
$isrc = $icfunc($src);
$idest = imagecreatetruecolor($width, $height);
imagecopyresampled($idest, $isrc, 0, 0, 0, 0, ImageSX($idest), ImageSY($idest), ImageSX($isrc), ImageSY($isrc));
imagejpeg($idest, $dest, $quality);
imagedestroy($isrc);
imagedestroy($idest);
return true;
}
function menu_obraz_res($id) {
$query = "SELECT cleft, cright FROM `adv_catalogue` WHERE id='$id' limit 1";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$cleft = $row["cleft"];
$cright = $row["cright"];
$query = "SELECT cleft FROM `adv_catalogue` WHERE cleft>'$cleft' AND cleft<'$cright'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$cleft = $row["cleft"];
echo $name;
}
function encode($in_str, $charset) {
$out_str = $in_str;
if ($out_str && $charset) {
// define start delimimter, end delimiter and spacer
$end = "?=";
$start = "=?" . $charset . "?B?";
$spacer = $end . "\r\n " . $start;
// determine length of encoded text within chunks
// and ensure length is even
$length = 90- strlen($start) - strlen($end);
$length = floor($length/2) * 2;
// encode the string and split it into chunks
// with spacers after each chunk
$out_str = base64_encode($out_str);
$out_str = chunk_split($out_str, $length, $spacer);
// remove trailing spacer and
// add start and end delimiters
$spacer = preg_quote($spacer);
$out_str = preg_replace("/" . $spacer . "$/", "", $out_str);
$out_str = $start . $out_str . $end;
}
return $out_str;
}
function strings_isemail($string) {
return preg_match('%[-\\.\\w]+@[-\\w]+(?:\\.[-\\w]+)+%', $string);
}
function strings_clear($string) {
$string = trim($string);
$string = stripslashes($string);
return htmlspecialchars($string, ENT_QUOTES);
}
function strings_stripstring($text, $wrap, $length) {
$text = preg_replace('%(\\S{'.$wrap.'})%', '\\\\1 ', $text);
return substr($text, 0, $length);
}
function sovp($num) {
switch($num%10) {
case "1":
echo"совпадение";
break;
case "2":
echo"совпадения";
break;
case "3":
echo"совпадения";
break;
case "4":
echo"совпадения";
break;
default:
echo"совпадений";
break;
}
}
?>
if (isset($_POST['auth_name'])) {
$name=mysql_real_escape_string($_POST['auth_name']);
$pass=mysql_real_escape_string($_POST['auth_pass']);
$query = "SELECT name FROM user WHERE log='$name' AND pass='$pass'";
$res = mysql_query($query) or trigger_error(mysql_error().$query);
if ($row = mysql_fetch_assoc($res)) {
session_start();
$_SESSION['user_id'] = $row['id'];
$_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];
$_SESSION['name'] = $row['name'];
}
header("Location: http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."?link=$_POST[l]&type=$_POST[t]");
exit;
}
if (isset($_GET['action']) AND $_GET['action']=="logout") {
session_start();
session_destroy();
header("Location: http://".$_SERVER['HTTP_HOST']."/");
exit;
}
if (isset($_REQUEST[session_name()])) session_start();
?>
:: Образовательный портал РТ
|
|
|
|
|
|
сегодня: понедельник, 11 ноября 2024
|
|
Наши награды:
лауреат премии рунета 2006
диплом Фестиваля "Новая Реальность-2006"
лаурет 1 премии "Звёзды Татнета-2007"
|