By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,967 Members | 2,124 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,967 IT Pros & Developers. It's quick & easy.

Flash not reading the PHP files

P: 6
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------------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. session_start();
  3. $username = $_POST['username'];
  4. $password = $_POST['password'];
  5.  
  6. //in real life you will probably want to check whether the username/password exist in a database instead
  7. if($username == "admin" && $password == "password"){
  8. $_SESSION['loggedIn'] = true;
  9. echo 'login=success';
  10. }else{
  11. echo 'login=failure';
  12. }
  13. ?>
  14.  
-------------------------members php-------------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. session_start();
  3. //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
  4. if(!isset($_SESSION['loggedIn'])){
  5. header("Location: login.html");
  6. exit();
  7.  
  8. }
  9. ?><style type="text/css">
  10. <!--
  11. body {
  12.     background-color: #333333;
  13. }
  14. .style1 {
  15.     color: #FFFFCC;
  16.     font-weight: bold;
  17. }
  18. -->
  19. </style>
  20. <span class="style1">
  21. Congratulations you are now in the upload area</span>
  22.  
-----------------------------------and finally the actionscript code just in case:--------------------------------------
Expand|Select|Wrap|Line Numbers
  1. tError.autoSize = "right";
  2.  
  3. var lvSend:LoadVars = new LoadVars();
  4. var lvReceive:LoadVars = new LoadVars();
  5.  
  6. mcLogin.onRelease = function() {
  7.     lvSend.username = tUsername.text;
  8.     lvSend.password = tPassword.text;
  9.     lvSend.sendAndLoad("logincheck.php", lvReceive, "POST");
  10. };
  11.  
  12. lvReceive.onLoad = function(success:Boolean) {
  13.     if (success) {
  14.         if (this.login == "success") {
  15.             getURL("members.php");
  16.         }else{
  17.         tError.text = "I'm sorry you did not enter valid login details";
  18.         }
  19.     } else {
  20.         trace("no reponse from server");
  21.     }
  22. };
Dec 26 '07 #1
Share this Question
Share on Google+
1 Reply


pbmods
Expert 5K+
P: 5,821
Heya, J.

What error message do you get from lvReceive.onLoad (no response or invalid info)?
Jan 2 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.