WebsiteBaker 2.13.8 is now available!
R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WBhttps://forum.websitebaker.org/index.php/topic,32355.0.html
<?php// First we prevent direct accessif(!isset($_POST['queryString'])) {// nowwe redirect to index, if you are in subfolder use ../index.phpheader( 'Location: index.php' ) ;} else { // Now we set the path to config file require('config.php'); global $database; global $wb; if(isset($_POST['queryString'])) {// $queryString = $_POST['queryString'];$queryString = htmlspecialchars($_POST['queryString'], ENT_QUOTES); // I used page_title field from pages. you can set or remove limit -- max number of sugestions $query = $database->query("SELECT * FROM `".TABLE_PREFIX."pages` WHERE `page_title` LIKE '%$queryString%' LIMIT 20"); if($query->numRows() < 1) { // replace this text with: there is no suggestion, or whaatever echo ' No suggestions'; } else { // now we can add some text like Here are suggestions echo '<span style="display:block; font-weight: bold; font-size: 80%; padding: 5px 5px; text-decoration: underline;">Suggestions:</span>'; // now we loop thrue suggestions. style list via droplet echo '<ul>'; while ($result = $query->fetchRow()) { $filename = str_replace(' ', '', strtolower($result['description'])); echo '<li onClick="fill(\''.addslashes($result['description']).'\');"><a href="'.WB_URL.PAGES_DIREC TORY.$result['link'].PAGE_EXTENSION.'">'.$result['page_title'].'</a></li>'; } echo '</ul>'; } }} // this ends else statement from the top of the page?>
global $TEXT;$return_value = " ";if(SHOW_SEARCH) { $scripta = "\n".'<script type="text/javascript">'."\n";$scripta .= ' function lookup(inputString) { '."\n";$scripta .= ' if(inputString.length < 1) { '."\n"; // after how menu letters script will react$scripta .= ' $(\'#suggestions\').hide(); '."\n";$scripta .= ' } else { '."\n";$scripta .= ' $.post("'.WB_URL.'/suggestion.php", {queryString: ""+inputString+""}, function(data){ '."\n";$scripta .= ' if(data.length > 0) { '."\n";$scripta .= ' $(\'#suggestions\').show(); '."\n";$scripta .= ' $(\'#autoSuggestionsList\').html(data); '."\n";$scripta .= ' } '."\n";$scripta .= ' }); '."\n";$scripta .= ' } '."\n";$scripta .= ' } '."\n";$scripta .= ' function fill(thisValue) { '."\n";$scripta .= ' $(\'#inputString\').val(thisValue); '."\n";$scripta .= ' setTimeout("$(\'#suggestions\').hide();", 200); '."\n";$scripta .= ' } '."\n";$scripta .= '</script> '."\n";$scripta .= '<style type="text/css">'."\n";$scripta .= '.suggestionsBox { '."\n";$scripta .= ' position: relative; '."\n";$scripta .= ' left: 80px; '."\n";$scripta .= ' margin: 0px 0px 0px 0px; '."\n";$scripta .= ' width: 170px; '."\n";$scripta .= ' background-color: #fff; '."\n";$scripta .= ' -moz-border-radius: 7px; '."\n";$scripta .= ' -webkit-border-radius: 7px; '."\n";$scripta .= ' border: 2px solid #424242; '."\n";$scripta .= ' color: #333; '."\n";$scripta .= '} '."\n";$scripta .= '.suggestionList ul { '."\n";$scripta .= ' margin: 0px; '."\n";$scripta .= ' padding: 0px; '."\n";$scripta .= ' list-style-type: none; '."\n";$scripta .= '} '."\n";$scripta .= '.suggestionList li { '."\n";$scripta .= ' margin: 0px 0px 3px 0px; '."\n";$scripta .= ' padding: 3px; '."\n";$scripta .= ' cursor: pointer; '."\n";$scripta .= '} '."\n";$scripta .= '.suggestionList li:hover { '."\n";$scripta .= ' background-color: #f3f3f3; '."\n";$scripta .= '} '."\n";$scripta .= '</style> '."\n";$wb_page_data = str_replace('</head>',$scripta."\n".'</head>', $wb_page_data ); $return_value = '<form id="searchform" action="'.WB_URL.'/search/index'.PAGE_EXTENSION.'" method="post" >'; $return_value .= '<input class="button" name="dugme" type="submit" value=" " />'; $return_value .= '<input class="text" type="text" name="string" id="inputString" onkeyup="lookup(this.value);" onblur="fill();" /> '; $return_value .= '</form>'; $return_value .= '<div class="suggestionsBox" id="suggestions" style="display: none;">'; $return_value .= ' <div class="suggestionList" id="autoSuggestionsList">'; $return_value .= ' </div>'; $return_value .= '</div>';}return $return_value;
$queryString = $_POST['queryString'];if( preg_match('/;|UPDATE|DROP|DELETE|ALTER|\<SCRIPT.*\>|eval\(/si', $queryString){ echo ' Forbidden Request!!'; }else{....
'\';DELETE FROM `ul_pages`;';into searchbox, and table is still there so there is no SQL hack..
// Include WB functions file require_once(WB_PATH.'/framework/functions.php');AND THEN:$queryString = $wb->add_slashes($_POST['queryString']);
PAGES_DIREC TORY
PAGES_DIRECTORY
Uncaught exception: ReferenceError: Undefined variable: $Error thrown at line 6, column 4 in lookup(inputString) in http://MYSITE/pages/forum2.php: $.post("http://MYSITE/suggestion.php", {queryString: ""+inputString+""}, function(data){ called from line 1, column 0 in <anonymous function>(event): lookup(this.value);