Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * SimpleManager
- * for TheSpartan
- *
- * @author Nami <Vendethiel> D0C
- */
- $host = 'localhost';
- $user = 'root';
- $pswd = '';
- $dbname = 'accounts';
- $table = 'users';
- $champ1 = 'user'; //à mettre dans ?.. ET le nom de la colonne dans la DB
- $champ2 = 'pass'; //à mettre dans ?.. ET le nom de la colonne dans la DB
- $cnx = mysql_connect($host, $user, $pswd);
- mysql_select_db($dbname, $cnx);
- if (!isset($_GET[$champ1]))
- return; //wrong request
- $user = $_GET[$champ1];
- if (isset($_GET[$champ2]))
- { //add an user
- $pass = $_GET[$champ2];
- mysql_query('INSERT INTO `'.$table.'` (`'.$champ1.'`, `'.$champ2.'`) VALUES (\''.mysql_real_escape_string($user).'\', \''.$cnx->quote($pass).'\')');
- }
- else
- {
- $row = mysql_fetch_array(mysql_query('SELECT `'.$champ2.'` FROM `'.$table.' WHERE `'.$champ1.'` = \''.mysql_real_escape_string($user).'\' LIMIT 1'));
- echo $row[$champ2];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement