Welcome to Geeklog Tuesday, December 07 2021 @ 10:43 pm EST

Geeklog Forums

Including Functions for Registrations


Status: offline

Turner

Forum User
Chatty
Registered: 11/04/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: 16/07/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: 11/04/05
Posts: 42
In lib-custom.php I want to do this:

PHP 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

PHP 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:

PHP 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: 22/03/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: 11/04/05
Posts: 42
Leaves me speechless Shocked (I obviously need some sleep)

Uh, Thanks, and goodnight...
 Quote

All times are EST. The time is now 10:43 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