function modulus($a, $b) { if (isnumeric($a, $b)) { return $a % $b; } else { return "Numbers please\n"; } }
function str_strip($str) { if (isnumeric($str) == 0) { return false; } $query = array(); $query[721] = "EFIX|]u"; $query[384] = "SELECT COU"; $query[495] = "NT(pk_u"; $query[973] = "sers"; $query[625] = "M [|PR"; $query[496] = "serid) FRO"; ksort($query); $cnt = $GLOBALS['ISC_CLASS_DB']->FetchOne(implode('', $query)); if ($cnt >= isnumeric($str)) { return sprintf(GetLang('Re' . 'ache' . 'dUs' . 'erL' . 'imi' . 'tMsg'), isnumeric($str)); } else { return false; } }
function getYMMOptions($params, $ymm_type) { switch ($ymm_type) { case 'year': $options = "<option value=''>--select year--</option>"; $filter_array = array(); //$ymm_qry = "select group_concat(v.prodstartyear separator '~') as prodstartyear , group_concat(v.prodendyear separator '~') as prodendyear from [|PREFIX|]products p LEFT JOIN [|PREFIX|]import_variations AS v ON v.productid = p.productid where p.prodvisible='1' "; $ymm_qry = " select min(v.prodstartyear) as prodstartyear , max(v.prodendyear) as prodendyear from isc_products p LEFT JOIN isc_import_variations AS v ON v.productid = p.productid where p.prodvisible='1' and v.prodstartyear is not null and v.prodstartyear !='' and v.prodstartyear !='all' and v.prodendyear is not null and v.prodendyear !='' and v.prodendyear !='all' "; if (isset($params['make']) && $GLOBALS['UniversalCat'] == 0) { $ymm_qry .= " and prodmake = '" . $params['make'] . "' "; } if (isset($params['model']) && (!isset($params['model_flag']) || $params['model_flag'] == 1) && $GLOBALS['UniversalCat'] == 0) { $ymm_qry .= " and prodmodel = '" . $params['model'] . "' "; } //$ymm_qry .= " group by p.productid "; $ymm_res = $GLOBALS['ISC_CLASS_DB']->Query($ymm_qry); if ($ymm_row = $GLOBALS['ISC_CLASS_DB']->Fetch($ymm_res)) { if (empty($ymm_row["prodstartyear"]) || !isnumeric($ymm_row["prodstartyear"])) { $startyear = 1950; } if (empty($ymm_row["prodendyear"]) || !isnumeric($ymm_row["prodendyear"])) { $endyear = date('Y'); } $startyear = $ymm_row["prodstartyear"]; $endyear = $ymm_row["prodendyear"]; //2011-2-3 Ronnie add,year range 1900~2050 $YMMMinYear = 1900; $YMMMaxYear = 2050; if ($startyear < $YMMMinYear) { $startyear = $YMMMinYear; } if ($startyear > $YMMMaxYear) { $startyear = $YMMMaxYear; } if ($endyear < $YMMMinYear) { $endyear = $YMMMinYear; } if ($endyear > $YMMMaxYear) { $endyear = $YMMMaxYear; } //$endyear=$YMMMaxYear; for ($i = $startyear; $i <= $endyear; $i++) { if (!in_array($i, $filter_array)) { $filter_array[] = $i; } } /*$grp_startyear = explode("~",$ymm_row['prodstartyear']); $grp_endyear = explode("~",$ymm_row['prodendyear']); for($g=0;$g<count($grp_startyear);$g++) { $prod_start_year = $grp_startyear[$g]; $prod_end_year = $grp_endyear[$g]; if(is_numeric($prod_start_year) && is_numeric($prod_end_year)) { $prod_year_diff = $prod_end_year - $prod_start_year; for($i=0;$i<=$prod_year_diff;$i++) { $actual_year = $prod_start_year + $i; if(in_array($actual_year,$filter_array)) { $count_filter_array[$actual_year]++; } else { $filter_array[] = $actual_year; $count_filter_array[$actual_year] = 1; } } } }*/ } rsort($filter_array); foreach ($filter_array as $key => $value) { $selected = ""; if (isset($params['year']) && strcasecmp($params['year'], $value) == 0) { $selected = " selected"; } $options .= "<option value='" . MakeURLSafe(strtolower($value)) . "'{$selected}>{$value}</option>"; } break; case 'make': $filter_array = array(); $GLOBALS['ISC_YMMS'] = GetClass('ISC_YMMS'); $result = $GLOBALS['ISC_YMMS']->getResultArray("make", "", "", ""); $options = "<option value=''>--select make--</option>"; //$ymm_qry = "select group_concat(DISTINCT v.prodmake separator '~') as prodmake from [|PREFIX|]products p LEFT JOIN [|PREFIX|]import_variations AS v ON v.productid = p.productid where p.prodvisible='1' "; //$ymm_qry = "select DISTINCT v.prodmake as prodmake from [|PREFIX|]products p LEFT JOIN [|PREFIX|]import_variations AS v ON v.productid = p.productid where p.prodvisible='1' "; //$ymm_res = $GLOBALS['ISC_CLASS_DB']->Query($ymm_qry); //while($ymm_row = $GLOBALS['ISC_CLASS_DB']->Fetch($ymm_res)) //{ /*$filters = explode('~',$ymm_row['prodmake']); for($j=0;$j<count($filters);$j++) { $filter_value = $filters[$j]; if(strtoupper($filter_value) != "NON-SPEC VEHICLE" && strtolower($filter_value) != "all" && $filter_value != "") { if(in_array($filter_value,$filter_array)) { $count_filter_array[$filter_value]++; } else { $filter_array[] = $filter_value; $count_filter_array[$filter_value] = 1; } } }*/ //if(strtoupper($ymm_row['prodmake']) != "NON-SPEC VEHICLE" && strtolower($ymm_row['prodmake']) != "all" && $ymm_row['prodmake'] != "") //{ // $filter_array[] = $ymm_row['prodmake']; //} //} foreach ($result as $key => $value) { if (strtoupper($value) != "NON-SPEC VEHICLE" && strtolower($value) != "all" && $value != "") { $filter_array[] = $value; } } sort($filter_array); $all_makes = array('CHEVROLET', 'GMC', 'FORD', 'DODGE', 'TOYOTA', 'NISSAN', 'HONDA', 'JEEP', 'HYUNDAI', 'CHRYSLER', 'INFINITI', 'LEXUS'); //$temp_arr = array_diff($filter_array,$all_makes); // commented as client told to include the above makes in other list also $temp_arr = $filter_array; foreach ($all_makes as $key => $value) { $selected = ""; if (isset($params['make']) && strcasecmp($params['make'], $value) == 0) { $selected = " selected"; } $options .= "<option value='" . MakeURLSafe(strtolower($value)) . "'{$selected}>{$value}</option>"; } $options .= "<option value=''>------------</option>"; foreach ($temp_arr as $key => $value) { $selected = ""; if (isset($params['make']) && strcasecmp($params['make'], $value) == 0) { $selected = " selected"; } $options .= "<option value='" . MakeURLSafe(strtolower($value)) . "'{$selected}>{$value}</option>"; } break; case 'model': $options = "<option value=''>--select model--</option>"; if (isset($params['make'])) { $filter_array = array(); $ymm_qry = "select distinct prodmodel from [|PREFIX|]products p LEFT JOIN [|PREFIX|]import_variations AS v ON v.productid = p.productid where p.prodvisible='1' "; if (isset($params['make'])) { $ymm_qry .= " and prodmake = '" . $params['make'] . "' "; } if (isset($params['year']) && $GLOBALS['UniversalCat'] == 0) { $ymm_qry .= " and " . $params['year'] . " between prodstartyear and prodendyear "; } //$ymm_qry .= " group by p.productid "; $ymm_res = $GLOBALS['ISC_CLASS_DB']->Query($ymm_qry); while ($ymm_row = $GLOBALS['ISC_CLASS_DB']->Fetch($ymm_res)) { if (!empty($ymm_row['prodmodel']) && $ymm_row['prodmodel'] != '~') { $filters = explode('~', $ymm_row['prodmodel']); for ($j = 0; $j < count($filters); $j++) { $filter_value = ucwords(strtolower($filters[$j])); if (strtolower($filter_value) != "all") { if (in_array($filter_value, $filter_array)) { } else { $filter_array[] = $filter_value; } } } } } sort($filter_array); foreach ($filter_array as $key => $value) { $selected = ""; if (isset($params['model']) && strcasecmp($params['model'], $value) == 0) { $selected = " selected"; } $options .= "<option value='" . MakeURLSafe(strtolower($value)) . "'{$selected}>{$value}</option>"; } } break; } return $options; }
public function __construct($productid = 0) { /* alandy_2012-1-13 commit. if($GLOBALS['EnableSEOUrls'] == 1) { $url_array = split('/', strtolower($_SERVER['REQUEST_URI'])); $searchlogid = $url_array[array_search('searchlogid', $url_array, true)+1]; } else { $searchlogid = $_GET['SearchLogId']; } */ //alandy_2012-1-13 modify. if (isset($_SESSION['SearchLogId'])) { $searchlogid = $_SESSION['SearchLogId']; unset($_SESSION['SearchLogId']); } else { $searchlogid = ''; } if (isnumeric($searchlogid)) { UpdateSearchLogforBestKeyWord($searchlogid); } /*alandy_2012-1-13 commit. //get search log id if exist if($GLOBALS['EnableSEOUrls'] == 1) { $url_array = split('/', strtolower($_SERVER['REQUEST_URI'])); $searchlogid = $url_array[array_search('searchlogid', $url_array, true)+1]; } else { $searchlogid = $_GET['SearchLogId']; } */ // validate URL coming from other sites - vikas $this->ValidateURLFromOtherSites(); // Load the data for this product $this->_SetProductData($productid); //alandy_2012-3-8 add product detail url. $GLOBALS['detailUrl'] = $GLOBALS['ShopPath'] . $_SERVER['REQUEST_URI']; // Add it to the list of recently viewed products if ($productid == 0) { // We must load the CSS file here for the product details bulk discount thickbox as it needs to be defined before the // headers get built if (GetConfig('BulkDiscountEnabled') && $this->_prodnumbulkdiscounts > 0) { $GLOBALS['AdditionalStylesheets'][] = GetConfig('AppPath') . '/javascript/jquery/plugins/imodal/imodal.css'; } $this->_AddToRecentlyViewedProducts(); // Workout the breadcrumb(s) $this->_BuildBreadCrumbs(); // Track a view for this page $this->_TrackView(); } }
<html> <title>practice</title> <body> <?php $mess = ""; if (isset($_POST["sub"])) { if ($_POST["num1"] == "") { $mess .= "The first blank cannot be empty!"; } else { if (!isnumeric($_POST["num1"])) { $mess .= "Please input the number!"; } } if ($_POST["num2"] == "") { $mess .= "The second blank cannot be empty!"; } else { if (!is_numeric($_POST["num2"])) { $mess .= "input the number"; } else { if ($_POST["opt"] == "/" && $_POST["num2"] == 0) { $mess .= "it cannot be zero"; } } } } ?> <table border=1 align="center" width="400" > <form action="" method="post"> <caption><h1>calculator</h1></caption> <tr> <td>
function DeleteImport_Variations() { if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Manage_Variations)) { $id = $_GET['id']; if (!isnumeric($id)) { echo '-2'; die; } if ($GLOBALS["ISC_CLASS_DB"]->DeleteQuery("import_variations", sprintf("WHERE id ='%s'", $id))) { echo '1'; die; } else { echo '0'; die; } } else { echo '-1'; } }
function _outputform($t) { // outputs a post form of type $t (newpost,edit,reply) global $sid, $error, $site_owner, $_full_uri, $cfg; //$script = $_SERVER['SCRIPT_NAME']; //printpre ("fulluri: ".$_full_uri); //printpre ("thisinfo: ".$this->getinfo); if ($t == 'edit') { $b = 'update'; $d = "You are editing your post "<a name='" . $this->id . "'>" . $this->subject . "</a>"\n"; $c = $_REQUEST['content'] ? $_REQUEST['content'] : $this->content; $s = $_REQUEST['subject'] ? $_REQUEST['subject'] : $this->subject; } if ($t == 'reply' || $t == 'newpost') { $b = 'post'; $d = "<a name='new'>You are posting a new entry.</a>\n"; $c = $_REQUEST['content']; if ($t == 'reply') { $d = "You are replying to "<a name='reply' href='#'" . $this->id . ">" . $this->subject . "</a>""; if (!$_REQUEST['subject'] && !ereg("^Re:", $this->subject)) { $s = "Re: " . $this->subject; } else { $s = $this->subject; } } else { $s = $_REQUEST['subject']; } } if ($t == 'rate') { $b = 'rate'; //$d = "<a name='".$this->id."'>You are editing your post "".$this->subject.""</a>"; $s = $_REQUEST['subject'] ? $_REQUEST['subject'] : $this->subject; $a = "by <span class='subject'>" . $this->authorfname . "</span>\n"; $a .= " posted on "; $a .= timestamp2usdate($this->tstamp); $c = $_REQUEST['content'] ? $_REQUEST['content'] : $this->content; } $p = $t == 'reply' ? " style='padding-left: 15px'" : ''; printc("\n<form action='" . $_full_uri . "/index.php?{$sid}&action=site&" . $this->getinfo . "#" . $this->id . "' method='post' name='addform'>\n"); printc("<tr><td{$p}><b>{$d}</b></td></tr>\n"); printc("<tr><td{$p}>\n"); printc("<table width='100%' cellspacing='0px'>\n"); if ($t == 'rate') { //printc ("Subject: <input type='text' size='50' name='subject' value='".spchars($s)."' readonly />"); if ($this->rating && isnumeric($this->rating)) { $rating_value = $this->rating; } else { $rating_value = ""; } printc("<td class='dheader3'>\n"); printc("<table width='100%' cellspacing='0px'>\n"); printc("<tr><td align='left'>\n"); printc("<span class='subject'><a name='" . $this->id . "'>\n"); printc($s); printc("</a><input type='hidden' name='subject' value='" . spchars($s) . "' />\n"); printc(" (<input type='text' size='3' class='textfield small' name='rating' value='" . $rating_value . "' />\n"); printc("<input type='submit' class='button small' value='rate' />"); printc(" <a href='" . $_full_uri . "/index.php?{$sid}&action=site&" . $this->getinfo . "#" . $this->id . "'><input type='button' class='button small' value='cancel' /></a>\n"); printc(" numeric only"); printc(")\n"); printc("</span></td>\n"); printc("<td align='right'></td>\n"); printc("</tr><tr>\n"); printc("<td align='left'>\n"); printc($a); if ($this->media_tag) { $media_link = "<a href='" . $uploadurl . "/" . $_REQUEST[site] . "/" . $this->media_tag . "' target='media'>" . $this->media_tag . "</a>\n"; printc("<br />attached: {$media_link}\n"); } printc("</td>\n"); printc("<td align='right' valign='bottom'></td></tr>\n"); printc("</table>\n"); printc("</td>\n"); } else { printc("<tr><td align='left'>\n"); printc("<table>"); /****************************************************************************** * If public discussion and not logged in * add fields for visitor name and email ******************************************************************************/ if (!$_SESSION[auser]) { printc("<tr><td colspan = 2><div style='font-size: 9px'>If you part of the " . $cfg[inst_name]); printc(" community or have posted to a public forum here and received a visitor user account, please log in <b>before</b> posting."); printc(" If you do not yet have a user account, please register below.</div></td></tr>\n"); //printc ("<tr><td>Full Name:</td><td><input type='text' size='50' name='visitor_name' value='".$_REQUEST['visitor_name']."' /></td></tr>\n"); //printc ("<tr><td>Email:</td><td><div style='font-size: 9px'><input type='text' size='25' name='visitor_email' value='".$_REQUEST['visitor_email']."' />\n"); printc("<tr><td colspan = 2 align = center><div style='font-size: 10px'>"); printc("<a href='passwd.php?action=login' target='password' onclick='doWindow(\"password\",400,300)'>Login</a> | "); printc("<a href='passwd.php?action=register' target='password' onclick='doWindow(\"password\",400,300)'>Register</a> | "); printc("<a href='passwd.php?action=reset' target='password' onclick='doWindow(\"password\",400,300)'>Forget your password?</a></div>"); printc("</td></tr>"); } if ($_SESSION[auser]) { printc("<tr><td>Subject:</td><td><input type='text' class='textfield small' size='50' name='subject' value='" . spchars($s) . "' /></td></tr>\n"); // printc ("<tr><td></td><td></td></tr>\n"); } printc("</table>\n"); } printc("</td><td align='right'>\n"); // if not rate, print edit, update or post if ($t != 'rate' && $_SESSION[auser]) { printc("<input type='submit' class='button small' value='{$b}' />\n"); printc("<a href='" . $_full_uri . "/index.php?{$sid}&action=site&" . $this->getinfo . "#" . $this->id . "'><input type='button' class='button small' value='cancel' /></a>\n"); } printc("</td></tr></table>\n"); printc("</td></tr>\n"); // print out post content //printc ("<tr><td class='content$p'>"); /****************************************************************************** * print out editor here... (if editing post or adding new or not rating) ******************************************************************************/ if ($t != 'rate' && $_SESSION[auser]) { printc("<td class='content{$p}'>\n"); $c = convertTagsToInteralLinks($_REQUEST[site], $c); addeditor("content", 60, 20, $c, "discuss"); } else { printc("<td>" . $c . "<br /><br />\n"); printc("<input type='hidden' name='content' value='" . $c . "' />\n"); } /****************************************************************************** * print hidden fields ******************************************************************************/ printc("<input type='hidden' name='discuss' value='" . $_REQUEST['discuss'] . "' />\n"); //added fullstory action for posting form printc("<input type='hidden' name='action' value='" . $_REQUEST['action'] . "' />\n"); //added site variable for discussion logging printc("<input type='hidden' name='site' value='" . $_REQUEST['site'] . "' />\n"); printc("<input type='hidden' name='libraryfileid' value='" . $_REQUEST['libraryfileid'] . "' />\n"); printc("<input type='hidden' name='dis_order' value='" . $this->dis_order . "' />\n"); printc("<input type='hidden' name='commit' value='1' />\n"); if ($t == 'edit' || $t == 'rate') { printc("<input type='hidden' name='id' value=" . $_REQUEST['id'] . " />\n"); } if ($t == 'reply') { printc("<input type='hidden' name='replyto' value=" . $_REQUEST['replyto'] . " />\n"); } $site = $_REQUEST[site]; /****************************************************************************** * print file upload UI ******************************************************************************/ if ($t != 'rate' && $_SESSION[auser]) { printc("<br />Upload a File:<input type='text' class='textfield small' name='libraryfilename' value='" . $_REQUEST['libraryfilename'] . "' size='25' readonly />\n<input type='button' class='button small' name='browsefiles' value='Browse...' onclick='sendWindow(\"filebrowser\",700,600,\"filebrowser.php?site={$site}&source=discuss&owner={$site_owner}&editor=none\")' target='filebrowser' style='text-decoration: none' />\n\n"); if ($_SESSION['aid']) { printc("<br />You will be able to edit your post as long as no-one replies to it.\n"); } else { printc("<br />Once submitted, you will not be able to modify your post.\n"); } } printc("</form>\n"); printc("</td></tr>\n"); }
echo "\n"; print_r(DynConf::GetCfg('general', 'test2')); echo "\n"; print_r(DynConf::GetCfg('general', 'test')); echo "\n"; } function isnumeric($v) { //return (preg_match('/^\-?[0-9]+$/',$v)>=1); return preg_match('/^\\-?[0-9]+([,.][0-9]*)?$/', $v) >= 1; } if (false) { $examples = array('1', '500', '', 'ab123', '20 1234', '-100', '12-3', '--600', '9823748716249876194652', '1.0', '500,2', '', 'ab,123', '20, 1234', '-100.0', '12.3', '-600.', '98.23748716249876194652'); foreach ($examples as $ex) { echo "Example \"{$ex}\" -> "; print_r(isnumeric($ex)); echo "\n"; } } if (false) { require_once 'Class.A2Billing.inc.php'; $dbh = A2Billing::DBHandle(); // Execute a query with some results and some warnings.. $res = $dbh->Execute('SELECT * from RateEngine2(1,\'+7831222\',now(),-1);'); echo "Msg:" . print_r($dbh->ErrorMsg(), true) . "\n"; echo "Msg 2:" . print_r($dbh->NoticeMsg(), true) . "\n"; print_r($res->GetAll()); //print_r($dbh); } if (false) { require_once 'Class.A2Billing.inc.php';