General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old December 4th, 2002, 01:06 AM
Attila Attila is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 67 Attila User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Portal System

Hello,

I have a project that I am working on. A portal system. So far eveything seems to work fine on my website but if I have someone else install the poral we get errors.

I know some of the errors are becaue I have made certain lines concreat insted of flexable.

I fixed these lines but am still having problems with the root directory.

If someone uploads my stuff to this web address.

www.yoursite.com/portal/

my include paths are absolute and I need to change this. So I gather the location they install the primary file on. In this case www.yoursite.com/portal/

No my functions are inside this folder www.yoursite.com/portal/includes/functions/

how do I set up my includes and reguire paths correctly?

Here is a link to the setup.php file Setup file.

I took the submit button out. Now after submitting it goes to this file.

PHP Code:
<?

    
global $board_url
    global 
$sql_host;
    global 
$sql_database;
    global 
$sql_user;
    global 
$sql_pass;
    global 
$adminname;
    global 
$adminpassword;
    global 
$adminpassword2;
    global 
$email;
    global 
$HTTP_POST_VARS;
    global 
$forums;
    global 
$yes;
    global 
$no;
    global 
$squad_tag;
    global 
$squad_desc;
    global 
$squadname;
    
    
    
// Check for blank info in the entries.
    
$root "./";
        
