Script to Add User to Wordpress - mysql

I need help to quickly add about >100 username and password to a locally installed Wordpress.
I have a list of usernames in text file, and I'd let each password to be equal to username (or someother function if equal is not allowed by Wordpress).
Is there a way I can programmatically add users to Wordpress? I have access to wordpress database if that helps.
Thanks.

If you don't want to use a plugin and you have your users and passwords stored in an array, simply throw it into a loop and use the 'wp_create_user' function. It takes 3 parameters (username, password and email). It will return the ID if successful and false if not.
http://codex.wordpress.org/Function_Reference/wp_create_user

Check out this plugin, it will let you import users from a csv which is basically what you're looking to do:
http://www.dagondesign.com/articles/import-users-plugin-for-wordpress/

Related

Writing an IIF query in Access

I'm attempting to create an Access db to log company domain names, hosting companies, usernames / passwords etc.
I want to create a field with a hyperlink in it which says
Iif [software] == 'wordpress' , link=url+'wpadmin', else link=url+'admin'
I cannot see how to make the fields query it and add a button to click which automatically directs the user to the correct admin site.
Can anyone help please? If this php and sql i'd be fine!
In Access, it would be something like this:
link = url & IIf([software] = "wordpress", "wpadmin", "admin")

how to seperate admin and user in cakephp..?

I try to make a new blog. the admin and user logins works fine. My problem is whenever user make login ,he can access the other user iformation too. how to protect those files ??. thanks in advance
Try to add an attribute to your "Users" table, name this attribute "super_admin" and give it a "smallint" type with the size of 1 caracter so he can take only 1 or 0 as a value(Boolean).
The only thing you have to do is checking if the user is a SUPER ADMIN or Not.
For exemple:
$user=$this->request->session()->read('Auth')['User'];
if($user->super_admin == 0)//Not an Admin
{
//Do some stuffs
}
Don't forget to update your "Users" Model when you add the "super_admin" attribute.
For mor info please check AUTHENTIFICATION WITH CAKE PHP 3
GOOD LUCK :)

How do I change a user's Email address in MediaWiki

With access sysop and database access how do I change the Email address associated with a user?
The user table in the database has everything encoded as BLOBs. If I can decode and encode those values presumably I can just update user.user_email.
UPDATE user SET user_email='foo#bar.com' WHERE user_id=... should just work. However, if you need to also set the confirmed flag, see instructions here (replace the mwscript line with php maintenance/eval.php). If you need to set their email only so that they could reset their password, see https://www.mediawiki.org/wiki/Manual:Resetting_passwords
You can get a current list of users and emails like this (i.e. decode):
SELECT Cast(user_name AS CHAR), Cast(User_Email AS CHAR) FROM user;
MaxSem's answer did not work for me, but here is a MediaWiki maintenance script (introduced in v1.27) that'll do the trick: https://www.mediawiki.org/wiki/Manual:ResetUserEmail.php
Go to the base directory of your wiki, and type something like this:
php maintenance/resetUserEmail.php uuuu new#email.address
to change user uuuu's email address to new#email.address. By default, this will change the user's password so that the user has to reset it, which can usually be done on the wiki website. You might need to add user name and password for database access, e.g.:
php maintenance/resetUserEmail.php --dbuser myuser --dbpass wordpass uuuu new#email.address

User experience question: Password change in users management module

We are writing a user management module where the admin can change passwords for other users.
We store hashed passwords of users in DB.
The question is what field do we present to the admin user ?
There are some options:
Present the input filed with no value, and change the password only if the some value was entered
Present the input field with fixed-length string, and detect the change when the value changes
There's an option of presenting a change password button, but we prefer not to do it this way.
What option do you use and why ?
I would go with option 1.
Present the input filed with no value, and change the password only if the some value was entered
This is because its not really a "change password" option, its really a "set password" option. There is no value in showing the current hash to the admin user.
So in your update user code you just check if the password field is set, if so hash the new value and store the new hash.
Note: this is traditionally different to the way a user (including admin) changes their own password.
In that case the user is usually prompted for the value of the old password to ensure that its not someone else coming across the screen when its already logged in. But if you wanted to re-use the same screen (with a different where clause) then this is not essential - just what's normally done.
After a few minutes of brainstorming we got to the merged option, of showing fixed-size value inside the text-box and use onfocus() and onblur() events to blank the field on focus and return to the fixed size string on loose of focus when no text was entered.

Designing Database

I need to design database with frontend as HTML.
This is my first attempt to do this.
What I need is,
- User can input a word from HTML page, click submit
I will query the word to get a URL from database and user sees that webpage(pointed by URL).
Just enter word, submit and get the webpage displayed.
People suggested using JSP/Access. I am new to everything.
Can you please point out what exactly I need to do?
Thanks a ton.
Following is the way you need to approach
Step1:
Create an HTML page which can take an input from the users
Step 2:
After getting the data from the user, create a connection to the database and pass the searched string as an input paramater.
Step 3:
You will get a result set from a database
Step 4:
Iterate through the result set and display in the html page, if you require the url to be given for those url, so when user clicks So that he will be directed to those websites.
Sample Query:
Select * from table1 where url_Word like '%Search_String'
This will be the procedure that you need to follow to complete your work.
You do not need a database you need a text file. If this is a school project you need more information.