[PHP] Simpel beveiligen wachtwoord & Sessie

Gestart doorMarvinn71 reacties159 weergaven

72 berichten · pagina 2 van 5

Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Aggh werkt nog niet...
Nickjexx schreef:
Eerdere citaten tonen
Aarclay schreef:
bovenaan in je PHP-blok, zou ik doen....
Aggh werkt nog niet...
Dan is er *iets* mis?
Als ik een glazen bol had...

(m.a.w: met zo een quote kunnen we weinig)
0
Marvinn

Lid · Topicstarter

Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Aarclay schreef:
Aggh werkt nog niet...
Nickjexx schreef:
Eerdere citaten tonen
Aarclay schreef:
bovenaan in je PHP-blok, zou ik doen....
Aggh werkt nog niet...
Dan is er *iets* mis?
Als ik een glazen bol had...

(m.a.w: met zo een quote kunnen we weinig)

x Wrijft over glazen bol x

Wat het probleem nou is, als ik de pagina herlaad is me session weg. Dus moet ik weer opnieuw inloggen.
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Welke session? smileIk zie geen session wink
0
Marvinn

Lid · Topicstarter

Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nou session_start(); staat bovenaan.

toevoeging op 15 juni 2012, 181201:
En nog werkt het niet...
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/session_start"]session_start[/URL][COLOR= #007700]();[/COLOR]
[URL="http://www.php.net/ini_set"]ini_set[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]session.gc_maxlifetime[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]600[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]]==[/COLOR] [COLOR= #DD0000]"POST"[/COLOR][COLOR= #007700]) {[/COLOR]
   
  [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"pass"[/COLOR][COLOR= #007700]] !=[/COLOR] [COLOR= #DD0000]"admin"[/COLOR][COLOR= #007700]) {[/COLOR]  
  [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]"FOUT!"[/COLOR][COLOR= #007700];
   }[/COLOR]  [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]ADMIN TOOL [/COLOR][COLOR= #007700];
   }

}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]<div align="right">  
     <form action="" method="post">  
           <input name="pass" type="password" value="" size="9"><br>  
           <input type="submit" value="Log in">  
     </form>  
</div> [/COLOR][COLOR= #007700];
}[/COLOR]
?>


Zoiets?

Dan zou het moeten werken...
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Nickjexx schreef:
Nou session_start(); staat bovenaan.
Ja, je start het sessie systeem, maar je maakt zelf nog geen sessies aan.
0
Marvinn

Lid · Topicstarter

Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jellesch schreef:
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/session_start"]session_start[/URL][COLOR= #007700]();[/COLOR]
[URL="http://www.php.net/ini_set"]ini_set[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]session.gc_maxlifetime[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]600[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]]==[/COLOR] [COLOR= #DD0000]"POST"[/COLOR][COLOR= #007700]) {[/COLOR]
   
  [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"pass"[/COLOR][COLOR= #007700]] !=[/COLOR] [COLOR= #DD0000]"admin"[/COLOR][COLOR= #007700]) {[/COLOR]  
  [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]"FOUT!"[/COLOR][COLOR= #007700];
   }[/COLOR]  [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]ADMIN TOOL [/COLOR][COLOR= #007700];
   }

}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]<div align="right">  
     <form action="" method="post">  
           <input name="pass" type="password" value="" size="9"><br>  
           <input type="submit" value="Log in">  
     </form>  
</div> [/COLOR][COLOR= #007700];
}[/COLOR]
?>
Zoiets?

Als ik de pasgina herlaad moet ik weer inloggen confused
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/session_start"]session_start[/URL][COLOR= #007700]();[/COLOR]
[URL="http://www.php.net/ini_set"]ini_set[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]session.gc_maxlifetime[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]600[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]]==[/COLOR] [COLOR= #DD0000]"POST"[/COLOR][COLOR= #007700]) {[/COLOR]
   
  [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"pass"[/COLOR][COLOR= #007700]] !=[/COLOR] [COLOR= #DD0000]"admin"[/COLOR][COLOR= #007700]) {[/COLOR]  
  [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]"FOUT!"[/COLOR][COLOR= #007700];
   }[/COLOR]  [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]ADMIN TOOL [/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]pass[/COLOR][COLOR= #007700]]=[/COLOR][COLOR= #DD0000]"admin"[/COLOR][COLOR= #007700];
   }

}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]<div align="right">  
     <form action="" method="post">  
           <input name="pass" type="password" value="" size="9"><br>  
           <input type="submit" value="Log in">  
     </form>  
</div> [/COLOR][COLOR= #007700];
}[/COLOR]
?>


Volgensmij, ik ben hier ook neit zon expert in wink
0
Berichten
5.897
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jellesch schreef:
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/session_start"]session_start[/URL][COLOR= #007700]();[/COLOR]
[URL="http://www.php.net/ini_set"]ini_set[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]session.gc_maxlifetime[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]600[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]]==[/COLOR] [COLOR= #DD0000]"POST"[/COLOR][COLOR= #007700]) {[/COLOR]
   
  [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"pass"[/COLOR][COLOR= #007700]] !=[/COLOR] [COLOR= #DD0000]"admin"[/COLOR][COLOR= #007700]) {[/COLOR]  
  [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]"FOUT!"[/COLOR][COLOR= #007700];
   }[/COLOR]  [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]ADMIN TOOL [/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]pass[/COLOR][COLOR= #007700]]=[/COLOR][COLOR= #DD0000]"admin"[/COLOR][COLOR= #007700];
   }

}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]<div align="right">  
     <form action="" method="post">  
           <input name="pass" type="password" value="" size="9"><br>  
           <input type="submit" value="Log in">  
     </form>  
</div> [/COLOR][COLOR= #007700];
}[/COLOR]
?>
Volgensmij, ik ben hier ook neit zon expert in wink
PHP beëindigen, dan HTML en weer PHP openen
0
Berichten
5.897
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jellesch schreef:
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/session_start"]session_start[/URL][COLOR= #007700]();[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]]==[/COLOR] [COLOR= #DD0000]"POST"[/COLOR][COLOR= #007700]) {[/COLOR]
  [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"pass"[/COLOR][COLOR= #007700]] !=[/COLOR] [COLOR= #DD0000]"admin"[/COLOR][COLOR= #007700]) {[/COLOR]  
  [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]"FOUT!"[/COLOR][COLOR= #007700];
   }[/COLOR]  [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/setcookie"]setcookie[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]pass[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]admin[/COLOR][COLOR= #007700],[/COLOR] [URL="http://www.php.net/time"]time[/URL][COLOR= #007700]()+[/COLOR][COLOR= #0000BB]600[/COLOR][COLOR= #007700]);[/COLOR] 
  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]ADMIN TOOL [/COLOR][COLOR= #007700];
   }

}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]<div align="right">  
     <form action="" method="post">  
           <input name="pass" type="password" value="" size="9"><br>  
           <input type="submit" value="Log in">  
     </form>  
</div> [/COLOR][COLOR= #007700];
}[/COLOR]
?>
Werkt het nu?

Wachtwoord opslaan in een cookie emo
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Fout, passwoorden sta je niet op in een cookie. En die cookie die je nu maakt is zinloos.
Wat wil je ermee bereiken?

Cookies ==! Sessions
0
Marvinn

Lid · Topicstarter

Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Pff wat is het nou? Ik snap er niks van iedereen zegt wat anders yummie
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
SESSIES wou je toch gebruiken? Je kan ook Cookies gebruiken, maar dan zou je toch wel wat meer moeten scripten om het veilig af te handelen.
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