473,385 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

PHP Class Trouble

I am new to OOPS esp in PHP and I am stuck here -

I have a file called dat.php which has a class defined in it. This class has usual functions for database connectivity and error reporting if not connected etc. I use this file anywhere in my application I want to connect to my database.

The constructor is

Expand|Select|Wrap|Line Numbers
  1.     function DB {
  2.        $this->host = 'XXXXXXXX';
  3.        $this->user = 'XXXXXXXX';
  4.        $this->password = 'XXXXXXXXXX';
  5.        $this->database = 'XXXXXXXX';
  6.        $this->persistent = false;
  7.  
  8.     }
Problem is that I have to encrypt the password (using another encryption function) and retrieve it from another file and I do not want to put username and password here in this file and I do not know how to do that. I definitely cannot remove this class as it has been used at a lot of places.


Can anyone help please?

Thanks,
AJ
Jan 9 '08 #1
1 931
Well, I came to know that base class constructor does not automatically pass to the derived class. So I put my username and password in a class in some different file. Included this file in the dat.php and in the constructor of the class DB{} I used this =
Expand|Select|Wrap|Line Numbers
  1. class DB extends DB_p {
  2.  
  3. function DB {
  4. parent::DB_p();
  5. }
  6. }
Any suggestions if this secure?

Thanks
AJ
Jan 9 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Jerry | last post by:
My "main" class is getting a bit long...Is it possble to split a class definition into several files and then import the pieces to get the whole definition? Jerry
2
by: Jeff | last post by:
/* -------------------------------------------------------------------------- Hello, I was experimenting with class templates and specializing member functions and came across a simple problem...
3
by: polarz | last post by:
I'm having trouble getting items from different classes to display in my textBox. e.g. private void button2_Click(object sender, System.EventArgs e) { someData sd = new someData();...
7
by: S. Lorétan | last post by:
Hi guys, Sorry for this stupid question, but I don't know why it isn't working. Here is my (example) code: namespace Test { class A { public string Label1; }
11
by: xxbabysue123xx | last post by:
Heres the problem: Create a class Student with instance data name, studentNumber, class (where class is a String containing one of the following: “Freshman”, “Sophomore”, “Junior”, “Senior”. ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.