Advertisement:

Author Topic: [tip] Hide links for 3 seconds - prevents bots  (Read 1919 times)

design

  • Hero Member
  • *****
  • Posts: 2619
  • Osclass 3.5 MAC/PC w/ Modern Browsers
[tip] Hide links for 3 seconds - prevents bots
« on: June 26, 2014, 07:22:16 pm »
create a js file with this (I called mine bothide.js)

Code: [Select]
function regiChange() {
  //change links to the correct address
  $('a[href="register:#"]').attr('href','index.php?page=register&action=register');
  return true;
}

$(document).ready(function(){
//set timeout to 3 seconds
var t=setTimeout("regiChange()",3000);
});

add this to footer.php
before content closing </div>

<script type="text/javascript" src="<?php echo osc_current_web_theme_js_url('bothide.js') ; ?>"></script>

and the implementation:

<a href="register:#"><?php _e('Register', 'Theme Name') ; ?></a>


you can do this for any link, including - changing the links and the href names accordingly

<?php echo osc_contact_url(); ?>
<?php echo osc_item_contact_email(); ?>

______

this can also be used on a form submit

$('form[action="#"]').attr('action','http://domain.com/post');
  return true;
« Last Edit: June 26, 2014, 09:55:58 pm by design »

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: [help: soon to be tip] Hide links for 3 seconds
« Reply #1 on: June 26, 2014, 07:55:11 pm »
I'm getting a coding error in DW

DW? ??? What's wrong? Seems to work fine here... ???

Regards

design

  • Hero Member
  • *****
  • Posts: 2619
  • Osclass 3.5 MAC/PC w/ Modern Browsers
Re: [help: soon to be tip] Hide links for 3 seconds
« Reply #2 on: June 26, 2014, 07:58:43 pm »
DW Dream Weaver

I put that section in functions.php, is dream weaver wrong?


teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: [help: soon to be tip] Hide links for 3 seconds
« Reply #3 on: June 26, 2014, 08:11:20 pm »
What's the error on DreamWeaver? Is it working for you on real browsers?

design

  • Hero Member
  • *****
  • Posts: 2619
  • Osclass 3.5 MAC/PC w/ Modern Browsers
Re: [help: soon to be tip] Hide links for 3 seconds
« Reply #4 on: June 26, 2014, 08:16:55 pm »
here is the error

Parse error: syntax error, unexpected '(', expecting variable (T_VARIABLE) or '$'

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: [help: soon to be tip] Hide links for 3 seconds
« Reply #5 on: June 26, 2014, 08:30:52 pm »
And you're sure is this line

$('a[href="register:#"]').attr('href','<?php echo osc_register_account_url() ; ?>');

what's provoking the error? ???

Try

$('a[href="register:#"]').attr('href','<?php echo osc_register_account_url()?>');

or

$('a[href="register:#"]').attr('href',"<?php echo osc_register_account_url() ; ?>");

design

  • Hero Member
  • *****
  • Posts: 2619
  • Osclass 3.5 MAC/PC w/ Modern Browsers
Re: [help: soon to be tip] Hide links for 3 seconds
« Reply #6 on: June 26, 2014, 08:45:52 pm »
I can get it to work if I do it this way - I would prefer to do it osclass style. I think it would be sort of a plugin its to light to make it a full plugin though. it really would defeat the purpose of this script if I have it in header or footer.


still working on it....

the above error was solved by putting it in a js file not the function file (sigh) I am blind to see the difference between the two.  :-[

in header.php line 1

Code: [Select]
<script type="text/javascript">
function regiChange() {
  //change links to the correct address
  $('a[href="register:#"]').attr('href','<?php echo osc_register_account_url() ; ?>');
}

$(document).ready(function(){
//set timeout to 3 seconds
var t=setTimeout("regiChange()",3000);
});
</script>
« Last Edit: June 26, 2014, 09:06:00 pm by design »

design

  • Hero Member
  • *****
  • Posts: 2619
  • Osclass 3.5 MAC/PC w/ Modern Browsers
Re: [help: soon to be tip] Hide links for 3 seconds
« Reply #7 on: June 26, 2014, 09:17:15 pm »
DONE!

 ;D see first post above  ;D 
« Last Edit: June 26, 2014, 09:57:09 pm by design »

design

  • Hero Member
  • *****
  • Posts: 2619
  • Osclass 3.5 MAC/PC w/ Modern Browsers
Re: [tip] Hide links for 3 seconds - prevents bots
« Reply #8 on: June 26, 2014, 11:43:11 pm »
I will put this to the test tonight. I usually have about 4 new bot members a day. will post results tomorrow!!

design

  • Hero Member
  • *****
  • Posts: 2619
  • Osclass 3.5 MAC/PC w/ Modern Browsers
Re: [tip] Hide links for 3 seconds - prevents bots
« Reply #9 on: June 27, 2014, 05:53:31 pm »
well...good and bad. I had a legitimate new member with ad posted :-D yea!

but I still had two more of the yahoo.com bots register. so I think again this is an osclass search bot because on a totally unrelated server and domain I get the same type of signup.

bottom line: this is working and is not a hinderance to real people.