Note that there are some explanatory texts on larger screens.

plurals
  1. POuse external class file from parent domain onto subdomain
    primarykey
    data
    text
    <p>how can i inlude a class file from my parent domain to be used in a subdomain on my server?</p> <p>for example, I have a class file that handles user authentication along with some important methods. How can I use that authentication class on a subdomain?</p> <p>my folder structure is</p> <p>parent domain</p> <pre><code>/home/&lt;domain&gt;/public_html/ </code></pre> <p>subdomain</p> <pre><code>/home/&lt;domain&gt;/public_html/users/cluster_1/&lt;sub&gt; </code></pre> <p>When I make a new subdomain I have a template index.php that is copied onto the</p> <pre><code>/home/&lt;domain&gt;/public_html/users/cluster_1/&lt;sub&gt;/index.php </code></pre> <p>in the index.php i want to include my authentication class so that I can do some more stuff based on the data returned by its methods.</p> <p>i know that i cannot include http requests and also I do not want to use <code>dirname(dirname(__FILE__)</code> because if the user alters that they can see the server folder structure for the domain.</p> <p>I tried an fopen but i couldn't get that to include my class, and also i tried a cURL like this</p> <pre><code>function get_data($url) { $ch = curl_init(); $timeout = 5; curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); $data = curl_exec($ch); curl_close($ch); return $data; } $returned_content = get_data('http://domain.com/api/ApiClient.php'); </code></pre> <p>is there an elegant way to include my ApiClient.php class file and even if the user changes the PHP code for them not to see folder structure information that is thrown by the PHP errors.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload