Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   Серверные технологии и Flash (http://www.flasher.ru/forum/forumdisplay.php?f=62)
-   -   Поддержка сессии (http://www.flasher.ru/forum/showthread.php?t=129636)

codfelix 07.09.2009 06:50

Поддержка сессии
 
Здравствуйте, уважаемые флешеры
Не могли бы, Вы мне помочь.
Как в этот php/код, добавить поддержку сессии?

PHP код:

<?php 

// SET THE CORRECT USERNAME AND PASSWORD
$correct_user "flash";
$correct_pass "vista";

// Checkif the username is correct
if ($user==$correct_user){

    
//IF the username is correct, check the password
    
if ($pass==$correct_pass){

        
//If the password is correct, return "ok"
        
$response="ok";

    } else {

        
//Else the password is wrong
        
$response="Wrong password";
    }

} else {

    
//If the username is wrong
    
$response="Wrong username";
}

//Return the response to Flash
print "&response=".$response."&";

?>

что-то вроде, этого
Код:

  session_start();
  session_destroy();

Заранее благодарю.
С уважением, codfelix

duhowka 07.09.2009 18:45

а погуглить?

mooncar 07.09.2009 21:11

Почитайте материалы по авторизации с использованием сессии.
Там небольшой, но все же комплекс мероприятий, в двух словах на форуме рассказывать бессмысленно и бесполезно.

codfelix 08.09.2009 08:36

Нужна помощь
http://img-fotki.yandex.ru/get/3707/..._81550742_orig

В коде флешки есть строка
Код:

mb.onRelease = function() {
        getURL('javascript:location.reload();');       
}

после входа, и определенных действий нужно нажать button mb, а это приводит
соответственно к рефрешу браузера и повторному появлению логина парола. (1 кард). Как этого избежать, т. е. чтобы логин пароль сохранялся и после нажатия button mb, флешка сама переходила на 2 кадр?

Мне сказали, что сессию в этом коде добавлять не желательно,
лучше - сохранять логин-пароль в SharedObject, но у меня не получается, сделать, помогите.

флешка состоит из двух кадров
1 кадр: логин пароль
2 кадр: контент

Код 1 кадра
Код AS1/AS2:

btn.onRelease = function () {
        //create a new LoadVars Object
        myvars = new LoadVars();
        //set variables in that objec
        myvars.user = user;
        myvars.pass = pass;
        //When you receive data back, execute the function action ()
        myvars.onLoad = action;
        //Send the variables and wait for the response
        //The random fake variable is attached to prevent caching the response data
        myvars.sendAndLoad("secure_login.php?random="+new Date().getTime(), myvars);
}
function action() {
        //Check the response
        if (myvars.response == "ok") {
                //if the response was "ok", proceed to the secured area
                status = "Welcome, "+user;
                gotoAndStop(2);
        } else {
                // else show the error status
                status = myvars.response;
        }
}
// Stop the movie here
stop();

Код 2 кадра
Код AS1/AS2:

mb.onRelease = function() {
        getURL('javascript:location.reload();');       
}

PHP код
PHP код:

<?php 

// SET THE CORRECT USERNAME AND PASSWORD

$correct_user "flash";
$correct_pass "vista";

// Checkif the username is correct
if ($user==$correct_user){

    
//IF the username is correct, check the password
    
if ($pass==$correct_pass){

        
//If the password is correct, return "ok"
        
$response="ok";

    } else {

        
//Else the password is wrong
        
$response="Wrong password";
    }

} else {

    
//If the username is wrong
    
$response="Wrong username";
}

//Return the response to Flash
print "&response=".$response."&";


?>



Часовой пояс GMT +4, время: 23:59.

Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.