Re: Multi-user problems
by "Rossi Designs" <webmaster(at)rossidesigns.net>
|
Date: |
Thu, 20 Apr 2000 11:25:32 -0400 |
To: |
"Cyanide _7" <leo7278(at)hotmail.com>, <Reywob(at)aol.com> |
Cc: |
<hwg-languages(at)hwg.org> |
References: |
hotmail |
|
todo: View
Thread,
Original
|
|
if the required file is code it should interpret it as code. For instance;
// file connect.inc
<?php
$host = "yourdomain.com";
$user = "username";
$pass = "password";
$conn = mysql_connect($host,$user,$pass) or die(mysql_error());
?>
any time that you require() or include() connect.inc it will connect to
MySQL.
I think his problem is that he needs to declare a global variable not
require it
instead of require($datafile) just use
global $datafile;
inside of Phorum. of coarse I didn't catch this whole thread and I could be
wrong.
Rossi Designs
PO Box 1084
Holly Hill, FL 32125-1084
Phone : (904) 226-8979
URL : http://rossidesigns.net
----- Original Message -----
From: Cyanide _7 <leo7278(at)hotmail.com>
To: <Reywob(at)aol.com>
Cc: <hwg-languages(at)hwg.org>
Sent: Thursday, April 20, 2000 5:08 AM
Subject: Re: Multi-user problems
| the problem i see here is that you want require to import the content as
| more code, which it cannot do. it wont replace the require statement with
| the code and continue on executing, if im not mistaken, it will interpret
| the content as document data. i recommend actually reading the file
manually
| to get the values. you can use the php *file* function to read the file
into
| an array, newline delimited. each array element will still have the
newline
| character appended on the end so you'll need to handle that. so with the
| file data:
|
| http://www.domain.com/mystyle.css
| http://www.domain.com
| Name of Site
|
| then with the following code (writing this off the fly, sorry):
|
| $datafile = "http://www.your-domain.com/data.inc";
| $data = file($datafile);
|
| if($data){
| $css = str_replace("\n","",$datafile[0]);
| $siteurl = str_replace("\n","",$datafile[1]);
| $sitename = str_replace("\n","",$datafile[2]);
| } else {
| $css = "default.css";
| $siteurl = "http://www.default-domain.com";
| $sitename = "Default Site Name";
| }
|
| and that should effectively replace your require statement. - Cyanide_7
|
| >
| >Hi Guys (and Guy-persons for the politically correct :-) )
| >
| >I've been pondering this for days - see if you can come up with a
solution.
| >I am building a site (<A
| >HREF="http://www.narrowgauge.f2s.com">www.narrowgauge
| >.f2s.com</A>) that offers a postcard generator and a message board. To
| >make
| >that site more popular and to offer a service to like-minded webmasters I
| >am
| >going to allow them to link to the message board & postcard generator.
| >HOWEVER, instead of just a straight link, I want it to look like part of
| >their site by using their style sheet. See what I mean by trying these
two
| >links:
| ><A
|
>HREF="http://www.narrowgauge.f2s.com/cgi-bin/postcard/index.php?datafile=ht
tp:
|
>//www.narrowgauge.f2s.com/data.inc">http://www.narrowgauge.f2s.com/cgi-bin/
pos
| >tcard/index.php?datafile=http://www.narrowgauge.f2s.com/data.inc</A>
| >
| ><A
|
>HREF="http://www.narrowgauge.f2s.com/cgi-bin/postcard/index.php?datafile=ht
tp:
|
>//members.aol.com/reywob/data.inc">http://www.narrowgauge.f2s.com/cgi-bin/p
ost
| >card/index.php?datafile=http://members.aol.com/reywob/data.inc</A>
| >
| >The two scripts I'm using are Phorum for the message board and a CGI
| >script
| >for the postcard generator (from <A
| >HREF="http://www.aestheticsurgerycenter.com/scripts/">Jason's
scripts</A>).
| >
| >At first I thought that it would be simple. The webmaster would upload a
| >file called datafile.inc to his/her webspace. This would contain
| >$css = "http://www.domain.com/mystyle.css";
| >$siteurl = "http://www.domain.com";
| >$sitename = "Name of Site";
| >
| >(I enclosed the data above in <?PHP ?> tags to allow it to be read by the
| >require() statement.)
| >
| >Every link would have ?datafile=http://www.yourname.com/data.inc
appended
| >to
| >it.
| >Now for the Problems.
| >
| >PHORUM: I modified every link to have &datafile=$datafile in it. In the
| >header.php file I added <?PHP require ("$datafile"); ?> as I assumed
that
| >this would bring the variables into the script and allow them to be
| >appended
| >to the links. However all I get is error messages now. You can check my
| >latest progress by looking at <A
|
>HREF="http://www.narrowgauge.f2s.com/phorum/index.php?datafile=http://membe
rs.
|
>aol.com/reywob/data.inc">http://www.narrowgauge.f2s.com/phorum/index.php?da
taf
| >ile=http://members.aol.com/reywob/data.inc</A>. If it works then the
| >background should be blue.
| >
| >What am I doing wrong??? Does anyone have any ideas as to how I can get
| >this
| >to work? I've totally exhausted my knowledge of programming, so I hope
| >someone can tell me.
| >
| >
| >POSTCARD: This uses HTML templates called from inside the CGI script (a
| >working example can be found at <A
|
>HREF="http://www.narrowgauge.f2s.com/pwp/postcard/">www.narrowgauge.f2s.com
/pw
| >p/postcard/</A>) and I thought this would be simple as I could rename the
| >templates and embed PHP in them. However, for some reason the PHP is not
| >being processed - I assume being required by the CGI script fools the
| >server.
| >I then thought about using cookies, but gave that up when I realised that
I
| >couldn't put a URL in as the value.
| >
| >How can I get the values from the datafile (included using require () in
| >the
| >index.php page) into the CGI script and hence the templates???
| >
| >
| >If you think that the modifications to either of the above programs will
be
| >impossible, are there any other (free) programs that you could recommend?
| >Thanks in advance for any help you can offer.
| >Peter.
|
| ______________________________________________________
| Get Your Private, Free Email at http://www.hotmail.com
|
|
HWG: hwg-languages mailing list archives,
maintained by Webmasters @ IWA