php

unable to get resopnse from google recaptcha

I am working in an application by using codeigniter framework back end as mysql. in login page i am trying to apply Google recaptcha as given by https://developers.google.com/recaptcha/ For this i have added curl.php library in application/library given by https://github.com/philsturgeon/codeigniter-curl/tree/master/libraries and in my controller i am writing following code $recaptchaResponse = trim($this->input->post(‘g-recaptcha-response’)); $userIp=$this->input->ip_address(); $secret=’MY_KEY’; $url=”https://www.google.com/recaptcha/api/siteverify?secret=”.$secret.”&response;=”.$recaptchaResponse.”&remoteip;=”.$userIp; $response = $this->curl->simple_get($url); $status= json_decode($response,…
Read more

Remove all am/pm but the first instance in an array

I have an arrays of time slots in $a: 10:00 am,11:00 am,12:00 pm,01:00 pm,02:00 pm,03:00 pm,04:00 pm I would like to remove all but the first instance of am/pm from the array: 10:00 am,11:00,12:00 pm,01:00 pm,02:00,03:00, 04:00 str_replace() will take them all out. preg_replace will let me limit how many I take out but will not let me take out…
Read more

JQuery Pagination + JSON

Javascript $(‘td’, ‘table’).each(function(i) { $(this).text(i+1); }); $(‘table.paginated’).each(function() { var currentPage = 0; var numPerPage = 2; var $table = $(this); $table.bind(‘repaginate’, function() { $table.find(‘tbody tr’).hide().slice(currentPage * numPerPage, (currentPage + 1) * numPerPage).show(); }); $table.trigger(‘repaginate’); var numRows = $table.find(‘tbody tr’).length; var numPages = Math.ceil(numRows / numPerPage); var $pager = $(‘<div class=”pager”></div>’); for (var page = 0; page < numPages; page++) {…
Read more

trying to upload a file using ajax file uploaded but in currupted php ajax jquery

I am trying to upload a file using php ajax jquery file is uploading but in corrupted format how can i make it correct. in my controller i am using $product_image = $request->getParam(“product_image”); defined(‘PUBLIC_PATH’) || define(‘PUBLIC_PATH’, realpath(dirname(dirname(dirname(dirname(dirname(__FILE__))))))); $filename = time() . rand(10000, 99999) . “.jpg”; file_put_contents(PUBLIC_PATH . “/public_html/product_images/” . $filename, base64_decode($product_image)); $products->__set(“product_image”, $filename); $data = array( “product_image” => $this->view->baseUrl() ….
Read more

Mysql ORDER BY RAND()

I have a table storing the usage count of topics used, for each subsequent request increases the usage count. I have added a query to return the least used topic. SELECT b.body, n.nid FROM node n LEFT JOIN body b ON n.nid = b.entity_id LEFT JOIN topic_usage u ON n.nid = u.entity_id LEFT JOIN reference r ON n.nid = r.entity_id…
Read more

cannot find “mysql” in PHPinfo();

I have install php-mysql in my linux server,and restart apache server,but it cannot suport “mysql_connect” function. I have search “mysql” in my phpinfo page,there is no “mysql” words in my phpinfo page. How to solve this problem? Source: php

how to append login credentials to url in php

i have two accounts(admin and user). when the user create account, his information is sent to admin email. Now i want the email to have a link, such that when the admin click the link, he is able to login automatic to website account and view the user details. I do not have an idea of how to go about…
Read more

how to create a button to learn a javascript function but the page cannot be refreshed

i am developing a application that can show the point in the map using google maps api and php but i had a button if you clique for searching the page refreshed …. please if you have asolution help me <?php $host = “localhost”; $user = “postgres”; $password = “20152016”; $db = “Projet”; $con = pg_connect(“host=$host dbname=$db user=$user password=$password”) or…
Read more