Login to game before start

Get help using Construct 2

Post » Mon Jan 07, 2013 7:37 am

@droptank21,

Its not working on my side. I change the login.php and also the events but its not working.
B
11
S
3
G
2
Posts: 40
Reputation: 2,362

Post » Wed Jan 09, 2013 1:01 am

Post all of your files please. I'll have a look and see what is going on.
B
22
S
9
G
3
Posts: 203
Reputation: 3,647

Post » Wed Jan 09, 2013 4:27 am

@droptank21,

Heres the files link. https://www.dropbox.com/sh/2f4j5b3fptklr9n/d0LC8AqvFd
B
11
S
3
G
2
Posts: 40
Reputation: 2,362

Post » Thu Jan 10, 2013 12:51 am

SQL file?
B
22
S
9
G
3
Posts: 203
Reputation: 3,647

Post » Thu Jan 10, 2013 1:39 am

Works fine. Use the following files. Here

Create a new database in phpmyadmin named "test". Then import the database.sql file to that database.
B
22
S
9
G
3
Posts: 203
Reputation: 3,647

Post » Thu Jan 10, 2013 4:27 am

@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 https://www.dropbox.com/sh/x97izi9gt5cme1x/SldUhaXxJl


Thanks
B
11
S
3
G
2
Posts: 40
Reputation: 2,362

Post » Fri Jan 11, 2013 3:13 am

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... Thank goodness for C2.
B
22
S
9
G
3
Posts: 203
Reputation: 3,647

Post » Mon Jan 14, 2013 2:58 am

Hi @droptank21,

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

Yeah your right C2 is so cool.
B
11
S
3
G
2
Posts: 40
Reputation: 2,362

Post » Wed Jan 23, 2013 1:03 am

I'll work on it. In theory it should show the error message. Strange...
B
22
S
9
G
3
Posts: 203
Reputation: 3,647

Post » Wed May 15, 2013 9:13 pm

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
http://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
B
3
Posts: 1
Reputation: 177

Previous

Return to How do I....?

Who is online

Users browsing this forum: Televangelist and 18 guests