Je denkt toch niet dat alle accounts geblokkeerd zijn?
Vraag over source
- Dpm_x
- Closed
-
-
Guest, wil je besparen op je domeinnamen? (ad)
-
-
Ik zou het nog niet verkopen. De code is niet netjes gemaakt en er zitten nogal wat fouten in verwacht ik als ik de voorbeeld code bekijk.
-
Ik zag dat je ook een session wachtwoord maakt. Dit raat ik je echt ten zeerste af. Als iemand de sessions kan uitlezen heeft hij zo een wachtwoord van iemand. Mijn tip is zoek eens op login systeem op google, en kijk daar eens hoe inloggen wordt gecontroleerd etc.
-
@BrokenTrack , laat eens wat van jouw code zien?
-
Citaat van Dpm_x
@BrokenTrack , laat eens wat van jouw code zien?
PHP
Toon Meer<?php ########################### ### Copyright SimplePHP ### ### Created by ### ### BrokenTrack.com ### ### Author: ### ### Tim van den Belt ### ### Licensed under: ### ### {input_licence_here ### ########################### /* @author Tim van den Belt */ class Mysql extends SimplePHP { private $connection; private $connected = false; /* This will connect with the mysql database and selects the right database. On fail an exception will be caught and printed. This will set the core initialisation on false. */ public function check_connection() { if(!$this->Database->connected) { try { $this->Connection = $this->connect(); $this->select_db(); return true; } catch(Exception $e) { $e->add_error('<strong>SimplePHP error:</strong> Mysql error in '.$e->getFile().' on line '.$e->getLine().' because: '.$e->getMessage().'<br />'); $this->core_load_false(); return false; } } } /* Tries to connect with the mysql server. Exception on error. */ private final function connect() { if(!$this->Database->Connection = @mysql_connect(SERVER,DATABASE_USER,DATABASE_PASSWORD)) { throw new Exception('Cannot connect with the mysql server'); return false; } $this->Database->connected = true; return true; } /* Tries to select the database. Exception on error. */ private final function select_db() { if(!@mysql_select_db(DATABASE)) { throw new Exception('Cannot select the database'); return false; } return true; } /* @param, the query string that needs to be executed. @return, the result of the query. Will try to execute the query. Will use the Error Exception class on error. */ public function query($query) { try { $result = $this->Mysql->do_query($query); } catch(Error $e) { $e->add_error('SQL query error in '.$e->getFile().' on line '.$e->getLine.' because: '.$e->getMessage()); return false; } return $result; } /* @param, the query that needs to be executed @return, the result of the query Will execute the query, exception on error */ private final function do_query($query) { if(!$result = @mysql_query($query)) { throw new Exception(mysql_error()); return false; } return $result; } /* @param, the query string that needs to be assoced. @return, the result of the query. Will try to assoc the query. Will use the Error Exception class on error. */ public final function assoc($query) { $query = $this->Mysql->query($query); try { $result = $this->Mysql->do_assoc($query); } catch(Error $e) { $e->add_error('SQL assoc error in '.$e->getFile().' on line '.$e->getLine.' because: '.$e->getMessage()); return false; } return $result; } /* @param, the query that needs to be assoced @return, the result of the assoc Will assoc the query, exception on error */ private final function do_assoc($query) { if(!$result = @mysql_fetch_assoc($query)) { throw new Exception(mysql_error()); return false; } return $result; } /* Closes the mysql connection if any */ protected final function close() { if($this->Database->connection) { if($this->Database->Connection) { @mysql_close($this->Database->$connection); return false; } } return true; } } ?>
Stukje van het framework waar ik mee bezig ben. Deze klasse is waarschijnlijk nog niet af. -
ok maar wat is er dan anders??
-
-
Bij mij blijft er 'Je bent niet ingelogd' staan..
-
Hopelijk is het nu dan wel opgelost...
-
Nee nog steeds niet...
-
Je bent niet ingelogd. krijg ik steets:x
-
PHP
Toon Meer<?php if($_POST['inloggen']) { $gebruiker = mysql_real_escape_string($_POST['login']); $wachtwoord = mysql_real_escape_string($_POST['pass']); $IP = $_SERVER[REMOTE_ADDR]; // even wat beveiligen en IP opvragen $bestaatdb = mysql_query("SELECT * FROM `users` where `login`='".$gebruiker."' AND `pass`='".$wachtwoord."'"); $controle = mysql_num_rows($bestaatdb); // is de ingevulde combinatie wel correct? if($controle == 0) { echo'Je hebt een foute wachtwoord of login opgegeven!'; } else { $_SESSION['login'] = $gebruiker; $_SESSION['pass'] = $wachtwoord; mysql_query("UPDATE users SET laatstelogin=NOW() WHERE login='".$gebruiker."'"); mysql_query("INSERT INTO logs (wat, wanneer, wie, IP) VALUES('ingeloggen',NOW(), '".$gebruiker."', '".$IP."')"); // user zijn laatste login tijd updaten & aanvraag loggen echo '<meta http-equiv="refresh" content="0;url='.$siteadres.'/index2.php" />'; // user wordt naar het ingelogde deel herleidt! } } ?>
Verder valt het me op dat je wachtwoord niet MD5 wordt opgeslagen, zeer onveilig en ik als gebruiker wil absoluut niet op je website komen. Want jij of een hacker zou zo mijn wachtwoord kunnen lezen.
Hoe check jij of iemand is ingelogd? Laat die checks eens zien.
-
-
if(! isset($_SESSION['login'])) {
unset($_SESSION['login']);
unset($_SESSION['pass']);
} -
Heb dat nu , kijk eens?
-
En dat werkte bij me:) Ik blijf er echter wel bij dat je beveiliging echt heel slecht is.
Wat je beter kan doen is een sessie['ip'] te maken en die ook mee te checken en wachtwoord als sessie raadt ik echt af.
-
Heb het weggedaan (wachtwoord sessie en ik bouw nu wel even MD5 in)
-
Nu ik ingelogd ben, zie ik ook dat je layout niet klopt in google chrome.. Dus als je dit script al zou willen verkopen, moet je nog best veel aanpassen. Nu is het eerlijk gezegd niets waard.
-
Leuk dan dat ik een maand voor niks heb gewerkt... De gebruiker moet het dan maar kopen als hij/zij weet dat die er iets moois van kan maken , en ik denk wel dat dat moet lukken met dit aangezien het toch redelijk goed is gemaakt qua systeem.
Participate now!
Heb je nog geen account? Registreer je nu en word deel van onze community!