Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Common PHP Files On Different Domains


I have several websites on a remote virtual server. These websites use the same software.  I am looking for a way to update all the common files at the same time, rather than uploading the same file via FTP to each domain. I can not INCLUDE() a file from a different domain.

Is there a way to use a common source file stored on one domain, to be used on multiple domains?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Sharing Common Files Between Sub-domains
I'm looking for some ideas and best practices for setting up my sub-domains to make sharing/including common files among different sub-domains easy.

Specifically, I am looking for a solution that will make it easy to reference common files in the PHP script as well as referencing common images within the HTML. This is particularly a problem when including files in a PHP script that may include other files - can't use relative pathing.

For example, let's say I had this folder structure:

mydomain.com
 |
 |--sub1.mydomain.com
 |
 |--sub2.mydomain.com
 |
 |--images
 |
 |--includes

I could create a $prepath varaible with the value ".." for the subdomains and "" for the main domain. Then use that to reference all files from the root of the main domain. Of course I would have to reference any images in the HTML with a full path from the main domain only.

Common SQL Injection
What are common SQL injection methods that are used? I would like to test my site against them. Login Set Up Email: [input box] Pass: [input box] [submit button]

Common Database For Php And Java
how could I use common database for php as well as java.Is there any support for java available.Please some suggestion.

What Editor Is The Most Common In PHP Developer?
I am newbie in PHP, Thanks for any advise.

Web Surveys: Common Practice
I am just wondering, what is the current best
common practice for online surveys:

1. allowing users to vote any number of times
2. allowing one vote per IP
3. requiring email address verification (seems overly complex for a survey)
4. setting a cookie on the web browser and allowing no more voting until
the user closes the web browser
5, other

PHP In Array Issue - Common Words
I have an array

$commonwords = array ("and", "he", "I", "in", "is", "it", "of", "that", "the", "to", "was","are", "as", "at", "be", "but", "for", "had", "have", "him","his", "not", "on", "one", "said", "so", "they", "we", "with", "you", "about", "an", "back", "been", "before", "big", "by", "call","came", "can", "come", "could", "did", "do", "down", "first", "from", "get", "go","has", "her", "here", "if", "into", "just", "like", "little", "look", "made", "make","more", "me", "much", "must", "my", "no", "new", "now", "off", "old", "only", "or","our", "other", "out", "over", "right", "she", "see", "some", "their", "them", "then","there", "this", "two", "up", "want", "well", "went", "were", "what", "when", "where","which", "who", "will", "your", "i", "&", "a", "good", "i'm");

Now I am trying to check if a perticuler search word containing any word which is in array.. so avoide them.. example:

if(!in_array($space_split['search_word'],$commonwords))
{
// some work
}

this is not giving me right result.. for example.. it is not avoiding some words like "a" "i'm" "&" and few others..

can anyone tell me what is this issue?

Common Login For Diff Modules
I need to make a community site containing blog, forum, shoutbox, gallery, news, event calenders. Any one can give me suggestions like how can i make them accessible with one common login? Is it already handled by joomla or any other cms?

Pre-caching Common Queries On A Database
In trying to improve the performance of searches on a database, I read that it makes sense to run a small set of common queries off-line and cache them in a plain HTML file, and then use HTTP Location: to point to the static page. Problem is the book I read only talks about CGI. Can anyhow tell me/point me in the right direction for doing a similar thing using PHP?

Common MySql Search Algorithms In PHP?
I need to put together a simple search function. I imagine there is
already some PHP code out there that handles the basics?

For instance, how do I search for just words, from one word boundry to
another?

Common Causes For Apache Exiting With SIGSEGV?
I have a website that's built with PHP and MySQL and it works just
fine, most of the time. However, when the load gets higher (say 3
hits per second), Apache starts to exit with SIGSEGV on almost every
request.

Are there any typical areas to look at to solve these kinds of
problem?