$phpversion phpversion();
    
        if (
$phpversion '4.0.0'
            {
                echo 
"You cannot install Squad Portal. Squad Portal requires PHP Version 4.0.0 or better.";
                exit;
            }


        if (
$board_url == "")
            {
                echo 
"You did not enter all the required information all fields must be filled in.";
                exit;
            }
        if (
$sql_host == "")
            {
                echo 
"You did not enter all the required information all fields must be filled in.";
                exit;
            }
        if (
$sql_database == "")
            {
                echo 
"You did not enter all the required information all fields must be filled in.";
                exit;
            }
        if (
$sql_user == "")
            {
                echo 
"You did not enter all the required information all fields must be filled in.";
                exit;
            }
        if (
$sql_pass == "")
            {
                echo 
"You did not enter all the required information all fields must be filled in.";
                exit;
            }
        if (
$adminname == "")
            {
                echo 
"You did not enter all the required information all fields must be filled in.";
                exit;
            }
        if (
$adminpassword == "")
            {
                echo 
"You did not enter all the required information all fields must be filled in.";
                exit;
            }
        if (
$adminpassword2 == "")
            {
                echo 
"You did not enter all the required information all fields must be filled in.";
                exit;
            }
        if (
$email == "")
            {
                echo 
"You did not enter all the required information all fields must be filled in.";
                exit;
            }
        if (
$forums == "")
            {
                echo 
"You did not enter all the required information all fields must be filled in.";
                exit;
            }
        if (
$yes == "1" && $no == "1" )
            {
                echo 
"You can not choose Yes and No.  You must choose Yes or No.  Please try again.";
                exit;
            }
        if (
$yes == "0" && $no == "0" )
            {
                echo 
"You must choose Yes or No for application options.  Please try again.";
                exit;
            }
        if (
$yes == "" && $no == "" )
            {
                echo 
"You must choose Yes or No for application options.  Please try again.";
                exit;
            }
        if (
$squad_tag == "")
            {
                echo 
"You did not enter all the required information all fields must be filled in.";
                exit;
            }
        if (
$squad_desc == "")
            {
                echo 
"You did not enter all the required information all fields must be filled in.";
                exit;
            }
        if (
$squadname == "")
            {
                echo 
"You did not enter all the required information all fields must be filled in.";
                exit;
            }
        
        
    
//You get to here all the information was entered.  Entered correctly is a differnt story.
    
    //Do the passwords match for the admin?
    
    
if ($adminpassword != $adminpassword2)
    {
        echo 
"Your admin passwords did not match.";
        exit;
    }
    
    
//Did they enter the correct database information?  Test the connection
    
    
if ( ! $dbconnect mysql_connect($sql_host$sql_user,$sql_pass))
    {
        echo (
"Could not create a mySQL connection, please check the SQL values entered");
        exit;
    }
    
        
    if ( ! 
mysql_select_db($sql_database$dbconnect))
    {
        echo (
"mySQL could not locate a database called '$sql_database' ' please check the name you entered and try again.");
        exit;
    }
    
    
//Check to see if they uploaded cong_global.php
    
$isfilethere $root."conf_global.php";
    
    if ( ! 
file_exists($isfilethere) )
    {
        echo (
"Could not locate '$isfilethere'.");
    }
    
$start time();
    
//Can I write the data to the conf_global.php
$thisdata "
\$conf['adminpassword']            =    '$adminpassword';
\$conf['adminname']                =    '$adminname';    
\$conf['ban_ip']                =    '';
\$conf['ban_email']                =    '';
\$conf['ban_names']                =    '';
\$conf['Squad_start']            =    $start;
\$conf['admin_group']            =    '4';
\$conf['auth_group']            =    '1';
\$conf['member_group']            =    '3';
\$conf['guest_group']            =    '2';
\$conf['squadname']                =    'Squad Portal';
\$conf['squad_desc']            =    'Squad Portal System';
\$conf['squad_tag']                =    '$squad_tag';
\$conf['squad_url']                =    '';
\$conf['clock_long']            =    'M j Y, h:i A';
\$conf['clock_short']            =    'jS F Y - h:i A';
\$conf['clock_joined']            =    'j-F y';
\$conf['email']                    =    '$email';
\$conf['email_header']            =    'This email generated via Squad Portal';
\$conf['show_active']            =    '1';
\$cong['forums']                =    '$forums';
\$conf['sql_driver']            =    'mySQL';
\$conf['sql_host']                =    '$sql_host';
\$conf['sql_database']            =    '$sql_database';
\$conf['sql_pass']                =    '$sql_pass';
\$conf['sql_user']                =    '$sql_user';
\$conf['home_name']                =    '$board_url';
\$conf['home_url']                =    '$board_url';
\$conf['html_dir']                =    '$root';
\$conf['base_dir']                =    '$root';
\$conf['html_url']                =    '$board_url';
\$conf['upload_dir']            =   '$board_url/uploads/';
\$conf['upload_url']            =    '$board_url/uploads/';
\$conf['session_expiration']    =    '3600';
?>"
;

// Let's make sure the file exists and is writable first.
if (is_writable($isfilethere)) {

    if (!
$fp fopen($isfilethere'a')) {
         print 
"Cannot open file ($isfilethere)";
         exit;
    }

    
// Write $thisdata to our opened file.
    
if (!fwrite($fp$thisdata)) {
        print 
"Cannot write to file ($isfilethere)";
        exit;
    }
       
    
fclose($fp);
                    
} else {
    print 
"The file $isfilethere is not writable";
}

//
// Import $conf, now!
//

require $root_path."conf_global.php";

//after this all it does is table creation.  Was too long for this forum.


So once again how do I make my path (relative) dynamic? So it is not absolute?

I added both the setup.php setup1.php and all the include files and the function dbconnect () if someone could please help.

Thanks so much,
Attila


P.S. Can someone refresh me on how to do the Nocaching thing with PHP for my header?
Attached Files
File Type: zip include directory.zip (11.6 KB, 227 views)
__________________
Thanks,
Attila
http://www.glorynaspiration.com
http://www.abitofthings.com

Reply With Quote
  #2  
Old December 4th, 2002, 04:13 AM
azzameen azzameen is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Vienna, Austria
Posts: 1 azzameen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to azzameen
Hi,
it should work when you work with the absolute path of your html root, for example:
$conf['rootDir'] = "/home/youruser/www/";
$conf['portalDir'] = $conf['rootDir']."portal/";

require $conf['portalDir] = $conf['portalDir'];

Reply With Quote
  #3  
Old December 4th, 2002, 05:10 PM
Attila Attila is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 67 Attila User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Thank you.....I am working on that right now.

Would it be safe for me to assume that web host seem to make their root directory connection strings like this.

www.devarticles.com
would be
/home/devartic/www/

and

www.oscommerce.com
would be
/home/oscommer/www/

and

www.msn.com
would be
/home/msn/www/

and
www.yahoo.com
would be
/home/yahoo/www/


No I am not looking for this information to hack....Wouldn;t know were to start. Just this way I can cover a lot of the pitfalls before I release my portal system.

Thanks again,
Attila

Reply With Quote
  #4  
Old December 4th, 2002, 05:26 PM
Gee Gee is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 61 Gee User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
If I think what you mean, you can declare any , dir or folder as dynamic so long as it is under your root you have set.

For example - my root is C:\\FoxServ\www

anything inside www can be declared as dynamic - take a look below. Hope this helps!

PHP Code:
//Put your ip address or domain name in here for actual use - if testing on a localhost use
//the absolute path shown below (or where files are stored on your server) 
//**************************************************  ***************************************
//$filePath = "http://***.***.***.***:80\\lectures\\".$_FILES['yourFile']['name'];
$filePath "C:\\FoxServ\\www\\lectures\\".$_FILES['yourFile']['name']; 

Reply With Quote
  #5  
Old December 4th, 2002, 05:55 PM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 6 m 11 sec
Reputation Power: 8
Send a message via ICQ to stumpy Send a message via MSN to stumpy
from a different angle

I develop on a windows platform, but I think the same logic should still apply. Does Apache use the IIS equivelant of "Virtual Directories"? (you essentially mount a directory from elsewhere on the system e.g. home/shared/, and it appears to be hanging directly off your site, that it is within the same dir structure: home/clientname/wwwroot/virtual,)

If so, for your portal system, don't put your uploaded files, functions, or any other stuff that you want to share in a client specific directory e.g. home/clientname/ dir - put them in a shared directory.

For example in IIS, above my wwwroot, I have a scripts dir. eg.

inetpub/wwwroot/clientname
inetpub/scripts
inetpub/scripts/clientname

File that are sitting in the scripts directory are accessiable for my other sites.

Bottomline - I think you may be going about this the wrong way. I.e. - doing a lot of hard work in your code. If you are setting up a portal, let your webserver handle the tricky stuff!

Or maybe I've missed the point entirely???!!!



stumpy

Reply With Quote
  #6  
Old December 4th, 2002, 07:07 PM
Attila Attila is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 67 Attila User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Ok

LMAO.....You probably are telling me what to do and explaining it perfectly although I am not understanding.

I gave a copy of what I have done and let a friend try to install it on his website. His site
You can see the error he is getting.

I have MSN messinger and someone can add me with attilagna@hotmail.com I will be on for several hours. I will send you my website portal system so you can try it and see if you see what I am talking about....I think I understand you so I am goig to try and fix it.

Reply With Quote
  #7  
Old December 4th, 2002, 08:04 PM
Kanu Kanu is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 91 Kanu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
You're writing a portal system with an actual install routine? Hmm, in that case, for each install you'll probabaly run something like:

http://someserver/setup.php ?

In that case, couldn't you use something like the $_PHP_SELF variable to make the server tell the script where it is installing to and set the variable from that?

Basically:

PHP Code:
 $temp=$_PHP_SELF;
$serverurl=substr($tempparams); 

That would allow you to strip off the amount of characters required to get back to the server base address.

Reply With Quote
  #8  
Old December 4th, 2002, 08:55 PM
Attila Attila is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 67 Attila User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Quote:
Originally posted by azzameen
Hi,
it should work when you work with the absolute path of your html root, for example:
$conf['rootDir'] = "/home/youruser/www/";
$conf['portalDir'] = $conf['rootDir']."portal/";

require $conf['portalDir] = $conf['portalDir'];


Thank you....What you sugested didn't get all of it the way I did it but pushed me in the correct direction. This iw what I got.

PHP Code:
include ($conf['rootdir']."includes/functions/dbconnect.php"); 


This is data that I get from the person installing the script. I give them an example of this
Quote:
Absolute address
This is the root directory for your website so files will get installed appropriately. (Ex: /usr/local/lib/) If your website is www.squadportal.com then this would be /home/squadpor/public_html/
If you installed into a sub folder like portal then it would be. /home/squadpor/public_html/portal/ You must end what ever you type in here with a "/" not counting the quotes.


Well this data is written to a Configfile in the root directory that they installed the program in. Now the weird part is I thought I would have to do a
PHP Code:
require $root_path."conf_global.php"
on each page but I do not have too. I have cleared my browser cache nd deleted the history. Somehow it is working without the above line. Not that I am complaining it is working.

It will be up and down as I manipulate the setup script but if any of you want to see it you can go here Portal


More questions I am sure to come!! Going into sessions after Iget things cleaned up!

Thanks everyone for all your help..

A special thanks to Stumpy for catching me on MSN and helping me with this. He tought me a lot in a few minutes.

Thanks,
Attila

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Portal System


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |