Flash not reading the PHP files

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hott5hotj
    New Member
    • Oct 2007
    • 6

    Flash not reading the PHP files

    I have been trying to create an authentication system using PHP5+, MYSQL 5+ and APACHE2+ using Actionscript3. When I got the codes together my password and usernames would not check against the MYSQL database, so I tried changing the code to then just obtain the passwords straight from the PHP files. I was just trying something different as I had been tearing my hair out over this and to my surprise even this did not work. I am new to this so I might need some correcting, but I did not see any errors in this. Can you guys help me.
    Also when I directly write php code to insert data into the MySQL database but when I run that code through actionscript it fails to work.

    Thanks in advanced.

    Here is my php codes:

    ---------logincheck------------------------------------------------------
    [code=php]
    <?php
    session_start() ;
    $username = $_POST['username'];
    $password = $_POST['password'];

    //in real life you will probably want to check whether the username/password exist in a database instead
    if($username == "admin" && $password == "password") {
    $_SESSION['loggedIn'] = true;
    echo 'login=success' ;
    }else{
    echo 'login=failure' ;
    }
    ?>
    [/code]

    -------------------------members php-------------------------------------------------------
    [code=php]
    <?php
    session_start() ;
    //check if the loggedIn session has been really set so that noone can access this page directly. If it is not set send him to login page
    if(!isset($_SES SION['loggedIn'])){
    header("Locatio n: login.html");
    exit();

    }
    ?><style type="text/css">
    <!--
    body {
    background-color: #333333;
    }
    .style1 {
    color: #FFFFCC;
    font-weight: bold;
    }
    -->
    </style>
    <span class="style1">
    Congratulations you are now in the upload area</span>
    [/code]
    -----------------------------------and finally the actionscript code just in case:--------------------------------------
    [code=actionscri pt]
    tError.autoSize = "right";

    var lvSend:LoadVars = new LoadVars();
    var lvReceive:LoadV ars = new LoadVars();

    mcLogin.onRelea se = function() {
    lvSend.username = tUsername.text;
    lvSend.password = tPassword.text;
    lvSend.sendAndL oad("logincheck .php", lvReceive, "POST");
    };

    lvReceive.onLoa d = function(succes s:Boolean) {
    if (success) {
    if (this.login == "success") {
    getURL("members .php");
    }else{
    tError.text = "I'm sorry you did not enter valid login details";
    }
    } else {
    trace("no reponse from server");
    }
    };[/code]
    Last edited by pbmods; Jan 2 '08, 03:13 AM. Reason: Added CODE tags.
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, J.

    What error message do you get from lvReceive.onLoa d (no response or invalid info)?

    Comment

    Working...