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
- <?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';
- }
- ?>
Expand|Select|Wrap|Line Numbers
- <?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($_SESSION['loggedIn'])){
- header("Location: 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>
Expand|Select|Wrap|Line Numbers
- tError.autoSize = "right";
- var lvSend:LoadVars = new LoadVars();
- var lvReceive:LoadVars = new LoadVars();
- mcLogin.onRelease = function() {
- lvSend.username = tUsername.text;
- lvSend.password = tPassword.text;
- lvSend.sendAndLoad("logincheck.php", lvReceive, "POST");
- };
- lvReceive.onLoad = function(success: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");
- }
- };