Welcome to Geeklog, Anonymous Sunday, December 22 2024 @ 12:46 am EST
Geeklog Forums
Including Functions for Registrations
Status: offline
Turner
Forum User
Chatty
Registered: 04/11/05
Posts: 42
I have a handful of sites running on one codebase. This means every site must have the same custom registration fields. I'd like to snip the custom registration functions and put a call in lib-custom.php that checks the url (i.e. "if ($_SERVER['HTTP_HOST'] == 'www.url.com')") and then require_once (the appropriate registration functions).
But when I do this, the code itself displays at the top of the site. Anyone know what gives?
(Is there a better way to do what I am trying to do?)
Thanks!
-Jeff
But when I do this, the code itself displays at the top of the site. Anyone know what gives?
(Is there a better way to do what I am trying to do?)
Thanks!
-Jeff
11
12
Quote
Status: offline
Turner
Forum User
Chatty
Registered: 04/11/05
Posts: 42
In lib-custom.php I want to do this:
require_once ('c:/site-path/registrationcodeforsite1.php');
} else if ($_SERVER['HTTP_HOST'] == 'urlforsite2') {
require_once ('c:/site-path/registrationcodeforsite2.php');
}
I want to move the custom registration code from lib-custom.php into a file registrationcodeforsite1.php so it would contain this
user create stuff unique for site1
}
function custom_userdisplay($uid) {
user display stuff unique for site1
}
function custom_useredit($uid) {
user edit stuff unique for site 1
}
I want to duplicate the custom registration stuff in a file registrationcodeforsite2.php so that it would contain something like this:
user create stuff unique for site2
}
function custom_userdisplay($uid) {
user display stuff unique for site2
}
function custom_useredit($uid) {
user edit stuff unique for site 2
}
With this scheme, I can have completely different registrations being run by the same code.
Unfortunately, when I do the require_once above, the actual code in registrationcodeforsite1.php displays when I simply want it to load and be available for use.
Text Formatted Code
if ($_SERVER['HTTP_HOST'] == 'urlforsite1') {require_once ('c:/site-path/registrationcodeforsite1.php');
} else if ($_SERVER['HTTP_HOST'] == 'urlforsite2') {
require_once ('c:/site-path/registrationcodeforsite2.php');
}
I want to move the custom registration code from lib-custom.php into a file registrationcodeforsite1.php so it would contain this
Text Formatted Code
function custom_usercreate($uid) {user create stuff unique for site1
}
function custom_userdisplay($uid) {
user display stuff unique for site1
}
function custom_useredit($uid) {
user edit stuff unique for site 1
}
I want to duplicate the custom registration stuff in a file registrationcodeforsite2.php so that it would contain something like this:
Text Formatted Code
function custom_usercreate($uid) {user create stuff unique for site2
}
function custom_userdisplay($uid) {
user display stuff unique for site2
}
function custom_useredit($uid) {
user edit stuff unique for site 2
}
With this scheme, I can have completely different registrations being run by the same code.
Unfortunately, when I do the require_once above, the actual code in registrationcodeforsite1.php displays when I simply want it to load and be available for use.
10
10
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/04
Posts: 1512
don't mind me guessing, but my first guess would be that your required files simply don't have the proper open and closing tags, eg., <?php //code here ?>.
The tags indicate that the code in between should be parsed as PHP code rather than plain text.
The tags indicate that the code in between should be parsed as PHP code rather than plain text.
11
11
Quote
All times are EST. The time is now 12:46 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content