1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Submit URL Restriction

Discussion in 'General Troubleshooting' started by drvosjeca, Oct 16, 2011.

  1. drvosjeca

    drvosjeca New Member

    Hi...

    Im building squidoo directory and i would like to restrict submissions from NON-Squidoo pages...

    So basicly i would like users to only be able to submit their lenses, so url they are submitting must have ht*p://squidoo.com/their-lens

    Can anyone help me with this please?

    thanks
     
  2. carlo75

    carlo75 Design & Development

    Hi drvosjeca,
    you can simply block URL from admin panel, section Blocked List, select domain and add all the domain that you want disable.
     
  3. drvosjeca

    drvosjeca New Member

    ufff.... you are killing me :)

    I wana disable all domains, only squidoo should be available to submit


    Any way to do this?
     
  4. carlo75

    carlo75 Design & Development

    Sorry, I've read too quickly...

    So if you want to prevent all *.* site, except from SQUIDOO, I think you have to draft something in hotaru core, in submit.php or libs/SubmitFunctions.php inside Submit Plugin.
    I'll do some tries...
     
    Last edited: Oct 17, 2011
  5. PuckRobin

    PuckRobin New Member

    In plugins/submit/templates/submit1.php change the following line:

    PHP:
    <form name='submit_1' action='<?php echo BASEURL?>index.php?page=submit1' method='post'>
    to:

    PHP:
    <form name='submit_1' action='<?php echo BASEURL?>index.php?page=submit1' method='post' onsubmit='return checkurl()'>
    Add following lines to the end of submit1.php:
    PHP:
    <script type="text/javascript">
    function 
    checkurl() {
    var 
    url = $("#submit_orig_url").val();
    if ( 
    url.indexOf("squidoo.com") == -1){ 
    alert("You can only submit squidoo.com links. Please try again.");
    return 
    false;
    }
    else { return 
    true;}
    }
    </script>
    User cannot proceed further until he submits a squidoo.com link.
     
    drvosjeca and carlo75 like this.
  6. carlo75

    carlo75 Design & Development

    Got it:
    you can reverse engine the Blocked List function, adding http://www.squidoo.com like a domain to block. Suddenly you need to edit SubmitFunctions at line ~695 with this:

    /**
    * Check if url or domain is on the blocked list
    *
    * @param string $url
    * @return bool - true if blocked
    */
    public function checkBlocked($h, $url)
    {
    // Is url blocked?
    if ($h->isBlocked('url', $url)) {
    return false;
    }

    // Is domain blocked?
    $domain = get_domain($url); // returns the domain including http
    if ($h->isBlocked('url', $domain)) {
    return false;
    }

    // Is domain extension blocked?
    $host = parse_url($url, PHP_URL_HOST); // returns www.google.com
    $ext = substr(strrchr($host, '.'), 1);
    if ($h->isBlocked('url', '.' . $ext)) { // dot added here
    return false;
    }

    return true; // not blocked
    }

    Not so much elegant but it'll works
     
    drvosjeca likes this.
  7. carlo75

    carlo75 Design & Development

    Definitely a better solution!

    But with JAVA disabled... it's ok... probably all hotaru system doesn't work ;-)
     
    Last edited: Oct 17, 2011
  8. drvosjeca

    drvosjeca New Member

    Thank you guys...

    I have used solution @PuckRobin posted and it solved my problem.

    Well... if users have java disabled, then site wont be working at all, as you said carlo
     
  9. PuckRobin

    PuckRobin New Member

    Does Hotaru even work with javascript disabled? I am not sure about that, but if it works and somebody cares about those people who can still live on the Internet with javascript disabled, he has the liberty to modify submit.php and SubmitFunctions.php I think :) But me, no thanks :p
     
  10. carlo75

    carlo75 Design & Development

    Sure... mine was an ironic supposition :rolleyes:
     
  11. drvosjeca

    drvosjeca New Member

    im glad i got this solved, this is simply best way to isolate spammers without using a plugin :)
     
  12. drvosjeca

    drvosjeca New Member

    hi guys...

    I didnt wanna start new thread for it, since my problem is quite related to first post of this thread with a little update.

    I have used a solution provided by you guys in order to restrict spamm submissions. So i was trying to limit submits to squidoo only, but lately i see somehow many spam sh*t on website.

    Could you guys tell me how is it possible that these spamms are getting submitted after i did this?


    And what else could i do to avoid getting more spam?

    thanks for your support guys
     
  13. PuckRobin

    PuckRobin New Member

    Check for javascript errors on your page or give us a link.

    If you have errors, those snippet will not function properly.
     
  14. drvosjeca

    drvosjeca New Member

    Here is the link to website...

    squidoos.com

    I hope there is a way to do something about it, spam im getting last few days is killing me.
     
  15. PuckRobin

    PuckRobin New Member

  16. drvosjeca

    drvosjeca New Member

    hmm... I see this option with JS, but im not sure how to implement it corectly.

    server side url check is something i thought about before, but this is something i even know less about then JS :)

    any sugestions?
     
  17. PuckRobin

    PuckRobin New Member

    What more suggestions are you looking for? If you cannot do it yourself, just hire a developer to do it for yourself :)
     
  18. frytec

    frytec Member

    @drvosjeca, that solution at stackoverflow that puckrobin just pointed is VERY easy to implement dude... Give it a try.

    the file you need to edit is submit1.php

    the name of the submit button youre looking for is submit_button_1

    probably what you have to do is find

    Code:
    <input id="submit_button_1" type='submit' class='submit' name='submit' value='<?php echo $h->lang['main_form_next']; ?>' />
    and replace with

    Code:
    <input id="submit_button_1" type='submit' class='submit' name='submit' value='<?php echo $h->lang['main_form_next']; ?>' disabled />
    
    <script type="text/javascript">
    var _onload = window.onload || function()
    {
      document.getElementById('submit_button_1').disabled = false;
    }
    
    _onload();
    </script>
    someone pls correct me if im wrong.
     
  19. drvosjeca

    drvosjeca New Member

    Sorry man, i was just trying to get things clear... :)

    I have solved this with javascript, thanks for provided link @PuckRobin. After i got some sleep it was easy to do it. I just hope this will work fine... will see :)
     
    Last edited: May 2, 2012
  20. drvosjeca

    drvosjeca New Member

    You are right... As i said, I just needed some sleep :)
     

Share This Page