Common Email Characters Not Accepted By Mysql
I'm making array of characters to replace with temporary proxys (equalsign, singlequote, doublequote, etc.) that will be switched back the original character when a user views his or her emails. For those of you who've done e-mail scripts with mysql before, which characters have proven to be the most trouble (I'm only imagining how many emails one email could hold up if checkmail.php's error array didn't have a certain charactter)?

Failed Opening Required 'common.inc'
I get this fatal error message when i try to include the 'common.inc' file. Could someone explain where common.inc and php.ini should be located and what their contents should be. I am running an apache server and php4. I found 3 different 'common.php' files in different locations within the php directory.

Reusing An Object For Common Select To Database
I've noticed that after I finished this app, I had repeated a similar task over and over and would like to modularize it. The repeated task was connecting to the database, executing a select, putting all the results of the columns into different variables of an object. PHP Code:

Forum Integrating Into The Common Web-site Interface
I am developing a dynamic site and I'd like to have the communication place for users of my web-site. For this goal I'd like to use phpBB, I like it. But I don't want to open this forum separately in another window or in the same with another design. I'd like to save the common web-site design (navigation menu on the left side of page, header and feuilleton).

List Of Common Words Mit My Keyword Search?
Seeing if anyone had a list of common words (the,a, as, of,...) so that I can limit my keyword search. I do not want to use the length of the word to limit.

How I Can Find Longest Common Prefix Of Strings
I'm interested in such algorithm that solves problem of finding longest
common prefix of two or more strings.

I haven't found such function in PHP, or I pass it?

Common Prob With Mysql LOAD DATA LOCAL INFILE ...
i have most recent php & mysql versions running on a linuxmachine

i want to use LOAD DATA LOCAL INFILE and pass it from php to mysql.

- the file i load is given with full path and the directory is readble
- On MySQL local-infile = ON
- From PHP i connect using client flag (128) to allow passing a file over
that connection: mysq_connect( $host, $usr, $pwd, false, 128)

Ive followed all advice from php & mysql sites and deja.com ...

But i still get the message: The command is not allowed with this MySql
Version or something ...

any ideas where i should look further?

what are *all* the requirements for a LOAD DATA LOCAL INFILE to work
seamingly?

PHP And Parked Domains
I've been searching on this subject but haven't had any luck, so I thought I'd ask it here.

I have a main domain with a parked domain on it. Is there a way to use PHP to detect which domain name the visitor has typed into the browser and redirect accordingly? Actually, all I want to do is send them to a subfolder if they try to access the parked domain.

Cookies And Domains
I am not sure if this is a PHP problem or not, but since I use PHP for everything, perhaps there is a PHP workaround.

I am trying to set a cookie for another domain, ie a domain that isn't the same as where the script is being run, and both Netscape 6 and IE 6 ignore the code as if it doesn't exist.

I have tested the same code with the domain the script lies on and the cookie manipulation works fine.

Does anyone have any idea how to get around this?

Includes Across Sub Domains
I have a site www.mysite.com.
I have 3 subdomains sub1.mysite.com, sub2.mysite.com and
sub3.mysite.com.
sub3.mysite.com is password protected.
All pages end with .php (ie index.php)
I use the following code:

<?php
include("inc23.inc");
?>

I find that I will require some of the same includes in more than one
subdomain.
Can I do the following?

1) Create a subdomain called resources.mysit.com with 3 folders - images,
includes and stylesheets
and use

A.

<?php
include("resources.mysit.com/includes/ inc23.inc");
?>

B.

<link rel="stylesheet" type="text/css"
href="resources.mysit.com/stylesheets/stylesheetraw.css" />
Instead of
<link rel="stylesheet" type="text/css" href="stylesheetraw.css" />

C.

In my style sheet use

#toparea {background-image: url(resources.mysit.com/images/images/gs1.gif);
etc
instead of
#toparea {background-image: url(images/gs1.gif); etc

D

Does the fact that one of my subdomains is password protected complicate
anything?

Two Domains On The Same Account
I don't know if this is the right place (because I don't know if it's PHP-related).

