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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.