[Tutorial] Registration Engine
Posted: Mon Jul 08, 2013 4:00 am
Well, it seems my hard work (on and off, of course!) has finally paid off. While it doesn't integrate directly with Facebook, I have successfully created a registration engine that allows new users to create their own username on my Madsonic server. Not 100% sure this will work for Subsonic, but I am running Madsonic, and it works fine.
Pre-requisites:
1) A server running MySQL (can be the same server you are running Madsonic from)
2) A server with Sendmail or PostFix installed and configured to send email (does not need to "receive" email)
3) The registration script, which can be downloaded here: http://www.html-form-guide.com/files/ph ... onForm.zip
Instructions:
1) Unzip the downloaded files into your main website folder, so all of the files are under a subfolder called "Source".
2) Edit the "source/include/membersite_config.php" file in a text editor or whatever you use (I use Dreamweaver).
2a) Set the "website name" to the name of your site - don't use the URL for your site, just the name.
2b) Set the administrator's email address.
2c) Enter the hostname (or IP address), username, password, database name, and table name for your MySQL server
(table name can be anything you want - the script will create the table the first time it is run)
2d) (optional) Create a "random" key.
3) Edit the "source/include/fg_membersite.php" file.
3a) Change "$this->sitename" to your site, without the http:// in front.
3b) Copy the "random" key from the previous file and paste it here, under "rand_key"
3c) Scroll down to almost the bottom of this file, to around line 790 or so, or where you find the lines:
Just below these lines, you will see a line stating "return true". ABOVE this line, but BELOW the "return false", add the following lines:
Replace the parts (YOUR _____ HERE) with your information.
4) Edit the "thank-you-regd.html" file. At the last line, beginning with "a href", change the "login.php" name to your site's homepage.
Save all files as you move on to the next one.
Last step is to go into Madsonic, under Settings/General, scroll to the bottom, and create a "link" in the login message - something similar to this:
Save these settings, and then logout and you will see this link on your login screen.
Please post up any issues you run into, and I'll see what I can do to resolve them for you.
Pre-requisites:
1) A server running MySQL (can be the same server you are running Madsonic from)
2) A server with Sendmail or PostFix installed and configured to send email (does not need to "receive" email)
3) The registration script, which can be downloaded here: http://www.html-form-guide.com/files/ph ... onForm.zip
Instructions:
1) Unzip the downloaded files into your main website folder, so all of the files are under a subfolder called "Source".
2) Edit the "source/include/membersite_config.php" file in a text editor or whatever you use (I use Dreamweaver).
2a) Set the "website name" to the name of your site - don't use the URL for your site, just the name.
2b) Set the administrator's email address.
2c) Enter the hostname (or IP address), username, password, database name, and table name for your MySQL server
(table name can be anything you want - the script will create the table the first time it is run)
2d) (optional) Create a "random" key.
3) Edit the "source/include/fg_membersite.php" file.
3a) Change "$this->sitename" to your site, without the http:// in front.
3b) Copy the "random" key from the previous file and paste it here, under "rand_key"
3c) Scroll down to almost the bottom of this file, to around line 790 or so, or where you find the lines:
- Code: Select all
$insert_query = 'insert into '.$this->tablename.'(
name,
email,
username,
password,
confirmcode
)
values
(
"' . $this->SanitizeForSQL($formvars['name']) . '",
"' . $this->SanitizeForSQL($formvars['email']) . '",
"' . $this->SanitizeForSQL($formvars['username']) . '",
"' . md5($formvars['password']) . '",
"' . $confirmcode . '"
)';
Just below these lines, you will see a line stating "return true". ABOVE this line, but BELOW the "return false", add the following lines:
- Code: Select all
$url = "http://(YOUR SITE NAME)/rest/createUser.view?u=(YOUR ADMIN NAME)&p=(YOUR ADMIN PASSWORD)&v=1.9.5&c=remoteregister&username=". $this->SanitizeForSQL($formvars['username']) ."&password=". ($formvars['password']) ."&email=". $this->SanitizeForSQL($formvars['email']) ."&settingsRole=true&streamRole=true&jukeboxRole=false&downloadRole=false&uploadRole=false&playlistRole=true&coverartRole=false&commentRole=false&podcastRole=false&shareRole=true&searchRole=true&groupID=4";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_exec($curl);
curl_close($curl);
Replace the parts (YOUR _____ HERE) with your information.
4) Edit the "thank-you-regd.html" file. At the last line, beginning with "a href", change the "login.php" name to your site's homepage.
Save all files as you move on to the next one.
Last step is to go into Madsonic, under Settings/General, scroll to the bottom, and create a "link" in the login message - something similar to this:
- Code: Select all
If you don't have an account, click {link:HERE|http://bustermusic.servemp3.com/source/register.php} to create an account. You will be able to login after clicking the link in the confirmation email that will be sent to you.
Save these settings, and then logout and you will see this link on your login screen.
Please post up any issues you run into, and I'll see what I can do to resolve them for you.