Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 05:11 pm EDT

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
 Quote

Status: offline

Blaine

Forum User
Moderator
Registered: 07/16/02
Posts: 1232
Location:Canada
Post an extract of one of the functions with your change so we can see.
Geeklog components by PortalParts -- www.portalparts.com
 Quote

Status: offline

Turner

Forum User
Chatty
Registered: 04/11/05
Posts: 42
In lib-custom.php I want to do this:

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.
 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.
 Quote

Status: offline

Turner

Forum User
Chatty
Registered: 04/11/05
Posts: 42
Leaves me speechless Shocked (I obviously need some sleep)

Uh, Thanks, and goodnight...
 Quote

All times are EDT. The time is now 05:11 pm.

  • 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