I've registrered two .com-domains (the will go to two dofferent unrelated sites) which I have on the same account on the sama webhost.

When I asked my webhost about it they told me that I should use som sort of script. The reality is that I have no idea of what script (and type of script) I should use, and how it'll work.

I've also asked them if they could direct it to different webroots, but they insist that I should use a script.

Someone that have the script?

Expiring Sessions Between 2 Domains.
Background:

Client owns one ecommerce site. We're building another ecommerce site with different products/theme.

To save on costs.. client wants to use his SSL server of the first Ecommerce site for this new site.

Problem:

Initially wanted to use cookies to store the session variable which holds shopping cart contents. Can't do that because of the different domains (http://www.newsite.com AND https://oldsite.com).

Went to sessions and passed the PHPSESSID to the secure area to transfer customer data.

This works fine until the transaction is complete and we pass the visitor back to the non-secure site...session is still active UNTIL a page refresh is done by the visitor.

Even more of a problem is when I close down ALL windows.. hell even if I reboot the client computer and go back to the site the session is still active UNTIL a manual refresh of the page is done.

Can anyone help me in how I do a full proof method of expiring sessions and session data once I have finalized the order?

SSL Passing Sessions Into Other Domains
I have a store and at the checkout would like to go from my shopping cart domain to anither domain where I have my verisign certificate. I can't seem to go to another domain and keep my session information. Does anyone have any experience with SSL virtual hosts and transfering session info?

Using A Template Across Multiple Domains
Is there a way to share files accross domains on the same server? Let's say I have 25 domains, and there is an index page like a template, it's this way so it all looks similar and one change can be made across all domains. Is it possible to include a file which resides under one domain, and use it in another domain for similar use as an index page? If so, where should I place this file on the directory. Here's the structure

root>>domains>>mysite>>htdocs>>www>>index.html

root>>domains>>anothersite>>htdocs>>www>index.html

2 Domains On One Dedicated Server
our ecom site is on example.com. when the user enters from a link from example.de, i wish to set a cookie from example.com which i can read on example.de. i have tried:

setcookie('cart', $cookie, time()+86400, '.example.de');

but this doesn't seem to work. (i have all p3p policies in place).

can anyone suggest a reason?

Logging In/out Of Multiple Domains ?
Ive created a login/logout system, for multiple domains....

My Main one - & a 2nd one which ive created - Both are on the same
server - but different directories (of course)...

BACKGROUND

Basically, ive set it to 'expire' in 60*60*5 seconds on my main site
(where the login script is..)

- that is :- 5 hour timeout..

It updates a MYSQL database, - with a UserID, the Unix Timestamp & a
alpha/numeric randomised code.. 27 characters long...

on my "main site" - I have a small script to scan if im 'logged in'
or not & obtain the timestamp & code - & produce a URL - to loginto
the 2nd domain...

- The 2nd domain
:- Checks if im already logged in with a cookie
:- If not - Access the URL, & then access the MYSQL database - If it
matches, then updates a cookie on my 2nd domain, with 60*50*5 seconds
(4.1 hours...)

QUESTION :-

Unless I programme it to check the MYSQL database every 5 or 10
minutes, - (IE make it 'expire' at a shorter time), is there a way to
make a cookie logout - on both sites, if I logout on the main site ?

If this doesnt make sense, im a bit tired - Back soon..

I guess I'll make the 2nd site expire at a 10 minute interval - It can
then access the msain sites MYSQL database every 10 minutes, & check
if im still logged in or not....

Sharing Cookies Within Domains
Basically, I have my http://www.domaion.com, & various subdomains

http://test.domain.com

http://othersubdomain.domain.com etc...

(all subdomains are stored in the same / my "package" at the host...)

Now - I have sucessfully created a PHP login/logout area - which can
be seen / used by all my subdomains.

If I create a new domain name - which accesses the files in an
existing Subdomain, - Will the cookies still be able to be shared
between the two doamins?

