Removing link from botdetect captcha in code igniter - codeigniter

I am using Botdetect captcha, But i need to remove the link they have given below the image captcha, how to remove it
BotDetect CAPTCHA Library for CodeIgniter
Here is the image

add code top site
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("a[title ~= 'BotDetect']").removeAttr("style");
$("a[title ~= 'BotDetect']").removeAttr("href");
$("a[title ~= 'BotDetect']").css('visibility', 'hidden');
});
</script>

I had used botdetect captcha for non commercial use,
where I was able to successfully removed the link and title .
Path of file to be modified ,
vendor/captcha-com/examples/captcha/lib/botdetect/CaptchaInculdes.php
private static function iqy23{
return '';
}
And
public static function GetHelpLinkText($_1qfl5bimwvnl8fd7, $_iitpwcsaaap742gstb7q5) {
return '';
}
Return blank in above two functions.
Hope it helps someone looking for non commercial use or who is willing to understand the algorithm ,
it is always recommendable to purchase the paid version for commercial use.
Cheers :)

Read the below links. I suggest you can convert the help link mode to image instead. It will hide the text from getting displayed and instead captcha will be clickable.
https://captcha.com/doc/java/captcha-options.html#captcha_help_link_mode
https://captcha.com/license/captcha-free-version-limitations.html#link

You can add HelpLinkMode property with "Image" value
Like this:
<BotDetect:WebFormsCaptcha ID="ExampleCaptcha" UserInputID="CaptchaCode" runat="server" HelpLinkMode="Image"/>

You can make a div over the legend:
<botDetect:captcha id="miCaptcha" userInputID="captchaCode" codeLength="4" imageWidth="150" imageStyle="GRAFFITI2"/>
<div id="tapa" style="background-color: #ffffd9;height: 10px;width: 150px;position: relative;top: -10px;"></div>

Related

check in blade view if image is loaded or 404

