Skip to content

Instantly share code, notes, and snippets.

@jblac
jblac / login.js
Last active December 10, 2015 10:29
$('form').on('submit', function(e) {
e.preventDefault();
$.ajax({
type: "POST",
url: $(this).attr('action'),
data: $(this).serialize(),
success: function(resp) {
var obj = $.parseJSON(resp);
if (obj.resp == 0) {
$(this).alertBox(obj.err, { type: 'error'});
<?php
class user extends CI_Controller {
public function __construct() {
parent::__construct();
}
function login() {
$data = '';
<?php
/**
* Date: 12/31/12
* Time: 9:36AM
* Model corresponding to all actions one can take on a users account.
*/
class bm_users extends CI_Model {
function login($data) {
$.fn.resetForm = function() {
$(this).removeAlertBoxes();
return this.each(function() {
// guard against an input with the name of 'reset'
// note that IE reports the reset function as an 'object'
if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
this.reset();
});
};
$('form').on("submit", function(e) {
$.ajax({
type: "POST",
url: $(this).attr('action'),
data: $(this).serialize(),
success: function(resp) {
var obj = $.parseJSON(resp);
if (obj.resp == 0) {
$(this).removeAlertBoxes();
$(this).alertBox(obj.err, { type: 'error'});
<?php
class BM_Controller extends CI_Controller {
function __construct() {
parent::__construct();
$logged = $this->check_login();
$cArray = array('login', 'logout');
$this->load->helper('url');
<?php
/**
* Created by JetBrains PhpStorm.
* User: bonk
* Date: 1/6/13
* Time: 1:55 PM
* To change this template use File | Settings | File Templates.
*/
class users extends BM_Controller {
function include(script) {
$.ajax({
url: script,
dataType: "script",
async: false,
success: function() {
// everything works fine
},
error: function() {
throw new Error("Could not load script " + script);
<!--[if IE]>
<style type="text/css">
html { display: none; }
</style>
<![endif]-->
<?php
function get_catalog_new($column=1, $storeID=0, $parentID=0, $isFront=0) {
if ($isFront != 0) {
// information is being pulled from the new front end.
$newJoin = "LEFT JOIN ic_product_stores as st ON $storeID = st.storeID AND prod.productID = st.productID";
$extsql = " AND st.oos = 0";
} else {
// information is being pulled from the administration panel.
$newJoin = '';
$extsql = '';