createing links in php to database and site files in a subdomain?

chriscrowe43

New Member
Messages
23
Reaction score
0
Points
0
Ok so I have ran into an issue with codeing when it comes to php and my subdomain.
my php code works in my main domain ie. it sends out an activation email to the user after registering for join my community. But when I began setting up my subdomain and tired to use the same code(which is automaticly set up with a configure page.php) It's not sending the activation email. My php register page (for the subdomain) is set to use my subdomains email for an auto mailer. That is what is not working in my sub but does when i set it up for my main. So i was wondering if in the subdomain sinse the code is in a subdomain and not at the "top level" like the main domain if I need to altar the codes link names. such as
here in the include once statement: i placed the file structure of my sever at the bottom.

session_start();
if (!$_SESSION['id']) {
$msgToUser = '<br /><br /><font color="#FF0000">Only site members can do that</font><p><a href="register.php">Join Here</a></p>';
include_once 'msgToUser.php';
exit();
}
//////////////////////////////////////////////// End member Log in check ///////////////////////////////////////////////////
$id = $_SESSION['id'];
////////////

to something like 'peacemakers/msgToUser.php';

or include_once "scripts/connect_to_mysql.php"; to
include_once "peacemakers/scripts/connect_to_mysql.php";

and situations like
include_once 'msgToUser.php'; to
include_once 'peacemakers/msgToUser.php'; and

<table width="600" align="center" cellpadding="5">
<form action="register.php" method="post" enctype="multipart/form-data">
<tr>
to

<table width="600" align="center" cellpadding="5">
<form action="peacemakers/register.php" method="post" enctype="multipart/form-data">
<tr>


here is what my server looks like (at least the important part of it. )
file%20structure.jpg
 
Last edited:

Dead-i

x10Hosting Support Ninja
Community Support
Messages
6,084
Reaction score
368
Points
83
I'm not sure if I understand your question, but I'll try my best. Before you start, could you tell me what the physical path of your subdomain is?

Such as:
/home/user/public_html/peacemakers
 

chriscrowe43

New Member
Messages
23
Reaction score
0
Points
0
im assuming it is/home/user/public_html/peacemakers

i have been doing all my uploading to

/home/user/www/peacemakers
but im told there the same thing so.?
 

Dead-i

x10Hosting Support Ninja
Community Support
Messages
6,084
Reaction score
368
Points
83
Yes, public_html and www are symlinked. So is your subdomain pointing to /www/peacemakers/ ?
 

chriscrowe43

New Member
Messages
23
Reaction score
0
Points
0
Yes, public_html and www are symlinked. So is your subdomain pointing to /www/peacemakers/ ?

i think so, i just dont understand why it would work when its in /home/user/public_html/
and not in /home/user/public_html/peacemakers/ , if there is code i need to change im not really sure what. But it just doesnt want to send out the activation email through my subdomains email...?

---------- Post added at 05:32 PM ---------- Previous post was at 05:19 PM ----------

It works for registering becuase it connects to the data base and puts a record in the members table. And it works for loging in if i manual activate the account from inside table. but not email. btw sending created a test user account with my yahoo email , thats the one its suposed to send the activation email too.
 

Dead-i

x10Hosting Support Ninja
Community Support
Messages
6,084
Reaction score
368
Points
83
Also, what is the location of your script? Is it /public_html? :)

Also, on your Yahoo account do you have SpamGuard enabled? If so, it might have gone in your Yahoo Spam folder (at yahoo.com).
 

chriscrowe43

New Member
Messages
23
Reaction score
0
Points
0
Also, what is the location of your script? Is it /public_html? :)

Also, on your Yahoo account do you have SpamGuard enabled? If so, it might have gone in your Yahoo Spam folder (at yahoo.com).


all the files are copied to the /peacemakers/ and then a automatically configred from configure.php page that you navigate to in your browser. then delet so there is a complete copy of the files on both the /home/user/public_html/ and /home/user/public_html/peacemakers/
just with different databases.

i do have spam gaurd but i have been checking both the inbox and the spam box.
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
Please use
PHP:
, [html] or [code] tags (as appropriate) to separate and format code.

PHP checks every directory listed in the [URL="http://php.net/include_path"]include_path[/URL] directive when searching for include files, unless an absolute (beginning with a "/") or relative (beginning with "./" or "../") path is used. If the file can't be found, PHP will then check the [URL="http://php.net/getcwd"]current working directory[/URL]. The current working directory starts out as the directory of the top-level script (the one the URL maps to, [c]$_SERVER['SCRIPT_FILENAME'][/c]). 

Use [URL="http://php.net/get_include_path"][c]get_include_path[/c][/URL] and [URL="http://php.net/set_include_path"][c]set_include_path[/c][/URL] to manage the include path. You can do this in a site-wide initialization file (named e.g. "init.php"), then create a per-directory file with the same name in subfolders to include the site-wide file. Start each script with a [c]require_once('./init.php');[/c].

Per-directory init.php:
[php]<?php
require_once($_SERVER['DOCUMENT_ROOT'] . '/init.php')

With this approach, libraries can be placed outside the web hierarchy, as is proper (library scripts shouldn't be publicly addressable/accessible).

Personally, I prefer to reserve scripts with "config" in their name for admin-editable settings. That is, "config.php" and the like contain only variable assignment statements, whereas "init.php" contains more complex code that only developers should edit.

One way to be certain that the files are being included is to use require_once rather than include_once, which will result in a fatal error rather than a warning if the file isn't found. Note that you should only do this if a missing included script will prevent the including script from doing anything useful.

As for sending e-mails, make sure your code performs proper error checking at all potential failure points. The built-in mail function offers very little when it comes to reporting e-mail problems; use a more full-featured PHP mailer, such as PEAR's Mail or PHPMailer to get better feedback.

<br/> and <font> arn't semantic. Similarly, don't use tables for layout, as it's not semantic. Instead of <br>, use a more appropriate element, such as <p>. Instead of <font> and table-based layouts, use CSS. Make sure any element class names you use are also semantic.

Don't use exit or die when outputting HTML. You'll get invalid HTML.
 
Last edited:

chriscrowe43

New Member
Messages
23
Reaction score
0
Points
0
If i understand what your saying correctly i would have to think that everything should be working.
Thats where im confused becuase It all works in the /home/user/public_html/ where i have it set up on my main domain. but its not working on the subdomain.
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
Did you check the include path? What is it?
 
Top