Socialworld Project ~ Fouten

Gestart doorDigital11 reacties46 weergaven

12 berichten · pagina 1 van 1

Digital

Lid · Topicstarter

Berichten
326
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hallo,
Ik ben momenteel bezig met het maken van een virtueele Game. [Not habbo ofzuuu]
Maar omdat ik in PHP nog niet zo goed ben heb ik nog al wat foutjes erin zitten.
Daarom dat ik dit topic heb.
En wanneer hij eindelijk klaar is voor test versie.
Zal er zeker iets van op one2xs verschijnen.
Maar tot die tijd heb ik nog wat hulp nodig. Ik hoop dat jullie daar bereid voor zijn mij te helpen.

Updates en vorderingen :
Server
- A* Pathfinding
- SQL connection
- Sockets
- Anti-hax - Maar nog niet volledig af
Website
- Login
- Register
- Profielpagina - Nog aan bezig
- Gebruikersinfomatie
Game
- Connectie
- Lopen
- Praten
- X/Y Coords

Testers worden later nog gezocht smile
Momenteel zit ik met een foutje bij het redirecten van de webpagina.
Want via xampp / aka usbwebserver. Gaat hij wel door
maar via de hosting van one2xs / of andere. Krijg ik een session error of hij linkt niet door.

De volledige PHPcode
Spoiler tonen
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]/*Kijk of de formulier is verzonden, zoniet dan krijg je de foutmelding.*/[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700](![/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_REQUEST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]action[/COLOR][COLOR= #007700]])) {[/COLOR]
  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]No form has been submitted.<br />Press back to return.[/COLOR][COLOR= #007700]);
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
  [URL="http://www.php.net/switch"]switch[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$_REQUEST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]action[/COLOR][COLOR= #007700]]) {
    case[/COLOR] [COLOR= #DD0000]Register[/COLOR][COLOR= #007700]:[/COLOR]

      [COLOR= #FF8000]/*Voor het geval dat mensen de volgende link invoeren
       *http://www.mijnwebsite.nl/transact-user.php?action=Register
       *krijgen ze als nog de foutmelding.*/[/COLOR]
      [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700](![/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_REQUEST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]action[/COLOR][COLOR= #007700]])) {[/COLOR]
        [URL="http://www.php.net/header"]header[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]refresh: 3; url=register.php[/COLOR][COLOR= #007700]);[/COLOR]
        [URL="http://www.php.net/die"]die[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]No form has been submitted[/COLOR][COLOR= #007700]);
      }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]

        [COLOR= #FF8000]/*Alles naar makkelijke variabelen omzetten.*/[/COLOR]
        [COLOR= #0000BB]$user[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]];[/COLOR]
        [COLOR= #0000BB]$pass[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]];[/COLOR]
        [COLOR= #0000BB]$pass2[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]check_password[/COLOR][COLOR= #007700]];[/COLOR]
    [COLOR= #0000BB]$mail[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]];[/COLOR]
    [COLOR= #0000BB]$mission[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]mission[/COLOR][COLOR= #007700]];[/COLOR]

        [COLOR= #FF8000]/*Check of geen enkele variabelen leeg is, is er wel een leeg.
         *Dan krijg je een foutmelding.*/[/COLOR]
        [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$user[/COLOR][COLOR= #007700]) ||[/COLOR] [URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$pass[/COLOR][COLOR= #007700]) ||[/COLOR] [URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$pass2[/COLOR][COLOR= #007700]) ||[/COLOR] [URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$mail[/COLOR][COLOR= #007700]) ||[/COLOR] [URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$mission[/COLOR][COLOR= #007700])) {[/COLOR]
          [URL="http://www.php.net/header"]header[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]refresh: 3; url=register.php[/COLOR][COLOR= #007700]);[/COLOR]
          [URL="http://www.php.net/die"]die[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]One or more fields have not been filled in[/COLOR][COLOR= #007700]);[/COLOR]

        [COLOR= #FF8000]/*Check of ingevoerde wachtwoorden hetzelfde zijn.*/[/COLOR]
        [COLOR= #007700]}[/COLOR] [URL="http://www.php.net/elseif"]elseif[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$pass[/COLOR] [COLOR= #007700]!=[/COLOR] [COLOR= #0000BB]$pass2[/COLOR][COLOR= #007700]) {[/COLOR]
          [URL="http://www.php.net/header"]header[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]refresh: 3; url=register.php[/COLOR][COLOR= #007700]);[/COLOR]
          [URL="http://www.php.net/die"]die[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]Passwords do not match[/COLOR][COLOR= #007700]);[/COLOR]

        [COLOR= #FF8000]/*Als magic_quotes uitstaat zet dan addslashes bij de variabelen neer.*/[/COLOR]
        [COLOR= #007700]}[/COLOR] [URL="http://www.php.net/elseif"]elseif[/URL] [COLOR= #007700](![/COLOR][URL="http://www.php.net/get_magic_quotes_gpc"]get_magic_quotes_gpc[/URL][COLOR= #007700]()) {[/COLOR]
          [COLOR= #0000BB]$user[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$user[/COLOR][COLOR= #007700]);[/COLOR]
          [COLOR= #0000BB]$pass[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$pass[/COLOR][COLOR= #007700]);
        }[/COLOR]

        [COLOR= #FF8000]/*Codeer de variabelen.*/[/COLOR]
         [COLOR= #0000BB]$user[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$user[/COLOR][COLOR= #007700]);[/COLOR]
         [COLOR= #0000BB]$pass[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$pass[/COLOR][COLOR= #007700]);[/COLOR]

        [COLOR= #FF8000]/*Database contacten wordt verder op uitgelegt.*/[/COLOR]
        [COLOR= #0000BB]$check_sql[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"SELECT id, name "[/COLOR] [COLOR= #007700].[/COLOR]
                     [COLOR= #DD0000]"FROM users "[/COLOR] [COLOR= #007700].[/COLOR]
                     [COLOR= #DD0000]"WHERE name=$user"[/COLOR][COLOR= #007700];[/COLOR]

        [COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"INSERT INTO users (id, name, password, email, age, pants, shirt, head, sex, mission, rank) "[/COLOR] [COLOR= #007700].[/COLOR]
               [COLOR= #DD0000]"VALUES (NULL, "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$user[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]","[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$pass[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]","[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$mail[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]", 9, 9, 9, 9, M,"[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$mail[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]", 1)"[/COLOR][COLOR= #007700];[/COLOR]

        [COLOR= #0000BB]$check_result[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$check_sql[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$conn[/COLOR][COLOR= #007700])[/COLOR]
                          or [URL="http://www.php.net/die"]die[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]Could not check up user account; [/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]

        [COLOR= #FF8000]/*De eerste database contact wordt hier gebruikt om te checken of jou
         *ingevoerde username nog niet bestaat. Bestaat het wel foutmelding.*/[/COLOR]
        [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700](([/COLOR][URL="http://www.php.net/mysql_fetch_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$check_result[/COLOR][COLOR= #007700])) !=[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]) {[/COLOR]
          [URL="http://www.php.net/header"]header[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]refresh: 3; url=register.php[/COLOR][COLOR= #007700]);
        }[/COLOR]      [COLOR= #FF8000]/*Alles is gedaan en goedbevonden, dus voeg de account maar toe.*/[/COLOR]
        [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$conn[/COLOR][COLOR= #007700])[/COLOR]
          or [URL="http://www.php.net/die"]die[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]Could not create account; [/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]

        [URL="http://www.php.net/header"]header[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]refresh: 3; url=index.php[/COLOR][COLOR= #007700]);[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]Je account is succesvol aangemaakt, We sturen je terug. Bedankt voor het registeren![/COLOR][COLOR= #007700]);[/COLOR]
        [URL="http://www.php.net/break"]break[/URL][COLOR= #007700];
      }

    case[/COLOR] [COLOR= #DD0000]Login[/COLOR][COLOR= #007700]:[/COLOR]
      [COLOR= #FF8000]/*Voor het geval dat mensen de volgende link invoeren
       *http://www.mijnwebsite.nl/transact-user.php?action=Login
       *krijgen ze als nog de foutmelding.*/[/COLOR]
      [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700](![/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_REQUEST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]action[/COLOR][COLOR= #007700]])) {[/COLOR]
        [URL="http://www.php.net/header"]header[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]refresh: 3; url=index.php[/COLOR][COLOR= #007700]);[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]No form has been submitted.[/COLOR][COLOR= #007700]);
      }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]

        [COLOR= #FF8000]/*Alles naar makkelijke variabelen omzetten.*/[/COLOR]
        [COLOR= #0000BB]$user[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]];[/COLOR]
        [COLOR= #0000BB]$pass[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]];[/COLOR]

        [COLOR= #FF8000]/*Check of geen enkele variabelen leeg is, is er wel een leeg.
         *Dan krijg je een foutmelding.*/[/COLOR]
        [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$user[/COLOR][COLOR= #007700]) ||[/COLOR] [URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$pass[/COLOR][COLOR= #007700])) {[/COLOR]
          [URL="http://www.php.net/header"]header[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]refresh: 3; url=index.php[/COLOR][COLOR= #007700]);[/COLOR]
          [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]One or both fields have not been filled in[/COLOR][COLOR= #007700]);[/COLOR]

        [COLOR= #FF8000]/*Als magic_quotes uitstaat zet dan addslashes bij de variabelen neer.*/[/COLOR]
        [COLOR= #007700]}[/COLOR] [URL="http://www.php.net/elseif"]elseif[/URL] [COLOR= #007700](![/COLOR][URL="http://www.php.net/get_magic_quotes_gpc"]get_magic_quotes_gpc[/URL][COLOR= #007700]()) {[/COLOR]
          [COLOR= #0000BB]$user[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$user[/COLOR][COLOR= #007700]);[/COLOR]
          [COLOR= #0000BB]$pass[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$pass[/COLOR][COLOR= #007700]);
        }[/COLOR]

        [COLOR= #FF8000]/*Codeer de variabelen.*/
    /* $pass = addslashes(sha1($pass)); - $user = addslashes(base64_encode($user)); */[/COLOR]
        [COLOR= #0000BB]$pass[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$pass[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$user[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$user[/COLOR][COLOR= #007700]);[/COLOR]

        [COLOR= #FF8000]/*Table contact is hier gemaakt en checkt of de variabelen
         *overeenkomen met die van de table.*/[/COLOR]
        [COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"SELECT id, name, password "[/COLOR] [COLOR= #007700].[/COLOR] 
               [COLOR= #DD0000]"FROM users "[/COLOR] [COLOR= #007700].[/COLOR]
               [COLOR= #DD0000]"WHERE name=$user "[/COLOR] [COLOR= #007700].[/COLOR]
               [COLOR= #DD0000]"AND password=$pass"[/COLOR][COLOR= #007700];[/COLOR]

        [COLOR= #0000BB]$result[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$conn[/COLOR][COLOR= #007700])[/COLOR]
                    or [URL="http://www.php.net/die"]die[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]Could not check up user account; [/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]

        [COLOR= #FF8000]/*Als het in de database niet overeenkwam wordt er hier een fout gemeldt.*/[/COLOR]
        [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700](([/COLOR][COLOR= #0000BB]$row[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700])) ==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR]
          [COLOR= #FF8000]/*header (refresh: 3; url=index.php);*/[/COLOR]
          [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]Login data incorrect[/COLOR][COLOR= #007700]);
        }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]

          [COLOR= #FF8000]/*Alles klopte dus hier begint de sessie en wordt alles van de slashes afgeholpen.*/[/COLOR]    
      [URL="http://www.php.net/session_start"]session_start[/URL][COLOR= #007700]();[/COLOR]  
          [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR]
          [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]] =[/COLOR] [URL="http://www.php.net/stripslashes"]stripslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]]);[/COLOR]
          [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]] =[/COLOR] [URL="http://www.php.net/stripslashes"]stripslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]]);[/COLOR]
          [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE `users` SET `status`=1 WHERE (`id`="[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]") AND (`name`="[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]")"[/COLOR][COLOR= #007700]);
        }[/COLOR]
        [URL="http://www.php.net/header"]header[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]refresh: 3; URL=homepage.php[/COLOR][COLOR= #007700]);[/COLOR] 
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]Account name [/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000] has been logged in[/COLOR][COLOR= #007700]);[/COLOR]
        [URL="http://www.php.net/break"]break[/URL][COLOR= #007700];
      }
      case[/COLOR] [COLOR= #DD0000]Logout[/COLOR][COLOR= #007700]:[/COLOR]
      [COLOR= #FF8000]/*Stop sessie en vernietig het.*/[/COLOR]
      [URL="http://www.php.net/session_start"]session_start[/URL][COLOR= #007700]();[/COLOR]
      [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE `users` SET `status`=0 WHERE (`id`="[/COLOR][COLOR= #007700].[/COLOR]         [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]") AND (`name`="[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]")"[/COLOR][COLOR= #007700]);[/COLOR]
      [URL="http://www.php.net/session_unset"]session_unset[/URL][COLOR= #007700]();[/COLOR]
      [URL="http://www.php.net/session_destroy"]session_destroy[/URL][COLOR= #007700]();[/COLOR]

      [URL="http://www.php.net/header"]header[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]refresh: 3; url=index.php[/COLOR][COLOR= #007700]);[/COLOR]
      [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]Afmelden was een succes[/COLOR][COLOR= #007700]);[/COLOR]
      [URL="http://www.php.net/break"]break[/URL][COLOR= #007700];
  }
}[/COLOR]

?>
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
Paar puntjes:
- vermijd $_REQUEST en gebruik $_GET of $_POST
- gebruik mysql_real_escape_string() ipv addslashes()
- doe geen die() als een query mislukt, maar zorg voor een nette foutpagina, al is dat nu nog lastig aanpassen
- op regel 37-38 doe je addslashes als magic quotes uit staat, en op regel 42-43 doe je dat nog een keer?
- je checkt op regel 7 of $_REQUEST[action] gelijk is aan Register, en op regel 12 check je nog een keer of die action wel bestaat; maar die bestaat sowieso, anders pakt hij die case toch niet? die check heb je al op regel 3
- je kunt session_unset() en session_destroy() gebruiken, maar ik zou gewoon de sessies leegmaken die je leeg wil hebben, dus niet alles; als je dan later bedenkt dat je iets anders in sessies wil bewaren, dan zit je niet met vreemde bugs dat ergens op je site alle sessies worden geleegd en je geen idee hebt waar. het heeft toch geen nut om alle sessies te verwijderen
- bedenk wat voor taal je hanteert; soms heb je Login data incorrect en soms Afmelden was een succes (wat sowieso een rare zin is?)
- het is niet handig om MySQL errors aan je publiek te laten zien, die moeten enkel een foutmelding zien en thats it

Succes thumbsup
toevoeging op 11 december 2011, 121955:
Welke sessie error krijg je trouwens?
0
Digital

Lid · Topicstarter

Berichten
326
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Haha, Dit helpt me al een heel stuk vooruit weer thumbsup Toppie Lennard!

Deze foutmelding kreeg ik ;
Spoiler tonen
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/umaxx/domains/umaxx.s2.one2xs.com/public_html/sw/processing.php:10) in /home/umaxx/domains/umaxx.s2.one2xs.com/public_html/sw/processing.php on line 125

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/umaxx/domains/umaxx.s2.one2xs.com/public_html/sw/processing.php:10) in /home/umaxx/domains/umaxx.s2.one2xs.com/public_html/sw/processing.php on line 125

Warning: Cannot modify header information - headers already sent by (output started at /home/umaxx/domains/umaxx.s2.one2xs.com/public_html/sw/processing.php:10) in /home/umaxx/domains/umaxx.s2.one2xs.com/public_html/sw/processing.php on line 131
En met die methode van $_POST & $_GET
Hoe moet je dan wanneer wat plaatsen?
Zoals bij de begin regel. De rest van je uitleg snapte ik allemaal smile
Spoiler tonen
Bij dit >
if (!isset($_REQUEST[action])) {
  echo (No form has been submitted.<br />Press back to return.);
} else {
  switch ($_REQUEST[action]) {
0
Berichten
3.112
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
session_start(); moet helemaal bovenaan volgens mij.
0
Digital

Lid · Topicstarter

Berichten
326
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Je hebt gelijk. En het mag maar een keer smile
Gamedealer schreef:
session_start(); moet helemaal bovenaan volgens mij.
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
Digital schreef:
En met die methode van $_POST & $_GET
Hoe moet je dan wanneer wat plaatsen?
Zoals bij de begin regel. De rest van je uitleg snapte ik allemaal smile
Bij dit >
if (!isset($_REQUEST[action])) {
  echo (No form has been submitted.<br />Press back to return.);
} else {
  switch ($_REQUEST[action]) {
Een $_POST als je variabele via een POST is gebracht (dus via een formulier met method="post" in zn form-tag), en $_GET als de waarde in de url zit; dus bijvoorbeeld hier:
http://www.one2xs.com/threads/37108
die 37108 zit in $_GET[id] omdat hij in de URL zit
0
Digital

Lid · Topicstarter

Berichten
326
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Laaste probleem wat waar ik nog mee zit. Dan is alles van mijn script klaar smileAls ik inlog. Via de gehoste link op jullie servers krijg ik dat de header al verzonden is.

Warning: Cannot modify header information - headers already sent by (output started at /home/umaxx/domains/umaxx.s2.one2xs.com/public_html/sw/processing.php:10) in /home/umaxx/domains/umaxx.s2.one2xs.com/public_html/sw/processing.php on line 129


Het gaat om de header

header (refresh: 3; URL=homepage.php);


En Thanks smile
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
Je moet op een andere manier doorsturen; met meta-redirect oid (google maar), of je moet die echo of wat je ook hebt op regel 10 weghalen, en zorgen dat die header de eerste output is, en er dus geen echo oid voor die regel staat.
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Lennard schreef:
Je moet op een andere manier doorsturen; met meta-redirect oid (google maar), of je moet die echo of wat je ook hebt op regel 10 weghalen, en zorgen dat die header de eerste output is, en er dus geen echo oid voor die regel staat.
En daarom is werken met classen en een template-systeem zo handig. emo
0
Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Rik schreef:
Eerdere citaten tonen
Lennard schreef:
Je moet op een andere manier doorsturen; met meta-redirect oid (google maar), of je moet die echo of wat je ook hebt op regel 10 weghalen, en zorgen dat die header de eerste output is, en er dus geen echo oid voor die regel staat.
En daarom is werken met classen en een template-systeem zo handig. emo
Met classen wel inderdaad. Maar ik denk dat een template systeem toch wel lastiger is om te maken.
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
Rik schreef:
Eerdere citaten tonen
Lennard schreef:
Je moet op een andere manier doorsturen; met meta-redirect oid (google maar), of je moet die echo of wat je ook hebt op regel 10 weghalen, en zorgen dat die header de eerste output is, en er dus geen echo oid voor die regel staat.
En daarom is werken met classen en een template-systeem zo handig. emo
Jep. pompom
Shahiem schreef:
Eerdere citaten tonen
Rik schreef:
Eerdere citaten tonen
Lennard schreef:
Je moet op een andere manier doorsturen; met meta-redirect oid (google maar), of je moet die echo of wat je ook hebt op regel 10 weghalen, en zorgen dat die header de eerste output is, en er dus geen echo oid voor die regel staat.
En daarom is werken met classen en een template-systeem zo handig. emo
Met classen wel inderdaad. Maar ik denk dat een template systeem toch wel lastiger is om te maken.
Dat template-systeem maak je niet, gebruik gewoon Smarty oid.
Maar ermee werken is wel lastiger en kost wel meer tijd ja.. maar het is wel uberhandig als je ooit een andere template ofzo in je site wil.
0
Digital

Lid · Topicstarter

Berichten
326
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik heb nu alles met classes, idd invoudiger en ook overzichtelijker smileWe komen er wel biggrin
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren