Allardje's Forum Posts

  • Ok here we go.

    Live test at: Link removed since fix

    Download C2 files: Link removed since fix

    In the CS2 files i updated the AJAX link again. It is NOT manually entered anymore now. Now it has to work from the forms you fill in.

    Btw i see that the labels are missing. Form as:

    Username

    Password

    Re-type password

    E-mail

    Country

    I would really appriciate the help!

    Thanks guys alot!

  • Thanks for the reactions! All data i need is actually in the URL.

    On error event also not updating my "error text".. I must be doing something wrong here (ofc otherwise it would work..)

    If i export to HTML5 and upload it all that happens:

    Creating Application Cache with manifest http://*.nl/test/offline.appcache *.nl/:1
    Application Cache Checking event *.nl/:1
    Application Cache Downloading event *.nl/:1
    Application Cache Progress event (0 of 9) http://*.nl/test/index.html *.nl/:1
    Application Cache Progress event (1 of 9) http://*.nl/test/logo.png *.nl/:1
    Application Cache Progress event (2 of 9) http://*.nl/test/images/loginbutton-sheet0.png *.nl/:1
    Application Cache Progress event (3 of 9) http://*.nl/test/jquery-2.0.0.min.js *.nl/:1
    Application Cache Progress event (4 of 9) http://*.nl/test/c2runtime.js *.nl/:1
    Application Cache Progress event (5 of 9) http://*.nl/test/images/startscreenbackground-sheet0.png *.nl/:1
    Application Cache Progress event (6 of 9) http://*.nl/test/images/mainscreenbackground-sheet0.png *.nl/:1
    Application Cache Progress event (7 of 9) http://*.nl/test/images/createaccount-sheet0.png *.nl/:1
    Application Cache Progress event (8 of 9) http://*.nl/test/images/sprite-sheet0.png *.nl/:1
    Application Cache Progress event (9 of 9)  *.nl/:1
    Application Cache Cached event
    

    Whenever i press the button nothing happens.

    ,

    Yes everything is set to visible.

    I rather not share the link yet for some reasons, but i need every help i could. In the meantime i will make a second build so i can share it all. Thanks!

  • Hi Lanceal,

    Thanks for thinking with me.

    Yep that double php is possible but not needed. I now just got it in one ;-)!

    Without the ticks also not solved.

    Some thing is grinding my gear. As you can see in Construct 2, anything that will be echo'ed on my script should appear in my C2 application.

    This text is not updated at all. For me that looks like it is not contacting my script at all.

    I can put in the link manually with variables manually putted in and that works ( in my browser not in C2 ).

    In other works, the script itself works perfect.

    Even if C2 would not send the variables within the link, it has to result an error.

    Hmmm I really don't know what the problem is anymore :(.

    I even tried the things like updating the scripts permissions and stuff. I tried it all :(

    Is there anything i need to know about C2 in combination with PHP? Look as far as i understand in C2 i give the variables away and from that point off i can let my php do the work right?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi Lanceal,

    Thanks for your reply.

    I'm afraid i already tried that. I am really desperate. For now, i tried it again with the GET in C2 ( Request ) but to bad still no result.

    A little more info i forgot. As you can see in my img, i did put up a "Error" text. Also this one is NOT changing. So that can be 2 things, or the error text isn't working in my CS2 or CS2 never contacts my php script.

  • Hi!

    For some days im still trying to fix my "Create account" page.

    The page is build up with textboxes and a button.

    After submitting it will AJAX to my php script and SHOULD create a account.

    To bad it isn't working for ages now and i think i might oversee something.

    I could use some help on this one!

    What i got a.t.m. in Construct 2 is:

    <img src="http://akey.nl/scr1.png" border="0" />

    Fyi, i filled in the values manually atm just for testing. Normally i would: "cusername="& Username.Text &"".

    Now. My PHP script is:

    <?php 
    header('Access-Control-Allow-Origin: *');
    
    // SET DATABASE CONNECTION  
    define ("DB_HOST", "localhost"); // set database host
    define ("DB_USER", "!!"); // set database user
    define ("DB_PASS","!!"); // set database password
    define ("DB_NAME","!!"); // set database name
    
    $link = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die("Couldn't make connection.");
    $db = mysql_select_db(DB_NAME, $link) or die("Couldn't select database");
    
    $username = $_GET['cusername'];
    $pass = $_GET['cpass'];
    $retypepass = $_GET['cretypepass'];
    $email = $_GET['cemail'];
    $country = $_GET['ccountry'];
    
    // SET ALL FUNCTIONS  
    function isUserID($username)
    {
         if (preg_match('/^[a-z\d_]{5,20}$/i', $username)) {
              return true;
         } else {
              return false;
         }
    }
    
    function checkPwd($x,$y) 
    {
    if(empty($x) || empty($y) ) { return false; }
    if (strlen($x) < 4 || strlen($y) < 4) { return false; }
    
    if (strcmp($x,$y) != 0) {
     return false;
     } 
    return true;
    }
    
    function PwdHash($pwd, $salt = null)
    {
        if ($salt === null)     {
            $salt = substr(md5(uniqid(rand(), true)), 0, (int)SALT_LENGTH);
        }
        else     {
            $salt = substr($salt, 0, SALT_LENGTH);
        }
        return $salt . sha1($pwd . $salt);
    }
    $err = array();
    
    // Validate User Name
    if (!isUserID($username)) {
    $err[] = "ERROR - Invalid user name. It can contain alphabet, number and underscore.";
    //header("Location: register.php?msg=$err");
    //exit();
    }
    
    // Check User Passwords
    if (!checkPwd($pass,$retypepass)) {
    $err[] = "ERROR - Invalid Password or mismatch. Enter 5 chars or more";
    //header("Location: register.php?msg=$err");
    //exit();
    }
           
    // stores sha1 of password
    $sha1pass = PwdHash($pass);
    
    $rs_duplicate = mysql_query("select count(*) as total from members where username='$username'") or die(mysql_error());
    list($total) = mysql_fetch_row($rs_duplicate);
    
    if ($total > 0)
    {
    $err[] = "ERROR - The username already exists. Please try again with different username.";
    }
    
    if(empty($err)) {
    
    $sql_insert = "INSERT into `members`
                    ?(`password`,`date`,`country`,`email`,`username`)
                  VALUES
                  ('$sha1pass',now(),'$country','$email','$username')
                  ?";
                  ?
    mysql_query($sql_insert,$link) or die("Insertion Failed:" . mysql_error());
    
      echo "Sign up complete!";
    
      exit();
    }
    ?>
    
      <?php     
          if(!empty($err))  {
           foreach ($err as $e) {
           ??echo "* $e";
           ??}     
           ?}else{
           ?}
          ?> 
    

    If i put in the link manually it works like a sharm and it will create my account. When i do the AJAX thingy in Construct 2 it won't work :(!

    Any 1 here that can see the problem?

    P.S! I know i can't test this in "Run Layout" mode. I export it before testing.

    Also i got a simple login to work so a connection worked before on a different script, same project.

    Thanks in advance!