2 registered members (AbrahamR, AndrewAMD),
1,278
guests, and 2
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: PHP help
[Re: Joozey]
#202073
04/13/08 02:50
04/13/08 02:50
|
Joined: Jan 2008
Posts: 1,580
Blade280891
OP
Serious User
|
OP
Serious User
Joined: Jan 2008
Posts: 1,580
|
Yes, but i want the database information to be used site wide, for user signup etc. therefore if i use a session, that will only work on one user
My Avatar Randomness V2"Someone get me to the doctor, and someone call the nurse And someone buy me roses, and someone burned the church"
|
|
|
Re: PHP help
[Re: Blade280891]
#202075
04/13/08 03:12
04/13/08 03:12
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
Professional cms systems use a file they place in the root directory of the cms, if you take e.g. php-fusion there is a file named config.php where the database login information is stored within. Sorry, I can't tell you how files are read and written. I don't know .php.
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: PHP help
[Re: Uhrwerk]
#202076
04/13/08 03:13
04/13/08 03:13
|
Joined: Jan 2008
Posts: 1,580
Blade280891
OP
Serious User
|
OP
Serious User
Joined: Jan 2008
Posts: 1,580
|
hmm, yer the problem is that if i use a file to store all the data to connect to a database in a PHP file, it cannot be written in through a user input form.
My Avatar Randomness V2"Someone get me to the doctor, and someone call the nurse And someone buy me roses, and someone burned the church"
|
|
|
Re: PHP help
[Re: Blade280891]
#202077
04/13/08 03:33
04/13/08 03:33
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
It sure can. Maybe looking at an excerpt of the setup.php of php-fusion will help you:
if ($step == "1") {
$db_host = stripinput($_POST['db_host']);
$db_user = stripinput($_POST['db_user']);
$db_pass = stripinput($_POST['db_pass']);
$db_name = stripinput($_POST['db_name']);
$db_prefix = stripinput($_POST['db_prefix']);
$config = "<?php
// database settings
"."$"."db_host="."\"".$_POST['db_host']."\"".";
"."$"."db_user="."\"".$_POST['db_user']."\"".";
"."$"."db_pass="."\"".$_POST['db_pass']."\"".";
"."$"."db_name="."\"".$_POST['db_name']."\"".";
"."$"."db_prefix="."\"".$_POST['db_prefix']."\"".";
define("."\""."DB_PREFIX"."\"".", "."\"".$_POST['db_prefix']."\"".");
?>";
$temp = fopen("config.php","w");
if (!fwrite($temp, $config)) {
echo $locale['430']."\n</td></tr>\n</table>\n";
fclose($temp);
exit;
}
fclose($temp);
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: PHP help
[Re: Uhrwerk]
#202078
04/13/08 03:40
04/13/08 03:40
|
Joined: Jan 2008
Posts: 1,580
Blade280891
OP
Serious User
|
OP
Serious User
Joined: Jan 2008
Posts: 1,580
|
and this saves the data entered?
My Avatar Randomness V2"Someone get me to the doctor, and someone call the nurse And someone buy me roses, and someone burned the church"
|
|
|
Re: PHP help
[Re: Blade280891]
#202088
04/13/08 08:36
04/13/08 08:36
|
Joined: Apr 2005
Posts: 3,815 Finland
Inestical
Rabbit Developer
|
Rabbit Developer
Joined: Apr 2005
Posts: 3,815
Finland
|
Yeah, at least it opens up file in write mode and inputs the logindata.
"Yesterday was once today's tomorrow."
|
|
|
Re: PHP help
[Re: Aaron_H]
#202122
04/13/08 14:22
04/13/08 14:22
|
Joined: Jan 2008
Posts: 1,580
Blade280891
OP
Serious User
|
OP
Serious User
Joined: Jan 2008
Posts: 1,580
|
that was very helpfull, a question though. Where is config.inc.php? or does it create it
My Avatar Randomness V2"Someone get me to the doctor, and someone call the nurse And someone buy me roses, and someone burned the church"
|
|
|
|