Cookies & Multiple Domains
Is it at all possible to access a cookie from another server on a site with the same domain name? I have my main site (http://www.domain.net in the UK) on a different machine than my forums (http://forums.domain.net in Oklahoma) and I was looking to set up some vBulletin mods once we get the license --

I've already got 2 of them done (news frontend via forum threads & active forum topics [like DevShed has -- they were my inspiration]). The third mod I was going to write was a "Quick Private Message Index" box for our main site. However, to do this I would need to check against the cookies that hold the userid and password (which are set for forums instead of www). Is there any way I can access the cookies from forums on www?

Setcookie() Over Multiple Domains...
I have a website that runs off .com and .co.uk. The login system relies on cookies. Can I set the cookie so that it is valid for both domains, at the moment I am doing:

setcookie ("cookiename", $value, time()+10386000, "", ".domain.com");
setcookie ("cookiename", $value, time()+10386000, "", ".domain.co.uk");

This will log users in from either .co.uk or .com, but if you transfer across from one to the other you are not logged in. Does this mean you can only set a cookie for the domain that you are setting it from(makes sense)?

Multiple Domains - One Set Of Code.
So I am developing a series of e-commerce sites...they are all basically the same site, but each one is tailored to a different segment of a larger market. For example purposes only, say I was setting up a pet store...and I wanted to have one site specialized for dogs, one for cats, and one for birds, all different domains. But I am trying to have just one back-end system...so my employees can fill the orders from the same back-end order management.

Is it possible to write some code in a single header file that would look for the URL requested and then pull up the right logo, maybe a different style sheet, image directory path, and the right products.

But basically it would all be the same program and I could add new sites as I saw fit and make changes in one place that would affect all the sites.

How To Use Session On 2 Diff Domains
i have 2 different domains which needs to use the user account, or cookie. let say i login to www.domain.com and then i go to www.domain-2.com. when i go to domain-2.com if i am already logged in to domain.com i will automatically be logged in to domain-2.com and vice -versa. is this possible? if so, what will the code be and how to do it?

Eregi And Domains/emails
I'm still doing my validation script slowly! I'm lost on the whole Eregi thingy!

I visited php.net/eregi but that did not help! It just bombarded me with all this code!

Can someone explain to me how eregi works and what would be suitable experssions for a domain and an email address cos there are so many on the web!

Sending Html Email By Domains
i have a small idea about a function i could pass the email address through and if it returns true then send s the user a html email else they will get a text email. is this a good way of doing this? PHP Code:

Does This Sound Safe? Sessions Between Domains
I've been trying to find a way to transfer session data (login information
and such) between different domains, both on the same shared host. I think
(I haven't tested yet, though) that using the same session ID will return
the same session data, since they're both running off the same copy of PHP.

The data being transmitted isn't extremely sensitive (not enough to be
worried things like shared-server tempfile reading), but I want to be as
secure as possible on the front-end.

Anyhow, how does this sound:

* The Session mechanism will be instructed to use only cookies. This might
be a pain to some users, but they've got to know by now that much of the
web uses Cookies, and they need to deal with it as-such.

* All care will be taken to prevent code from being arbitrarily executed on
the site. Users will not be able to arbitrarily upload executable
JavaScript or other code.

* This system will allow an easy transition from one domain name to
another, both on the same shared webspace, while remaining "logged in"
under a common set of credentials. I will use two of my own domain names as
examples. The user, in this case, is trying to go from pixelsaredead.com to
omni-megacorp.com.

1.) The user logs on to pixelsaredead.com and a session is set up. They are
authenticated and recieve a Session ID cookie.

2.) The user clicks to a "launch" page, which will transfer them from
pixelsaredead.com to omni-megacorp.com, while staying logged in. If they
are not currently authenticated, with an authenticated session, they are
Given the Boot.

3.) The "launch" page from pixelsaredead.com generates and stores a random
identifier, completely underived from the Session ID. The Random ID (RID)
and Session ID (SID) are then correlated in a table. The "reciver" page on
omni-megacorp.com is then called using only the RID:

