1
robstockley
Renaming register.php

I was reading this thread and was wondering if anyone, like me, was thinking that renaming register.php could be automated?

Thinking aloud here....
On my site there are six places where I'd need to change the reference, 5 php and one template. If I were to save the name of register.php as a configuration option, load it into a global variable and replace these six instances with a reference to that variable, then I could have an admin function that generated a random filename, copied the current register.php into that file, updated the config option then deleted the old copy of register.php.

Perhaps this could be made into a small module so you could repeat the process after any core update took place.

Sounds simple enough but with two under two years I may not get the chance to do it before someone else has a crack.

Huh? What's that? Sounds like someone needs winding again ....

2
robstockley
Re: Renaming register.php

Finally got around to doing something about this on my site. I decided that it was not worth coding this but rather simply describing the process.

I untarred the latest site backup on my laptop, openned a console and changed to the root folder of the website. I then issued the following command.
rob@mowglilaptop:~/public_html$ [color=ff0000]grep -r register.php *[/color]
[
color=00ff00]include/registerform.php:[/color]$reg_form = new XoopsThemeForm(_US_USERREG"userinfo""register.php""post"true);
[
color=00ff00]language/english/user.php:[/color]define('_US_NOTREGISTERED','Not registered?  Click <a href="register.php">here</a>.');
[
color=00ff00]language/english/user.php:[/color]//%%%%%%              File Name register.php          %%%%%
[color=00ff00]modules/system/templates/blocks/system_block_login.html:[/color]<a href="<{$xoops_url}>/register.php"><{$block.lang_registernow}></a>
[
color=00ff00]pmlite.php:[/color]    echo _PM_SORRY."<br /><br /><a href='".XOOPS_URL."/register.php'>"._PM_REGISTERNOW."</a>.";
[
color=00ff00]register.php:[/color]// $Id: register.php 2 2005-11-02 18:23:29Z skalpa $
[color=00ff00]register.php:[/color]           echo "<form action='register.php' method='post'>
[color=00ff00]themes/wfly_theme/theme.html:[/color]          <a href="
<{$xoops_url}>/user.php">LOGIN</a>&nbsp;&nbsp;<a href="<{$xoops_url}>/register.php">REGISTER</a>
rob@mowglilaptop:~/public_html$


All the files containing a reference to register.php are listed along the left margin (highlighted in green) together with the context.

Next I renamed the backup copy of register.php to something unintelligible such as wqropihshbgas.php. I then used a plain editor to update the change in the backups of the files identified above.

I also pasted the output of grep into a plain text file and stored that in the folder below the webroot. That way I have a backup copy of the changes I've made.

Lastly I uploaded the updated files overwriting the originals and deleted the old register.php.

It worked a treat and now protector is reporting zero spam attempts on register.php.

Pretty basic but I hope this helps someone.
Rob

Login

Who's Online

132 user(s) are online (102 user(s) are browsing Support Forums)


Members: 0


Guests: 132


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits