Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 05:41
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AbrahamR, AndrewAMD), 1,278 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 5 1 2 3 4 5
Re: PHP help [Re: Joozey] #202073
04/13/08 02:50
04/13/08 02:50
Joined: Jan 2008
Posts: 1,580
Blade280891 Offline OP
Serious User
Blade280891  Offline 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 Offline
Expert
Uhrwerk  Offline
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 Offline OP
Serious User
Blade280891  Offline 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 Offline
Expert
Uhrwerk  Offline
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:

 Code:
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 Offline OP
Serious User
Blade280891  Offline 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 Offline
Rabbit Developer
Inestical  Offline
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: Inestical] #202095
04/13/08 09:40
04/13/08 09:40
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline
Expert
Joey  Offline
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
you could also just use the php 'serialize' function to write an array with the information to a file, and 'unserialize' for reading it afterwards.

Re: PHP help [Re: Joey] #202103
04/13/08 11:51
04/13/08 11:51
Joined: Nov 2003
Posts: 698
England, UK
A
Aaron_H Offline
User
Aaron_H  Offline
User
A

Joined: Nov 2003
Posts: 698
England, UK
I coded something a few years back which sounds like what you're looking for.
It's pretty useless to me at the moment but it might be good for learning from.

Here's the link: http://download.yousendit.com/067F2DC1307951E1

Re: PHP help [Re: Aaron_H] #202122
04/13/08 14:22
04/13/08 14:22
Joined: Jan 2008
Posts: 1,580
Blade280891 Offline OP
Serious User
Blade280891  Offline 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"
Re: PHP help [Re: Blade280891] #202124
04/13/08 14:34
04/13/08 14:34
Joined: Apr 2005
Posts: 3,815
Finland
Inestical Offline
Rabbit Developer
Inestical  Offline
Rabbit Developer

Joined: Apr 2005
Posts: 3,815
Finland
It creates it if it doesn't exist yet ;\)


"Yesterday was once today's tomorrow."
Page 2 of 5 1 2 3 4 5

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1