Locating a database that I didn't create

  • (2 Pages)
  • +
  • 1
  • 2

15 Replies - 1120 Views - Last Post: 23 July 2012 - 09:11 AM Rate Topic: -----

#1 TKEYI60  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 26-April 11

Locating a database that I didn't create

Posted 20 July 2012 - 12:14 PM

Hi all,

I'm new to a job and am trying to go through the old employee's files. There is PHP, Javascript, Access, VisualBasic, and a few others extensions I'm not familiar with. One of our main tools our company uses is run off of the guy's local server. He uses Uniform Server and it starts when the machine boots.

My question is: I am trying to add a person to the website so when they login on their work computer, the tool we use recognizes the login and gives a specific menu based on the user's credentials. The old work has this set up for people who worked here, but I cannot figure out how to add a new employee (including myself). How can a php page link to a database, or where should I be looking for this database? Is it going to be Access or MySQL or both? Is there a config file I can check?

All of his PHP pages contain Javascript and they look like they contain database connection code, but I'm not sure what table to look for or where to look.

Thanks in advance.

Is This A Good Question/Topic? 0
  • +

Replies To: Locating a database that I didn't create

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8377
  • View blog
  • Posts: 31,138
  • Joined: 12-June 08

Re: Locating a database that I didn't create

Posted 20 July 2012 - 12:21 PM

I would start with looking at this "guy's local server.". I mean that pegs it down to one machine, right? Then it's an issue of sifting through what is installed and what is being served. The connection string in the php should fire back to the machine's address if you need to verify.
Was This Post Helpful? 0
  • +
  • -

#3 TKEYI60  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 26-April 11

Re: Locating a database that I didn't create

Posted 20 July 2012 - 12:37 PM

I've been sifting through the files. He created a local server on his desktop, and set it with a static IP. It's all well and good until it crashes or until his desktop needs to install updates and reboots. I was just trying to see if there was an easier way of seeing if he is connecting to an Access DB or a MySQL DB or if there is something I should specifically be looking for? Or is this just something that I will need to keep at until I find something?

