Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Rename admin directory - for developers


Guest

Recommended Posts

I have been playing around today and came up with a way to rename the admin directory in osC during the install process. It works on localhost using XAMPP but wondering is someone with better internet than satellite can test it online with CPanel, etc. I am sure it will need tweaking.

 

In install\templates\pages\install_3.php

 

Change

 

	  <tr>
	<td class="inputField"><?php echo 'Administrator Password<br />' . osc_draw_input_field('CFG_ADMINISTRATOR_PASSWORD', null, 'class="text"'); ?></td>
	<td class="inputDescription">The password to use for the administrator account.</td>
  </tr>
</table>

 

 

To

 

	  <tr>
	<td class="inputField"><?php echo 'Administrator Password<br />' . osc_draw_input_field('CFG_ADMINISTRATOR_PASSWORD', null, 'class="text"'); ?></td>
	<td class="inputDescription">The password to use for the administrator account.</td>
  </tr>
  <tr>
	<td class="inputField"><?php echo 'Admin Directory Name<br />' . osc_draw_input_field('STORE_ADMIN', null, 'class="text"'); ?></td>
	<td class="inputDescription">The name of your stores admin folder.</td>
  </tr>
</table>

 

 

In install\templates\pages\install_4.php

 

Change

 

				   '  define(\'DIR_WS_ADMIN\', \'' . $http_catalog . 'admin/\');' . "\n" .
			   '  define(\'DIR_FS_ADMIN\', \'' . $dir_fs_document_root . 'admin/\');' . "\n" .

 

To

 

				   '  define(\'DIR_WS_ADMIN\', \'' . $http_catalog . trim($_POST['STORE_ADMIN']) . '/\');' . "\n" .
			   '  define(\'DIR_FS_ADMIN\', \'' . $dir_fs_document_root . trim($_POST['STORE_ADMIN']) . '/\');' . "\n" .

 

 

After

 

  $fp = fopen($dir_fs_document_root . 'admin/includes/configure.php', 'w');
 fputs($fp, $file_contents);
 fclose($fp);

 

 

Add

 

  rename("../admin","../" . trim($_POST['STORE_ADMIN']) . " " );

 

 

Change

 

		<td align="center" width="50%"><a href="<?php echo $http_server . $http_catalog . 'admin/index.php'; ?>" target="_blank"><img src="images/button_administration_tool.gif" border="0" alt="Administration Tool" /></a></td>

 

To

 

		<td align="center" width="50%"><a href="<?php echo $http_server . $http_catalog . trim($_POST['STORE_ADMIN']) . '/index.php'; ?>" target="_blank"><img src="images/button_administration_tool.gif" border="0" alt="Administration Tool" /></a></td>

 

 

Now on the 3rd page of the install it will give the user the ability to set their own unique Admin directory name. It will make the appropriate changes to the configure.php file and rename the admin directory.

 

As I said it works on localhost but not sure if it will work in a live environment or if permissions might be a problem. Any testers would be great. Feedback appreciated.

 

Thanks.

 

:)

 

Edit: fixed spelling error.

Link to comment
Share on other sites

Hi Peter

 

I did this a few weeks back, it works fine, must admit i did not consider posting it!!

 

Only differernce is i have not given the choice of name to mine, if its not liked can be changed post install the main thing being the name is not admin!

 

Well done on a good post

 

Nic

Sometimes you're the dog and sometimes the lamp post

[/url]

My Contributions

Link to comment
Share on other sites

Hi Nick, thanks for the compliment :blush:

 

I think for something like this it is important to let the user choose their own admin name so each will be unique and also familiar to that particular user. If this can work in every environment then my hope is that it is included in the next releases as a way of providing some extra security for the users of osC.

Link to comment
Share on other sites

Looks like a good solution to the admin folder problem, I will take a look to test this out over the weekend under different configurations

Mark Evans

osCommerce Monkey & Lead Guitarist for "Sparky + the Monkeys" (Album on sale in all good record shops)

 

---------------------------------------

Software is like sex: It's better when it's free. (Linus Torvalds)

Link to comment
Share on other sites

  • 1 year later...

I am new to OSC but have experience of web development. I have read many threads on here about the re-naming the of 'admin' folder issue and users problems doing this. I thought I would try Java Roasters solution on a new installation of OSC.

 

I amended the above php files and the installation process went fine. The re-named 'admin' folder was added to the server but the new name wasn't added to the configure.php files. Even coding this manually the admin area gets 404 message.

 

Here's the code for the configure.php file

 

define('DIR_WS_ADMIN', '/admin_new/');
 define('DIR_FS_ADMIN', '/home/linweb01/a/asv-sport.co.uk/user/htdocs/admin_new/');

 

For security reasons the 'admin_new' is not the actual name for this folder. I can PM this if necessary.

 

The website can be viewed here.

Link to comment
Share on other sites

I am new to OSC but have experience of web development. I have read many threads on here about the re-naming the of 'admin' folder issue and users problems doing this. I thought I would try Java Roasters solution on a new installation of OSC.

 

I amended the above php files and the installation process went fine. The re-named 'admin' folder was added to the server but the new name wasn't added to the configure.php files. Even coding this manually the admin area gets 404 message.

 

Here's the code for the configure.php file

 

define('DIR_WS_ADMIN', '/admin_new/');
 define('DIR_FS_ADMIN', '/home/linweb01/a/asv-sport.co.uk/user/htdocs/admin_new/');

 

For security reasons the 'admin_new' is not the actual name for this folder. I can PM this if necessary.

 

The website can be viewed here.

Here is what I have

define('DIR_FS_DOCUMENT_ROOT', '/home/username/public_html');

define('DIR_WS_ADMIN', '/admin_new/');

define('DIR_FS_ADMIN', DIR_FS_DOCUMENT_ROOT . DIR_WS_ADMIN);

define('DIR_WS_CATALOG', '/');

define('DIR_WS_HTTP_CATALOG', '/');

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...