PHP - Php Include Used With Sub-domain
Hello everyone,
I have a site where the folders are set up in this arrangement: Code: [Select] _ ClientsFolder - client1 - | page-folder - pages are here (index.php) | | image-folder - images here | |_include-folder - style.css and database connections here _ client2 - | page-folder - pages are here (index.php) | | image-folder - images here | |_include-folder - style.css and database connections here PageIncludeFolder - include pages here (index.inc.php) The reason my folders are set up this way is because multiple clients will be using my site, but each client will have a customized sub-domain, yet all the code on the pages will be the same. All of the pages for the clients site are placed in ClientsFolder/client1/page-folder. Each page in this folder is a page that simply includes an entire page from the PageIncludeFolder. For example: ClientsFolder/client1/page-folder/index.php and ClientsFolder/client2/page-folder/index.php are exactly the same, file, which simply has the following code: Code: [Select] <?php include("../../../PageIncludeFolder/index.inc.php"); ?>The reason for this is so that I can easily modify all the client sites by only modifying the files that are in the PageIncludeFolder. (Trying to work smarter, not harder!) The images, style.css, and script.js files are called from the index.inc.php, which is included on the index.php page. For example, style.css is located at ClientsFolder/client1/page-folder/include-folder/style.css. So to link to the .css file, I have the following code in the index.inc.php file: Code: [Select] <link href="../include-folder/style.css" rel="sytlesheet" type="text/css" /> And images are linked using code similar to this: Code: [Select] <img src="../image-folder/image.jpg" /> Now, when I visit the index.php page by entering the entire url (http://www.mysite.com/ClientsFolder/client1/page-folder/index.php) everything works perfectly. However, as I stated, each client is being set up with a sub-domain. Client 1 has the sub-domain of http://client1/mysite.com, which is pointed to http://www.mysite.com/ClientsFolder/client1/page-folder/index.php. When I try to visit client 1's site using the sub-domain, the index.inc.php page is included perfectly, but the images and the style.css files are not being linked. I know this is kind of confusing, but as you can probably tell, I have spent many, many hours putting this together and now I need help to figure out what is wrong and why certain files are not linking properly ONLY when the page is visited using the sub-domain. ANY help or suggestions are GREATLY appreciated! Thanks everyone! Similar TutorialsI have two domains both running SSL. Let's call them old-domain and new-domain. old-domain is permanently redirecting traffic to new-domain. There are still a lot of links out there to old-domain with https://. If I were to remove SSL from old-domain but keep SSL on new-domain, I am betting that users will be getting some sort of certificate error. Right? Any way around that if I want to remove SSL from old-domain?
This topic has been moved to the corner of 3rd Avenue and mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=359430.0 CanI put one INCLUDE statement INSIDE of another INCLUDE statement? Hi Still a new comer when it comes to PHP. I have a situation where I want to use an include within an include and I am having trouble with my file paths. My main header include, includes everything for each page of my site, beyond the opening of the body to incorporate my navigation etc conditionally loading in css, and loading in titles and meta data etc depending on the page in question. This header needs to reference another include called the-pod.php which is required for every page, the only trouble is I want to use / to reference the root of the server and this is breaking my code. I can't use ../../ etc as its a different path depending on where the master file is located. So my question is how do I get around this? Can the root of the server or path to the root be stored in a variable? and if so how would I write this. Any tips / advice will be greatly appreciated. Hi Guys.. Merry Christmas Im kinda new to this fantastic world of PHP and i have a little problem i hope you can help me with. Im trying to build a website where I use include() to genereate my content. On my index.php i have a menu which includes content in a content div from external .php pages, my structure kinda goes like this.. (simplified) site/ index.php content/ fronpage.php products.php contact.php The HTML looks like this. <div id="menu"> <ul> <li><a href="index.php?page=frontpage">frontpage</a></li> <li><a href="index.php?page=products">frontpage</a></li> <li><a href="index.php?page=contact">frontpage</a></li> </ul> </div <div id="main"> <?php include('/content/'.$_GET['page'].'.php'); ?> </div> This all works very fine, but my problem is, can I have a include inside an already included page? I would like to have a menu on my products.php site, but that page is already included from above, and i would like the menu on the products.php site to stay as the content from the nested include changes with input from the /products folder. my idea was something like this. site/ index.php content/ frontpage.php products.php contact.php products/ product1.php product2.php the HTML on the index.php is the same as above and then i would add the include() on the products.php page, so its kinda the same thing, but one inside the other. HTML inside the products.php folder <div id="sub_menu"> <ul> <li><a href="#">frontpage</a></li> <li><a href="#">frontpage</a></li> <li><a href="#">frontpage</a></li> </ul> </div <div id="sub_main"> <?php include('/content/products'.$_GET['#'].'.php'); ?> </div> I dont know how to link to the new files so they will be included while the first include still stays on the page. Any of you know how and if this can be done? Or maybe at better way to do it? Hope this made sense, my first PHP question Thanks I was wondering if anyone knew of a good way to query domain name availability with php? I have a website on wordpress, at first it was on a friends server, but he switched it so its on bluehost. The website URL is an IP address with a slash and a name. However, I registered a domain name at godaddy. I was able to change the nameservers so that the URL of the index page of my website was changed to the domain name, however, when I click onto any other page from that page, it goes back to the IP address URL. What can I do? Thanks. This topic has been moved to Other Web Server Software. http://www.phpfreaks.com/forums/index.php?topic=359139.0 Hi I have written a server session on login in the main domain and am trying to read it when they are sent to their sub domain. Unfortunately it won't read the session. I have searched for a solution, which points to altering the php ini. Is there another option that anyone knows about. Thanks Hi, I am trying to see if the domain name in the string is in an array. eg; Code: [Select] mystring='http://google.com/somethingelse'; myarray[]='google.com'; myarray[]='anotherdomain.com'; in this case return TRUE Code: [Select] mystring='http://phpfreaks.com/adir'; myarray[]='google.com'; myarray[]='anotherdomain.com'; in this case return FALSE How would I do this? Thanks, -mme hey guys im making a script where the user gets redirected...but im wanting to make sure the redirection is within the same domain and not being shipped off to another site when using ($_SERVER['HTTP_REFERER'])
now what im using seems to do the trick but im wondering if there is a better method of doing this?...i dont want to use regex either
thank you guys
<?php $match = strpos("http://127.0.0.1/login", $_SERVER['SERVER_NAME']); if ($match && $match > 0 || $match === 0) { echo "domain match"; } ?> I'm sorry if this is in the wrong section. I'm working on coding a page that will pull data from a servlet that's already been coded. Right now I'm just trying to get it to pull and display any information. The developer who coded the servlet says it works on his server and I'd rather not badger him with questions. Any help you can provide would be greatly appreciated. So I am running Wampserver 2.5 a basic installation as I have not changed any settings and my HTML page is as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR...nsitional.dtd"> i want to get all the domain name on the internet and put them into a database. is there a way to get this. Hello I am curious if it is even possible to get the domain when using iframes/frames? eg. domain2 shows a file from domain1 in an iframe. Can domain1 grab domain name "domian2"? I have two questions: 1. Is it the best way to get the domain of a url by parse_url? or preg_match or str_replace can be better alternatives? 2. What is the best way to remove www from the domains? Note that the domain name itself may contain www too (like www.1www.com) Thank for your attention I know how to get an ip adress from a domain by using gethostbyname(), but I wanted to know if it was possible to get the domain name from the ip address. As in a website address (example.com) has a ip address of xxx.xx.xxx.xxx What I am trying to do is to get the 'example.com' domain name from the ip address. Is this at all possible, if so, how can it be done? Thanks in advance for any that helps out. When I put this above all else in my document and test it offline, all I see is code in the browser. But when I test it on my web server, I can view the markup and whatnot. Does anyone know why this is? Sorry if this is a stupid question http://www.dinksoftware.com/fig/index.php looks as it should with the php includes working. However if you go to http://www.dinksoftware.com/fig or http://www.dinksoftware.com/fig/ the php includes don't work for some reason. index.php Code: [Select] <?php session_start(); ?> <?php include('header.php'); ?> <?php include('topMenu.php'); ?> <?php include('sidenav.php'); ?> <div id="content"> <h3>Introducing 'The Business Sim'!</h3> <?php $errorMessage1 = $_SESSION['errorMessage1']; echo("$errorMessage1 <p>"); $_SESSION['errorMessage1'] = ""; ?> The Business Sim is an online, free to play educational game currently under development. <strong>The first round of gameplay will commence in Q1, 2011. </strong><br /> <p>Have gameplay ideas/suggestions or any other comments? Want to help mould the game? </p> <br/> <?php include('footer.php'); ?> </div> </body> </html> header.php part (no other includes or anything in this) Code: [Select] <a href="index.php"><img src="header.png" alt="The Business Sim" width="550" height="100" border="0"/></a> How do I fix this? I want http://www.dinksoftware.com/fig and http://www.dinksoftware.com/fig/ to work like it does when you go/fig/index.php etc. Trying to sort out setting a cookie that allows visitor to decide which sub domain to go directly to in subsequent visits. Somewhat complicated by the fact that the sub domains are running seprate instances of wordpress. Here's the code... any suggestions appreciated! Code: [Select] <?php if (isset($_POST['submitted'])) { $site=$_POST['site']; setcookie("SitePref",$site, time() + 60*60*24*30, 'historybee.com'); if ($site == 'ms') { header("Location: http://ms.historybee.com/"); } elseif ($site == 'hs') { define('WP_USE_THEMES', true); require('./wp-blog-header.php'); } } else { //if we have a cookie, load the site if (isset($_COOKIE['SitePref'])) { if (($_COOKIE['SitePref']) == 'hs') { define('WP_USE_THEMES', true); require('./wp-blog-header.php'); } else { header("Location: http://ms.historybee.com/"); } } else { //if we don't have a cookie, load the form ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>The National History Bee</title> </head> <body style="margin:0;padding:0;background: url('http://ms.historybee.com/wp-content/themes/makinghistoryblue/img/body_bg_hb5.jpg') repeat-x scroll center top #F2BF3B;"> <div align="center" style="width:800px;margin:0 auto;background:#fff;"> <p><img src="http://ms.historybee.com/wp-content/themes/makinghistoryblue/img/nhb_logo.png"> <p><h1>Welcome to the National History Bee!</h1> <p>The National History Bee has both High School and Middle School competitions. <p>Please choose which site you would like to visit. Your choice will be remembered for 30 days. <form action= "<?php echo $_SERVER['PHP_SELF']; ?>" method ="POST"> <input type="radio" name="site" value="ms"> Middle School Competition <input type="radio" name="site" value="hs"> High School Competition <input type ="hidden" name="submitted" value="true"> <p><input type="submit" value="Remember My Choice"> </form> <br /><br /><br /> </div> </body> </html> <?php } } ?> This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=353448.0 |