I don't mean to sound stupid, but I've never had to sort through something this complicated and without notes or commentation (especially when I don't know what file leads to what).

Thanks
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8377
  • View blog
  • Posts: 31,138
  • Joined: 12-June 08

Re: Locating a database that I didn't create

Posted 20 July 2012 - 12:48 PM

Well if this starts up when his pcs boots (and it's a windows machine) then look at the start up files.

Start->run-> and type "msconfig" and hit enter. Look at the services and start up tabs.. see if anything jumps out as "db-ish".

Failing that just do a general file search for "database" or known Access file extensions..
Was This Post Helpful? 0
  • +
  • -

#5 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 5954
  • View blog
  • Posts: 23,224
  • Joined: 23-August 08

Re: Locating a database that I didn't create

Posted 21 July 2012 - 01:27 PM

You say the files looks like they contain database connection code. Perhaps if you post some of that code, we can deduce something about the database.
Was This Post Helpful? 0
  • +
  • -

#6 e_i_pi  Icon User is offline

  • = -1
  • member icon

Reputation: 782
  • View blog
  • Posts: 1,663
  • Joined: 30-January 09

Re: Locating a database that I didn't create

Posted 21 July 2012 - 04:09 PM

Given that it is Uniform Server, then I'll assume you're using Windows. I could be wrong here, but it looks like Uniform is a WAMP solution (Windows-Apache-MySQL-PHP). Which means that the database is almost certainly MySQL. I say almost certainly, because it is possible to hook WAMPs up to different databases, but it is generally a pain in the rear-end.

Have a look in the taskbar to see if you can locate the Uniform Server taskbar item, and right click on it. It should show a popup like this:
Posted Image
Then click on phpMyAdmin, which is a nice MySQL interface program. In there, you'll be able to see the databases (on the left hand side). You may need to trawl through if there are a few, but my guess is theree will be one or two. Once you click on one, the left hand side will be replaced with links to the tables of that database. I'd be looking for a table with the name "Users" or similar.

After that, it's possibly a crapshoot as to whether you can jack yourself an account. You may need to INSERT a row in that table, or in other tables as well, which may be named something like "UserRights" or "UserRoles". Without knowing the schema, I can't help you too much there. Once you have superuser access, you might want to look at the webpages of the application to see if there is a UI where you can add users more easily/safely.

If you're still having trouble locating a Users table, post back and I'll whip you up a query to hit the INFORMATION_SCHEMA to mine out tables that reference anything containing "user".

This post has been edited by e_i_pi: 21 July 2012 - 04:11 PM

Was This Post Helpful? 0
  • +
  • -

#7 TKEYI60  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 26-April 11

Re: Locating a database that I didn't create

Posted 22 July 2012 - 01:21 PM

$rs = $conn->Execute("SELECT * FROM UserAuth WHERE UserName='$USERNAME' AND [Employee_Data2]=True"); 
    	while (!$rs->EOF) {
	    		
	    	$HASPOWER2 = "TRUE";
	    				
	    $rs->MoveNext(); }
	    
	    if($HASPOWER2=="TRUE"){
		    			
		if(empty($tmpSHOW)||$tmpSHOW=="FALSE"){	
			#SHOW TOP DATA TO CHOOSE DATE OF DATA TO VIEW
			echo "<tr class='r2'>";
			echo "<td width=300 align='Left' colSpan=1>ACTIVE EMPLOYEES<br>";
			echo "<select name='tmpAEMP' id='tmpAEMP'>";
			echo "<option>OFF</option>";
			echo "<option>NEW</option>";
			$ACOUNT=0;
			$rs = $conn->Execute("SELECT LastName,FirstName,MiddleName FROM Employees WHERE Status='EMPLOYED' ORDER BY LastName ASC"); 



Here is some example code. Yes it is Windows XP SP3. There is no icon in the taskbar. MSCONFIG shows MySQL running, as well as MySQL Server, and there is .bat file that shortcuts to the Uniform Server at startup. There is a MySQL Server 5.0 in 'Programs' and when I click on the command line client it asks for a password (no idea what it is). I do know for a fact that all information that all user data is stored in a Microsoft Access Database, such as inventory numbers. I just don't know if that is where the initial data is being pulled from when the program/website loads (if that makes sense.)

I can access localhost from a web browser though. There are links to phpMyAdmin, Apache Config, MySQL Server Config, etc.

Thanks for all the advice.
Was This Post Helpful? 0
  • +
  • -

#8 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 5954
  • View blog
  • Posts: 23,224
  • Joined: 23-August 08

Re: Locating a database that I didn't create

Posted 22 July 2012 - 02:05 PM

$conn


Where is this variable created? Search for $conn = new
Was This Post Helpful? 1
  • +
  • -

#9 e_i_pi  Icon User is offline

  • = -1
  • member icon

Reputation: 782
  • View blog
  • Posts: 1,663
  • Joined: 30-January 09

Re: Locating a database that I didn't create

Posted 22 July 2012 - 02:21 PM

The square brackets is a dead giveaway that it's either MSSQL or Access. Square brackets cause an error in MySQL.
Was This Post Helpful? 0
  • +
  • -

#10 TKEYI60  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 26-April 11

Re: Locating a database that I didn't create

Posted 22 July 2012 - 02:28 PM

It is not in that .php file, nor any of the others I've checked so far. The only times I see

 $conn 


are with

 $rs = $conn->Execute 

Was This Post Helpful? 0
  • +
  • -

#11 e_i_pi  Icon User is offline

  • = -1
  • member icon

Reputation: 782
  • View blog
  • Posts: 1,663
  • Joined: 30-January 09

Re: Locating a database that I didn't create

Posted 22 July 2012 - 02:36 PM

The $conn is an object, so at some stage it needs to be instantiated. Objects are instantiated like this:
$myobj = new MyObject();


So, somewhere in the PHP code there will be reference to $conn = new ....

Since it's on Windows, have you tried text-indexing the folder where all the files are, so that you can do a text search across them? I find that extremely handy when developing on a Windows platform. There's an FAQ here on how to create and rebuild indexes on Win.
Was This Post Helpful? 0
  • +
  • -

#12 TKEYI60  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 26-April 11

Re: Locating a database that I didn't create

Posted 22 July 2012 - 07:14 PM

While looking into indexing, I found the start-server.bat file that loads at boot. It connects to mysqld-opt.exe and it pointed me to the ...\udrive\usr\local\mysql\data\mysql file path where there are many files, each with .frm .MYD and .MYI extensions. The type says Visual Basic Form File, but then why would these be in the mysql folder? Especially when I double click and VB won't open them?
Was This Post Helpful? 0
  • +
  • -

#13 TKEYI60  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 26-April 11

Re: Locating a database that I didn't create

Posted 22 July 2012 - 07:21 PM

My mistake in the above. The start-server.bat file doesn't "connect" to mysqld-opt.exe, but it does run a start command followed by --defaults-file=.../bin/my-small.cnf
Was This Post Helpful? 0
  • +
  • -

#14 TKEYI60  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 26-April 11

Re: Locating a database that I didn't create

Posted 23 July 2012 - 07:37 AM

 // Absolute path of our mdb file 
    $cur_dir = addslashes(dirname(__FILE__)); 
    $db_file = "\\Software\\...\\DataGate.mdb";    
    // Establish the connection 
    $conn = new COM("ADODB.Connection") or die("Cannot start ADO" . odbc_errormsg());   
    $conn->Open("Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password=****;Data Source=\\Software\\....\\DataGate.mdb;");

    #$conn->Open("PROVIDER=Microsoft.Jet.OLEDB.3.2;DRIVER={Microsoft Access Driver (*.mdb)};USer ID=****;PWD=****;DBQ="("\\Software\\....\\DataGate.mdb;"));
    // Absolute path of our mdb file 
    $cur_dir2 = addslashes(dirname(__FILE__)); 
    $db_file2 = "\\Software\\....\\DataGate.mdb";
    #$provider2 = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . $db_file; "UID=****;PWD=****;"    
    // Establish the connection 
    $conn2 = new COM("ADODB.Connection") or die("Cannot start ADO" . odbc_errormsg());  
    #$conn2->Open($provider); 
    $conn2->Open("Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password=****;Data Source=\\....\\Refurb Production2002_D.mdb;");


Here is one of the php files that contain a new connection. All other files have the exact same pattern.
Was This Post Helpful? 0
  • +
  • -

#15 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8377
  • View blog
  • Posts: 31,138
  • Joined: 12-June 08

Re: Locating a database that I didn't create

Posted 23 July 2012 - 08:29 AM

You did just a general "search file" for DataGate.mdb & Production2002_D.mdb, right?
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2