Jump to content

[SOLVED] Script installer


stelthius

Recommended Posts

Hey guys, ive built my script installer, and then my script updater, im having a issue with the script updater, it always ads a second admin user is there anyway i could add in a check to see if there is already a username admin if so dont add a new username admin.

 

 

$admin_pass = md5($_POST['admin_pass']);
$query18 = "INSERT INTO `users` (`user_id`, `username`, `password`, `session_id`, `login_ip`, `last_activity`, `user_level`, `email_address`) VALUES
(1, '".$_POST['admin_user']."', '".$admin_pass."', 'NIL', 'NIL', 'NIL', '9', '".$_POST['admin_pass']."');";

 

With regards.

Link to comment
https://forums.phpfreaks.com/topic/166497-solved-script-installer/
Share on other sites

So basicly i could do something like

 

 


     $query="SELECT * FROM users WHERE admin = '$admin'";
     $result=mysql_query($query) or die ("Query failed");

// This is the part were im stuck how would i go about adding in the admin is there code

if (  ) {
// Do nothing carry on finishing the query executions
} else {
$admin_pass = md5($_POST['admin_pass']);
        $query18 = "INSERT INTO `users` (`user_id`, `username`, `password`, `session_id`, `login_ip`, `last_activity`, `user_level`, `email_address`) VALUES
(1, '".$_POST['admin_user']."', '".$admin_pass."', 'NIL', 'NIL', 'NIL', '9', '".$_POST['admin_pass']."');
}



 

 

Sorry for the messy code was just threw together to try get an idea.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.