+ Reply to Thread
Results 1 to 10 of 10

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

  1. #1
    chriscrowe43 is offline x10Hosting Member chriscrowe43 is an unknown quantity at this point
    Join Date
    Aug 2011
    Posts
    21

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

    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. )
    Last edited by chriscrowe43; 09-04-2011 at 11:23 AM.

  2. #2
    Dead-i's Avatar
    Dead-i is offline Community Advocate Dead-i has a spectacular aura about
    Join Date
    Aug 2011
    Location
    United Kingdom
    Posts
    1,448

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

    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

  3. #3
    chriscrowe43 is offline x10Hosting Member chriscrowe43 is an unknown quantity at this point
    Join Date
    Aug 2011
    Posts
    21

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

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

  4. #4
    Dead-i's Avatar
    Dead-i is offline Community Advocate Dead-i has a spectacular aura about
    Join Date
    Aug 2011
    Location
    United Kingdom
    Posts
    1,448

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

    Yes, public_html and www are symlinked. So is your subdomain pointing to /www/peacemakers/ ?

  5. #5
    chriscrowe43 is offline x10Hosting Member chriscrowe43 is an unknown quantity at this point
    Join Date
    Aug 2011
    Posts
    21

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

    Quote Originally Posted by Dead-i View Post
    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.

  6. #6
    Dead-i's Avatar
    Dead-i is offline Community Advocate Dead-i has a spectacular aura about
    Join Date
    Aug 2011
    Location
    United Kingdom
    Posts
    1,448

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

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

  7. #7
    chriscrowe43 is offline x10Hosting Member chriscrowe43 is an unknown quantity at this point
    Join Date
    Aug 2011
    Posts
    21

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

    Quote Originally Posted by Dead-i View Post
    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.

  8. #8
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

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

    Please use [php], [html] or [code] tags (as appropriate) to separate and format code.

    PHP checks every directory listed in the include_path 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 current working directory. The current working directory starts out as the directory of the top-level script (the one the URL maps to, $_SERVER['SCRIPT_FILENAME']).

    Use get_include_path and set_include_path 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 require_once('./init.php');.

    Per-directory init.php:
    PHP Code:
    <?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 by misson; 09-04-2011 at 01:53 PM.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  9. #9
    chriscrowe43 is offline x10Hosting Member chriscrowe43 is an unknown quantity at this point
    Join Date
    Aug 2011
    Posts
    21

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

    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.

  10. #10
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

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

    Did you check the include path? What is it?
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

+ Reply to Thread

Similar Threads

  1. how to make a subdomain with the files inside the folder?
    By danvictor2041 in forum Tutorials
    Replies: 0
    Last Post: 04-10-2011, 07:24 PM
  2. Please delete my subdomain and database
    By himanshu arora in forum Free Hosting
    Replies: 0
    Last Post: 11-27-2009, 12:14 PM
  3. PDF Files/Broken Links
    By cloverkennels in forum Off Topic
    Replies: 3
    Last Post: 04-01-2009, 03:07 PM
  4. links not working in subdomain
    By dig_enig in forum Free Hosting
    Replies: 3
    Last Post: 04-28-2008, 11:06 PM
  5. Database links to back end on SQL
    By slinky in forum Free Hosting
    Replies: 1
    Last Post: 11-06-2007, 08:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers