Foros del Web » Programando para Internet » PHP »

CodeIgniter simplecatpcha.js en codeignaiter

Estas en el tema de simplecatpcha.js en codeignaiter en el foro de PHP en Foros del Web. hola hoy les escribo para saber si alguien me puede colaborar el problema es lo siguiente estoy utilizando simplecatpchar.js que lo encuentran en [URL="http://jordankasper.com/jquery/captcha/examples2.php"]http://jordankasper.com/jquery/captcha/examples2.php[/URL] esta ...
  #1 (permalink)  
Antiguo 08/10/2012, 17:24
 
Fecha de Ingreso: septiembre-2012
Mensajes: 12
Antigüedad: 11 años, 6 meses
Puntos: 0
simplecatpcha.js en codeignaiter

hola hoy les escribo para saber si alguien me puede colaborar el problema es lo siguiente estoy utilizando simplecatpchar.js que lo encuentran en [URL="http://jordankasper.com/jquery/captcha/examples2.php"]http://jordankasper.com/jquery/captcha/examples2.php[/URL] esta sirve para crear un catpcha seleccionando una imagen pero el problema es lo siguiente me funciona muy bien en un proyecto normal pero si lo quiero utilizar con condeignaiter no me funciona el archivo simplecaptcha.php que es el encargado de cargar las imágenes si lo coloco fuera de la carpeta de application me funciona normal pero si lo meto dentro de esta carpeta no me muestra las imagenes solo me funciona los js espero que alguien tenga la solucion

Código PHP:
<?php // PHP code on the server where the form is submitted to
session_start();
// Sample PHP code
?>
<html>
<head>
    <title></title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="http://localhost/kidon/js/jquery.simpleCaptcha-0.2.min.js"></script>
<script type="text/javascript" src="http://localhost/kidon/js/jquery.simpleCaptcha-0.2.js"></script>
<script type="text/javascript">
$(document).ready(function() {
  $('#captcha1').simpleCaptcha();
});
</script>
</head>
<body>
<form method='POST' action="verifica.php">
  <div id='captcha1'></div>
  <input type='submit'/>
</form>
</body>
</html>
Código PHP:
<?php // PHP code on the server where the form is submitted to
session_start();
// Sample PHP code

// This is the PHP code you need to use on form submission to see if the user got the 
// captcha right. Note that this is for "POST" requests, and you may need to alter the 
// code to suit your needs.
if (isset($_SESSION['simpleCaptchaAnswer']) && $_POST['captchaSelection'] == $_SESSION['simpleCaptchaAnswer']) {
  echo
"si sirve";
}
else{ echo
"no sirver"; };
?>
simplecatpchat.php
Código PHP:
<?php
// This is the handler for captcha image requests
// The captcha ID is placed in the session, so session vars are required for this plug-in
session_start();

// -------------------- EDIT THESE ----------------- //
$images = array(
  
'casa'=> 'captchaImages/01.png',
  
'llave'=> 'captchaImages/04.png',
  
'bandera'=> 'captchaImages/06.png',
  
'reloj'=> 'captchaImages/15.png',
  
'bicho'=> 'captchaImages/16.png',
  
'lapiz'=> 'captchaImages/19.png',
  
'bombilla'=> 'captchaImages/21.png',
  
'nota musical'=> 'captchaImages/40.png',
  
'corazon'=> 'captchaImages/43.png',
  
'mundo'=> 'captchaImages/99.png'
);
// ------------------- STOP EDITING ---------------- //

$_SESSION['simpleCaptchaAnswer'] = null;
$_SESSION['simpleCaptchaTimestamp'] = time();
$SALT "o^Gj".$_SESSION['simpleCaptchaTimestamp']."7%8W";
$resp = array();

header("Content-Type: application/json");

if (!isset(
$images) || !is_array($images) || sizeof($images) < 3) {
  
$resp['error'] = "There aren\'t enough images!";
  echo 
json_encode($resp);
  exit;
}

if (isset(
$_POST['numImages']) && strlen($_POST['numImages']) > 0) {
  
$numImages intval($_POST['numImages']);
} else if (isset(
$_GET['numImages']) && strlen($_GET['numImages']) > 0) {
  
$numImages intval($_GET['numImages']);
}
$numImages = ($numImages 0)?$numImages:5;
$size sizeof($images);
$num min(array($size$numImages));

$keys array_keys($images);
$used = array();
mt_srand(((float) microtime() * 587) / 33);
for (
$i=0$i<$num; ++$i) {
  
$r rand(0$size-1);
  while (
array_search($keys[$r], $used) !== false) {
    
$r rand(0$size-1);
  }
  
array_push($used$keys[$r]);
}
$selectText $used[rand(0$num-1)];
$_SESSION['simpleCaptchaAnswer'] = sha1($selectText $SALT);

$resp['text'] = ''.$selectText;
$resp['images'] = array();

shuffle($used);
for (
$i=0$i<sizeof($used); ++$i) {
  
array_push($resp['images'], array(
    
'hash'=>sha1($used[$i] . $SALT),
    
'file'=>$images[$used[$i]]
  ));
}
echo 
json_encode($resp);
exit;
?>

Etiquetas: codeigniter, html, imagenes
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 23:25.