login  Naam:   Wachtwoord: 
Registreer je!
 Forum

login

Offline ottorocket - 30/03/2006 12:10
Avatar van ottorocketOnbekend ik ben bezig aan een login systeem voor mijn site, maar het inloggen duurt altijd heel lang, het aanmelden doet helemaal niks


action script eerste frame
  1. stop();
  2. //stops the movie on the login page
  3. userinput.restrict = "a-zA-Z0-9";
  4. passinput.restrict = "a-zA-Z0-9";
  5. //this will make it so the user can't use symbols
  6. //that could mess with your database
  7. Selection.setFocus(userinput);
  8. //this puts the cursor in the first box (thaks Kax!)
  9. status = "Enter your information";
  10. //this enters in directions in your textbox called status
  11. this.onEnterFrame = function() {
  12. if (_root.checklog == 1) {
  13. _root.gotoAndStop(2);
  14. }
  15. if (_root.checklog == 2) {
  16. _root.gotoAndStop(3);
  17. }
  18. };
  19. //the onEnterFrame constantly checks to see if the PHP
  20. //script has sent the variable 'checklog' back to the
  21. //movie and directs the people accordingly


action script button "login"
  1. //this will be the action to get your variables from the PHP
  2. on (release, keyPress "<Enter>") {
  3. //checks to see if there is something in both the name
  4. //and password
  5. if (user != "" && pass != "") {
  6. status = "Login, please wait...";
  7. //if you changed the php file name, change it here to!!
  8. loadVariablesNum("login.php", 0, "POST");
  9. }
  10. }



login.php
  1. <?php
  2. $user=$_POST['user'];
  3. $pass=$_POST['pass'];
  4.  
  5. //connect to database
  6. if ($user && $pass){
  7. include('config.php');
  8. //make query
  9. $query = "SELECT * FROM auth WHERE username = '$user' AND userpassword = '$pass'";
  10. $result = mysql_query( $query ) or die ("didn't query");
  11.  
  12. //see if there's an EXACT match
  13. $num = mysql_num_rows( $result );
  14. if ($num == 1){
  15. print "status=You're in&checklog=1";
  16. } else {
  17. echo "status=Sorry, wrong information.&checklog=2";
  18. }
  19. }
  20. ?>

10 antwoorden

Gesponsorde links
Offline marten - 30/03/2006 12:17
Avatar van marten Beheerder
  1. $query = "SELECT * FROM auth WHERE username = '$user' AND userpassword = '$pass'";


moet zijn
  1. $query = "SELECT * FROM auth WHERE username = " .$user. " AND userpassword = " .$pass. "";
Offline vinTage - 30/03/2006 12:25
Avatar van vinTage Nieuw lid
  1. //this will be the action to get your variables from the PHP
  2. on (release, keyPress "<Enter>") {
  3. //checks to see if there is something in both the name
  4. //and password
  5. if (user != "" && pass != "") {
  6. status = "Login, please wait...";
  7. //if you changed the php file name, change it here to!!
  8. loadVariablesNum("login.php", 0, "POST");
  9. }
  10. }


dat gaat niet
Probeer zelf maar met dit
  1. on (release, keyPress "<Enter>") {
  2. trace("ik moet verzenden");
  3. }


De rest heb ik niet eens bekeken, dus er zitten mss nog meer fouten in
Offline bigsmoke - 30/03/2006 12:27
Avatar van bigsmoke PHP interesse Ja gaat het zo niet?

Zou je scipt wel is willen zien als et klaar is.
Offline ottorocket - 30/03/2006 12:29 (laatste wijziging 30/03/2006 12:31)
Avatar van ottorocket Onbekend hij doet het nog altijd heel traag, er blijft altijd staan "Login, please wait..."

@vinTage dat met die enter ging wel hoor, je krijgt dan het tekste tezien "login, please wait..." en dan doet hij niks meer
Offline vinTage - 30/03/2006 12:42 (laatste wijziging 30/03/2006 13:02)
Avatar van vinTage Nieuw lid hmm, net getest met flash player 6, 7 en 8, maar dat , keyPress "<Enter>" werkt bj mij nergens, je kan er wel op klikken, dat werkt wel, maar de entertoets niet 

Maargoed, probeer het volgende eens

  1. //this will be the action to get your variables from the PHP
  2. on (release, keyPress "<Enter>") {
  3. //checks to see if there is something in both the name
  4. //and password
  5. if (user != "" && pass != "") {
  6. trace(user);
  7. trace(pass);
  8. status = "Login, please wait...";
  9. //if you changed the php file name, change it here to!!
  10. loadVariablesNum("login.php", 0, "POST");
  11. }
  12. }

en dan op de knop klikken ook, en niet alleen genoegen nemen met de enterknop 

edit: Als die dus niks outputten (als je published en test, dus niet via een webserver) dan heb je de textvakken geen juiste varnamen gegeven.
Offline ottorocket - 30/03/2006 13:08 (laatste wijziging 30/03/2006 18:09)
Avatar van ottorocket Onbekend krijg twee keer dit in output

undefined
undefined


als ik enter doe krijg ik "fout paswoord", dan gaat hij dus naar frame 2 als je paswoord juist is gaat hij naar frame 3

weet iemand het?
Offline vinTage - 30/03/2006 18:46
Avatar van vinTage Nieuw lid Dan moet je je textveldjes waar je je naam en wachtwoord ingeeft een var naam geven, de ene moet user heten en de andere pass.

Want wat je met bovenstaande code deed was de input van je textvelden nakijken, wat ik wel raar vind is dat je helemaal bovenin in je inleiding aangeeft dat userinput en passinput de texvelden zijn...hebben die mischien geen variabelnamen ?

Als die geen varnamen HOREN te hebben, dan ontbreekt er een stukje code die de user en pass input omzet naar variables.



Offline ottorocket - 30/03/2006 20:49
Avatar van ottorocket Onbekend als ik er nu iets intyp dan krijg ik in dat output de tekst tezien dat ik intypte, als ik niks intype krijg ik gewoon "undifined".
Offline vinTage - 30/03/2006 21:16
Avatar van vinTage Nieuw lid dat is dus goed.

Maar ik ga niet regeltje voor regeltje vragen hoe of wat, ga gewoon ALLES tracen wat er te tracen valt, en zie waar het fout gaat, kom dan nog maar eens 
Offline ottorocket - 31/03/2006 10:04
Avatar van ottorocket Onbekend ok, toch bedankt
Gesponsorde links
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2025 Sitemasters.be - Regels - Laadtijd: 0.234s