Answer the question
In order to leave comments, you need to log in
How to remove email request in vk iframe application?
Hello!
I can not get the approval of the iframe application in vk. The moderators write that "it is necessary to remove the e-mail request in the settings", but it is completely unclear what settings they are talking about. The code has already been rummaged through, several times we made sure that there are no lines like scope=email anywhere. Can't email be requested in some other way? Here, take a look at the code:
<a href="'.$CONF['url'].'/index.php?vk=true&state='.$_SESSION['state'].'">Войти в приложение</a>
<?
if(isset($_GET['vk']) && $settings['vkappid']) {
$reg = new register();
$reg->db = $db;
$reg->url = $CONF['url'];
$reg->username = $_POST['username'];
$reg->password = $_POST['password'];
$reg->email = $_POST['email'];
$reg->captcha = $_POST['captcha'];
$reg->captcha_on = $settings['captcha'];
$reg->message_privacy = $settings['mprivacy'];
$reg->like_notification = $settings['notificationl'];
$reg->comment_notification = $settings['notificationc'];
$reg->shared_notification = $settings['notifications'];
$reg->chat_notification = $settings['notificationd'];
$reg->friend_notification = $settings['notificationf'];
$reg->verified = $settings['verified'];
$reg->email_like = $settings['email_like'];
$reg->email_comment = $settings['email_comment'];
$reg->email_new_friend = $settings['email_new_friend'];
$reg->sound_new_notification = $settings['sound_new_notification'];
$reg->sound_new_chat = $settings['sound_new_chat'];
$reg->vkapp = $settings['vkapp'];
$reg->vkappid = $settings['vkappid'];
$reg->vkappsecret = $settings['vkappsecret'];
$reg->vkcode = $_GET['code'];
$reg->vkstate = $_GET['state'];
$TMPL['registerMsg'] = $reg->vk();
header("Location: ".$CONF['url']."/index.php?a=profile&u=".$reg->username);
}
function vk() {
if($this->vkapp) {
$api_id = *******; // здесь реальный id приложения
$secret_key = '**************'; // здесь реальный защищенный ключ
$auth_key = $_SESSION['vk_auth_key'];
$viewer_id = $_SESSION['vk_viewer_id'];
if(md5($api_id."_".$viewer_id."_".$secret_key)!=$auth_key) exit($error_text);
// Get user's ID + add 'id' line before his ID
$generator = $_SESSION['vk_viewer_id'];
$user->screen_name = 'id'.$generator;
//APIServerPHPClass initialization: get user's first_name & last_name
require 'vkapi.class.php';
$VK = new vkapi($api_id, $secret_key);
$resp = $VK->api('users.get', array('uids'=>$generator));
$polar_first_name = $resp['response'][0]['first_name'];
$polar_last_name = $resp['response'][0]['last_name'];
if($_SESSION['state'] == null || ($_SESSION['state'] != $this->vkstate)) {
header("Location: ".$this->url);
}
if(!empty($user->screen_name)) {
$this->screen_name = $user->screen_name;
$this->first_name = $polar_first_name;
$this->last_name = $polar_last_name;
$checkScreenName = $this->verify_if_screenname_exists();
// If user already exist
if($checkScreenName) {
// Set sessions and log-in
$_SESSION['username'] = $checkScreenName['username'];
$_SESSION['password'] = $checkScreenName['password'];
// Redirect user
header("Location: ".$this->url);
} else {
$this->username = $this->screen_name;
$this->password = $this->generatePassword(8);
$this->query();
$_SESSION['username'] = $this->username;
$_SESSION['password'] = md5($this->password);
return 1;
}
}
}
}
?>
<!DOCTYPE html>
<html lang="ru">
<head>
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/js/jquery.timeago.js"></script>
<script type="text/javascript" src="/js/functions.js"></script>
<script type="text/javascript" src="https://vkontakte.ru/js/api/xd_connection.js?2"></script>
<script type="text/javascript">
function postOnVkWall() {
VK.api('wall.post',{message: 'Текст_сообщения', attachments: 'vkapp/index.php?a=welcome'},function(data) {
if (data.response) {
alert('Запись опубликована на Вашей стене!');
document.location.reload();
}
if (data.error) {
alert('К сожалению, при публикации произошла ошибка.');
document.location.reload();
}
});
}
</script>
<link rel="stylesheet" href="/js/jquery.fancybox.css?v=2.1.5" type="text/css" media="screen" />
<script type="text/javascript" src="/js/jquery.fancybox.pack.js?v=2.1.5"></script>
<script>
$(document).ready(function() {
$(".fancybox").fancybox({
openEffect : 'none',
closeEffect : 'none'
});
});
</script>
</head>
<body>
<div style="height:auto !important; min-height:730px;" id="page">
<div id="loading-bar"><dd></dd><dt></dt></div>
<div class="topbar">
<div class="header">
<a href="/vkapp/index.php?a=welcome" rel="loadpage"><div class="menu_btn logo-container"><div class="logo"></div></div></a>
<div class="search-input"><input type="text" id="search" placeholder="Поиск людей, #хэштегов, !групп" autocomplete="off" value=""></div>
<a href="/vkapp/index.php?a=welcome" rel="loadpage" title="Присоединиться"><div class="topbar-button">Присоединиться</div></a>
</div>
<div class="search-container"></div>
</div>
<div id="content">
<div class="row-welcome content-welcome">
<div class="row-body">
<div class="welcome-inner">
<div class="welcome-message">
<div class="welcome-title">
Title
</div>
<div class="welcome-desc">
Description
</div>
<div class="welcome-about">
<!--делитесь информацией-->
</div>
</div>
<div class="welcome-inputs">
<br />
<form action="" method="POST" autocomplete="off">
<div class="facebook-button"><a href="/vkapp/index.php?vk=true&state=dbb8379b8bbb22b1c8d25ccd9ec42426" class="change_loading facebook-button">Войти в приложение</a></div>
</form>
</div>
</div>
</div>
</div>
<div class="welcome-full welcome-white">
<div class="welcome-inner">
<div class="welcome-row-title">Title</div>
<div style="width:100%; padding-bottom:22px; font-size: 16px; color: #999;" class="welcome-user">Description</div>
</div>
</div>
<div class="welcome-full">
</div>
</div>
<div class="footer">
<div class="footer-container">
</div>
</div>
</div>
</body>
</html>
//Polar: get VK iframe viewer_id
if(!isset($_SESSION['vk_auth_key']) || !isset($_SESSION['vk_viewer_id'])) {
$_SESSION['vk_auth_key'] = $_GET['auth_key'];
$_SESSION['vk_viewer_id'] = $_GET['viewer_id'];
// Check auth_key & viewer_id
$api_id = ********; // id приложения
$secret_key = '*************'; // защищенный ключ
$viewer_id = $_GET['viewer_id'];
$auth_key = $_GET['auth_key'];
if(md5($api_id."_".$viewer_id."_".$secret_key)!=$auth_key) exit('Key incorrect');
}
Answer the question
In order to leave comments, you need to log in
This is the server part in php, but what does the settings form itself look like in html?
Are you kidding today? :) The third question is about the same thing..
$(document).on('click', '.images', function(){ // кликаем по созданному вызовом функциии выше классу
alert("Вы кликнули по картинке с классом 'images'"); // сообщение не отображается
});
Most likely because in HTML class="image"
, and you are listening to events on $('.images')
(extra s at the end).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question