Is there a way to check in a blade view if an image is really there or not?
I need to show results from a search box.
The results are many boxes with infos and a picture for each box.
The point is in my DB I store links to images that are on remote servers and also name of images that are stored locally.
So what I am doing is check if the file exists locally and if so use it and if not look on the remote server (if the picture data is not NULL it's either there or in a remote server).
I was trying to check if file exists using curl and it works but for big collections it takes too much time to finally spit the data to the view (every link has to be checked).
So what I want to do, if possible, is check directly in the blade view if the picture is not broken (404) and if so replace with an "image-not-found.png" I store locally. How can I do that?
I usually handle this with JavaScript using the img tag's onerror event. Typically I add a few more bells and whistles to the solution but this is it in a nutshell.
Plan JavaScript
function loadNextImage(id,uri){
document.getElementById(id).src = uri;
}
Plain HTML
<img src="http://local/image.jpg"
onerror="loadNextImage('image1', 'http://remote/imae.jpg'));"
id='image1' />
VueJS and Webpack
<template>
<img :src="local_url" #error="imgOnError()" ref="image"/>
</template>
<script>
export default{
name: 'Thumbnail',
props: {
local_url: String,
remote_url: String
},
methods: {
imgOnError: function (e) {
this.$refs.image.src = this.remote_url
}
}
}
</script>
You can use the func "file_get_contents" inside a try-catch block. I know i not the best way, but i could work for you.
Tray this (no the best way):
<?php
try{
$img = 'myproject.dev/image.jpg';
$test_img = file_get_contents($img);
echo "<img src='{$img}'>";
}catch(Exception $e){
echo "<img src='img/no-img.jpg'>";
}
?>

Google ReCaptcha reload button does not work in Joomla 1.5

I'm working in an implementation of ReCaptcha from Google in my Joomla 1.5 application. I know, it's an old version of Joomla, but as the time got passed, the hard code practice at the company made the upgrading impossible.
I found an old ReCaptcha plugin for Joomla 1.5 at https://code.google.com/p/joomla-recaptcha/, by the way, recommended by developers.google (https://developers.google.com/recaptcha/old/intro).
That plugin is really simple to use. Enough to install the plugin and enable it. This way it's only a matter of use its static methods. One thing I had to do was change the path to the ReCaptcha ajax API, both in components/com_community/helpers/recaptcha.php and in plugins/system/recaptcha/recaptchalib.php. That's because the plugin reference the old path.
I'm working well with server side part of ReCaptcha. So I'm mostly concerned with a client-side issue. To display ReCaptcha snippet, is only a matter of include the line
<div><?php echo ReCaptcha::get('html'); ?></div>
in the template .php.
The ReCaptcha::get static method generates the following piece of code in my template
<div>
<div id='recaptcha_ajax_instance_'></div>
<script type='text/javascript' src='http://www.google.com/recaptcha/api/js/recaptcha_ajax.js'></script>
<script type='text/javascript'>
(function(){
function loadRecaptcha(){
Recaptcha.create('6LcKaAgTAAAAAP3CgGF04VUsWTPGwzDs3EaVlajH','recaptcha_ajax_instance_');
}
if( window.addEvent ){
window.addEvent('domready', loadRecaptcha);
}
else{
if( window.addEventListener ){ window.addEventListener('load', loadRecaptcha); }
else if( window.attachEvent ){ window.attachEvent('onload', loadRecaptcha); }
else{ old = window.onload; window.onload = function(){ if( old && typeof old == 'function'){ old(); } loadRecaptcha(); }; }
}
})();
</script>
</div>
That issue is simply the button to reload captcha doesn't work. Neither mouse changes to pointer when hovering button, nor button change the words when clicked. The two other buttons (audio chalange and help) work well.
I wondering if the code above is outdated with the most updated API in google URL.
If somebody could help, I appreciate.

Reloading everything but one div on a web page

I'm trying to set up a basic web page, and it has a small music player on it (niftyPlayer). The people I'm doing this for want the player in the footer, and to continue playing through a song when the user navigates to a different part of the site.
Is there anyway I can do this without using frames? There are some tutorials around on changing part of a page using ajax and innerHTML, but I'm having trouble wrapping my head aroung getting everything BUT the music player to reload.
Thank you in advance,
--Adam
Wrap the content in a div, and wrap the player in a separate div. Load the content into the content div.
You'd have something like this:
<div id='content'>
</div>
<div id='player'>
</div>
If you're using a framework, this is easy: $('#content').html(newContent).
EDIT:
This syntax works with jQuery and ender.js. I prefer ender, but to each his own. I think MooTools is similar, but it's been a while since I used it.
Code for the ajax:
$.ajax({
'method': 'get',
'url': '/newContentUrl',
'success': function (data) {
// do something with the data here
}
});
You might need to declare what type of data you're expecting. I usually send json and then create the DOM elements in the browser.
EDIT:
You didn't mention your webserver/server-side scripting language, so I can't give any code examples for the server-side stuff. It's pretty simple most of time. You just need to decide on a format (again, I highly recommend JSON, as it's native to JS).
I suppose what you could do is have to div's.. one for your footer with the player in it and one with everything else; lets call it the 'container', both of course within your body. Then upon navigating in the site, just have the click reload the page's content within the container with a ajax call:
$('a').click(function(){
var page = $(this).attr('page');
// Using the href attribute will make the page reload, so just make a custom one named 'page'
$('#container').load(page);
});
HTML
<a page="page.php">Test</a>
The problem you then face though, is that you wouldnt really be reloading a page, so the URL also doesnt get update; but you can also fix this with some javascript, and use hashtags to load specific content in the container.
Use jQuery like this:
<script>
$("#generate").click(function(){
$("#content").load("script.php");
});
</script>
<div id="content">Content</div>
<input type="submit" id="generate" value="Generate!">
<div id="player">...player code...</div>
What you're looking for is called the 'single page interface' pattern. It's pretty common among sites like Facebook, where things like chat are required to be persistent across various pages. To be honest, it's kind of hard to program something like this yourself - so I would recommend standing on top of an existing framework that does some of the leg work for you. I've had success using backbone.js with this pattern:
http://andyet.net/blog/2010/oct/29/building-a-single-page-app-with-backbonejs-undersc/
You can reload desired DIVs via jQuery.ajax() and JSON:
For example:
index.php
<script type="text/javascript" src="jquery-1.4.2.js"></script>
<script type="text/javascript" src="ajax.js"></script>
<a href='one.php' class='ajax'>Page 1</a>
<a href='two.php' class='ajax'>Page 2</a>
<div id='player'>Player Code</div>
<div id='workspace'>workspace</div>
one.php
<?php
$arr = array ( "workspace" => "This is Page 1" );
echo json_encode($arr);
?>
two.php
<?php
$arr = array( 'workspace' => "This is Page 2" );
echo json_encode($arr);
?>
ajax.js
jQuery(document).ready(function(){
jQuery('.ajax').click(function(event) {
event.preventDefault();
// load the href attribute of the link that was clicked
jQuery.getJSON(this.href, function(snippets) {
for(var id in snippets) {
// updated to deal with any type of HTML
jQuery('#' + id).html(snippets[id]);
}
});
});
});

