Solved

Identifying a Coldfusion / SQL database

Posted on 2011-09-27
12
396 Views
Last Modified: 2012-05-12
I am trying to pick my way through a client's web site which they had developed for them a few years ago. The design firm has now gone out of business.

I'm ok with PHP but unfamiliar with Coldfusion. I'm looking at the code and things seem straightforward enough but there's a few issues I just can't understand and I'd like some help please.

There is an area of the site that requires a login. I've seen references to the following variable but just can't find where its set:
datasource="#mainDataSource#"

Also, in the hunt for clues, I looked at a simple web page and found that it somehow knows the client's name without finding it in an include (unless I'm missing something!):
[_admin/home.cfm]
 
<!-- NO ACCESS CONTROL -->

<cfinclude template="includeHeaderHome.cfm">

<!--- OUTPUT --->
<div id="content" align="left">
	<div class="contentColumn1">
		<p class="contentHeading">Welcome</p>
		<p>This the ***client name*** administrator. Use the menu above to navigate around the site.</p>
		
		<!--- MESSAGES --->
		<cfif isDefined("URL.message")>
			<cfif URL.message EQ "editParam">
				<p>Thank you for editing the parameters, you should now thoroughly test the site.</p>
			</cfif>
		</cfif>
		
		<cfif IsDefined ('SESSION.userAccess.idUser')>
			<p>You are currently logged in as '<a href="user.cfm?action=edit&idUser=<cfoutput>#SESSION.userAccess.idUser[1]#</cfoutput>"><cfoutput>#SESSION.userAccess.nameUser[1]#</cfoutput></a>'.</p>
		</cfif>
		
		If you have any queries use the help panel if available or contact your <a href="mailto:<cfoutput>#getParam.siteAdmin#</cfoutput>">system administrator</a>.
	</div>
</div>

<cfinclude template="includeFooter.cfm">

Open in new window


[_admin/includeHeaderHome.cfm]
 
<cfinclude template="includeNav.cfm">
	<table class="navStyle" border="0" cellpadding="0" cellspacing="0" width="960">
		<tr>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="67"><a href="home.cfm">Home</a></td>
			<td width="127"><a href="param.cfm">Site Parameters</a></td>
			<td width="100"><a href="file.cfm">File Transfer</a></td>
			<td align="right" colspan="5"><span class="contentHighlight">Main</span></td>
		</tr>
	</table>
</div>

Open in new window


[_admin/includeNav.cfm]
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<cfprocessingdirective pageEncoding="utf-8">

<head>
	<title><cfoutput>#getParam.siteName#</cfoutput></title>
	<link href="css/admin.css" rel="stylesheet" type="text/css" />
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="keywords" content="<cfoutput>#getParam.siteKeywords#</cfoutput>" />
</head>

<body>
	<table width="100%"  border="0" cellspacing="0" cellpadding="0">
		<tr>
			<td align="center">
			
				<div id="container">
					<div id="nav" align="left">
						<div id="navTitle">
							<a href="home.cfm"><img src="gfx/EMDDLogo.gif" alt="EMDD Logo" border="0" /></a>
						</div>
						<br />
						<table class="navStyle" border="0" cellpadding="0" cellspacing="0" width="960">
							<tr>
								<td width="60"><a href="home.cfm">Main</a></td>
								<td width="80"><a href="content.cfm">Content</a></td>
								<td width="93"><a href="broadcast.cfm">Broadcast</a></td>
								<td width="66"><a href="user.cfm">Users</a></td>
								<td width="100"><cfif isDefined ('SESSION.userAccess.idUser')><a href="login.cfm?action=logout">Logout</a><cfelse><a href="login.cfm?action=login">Login</a></cfif></td>
								<td align="right"><a href="../index.cfm" target="_blank">View Site</a></td>
								<td align="right" width="59"><span class="dropStyle">Help</span></td>
							</tr>
						</table>

Open in new window


[_admin/includeFooter.cfm]
 
<!-- FOOTER -->
					<div id="footer" align="right"><cfoutput>#dateFormat(now(),'dd MMM yyyy')#</cfoutput> v0.7</div>
				</div>
			</td>
		</tr>
	</table>
</body>

</html>

Open in new window


Maybe this page might be a simple example that someone could explain for me please? How does the page know what the client's name is in order to put it in the Title tag of the HTML?

Any help is appreciated!
0
Comment
Question by:edz_pgt
  • 6
  • 4
  • 2
12 Comments
 
LVL 13

Expert Comment

by:ansudhindra
ID: 36708543
Mainly check for application.cfm file in the root folder of your website..
in the application.cfm file you may find the line which says <cfset mainDataSource="******" >. what ever is in the right side of the operator is the datasource value.

