Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
<?php
require_once('_inc.php');
$head_title = array();
$head_title[] = 'Login';
// If the user is already logged in then return them to the homepage
if($user->isAuthorized()){
header('Location: '.$config->site->base, true, 302);
exit;
}
// If the user clicked the 'sign in with Facebook' link
if( MK_Request::getQuery('platform') === 'facebook' ){
$config = MK_Config::getInstance();
$facebook_url = $config->facebook->getLoginUrl(array(
'next' => MK_Utility::serverUrl($config->site->referer),
'cancel_url' => MK_Utility::serverUrl($config->site->referer),
'req_perms' => 'email, user_photos'
));
header('Location: '.$facebook_url, true, 302);
exit;
}
$settings = array(
'attributes' => array(
'class' => 'narrow clear-fix'
)
);
$structure = array(
'email' => array(
'label' => 'Email',
'validation' => array(
'email' => array(),
'instance' => array()
)
),
'password' => array(
'label' => 'Password',
'validation' => array(
'instance' => array(),
),
'attributes' => array(
'type' => 'password'
)
),
'login' => array(
'type' => 'submit',
'attributes' => array(
'value' => 'Login'
)
)
);
if($config->site->facebook->login)
{
$structure['facebook'] = array(
'type' => 'link',
'text' => 'Login with Facebook',
'attributes' => array(
'href' => 'login.php?platform=facebook'
)
);
}
$form = new MK_Form($structure, $settings);
$output = '<h2 class="narrow">Login</h2>';
$output .= '<p class="narrow">Please enter your email address and password. If you can\'t remember then use the <a href="forgot-pass.php">forgotten password</a> form.</p>';
if($form->isSuccessful()){
$user = MK_Authorizer::authorizeByEmailPass(
$form->getField('email')->getValue(),
$form->getField('password')->getValue()
);
if($user->isAuthorized()){
$session->login = $user->getId();
$cookie->set('login', $user->getId(), $config->site->user_timeout);
header('Location: '.($config->site->referer === $config->site->page ? $config->site->base : $config->site->referer), true, 302);
}else{
$form->getField('email')->getValidator()->addError('This username and password combination does not match our records. Please try again.');
}
}
$output.=$form->render();
require_once('_header.php');
print $output;
require_once('_footer.php');
?>
<?php
require_once '_inc.php';
$head_title = array();
$head_title[] = 'User Access Levels';
$output = '<h2>User Access Levels</h2>';
// If user is logged in then see which messages they can see
if($user->isAuthorized())
{
$output .= '<p class="alert information">This account belongs to the <strong>'.$user->getGroup()->getName().'</strong> group, which <strong>'.($user->getGroup()->isAdmin() ? ' grants admin access' : ' doesn\'t have admin access').'</strong>. You have an access level of <strong>'.$user->getGroup()->getAccessLevel().'</strong>.</p>';
if( $user->getGroup()->getAccessLevel() >= 1)
{
$output .= '<p class="alert success">This message is displayed as <strong>you have</strong> an access level of 1 or higher</p>';
}
else
{
$output .= '<p class="alert warning">This message is displayed as <strong>you don\'t have</strong> an access level of 1 or higher</p>';
}
if( $user->getGroup()->getAccessLevel() >= 2)
{
$output .= '<p class="alert success">This message is visible as <strong>you have</strong> an access level of 2 or higher</p>';
}
else
{
$output .= '<p class="alert warning">This message is displayed as <strong>you don\'t have</strong> an access level of 2 or higher</p>';
}
if( $user->getGroup()->getAccessLevel() >= 3)
{
$output .= '<p class="alert success">This message is visible as <strong>you have</strong> an access level of 3 or higher</p>';
}
else
{
$output .= '<p class="alert warning">This message is displayed as <strong>you don\'t have</strong> an access level of 3 or higher</p>';
}
if( $user->getGroup()->getAccessLevel() >= 4)
{
$output .= '<p class="alert success">This message is visible as <strong>you have</strong> an access level of 4 or higher</p>';
}
else
{
$output .= '<p class="alert warning">This message is displayed as <strong>you don\'t have</strong> an access level of 4 or higher</p>';
}
}
else
{
$output .= '<p class="alert information">Please <a href="login.php">log in</a> or <a href="register.php">register</a> to view this page!</p>';
}
require_once '_header.php';
print $output;
require_once '_footer.php';
?>
<?php
require_once('_inc.php');
$head_title = array();
$head_title[] = 'Login';
// If the user is already logged in then return them to the homepage
if($user->isAuthorized()){
header('Location: '.$config->site->base, true, 302);
exit;
}
// If the user clicked the 'sign in with Facebook' link
if( MK_Request::getQuery('platform') === 'facebook' ){
$config = MK_Config::getInstance();
$facebook_url = $config->facebook->getLoginUrl(array(
'next' => MK_Utility::serverUrl($config->site->referer),
'cancel_url' => MK_Utility::serverUrl($config->site->referer),
'req_perms' => 'email, user_photos'
));
header('Location: '.$facebook_url, true, 302);
exit;
}
$settings = array(
'attributes' => array(
'class' => 'narrow clear-fix'
)
);
$structure = array(
'email' => array(
'label' => 'Email',
'validation' => array(
'email' => array(),
'instance' => array()
)
),
'password' => array(
'label' => 'Password',
'validation' => array(
'instance' => array(),
),
'attributes' => array(
'type' => 'password'
)
),
'login' => array(
'type' => 'submit',
'attributes' => array(
'value' => 'Login'
)
)
);
if($config->site->facebook->login)
{
$structure['facebook'] = array(
'type' => 'link',
'text' => 'Login with Facebook',
'attributes' => array(
'href' => 'login.php?platform=facebook'
)
);
}
$form = new MK_Form($structure, $settings);
$output = '<h2 class="narrow">Login</h2>';
$output .= '<p class="narrow">Please enter your email address and password. If you can\'t remember then use the <a href="forgot-pass.php">forgotten password</a> form.</p>';
if($form->isSuccessful()){
$user = MK_Authorizer::authorizeByEmailPass(
$form->getField('email')->getValue(),
$form->getField('password')->getValue()
);
if($user->isAuthorized()){
$session->login = $user->getId();
$cookie->set('login', $user->getId(), $config->site->user_timeout);
header('Location: '.($config->site->referer === $config->site->page ? $config->site->base : $config->site->referer), true, 302);
}else{
$form->getField('email')->getValidator()->addError('This username and password combination does not match our records. Please try again.');
}
}
$output.=$form->render();
require_once('_header.php');
print $output;
include '_footer.php';
?>
<link rel="stylesheet" href="tpl/css/reset.css" type="text/css" media="screen" />
<title>Вход</title>
<?php session_start(); ?><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Music</title>
</head>
<style type="text/css">
@import url(menu_style.css);
</style>
<style type="text/css">
a:link {
color: #06F;
}
a:visited {
color: #06F;
}
a:hover {
color: #06F;
}
a:active {
color: #06F;
}
</style>
</head>
<ul id="menu">
<a href="index.php">Начало</a>
<a href="project.php">Относно</a>
<a href="members.php">Потребители</a>
<a href="search.php">Търсене</a>
<?php
include '_inc.php';
if($user->isAuthorized()){
?>
<a href="members.php?profile=<?php print $user->getId(); ?>">Моя профил </a>
<a href="edit-profile.php">Промяна на профила</a>
<?php print $user->getType() === MK_RecordUser::TYPE_CORE ? '<a href="change-password.php">Смяна на парола</a>' : '' ?>
<?php print $user->getGroup()->isAdmin() ? '<a href="admin" target="_blank">Админ панел</a>
<a href="stats.php" target="_blank">Статистика</a>' : '' ?>
<a href="logout.php">Изход</a>
<?php
}else{
?>
<a href="login.php">Вход</a>
<a href="register.php">Регистрация</a>
<?php
}
?>
</ul>
<p> </p>
<form method="post" action="">
<table width="638" height="60" align="center" cellpadding="1" cellspacing="1">
<tr>
<td width="215" align="left"><p class="margin">Клипчето което гледаш: (vbox7/youtube)</p></td>
<td width="390" align="left"><input name="desc" type="text" id="desc" value="" size="40" />
<label for="type"></label>
<select name="type" size="1" id="type">
<option></option>
<option>Music</option>
<option>Fun video</option>
</select></td>
</tr>
<tr>
<td colspan="3" align="left"><div align="center">
<input name="submit" type="submit" id="button" value="Добави !" />
<input name="reset" type="reset" id="button" value="Изчисти !">
</div></td>
</tr>
</table>
</form>
<?php
$user_module = MK_RecordModuleManager::getFromType('user');
if($user->isAuthorized()) {
$profile = 'members.php?profile=' .$user->getId();
$display_name = $user->getDisplayName();
}
else {
$profile = "#";
$display_name = "Guest";
}
if(isset($_POST['submit'])){
if($_POST['desc'] == "") { echo "<script type=\"text/javascript\">alert('Сложи линк към клипа де')</script>"; }// изписва го ако desc is empty
if($_POST['type'] == "") { echo "<script type=\"text/javascript\">alert('Избери типът видео')</script>"; } // изписва го ako type is empty
else {
$desc = nl2br(strip_tags(addslashes($_POST['desc'])));
$ip = $_SERVER['REMOTE_ADDR'];
$ip = ip2long($ip);
$sql = "INSERT INTO `blanka` (`id`, `profile`, `display_name`, `desc`, `type`, `added`, `ip` )
VALUES (NULL, '$profile', '$display_name', '$desc', '$_POST[type]' , NOW(), '$ip')";
$result = mysql_query($sql)or die(mysql_error()."<br />Problem: ".__LINE__);
}}
?>
</p>
<div align="center"><hr>
<?php
$conn = mysql_connect('localhost', 'root', 'stanimir') or die("Грешка! Моля съобщете на администраторите!");
$rez = mysql_select_db('user_manager', $conn) or die("Грешка! Моля съобщете на администраторите!");
$the_limit = "5";
$the_query = "SELECT * FROM `blanka` ORDER BY id DESC";
$listed = "";
$listed_end = "";
$page = trim($_GET['page']);
if(is_numeric($page)){
$page = $page * $the_limit;
if( (!$page) or ($page == "0") ){
$a = "0";
$b = $the_limit;
} else {
$a = $page;
$b = $a + $the_limit;
}
} else {
$a = "0";
$b = $the_limit;
}
$query = $the_query." limit $a, $the_limit";
$result = mysql_query($query, $conn) or die (mysql_error());
$result_all = mysql_query($the_query, $conn) or die (mysql_error());
$num_all = mysql_num_rows($result_all);
while($row = mysql_fetch_array($result)){
$profile = $row['profile'];
$display_name = $row['display_name'];
$desc = $row['desc'];
$url = $desc;
if(preg_match("/youtube/si",$url)){
parse_str(parse_url($url, PHP_URL_QUERY ));
$id = $v;
echo'<iframe width="450" height="403" src="http://www.youtube.com/embed/'.$id.'?rel=0" frameborder="0" allowfullscreen></iframe><br /a>';
echo "Добавено от: <a href='$profile'>$display_name</a><br /a><br /a>";
}
elseif(preg_match("/vbox7/si",$url)){
$id = end(explode('play:',$url));
echo'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="450" height="403"><param name="movie" value="http://i47.vbox7.com/player/ext.swf?vid='.$id.'"><param name="quality" value="high"><embed src="http://i48.vbox7.com/player/ext.swf?vid='.$id.'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="450" height="403"></embed></object><br /a><br /a>' ;
echo "Добавено от: <a href='$profile'>$display_name</a><br /a><br /a>";
}
}
$num_pages = ceil($num_all / $the_limit);
for($i=0;$i<$num_pages;$i++){
$name = $i;
$name++;
if($name != $num_pages){
$last = " | ";
} else $last = "";
$pages.= "<a href=\"?page=".$i."\">".$name."</a>".$last;
}
echo "Показване на резултати от ".$a." до ".$b."<br /><br />";
echo $listed.$listed_end;
echo $pages;
echo "<hr>";
include '_footer.php';
?>
</div>
</body>
</html>