4.) The "reciever" page checks RID to see if it correlates with a valid
session. If not, the user is Given the Boot.

5.) If the RID matches a given session, that session is reactivated for
omni-megacorp.com, and the user is now logged in on both sites (through
some mechanism). The RID is then flagged as "invalid". Upon any further
attempts to use that RID, the associated session is invalidated. If anyone
tries to hijack the session, both the hijacker and the legitimate user get
logged off,

Problem With Cookies. Need To Encompass All Domains
I'm setting up a cookie for whenever a user logs into my site. Here's what I have:

setcookie('domainloginemail', $result['email'], time()+259200, '/', '.domain.com');
Now, I thought that since I have '.bloowoo.com' for the domain, this cookie would be loaded at both http://www.domain.com and http://domain.com  yet it's not. How can I fix it so that it's the same cookie for both with and without www?

Parked Domains And Mod_rewrite In Htaccess
I have 3 parked domains on 1 home site. I have a 3 page php/mysql driven site. I want each of the 3 parked domains to be associated with a url variable. So:

parkedone.com should go to homesite.com/page1.php?ID=1
parkedone.com/Page2 should go to homesite.com/page2.php?ID=1
parkedone.com/Page3 should go to homesite.com/page3.php?ID=1

parkedtwo.com should go to homesite.com/page1.php?ID=2
parkedtwo.com/Page2 should go to homesite.com/page2.php?ID=2
parkedtwo.com/Page3 should go to homesite.com/page3.php?ID=2

etc..

I'm not looking to redirect because I want the address bar still to show parkedone.com/Page2 not homesite.com/page2.php?ID=1

PHP Setting Cookies For Multiple Domains
Is it possible to set a cookie for another domain?

Basically what I want to do is set a cookie from domainX for domainY.  On domainY I want it to read to be able to read the cookie.  Currently when I set the domain arg using setcookie to a different domain it doesn't create the cookie.

Mail() Only Works With Trusted Hosts/domains
I have a dedicated linux web server and I am trying to use the PHP mail()
function to send emails any site visitor that requests one. This works only if the visitor has an email account on the box.

If not then the email request fails. I think this must be something to do with relaying and I have been entering domains and hosts (such as "localhost") to get the script to trust the source of the email request and relay it. Unfortunately I have not had any success.

Script To Access Expired/deleted Domains?
Does anyone know if there is a script available to access expired/deleted domains? If not, does anyone know how do you get access to the daily expired/deleted domains database?

Multiple Domains - Seperate Content Through Code
I have a website hosted on a plan that supports multiple domains, but does not allow it to point to different content for each domain. I would like to know if it is possible to seperate the content for each domain by using php code. The logic would work something like this: Code:

Read the domain name as typed in address bar
if "www.domain1.com"
echo page1.html
elseif "www.domain2.com"
echo page2.html

Cant this work? What would the code be? Excuse me for any incompetence here, it has been years since I have used PHP. I dont know if there are any easier ways to acheive the result. I do not seem to have access to a .htaccess file and I wouldnt know what to do anyway.

Pass Session Variable Between Separate Domains
I'm wondering if there is a way to pass a $_SESSION variable from one site to the next.

ie, I have $_SESSION['userid'] on mysite.com, but i want the session to remain accessable when redirected to forum.mysite.com.

is this possible?

Root Level Access With Multiple Domains
I've created a PHP testing environment on my PC using IIS. The default web root directory is C:Inetpubwwwroot.

Every domain that I test sits underneath it, like:

C:InetpubwwwrootSite1
C:InetpubwwwrootSite2

etc...

The problem that I'm having is that in my PHP code, sometimes I would like to include files by referencing them at the root level, i.e. include(‘/somefile.php’). This of course works on the production Apache web server, however, on my local installation the ‘/’ refers to the ‘wwwroot’ directory instead of the domain (or folder).