Getting raw text using #Html.ActionLink in Razor / MVC3?

Given the following Html.ActionLink:
#Html.ActionLink(Model.dsResults.Tables[0].Rows[i]["title"].ToString(), "ItemLinkClick",
new { itemListID = #Model.dsResults.Tables[0].Rows[i]["ItemListID"], itemPosNum = i+1 }, ...
Data from the model contains HTML in the title field. However, I am unable to display the HTML encoded values. ie. underlined text shows up with the <u>....</u> around it.
I've tried Html.Raw in the text part of the ActionLink, but no go.
Any suggestions?
If you still want to use a helper to create an action link with raw HTML for the link text then I don't believe you can use Html.ActionLink. However, the answer to this stackoverflow question describes creating a helper which does this.
I would write the link HTML manually though and use the Url.Action helper which creates the URL which Html.ActionLink would have created:
<a href="#Url.Action("ItemLinkClick", new { itemListID = #Model.dsResults.Tables[0].Rows[i]["ItemListID"], itemPosNum = i+1 })">
#Html.Raw(Model.dsResults.Tables[0].Rows[i]["title"].ToString())
</a>
MVCHtmlString.Create should do the trick.
Using the actionlink below you do not need to pass html in the model. Let the css class or inline style determine how the href is decorated.
#Html.ActionLink(Model.dsResults.Tables[0].Rows[i]["title"], "ItemLinkClick", "Controller", new { #class = "underline", style="text-decoration: underline" }, null)
those are the cases that you should take the other path
#{
string title = Model.dsResults.Tables[0].Rows[i]["title"].ToString(),
aHref = String.Format("/ItemLinkClick/itemListID={0}&itemPosNum={1}...",
Model.dsResults.Tables[0].Rows[i]["ItemListID"],
i+1);
}
#Html.Raw(title)
Remember that Razor helpers, help you, but you can still do things in the HTML way.
You could also use this:
<a class='btn btn-link'
href='/Mycontroler/MyAction/" + item.ID + "'
data-ajax='true'
data-ajax-method='Get'
data-ajax-mode='InsertionMode.Replace'
data-ajax-update='#Mymodal'>My Comments</a>

Validating HTML 5 with REL

I have browsed for a question similar to this but haven't happened to find exactly what i need but apologies if it has been answered somewhere.
I have started using java script light-boxes in my webpage to display images and am told to place on the links:
This means that the images now open in lightboxes however an HTML 5 validator says that 'lightbox' is obviously not an allowed link type.
How can i relate the required links to the lightbox java script so that it validates?
thanks alot in advance,
matt
Either
Ignore the validation errors (as they don't cause any problems), or
Change from rel="lightbox" to something like data-lightbox="true". Any attribute starting with "data-" is allowed and valid in HTML5.
Matthew's answer works, but you must remember to customize your lightbox source code as well. The example of such a modification you can see here: http://wasthere.com/lightbox2/js/custom-lightbox.js - it works (you can see here e.g. http://wasthere.com/asia/en/show-entry/141/kerala---munnar-(india) ), HTML5 validation passes. Check the comments in source file above, if you decide to use it - just change all "rel" attributes relevant to light box images to "data-rel" on your site.
Best regards,
Lukas
what helped me validating it, is based on what was stated above:
Javascript
function externalLinks()
{
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++)
{
var anchor = anchors[i];
if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
{
anchor.target = "_blank";
}
if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "lightbox")
{
anchor.setAttribute('data-lightbox','lightbox');
}
}
}
window.onload = externalLinks;
HTML:
<a href='assets/newsTemplate/07_350wtd.jpg' rel='lightbox' title='DumbThumb'><img src='assets/newsTemplate/07_350wtd.jpg' alt='dumb'></img></a>
A si lo solucione:
Modifico el html:
<a href="img/2.jpg" data-rel="lightbox" title="" >
Modifico el javascript:
jQuery(function($) {
$("a[data-rel^='lightbox']").slimbox({/* Put custom options here */}, null, function(el) {
return (this == el) || ((this.rel.length > 8) && (this.rel == el.rel));
});
});
}

Resources