in coldfusion database connection is usually done through cfadmin sections and not like as it is in PHP..
You can access CF administrator through url like
http://www.sitename.com/cfide/administrator/index.cfm
Once you login, on the left hand side there will be a menu. The second list in the menu contains "Data Sources" link. click on it, will open a page. In this page you will see datasource name..

Now you check the value of mainDataSource variable in the list of datasources in the admin page... click on it, you will get databse details...

BR-Sudhindra-www.clicksperday.com
0
 
LVL 13

Expert Comment

by:ansudhindra
ID: 36708556
FYI..
  CF                      PHP
cfinclude  === include()
isDefined === isset()
cfif === if()

for  more help on CF..check this.    http://livedocs.adobe.com/coldfusion/8/help.html

BR=Sudhindra-www.clicksperday.com
0
 
LVL 1

Author Comment

by:edz_pgt
ID: 36709445
Thanks for your information so far! :)

I've found application.cfm which contains an include of config.cfm containing:

<cfparam name="mainDataSource" default="xxxxxxxxxxx">
(where the xxxxxxxxxxxxx is the database name)

This system is hosted on a Plesk sever and I can't see any URLs that look like the one you quoted:
http://www.sitename.com/cfide/administrator/index.cfm

There is no directory called "cfide".

However, in Plesk there is a Coldfusion DSN icon. In there, there is a DSN with the same name quoted in the include parameter but when I click it, I get this error:
There is no file or directory with name [dbFile]

Any ideas?
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 13

Expert Comment

by:ansudhindra
ID: 36709473
you have to check with your site owner (or administrator) on how to access CF admin section.

---
<cfparam name="mainDataSource" default="xxxxxxxxxxx">
(where the xxxxxxxxxxxxx is the database name)
---
xxxxxxxxxx above is the datasource name and not the database name.. You have to check in the CF administrations section to find out which database they are using and the database name.
0
 
LVL 1

Author Comment

by:edz_pgt
ID: 36709497
OK - the site administrator is no longer available so we either have to scrap the whole web site or we have to figure it out ourselves.

What can you tell me about the CF admin section? I'm wondering if I could find it in another directory? What might I be looking for? What files would I expect to see in there?
0
 
LVL 1

Author Comment

by:edz_pgt
ID: 36709534
Actually, even if I find this database, will I ever be able to decode or recreate an administrator login for it?
0
 
LVL 13

Assisted Solution

by:ansudhindra
ansudhindra earned 250 total points
ID: 36709543
is this site hosted on a shared server?

If you install CF on your local machine, then you will find out what is there in the CF admin section.
for localhost http://localhost:8500/cfide/administrator/index.cfm
which is password protected.

if it is hosted in the third party sever then ask the help of the service provider for CF admin section, they will be able to let you know.
0
 
LVL 52

Expert Comment

by:_agx_
ID: 36709553
> There is no directory called "cfide"

The admin section under CFIDE isn't always available on prod sites for security reasons.  What version of CF are you using? If you don't know, create a blank .cfm script and dump the server scope. The version is there.

ie
<cfdump var="#server#">
0
 
LVL 1

Author Comment

by:edz_pgt
ID: 36709578
Hi _agx_,

The product version is:

PRODUCTVERSION       8,0,1,195765
0
 
LVL 52

Assisted Solution

by:_agx_
_agx_ earned 250 total points
ID: 36709790
I don't know anything about Plesk. So maybe there's an easier way but ..
 
If you have access to the physical files on the server, you could find out the database name from the config files. Dsn info is stored in XML files.  The default location for CF8 is  c:\coldfusion8\lib\neo-datasource.xml  (yours may differ).  

Locate that file, open it and search for your datasource name ie "xxxxxxxxxxxxx". The settings will vary by database and driver type. But for example an MySQL datasource on my test machine has settings like these. The database name and IP is in the jdbc URL

        jdbc:mysql://127.0.0.1:3306/MyDatabaseName?allowMultiQueries=true

<var name="MyDatasourceName">
<struct type="coldfusion.server.ConfigMap">
<var name="NAME">
  <string>MyDatasourceName</string> 
</var>
....
<var name="url">
  <string>jdbc:mysql://127.0.0.1:3306/MyDatabaseName?allowMultiQueries=true</string> 
</var>

Open in new window


0
 
LVL 1

Accepted Solution

by:
edz_pgt earned 0 total points
ID: 37130208
Sorry for not getting back this post sooner.

In the end I discovered that a domain administrator isn't automatically a user on an SQL database. Managed to get back in after re-enabling an old username that was originally an administrator of the database.
0
 
LVL 1

Author Closing Comment

by:edz_pgt
ID: 37163453
Thanks for helping. :)
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question