473,395 Members | 1,484 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How can I manually create an admin?

134 100+
hello,

I want to make my own website, with a login system. So I've downloaded a ready one. But now I had to install it by running the setup.php, which should provide me a admin account. The only problem is that when I full in the form to install it. It can't create an admin account because of a failure. As a solution it says that I have to create an admin account myself manually, but I have to make sure that the password is md5 coded. And now comes the question, how can I do that?
If you have another login system for me which is very safe, and easy to use and easy to install on my website, please tell me and give me the download link.
Thanks in advance.

Here is the code from the setup.php file
Expand|Select|Wrap|Line Numbers
  1. <?
  2. include("config.php");
  3. include("htmltop.php");
  4.  
  5. if(isset($_POST['submit'])) {
  6.  if($_POST['pass'] == $_POST['pass2']) {
  7.   $sql = "DROP TABLE IF EXISTS `gebruikers`;";
  8.   $query = mysql_query($sql);
  9.   if($query == TRUE) {
  10.    echo "Indien er oude tabellen waren met de naam gebruikers, zijn deze verwijderd...<br />\n";
  11.    $sql = "CREATE TABLE `gebruikers` (`id` int(11) NOT NULL auto_increment,`naam` varchar(50) NOT NULL default '',`wachtwoord` varchar(50) NOT NULL default '',`status` char(1) NOT NULL default '0',`email` varchar(100) NOT NULL default '',`actief` char(1) NOT NULL default '0',`actcode` varchar(15) NOT NULL default '',`lastactive` datetime NOT NULL default '0000-00-00 00:00:00',PRIMARY KEY  (`id`)) TYPE=MyISAM AUTO_INCREMENT=1";
  12.    $query = mysql_query($sql);
  13.    if($sql == TRUE) {
  14.     echo "De tabel 'gebruikers' is succesvol aangemaakt...<br />\nAdministrator account met naam '".$_POST['user']."' zal nu worden aangemaakt...<br />\n";
  15.     $md5pass = md5($_POST['pass']);
  16.     $sql = "INSERT INTO gebruikers (naam,wachtwoord,status,email,actief) VALUES ('".$_POST['user']."','".$md5pass."',1,'".$_POST['email']."',1)";
  17.     $query = mysql_query($sql);
  18.     if($query == TRUE) {
  19.      echo "De Administrator is succesvol aangemaakt, de gebruikersnaam van de Administrator is: '".$_POST['user']."'...<br />\n";
  20.      $del = unlink("setup.php");
  21.      if($del == TRUE) {
  22.       echo "Het bestand 'setup.php' is succesvol verwijderd...<br />\n";
  23.       echo "<p />\n";
  24.       echo "Installatie compleet. Je kunt nu gebruik maken van het script. Bedankt voor het gebruik maken van dit script!";
  25.      }else{
  26.       echo "Er is een fout opgetreden bij het verwijderen van het bestand 'setup.php'. Verwijder dit bestand handmatig!<br />\n";
  27.      }
  28.     }else{
  29.      echo "Er is een fout opgetreden bij het aanmaken van de Administrator. je kunt het handmatig proberen met bv. PhpMyAdmin (wachtword moet MD5 coded zijn!)...<br />\n";
  30.     }
  31.    }else{
  32.     echo "Er is een fout opgetreden bij het maken van de tabel. Weet je zeker dat je MySQL-instellingen in config.php kloppen?<br />\n";
  33.    }
  34.   }else{
  35.    echo "Er is een fout opgetreden bij het verwijderen van eventuele oude gebruikers-tabellen. Controleer de MySQL-instellingen in config.php<br />\n";
  36.   }
  37.  }else{
  38.   echo "De twee wachtwoorden komen niet overeen.<br />\n<a href=\"javascript:history.back()\">&laquo; Ga terug</a>";
  39.  }
  40. }else{
  41.  ?>
  42.  <form method="post" action="setup.php">
  43.   <table>
  44.    <tr>
  45.     <td>Administrator naam:</td><td><input type="text" name="user" maxlength="50" /> <small>(de inlognaam voor de administraotr)</small></td>
  46.    </tr>
  47.    <tr>
  48.     <td>Wachtwoord:</td><td><input type="password" name="pass" /></td>
  49.    </tr>
  50.    <tr>
  51.     <td>Herhaal:</td><td><input type="password" name="pass2" /></td>
  52.    </tr>
  53.    <tr> 
  54.     <td>E-mail:</td><td><input type="text" name="email" maxlength="100" /></td>
  55.    </tr>
  56.    <tr>
  57.     <td></td><td><input type="submit" name="submit" value="Installeren" /></td>
  58.    </tr>
  59.   </table>
  60.  </form>
  61.  <?
  62. }
  63. include("htmlbottom.php");
  64. ?> 
  65.  
Jun 16 '11 #1
1 1688
Atli
5,058 Expert 4TB
The SQL query on line 16 is what creates you account. To do it manually, just copy it, fill it out by hand, and execute it on your MySQL server.

MySQL has it's own MD5 function, so you can just do MD5('yourpass') where the password should go.

Just to point this out. MD5 is a very very weak algorithm. It really shouldn't be used for password security these days. The SHA-2 family, or Whirlpool, is much more secure. - Not to mention that you should at least be salting the hash, and even re-hashing it a few thousand times.


If you are looking for a decent quality CMS system that you can just plop onto your server and run without having to mess with the code, consider trying something like Drupal or Joomla. WordPress is also good, but requires a bit more coding to be effective.
Jun 17 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: GD | last post by:
I have a table(org1) that has fields (a, b, c, d). I can create another table (temptable) in design view and then use the lookup wizard to link field a from org1 into temptable. How can I do...
7
by: Ross Hamilton | last post by:
I have a Report that creates a Catalogue of Products we sell under various Headings eg: Books, Recordings, Health Food, Diet Foods, etc There are 82 Headings and a total of 6000+ products...
13
by: Richard W | last post by:
I have a very simple web page (ASP.NET) that I am trying to build. On the web page is a checkbox that enables or disables other controls based upon the checked status. However, .NET fails to...
1
by: Chenzo | last post by:
I have an issue where the provided .wsdl file is being generated incorrectly with the WSDL.exe tool. I have to use digital client certificates for authentication and it has been determined...by...
1
by: Jorge Luzarraga Castro | last post by:
Helloo, I´ve got a ASP .Net application which writes to the event viewer whenever it finds a error. This appl needs to create a new section in the event viewer the first time it encounters any...
4
by: Jan | last post by:
Have an SQL create/import script. Running this on SQL would make it create a table with some values. Can Access2003 somehow use such and SQL script? I went into SQL query view to try it out, but...
1
by: happypwc | last post by:
I am trying to create a user in the aspnet_user table but if keeps failing because of the unique variables. My hoster doesn't allow me to add users to this table other than through a t query. any...
3
by: Joseph Geretz | last post by:
The conventional approach is easy enough; drop a NotifyIcon onto a Form. When the form is loaded - bingo - the icon appears in the System Tray. I can't use this approach though. I'm writing a...
15
by: Killer42 | last post by:
Hi all. Ok, I'm using VB6 but I think the answer to this (if there is one) is more likely to be found in the Access forum. I have a situation where I've got tens of millions of records, spread...
0
by: raka61 | last post by:
Hi , I need help in understanding if i can directly(there are 100s of different structured files i get in text format with & hence dont wnat to manually define the structure for each file...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.