Is there a way to configure IIS to look at each folder as the root? ....

How Do I Prevent Bogus Email Addresses With Legit Domains? I Thought This Worked
I came up with functions that I thought would do the trick:

Code: ( php )

Authenticating User Common User Names
I want to create a password protected page with PHP and Mysql. I have 2 groups User and Admin. The respective groups have a common user/password. The user/password are stored in a database. I want to authenticate the user through a login form and not through a pop-up ($PHP_AUTH_USER) way.

What I want is, if a user logs in and he moves from one page to another, he should not be asked for validity again. Is this possible only with scripting (without session and $PHP_AUTH...). If yes - how do I keep track of an authorised user and unauthorised user, so that he should not be validated again. Does setting the user variable to global in all the pages do the trick.?

Variable Across Domains From Non Secure To Secure
have a variable ($basket) that is a unique identifier for my users. ties user browser to the contents of their shopping cart. I have to pass this variable from domain 1(unsecure) to domain 2(secure) using the url (http://www.domain.com/order.php?basket=9874e5dfkg9).

Approx 1 in 10 people lose this variable and their shopping cart is then "empty"

I tried passing the var with a cookie (set the cookie on domain 2 by faking the browser [img_src="domain2.com/setcookie.php"] but the problem persisted...)

i try to replicate the problem but have only gotten it to happen to me once by accident, and i didn't notice any abnormal procedures that would have caused it... it's has occured on opera, MSIE and Netscape browsers on Mac, and Win (all flavors).

Including Files In Different Direcories That Include Files From Teirs
Okay, I made a simple AJAX shoutbox and I want to include it on all my pages. To insert the shoutbox I simply type <? include('/shoutbox/shoutbox.php');?> into my HTML page.

The problem is, that in /shoutbox/shoutbox.php I also include settings.php, functions.php, and some other files, and when I include /shoutbox/shoutbox.php into my index page, /shoutbox/shoutbox.php tries to call settings.php from the same folder that my index file is in, since I just 'included' it in index's source.

So my question is, is there any way, without using frames, to include a PHP file as it would be if you link directly to it in the address bar, but placed into another file in a different directory?

How Do I Hide Database Connection Files Using PHP Include Files?
I have the following at the beginning of the PHP page:

<?php require_once('Connections/conn.php'); ?>

I want to hide the connection file, "conn.php", so it's out of the web
accessible file structure. I understand putting them in the php include
directory shoudl do this. For example, let's say the directory I put them
in is /www/phpIN/, and /www/ht/ is the root web directory.

So I put "conn.php" in the inlcude directory (/www/phpIN/conn.php) and
removed it form CONNECTIONS directory.

How Do I Hide Database Connection Files Using PHP Include Files?
I have the following at the beginning of the PHP page:

<?php require_once('Connections/conn.php'); ?>

I want to hide the connection file, "conn.php", so it's out of the web
accessible file structure. I understand putting them in the php include
directory shoudl do this. For example, let's say the directory I put them
in is /www/phpIN/, and /www/ht/ is the root web directory.

So I put "conn.php" in the inlcude directory (/www/phpIN/conn.php) and
removed it form CONNECTIONS directory.

Now it doesn't work.

What do I need to change?

Creating Dir, Copy Files And Pass Variables To 2 Files
I need to create a folder on the server weekly named by the user. To this folder copy the contents of an /Original folder. Inside the new folder edit one of the files to insert a data with a XML path generated in another application, copied (via memory) and pasted within the very first form and passed to the file in question.

<param name="FlashVars" value="xmlfile= $lanofile" />

the $lanofile is the value that I need to pass from the form to be read by this file.
I have created an form (n.php) that POST the name of the folder to a second file (creatdir.php) everything is cool until I have to edit the third file.

How can I pass the value of one of the formfileds to a second file and them read this value as a variable to be consumed as mentioned above? Or actually right whatever is on the third field to this position (not using variables).


Copyright © 2005-08 www.BigResource.com, All rights reserved