Login to game before start

0 favourites
From the Asset Store
five golem elements Sprites Sheet.Best for enemy or villain game characters.
  • Post all of your files please. I'll have a look and see what is going on.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • SQL file?

  • Works fine. Use the following files. Here

    Create a new database in phpmyadmin named "test". Then import the database.sql file to that database.

  • droptank21,

    The script that you give is working. But on my login system its not working. When I put the user level the login error is not showing and the button is not working properly, because the button is need to click many times so it will work.

    Can you take a look on my file, please? here's the link dropbox.com/sh/x97izi9gt5cme1x/SldUhaXxJl

    Thanks

  • Your issue was that you were trying to run two AJAX requests at the same time, login and login_info. So, essentially, the Ajax.LastData returned was the data run by the last completed Ajax Request - the user's level - and the username was never returned back to the client side.

    The easy fix was to run the login Ajax request and then when Ajax(login) is completed run the login_info Ajax request. The system gets one and sets the username then gets their level (admin or student) and sets that data to the user_Type variable.

    Here is the corrected capx Here

    All in all, you are definitely going in the right direction. You have done a very good job expanding upon the login system and even put my php skills to shame.

    Imagine trying to code all of this in actionscript... <img src="smileys/smiley5.gif" border="0" align="middle"> Thank goodness for C2.

  • Hi droptank21,

    Thanks for the reply. yes its working now. but the error message is not working.

    Yeah your right C2 is so cool.

  • I'll work on it. In theory it should show the error message. Strange...

  • hello, I'm using a script that it's like yours but i have some problems whit ajax.

    my php analyze via post the username and the pw and return the id (that i use in-game)

    this is my php (is pretty simple)

    <?php

         $user = $_GET["user"];

         $pw = $_GET["pw"];

         $con = mysql_connect("http://zhentilnews.altervista.org/",xxxx,xxxx)

                   or die ("Connessione al server non stabilita");

         $db = mysql_select_db ("my_zhentilnews", $con)

                  or die ("Connessione al Db non stabilita");

              $query = ("SELECT ID FROM DATI_PG WHERE USER ='".$user."' AND PW = '".$pw."'");

              $res = mysql_query($query)

                   or die("Query non valida: " . mysql_error());

              $row = mysql_fetch_array($res) or die(mysql_error());

              echo ($row['ID']);

         mysql_close($con);

    ?>

    and this is my construct script to use it

    img195.imageshack.us/img195/5053/img15052013220518.png

    you can also check the php page

    using -> user = pippo & pw = bau

    if someone can help it will be very appreciated

    this thing is freaking me out :

    ty

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)