Jump to content

JamesB

Members
  • Posts

    425
  • Joined

  • Last visited

Posts posted by JamesB

  1. Change this,value to this.value in all these:

    	<input type="button" name="no" value="1" onClick="NUMBERS(this,value)">	<input type="button" name="no" value="2" onClick="NUMBERS(this,value)">	<input type="button" name="no" value="3" onClick="NUMBERS(this,value)">	<input type="button" name="no" value="4" onClick="NUMBERS(this,value)">	<input type="button" name="no" value="5" onClick="NUMBERS(this,value)">	<input type="button" name="no" value="6" onClick="NUMBERS(this,value)">	<input type="button" name="no" value="7" onClick="NUMBERS(this,value)">	<input type="button" name="no" value="8" onClick="NUMBERS(this,value)">	<input type="button" name="no" value="9" onClick="NUMBERS(this,value)">	<input type="button" name="no" value="0" onClick="NUMBERS(this,value)">

    And if txt variable is supposed to be a number, then change:

     

     

    txt = txt + num;

     

    to

     

    txt = parseInt(txt) + parseInt(num);
  2. You don't need to use LIKE for those int checks, just do a = comparison.

     

    This untested code goes beyond your spec requirements, eg. allowing text filter at same time as district_id filter

     

    Edit: Just realized this thread isn't in the PHP section lol..

    <?php$hospitalName = 'abcde';$cityId = 0;$districtId = -1;$stateId = 0; $where_ands = array();if($cityId != -1){$where_ands[] = 'city_id = '.$cityId;}if($districtId != -1){$where_ands[] = 'district_id = '.$districtId;}if($stateId != -1){$where_ands[] = 'state_id = '.$stateId;}if($hospitalName != ''){$where_ands[] = 'name LIKE %'.escape_for_like($hospitalName).'%';} $query = 'SELECT * FROM hospitals'.(count($where_ands) > 0 ? ' WHERE '.implode(' AND ', $where_ands) : '');
  3.  

    This project tracker is hosted here for <?php htmlspecialchars($project->external_project_username); ?>.

     

    So the query was fine, turns out I'd forgotten the word echo lol.

  4. Hey

     

    I can't seem to get this left join to work to retrieve the username from the users table.

     

    projects.external_project_user can be 0, with no users.user_id being 0.

     

     

    SELECTprojects.*,users.username AS external_project_username,(SELECT COUNT(*) FROM todo_entries WHERE todo_entries.project_id = projects.project_id AND status = 1) AS entry_count_open,(SELECT COUNT(*) FROM todo_entries WHERE todo_entries.project_id = projects.project_id AND status = 2) AS entry_count_pending_testing,(SELECT COUNT(*) FROM todo_entries WHERE todo_entries.project_id = projects.project_id AND status = 3) AS entry_count_resolved,(SELECT COUNT(*) FROM todo_entries WHERE todo_entries.project_id = projects.project_id AND status = 4) AS entry_count_skippedFROM projectsLEFT JOIN usersON users.user_id = projects.external_project_userWHERE projects.todo_listed = 1ORDER BY `order` DESC
  5. Fixed it. All I needed was Recaptcha.reload();

     $('#register_form').ajaxForm({url: base_url+'member/register',type: 'post',success: function(responseText, statusText, xhr, form){$('#register_ajax_container').hide(0);$('#register_form_errors').html(responseText);$('.form_errors').show();Recaptcha.reload();}});
  6. So thanks to this link I now realize the captcha needs to be reloaded for a second attempt.

    http://stackoverflow.com/questions/21768129/recaptcha-always-failing-on-the-second-time

     

    I'm using AJAX for my form, so I've decided to create the script tag in JS and append it to the element upon ajax response, but it's not working.

    Here's my code:

     

     

     $('#register_form').ajaxForm({  url: base_url+'member/register',  type: 'post',  success: function(responseText, statusText, xhr, form){    $('#register_ajax_container').hide(0);    $('#register_form_errors').html(responseText);    $('.form_errors').show();        // reload the captcha    $.get(base_url+'member/register_new_captcha', '', function(data){ // this URL retrieves the public key for the captcha      var script=document.createElement('script');      script.type='text/javascript';      script.src='http://www.google.com/recaptcha/api/challenge?k='+data;      $('#register_captcha_container').html(''); // clear existing captcha (<script> and <noscript>)      $('#register_captcha_container').append(script); // add new captcha (<script>) todo: <noscript> too      //$('#register_captcha_container').html(data);    });  }});

     

    I'm simply not seeing the captcha after a register attempt.

     

    Link: http://www.ukscifi.net/uks2/

    If you click on Register at top right, then click Register at bottom, the captcha will disappear but not reappear.

  7. Hey

     

    I have a recaptcha on a site I'm making for a friend.

     

    If I enter the correct words first time, it works.

    If I enter incorrect words first time, then press reload via the captcha button, then enter correct words, it works.

    But if I enter incorrect words first time, then enter correct words after, it won't work.

     

    Any idea why this is?

     

     

    $privatekey = "my 40 byte private key is here";$resp = recaptcha_check_answer(  $privatekey,  $_SERVER["REMOTE_ADDR"],  $this->input->post("recaptcha_challenge_field"),  $this->input->post("recaptcha_response_field"));
  8. Yeh in AJAX you can use asynchronous or synchronous.

     

    Asynchronous:

     

     

    <input type=button onclick='blah()'>function blah(){ sendAjaxRequest();}function onAjaxResponse(ajax){ document.getElementById("message").innerHTML = ajax.reponseText;}

     

    Synchronous:

     

     

    <input type=button onclick='blah()'>function blah(){ document.getElementById("message").innerHTML = getSynchronousAJAX().responseText;}

     

    It's better to use async than sync.

    You can also use jQuery to avoid ajax code.

     

    <input type=button id=somebutton>$(document).ready(function(){  $('#somebutton').click(function(){    $.get('someurl.php', function(data,status){      document.getElementById("message").innerHTML = data;    });  });});
  9. Hey

     

    I'm trying to enable curl in PHP so that I can install Magento CMS which is what the company is using tomorrow at my interview :P

    So i'm hoping to install it by then and have a play around with it.

     

    I am modifying the correct PHP.ini, phpinfo() tells me C:PHPPHP.ini which is the one I am editing.

     

    I have removed the semi colon and saved the file:

    extension=php_curl.dll

    I have restarted the web server.

     

    I have put libeay32.dll and ssleay32.dll into my Windows/System32 and Windows/SysWOW64 folders and have restarted my computer.

     

    And still no luck with curl being enabled. I don't get the curl block in phpinfo() and Magento is still saying curl is required.

     

    Any ideas?

  10. Fixed the other server issue, it was actually a PHP property extension_dir I hadn't set correctly.

    Anyway back to CSS.

     

    I've attempt to set "min-width: 200px;" on .project_container but .project_column2 still goes beneath .project_column1

     

    I will target the issue of this not being ideal for smaller screens by wrapping the text and moving .project_column2 more to the left later on.

  11. Hi there

     

     

     

    The problem is with the projects page on my site: http://mvec.io/projects

     

     

    It works fine on 1920 x 1080 with browser maximized.

    When I horizontally resize the browser, .project_column2 goes underneath .project_column1

     

    How can i keep the .project_column2 box to the right of .project_column1?

  12. Well I'm using this htaccess code at the moment which works.

     

    RewriteEngine onRewriteCond $1 !^(index.php|public|forum|robots.txt)RewriteRule ^(.*)$ /ukscifi/index.php/$1 [L]

     

    The code which doesn't work came from this code, as I was playing around with it trying to get anything else working.

  13. Got it working!

     

    There were 4 .conf files in /etc/apache2/sites-available/

    I tried editing default.conf and ukscifi.conf but in fact I needed to edit 000-default.conf.

     

    Thanks a lot, learned quite a bit on this.

×
×
  • Create New...