I need the following code done and am willing to use a code for rent style site to get it done. I know it's not to complicated but I am planning a wedding and need to spend my time elsewhere.
I'm not sure if this can or should all be done in php. I would like it done in as few files as possible.
Can anyone suggest a site and and/or a reasonable price? (You can pm me if you wish to help out)
The basics of the code follows. Suggestions GREATLY welcome.
Current Setup:
Server is CentOS (Redhat stripped of the branding). Specs are as follows: WHM 10.0.0 cPanel 10.0.0-R149 - CentOS 3.4 i686 Kernal version 1.3.33(I think) WHM X v3.1.0 - PHP version 4.3.9 - MySQL version 4.0.22 standard - pure-ftpd 1.0.20 installer release number 10.tls
Project Overview:
I have a dedicated server in which I am writing some custom code in php/mysql. I do not have the time or technical experience to do some things. I need a procedure able to be initiated from a php script that will do the following: Make ftp account, set ftp access, make directories and chmod them, add information to a database. Emphasis for this script should be put on SIMPLICITY OF DESIGN. I prefer simpler code which is easier to understand to more complicated code which is harder for future programmers to pick up on, although the latter may be more processor efficient. The quickest way to get more coding jobs from me is to document everything. I am not putting $ signs in front of variables unless that portion of the code is specifically going to be php.
Details:
This program/procedure/script will be fed the following values:
Username
UsernamePassword
SizeOfAccount (will be a number in bytes... such as 1048576)
Your scripts and programs will reside in the following folder unless you give me reason to put it elsewhere:
/home2/websitename/public_html/users/autopopulate.php
Provide basic generic script to check database db01 and table tb01. Check if Username is already in ColumnUsername. If it is already there, do not process the script any further. Simply put up some text saying "Click your back button to change the username because this one is already taken".
The program/procedure/script(s) will then do the following.
Evaluate current month and day of year and set SignupDayOfYear in a 1 to 365 numerical value. February 29th should be calculated as February 28th. (Or a similar workaround for leap year so I don't have to worry about it when people sign up on this day). Set this into variable SignupDayOfYear
Create variable FtpPass12Chars to be used as ftp password (hence, users never know their ftp password even though they have an ftp account assigned to them specifically. The UsernamePassword above is only for web access to other scripts I've already written. They may only access their ftp account if they upgrade to a larger plan.)
Create variable RandomCharacters12 to be used later.
note The disk url for the website is /home2/websitename/public_html. I have added a subdomain users.domain.com which points to the /home2/websitename/public_html/users directory. The subdomain was created through cpanel and works fine.
mkdir folder1 path /users/Username
mkdir folder2 path /users/Username/content
mkdir folder3 path /users/Username/content/-RandomCharacters12- (including the dashes)
note making ftp users from this script will automatically make them in within this website's realm, folder1 above will really be /home2/public_html/websitename/users/Username even though you are creating it as /users/Username
chmod folder1 to 755
chmod folder2 to 755
chmod folder3 to 777 (777 is necessary for now. I am researching other ways. Another script I have written builds new jpg files in this directory.)
Make the following variable SizeOfAccount2 which is equal to (SizeOfAccount * 1.2)
Make an ftp user named Username, password FtpPass12Chars (duplicate username accounts will be checked before this script is run) and give them access to folder2. If possible, since we are creating this user with pure-ftpd, give this user an ftp size quota of SizeOfAccount2
Make a file /users/Username/vars.php, chmod it to 644 and populate with the following information
<?php
$servernamehardware="servernum.domain.com";//for logging?
$servernameurl="users.domain.com";//for scripting...
$serverbasedir="/home2/domain/public_html/users/";
$randomword="-RandomCharacters12-";
$username="Username";// variable from above
$workingdirectory="/home2/mtrxnet/public_html/users/$username/content/";
$userbasedirectory="/home2/mtrxnet/public_html/users/$username/";
$passwordweb="UsernamePassword";
$passwordftp="FtpPass12Chars";
$workingdirectoryrandomword=$workingdirectory.$randomword;
$workingdirectoryrandomwordslash=$workingdirectoryrandomword."/";
$currenturl=http://users.domain.com/$Username;
$spaceallowednumber=250000;
$spaceallowedtext="250MB";
$varext="JPG,jpg,JPEG,jpeg,JPE,jpe";
$varext2=".JPG,.jpg,.JPEG,.jpeg,.JPE,.jpe";
?>
Other initial variables:
AccountVerified=no
AccountPaid=no
Account30DaysPastDue=no
AccountDisabled=no
My other databases and tables are set up and working fine. Please give sample code to store the following info in a table within database db01:
Insert Username, UsernamePassword, SizeOfAccount, SizeOfAccount2, RandomCharacters12, folder1, folder2, folder3, FtpPass12Chars, AccountVerified, AccountPaid, Account30DaysPastdue, AccountDisabled, SignupDayOfYear into columns with similar names. In the future I may use MD5 for the passwords to add a bit more security.
I will need some further assistance in the future with optimizing the php code I have already written, or moving it away from php if another avenue is more processor friendly. I tend to be distrustful of handing out my personal info and access to my sites. If a person works with me on a couple projects I may wind up hiring them on for more secure, larger projects which will pay more.
Any questions? Please email me at codinghelp-AT-crazyjeremy.com
edited for content / verbage