function list_catsform($parent, $lev, $color, $message, $category_id) { global $db_con, $mysql_table_prefix, $debug; if ($lev == 0) { print "\n"; } $space = ""; for ($x = 0; $x < $lev; $x++) { $space .= " - "; } $sql_query = "SELECT * FROM " . $mysql_table_prefix . "categories WHERE parent_num={$parent} ORDER BY category LIMIT 0 , 300"; $result = $db_con->query($sql_query); if ($debug && $db_con->errno) { $err_row = __LINE__ - 2; printf("<p><span class='red'> MySQL failure: %s \n<br /></span></p>", $db_con->error); if (__FUNCTION__) { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} in function(): " . __FUNCTION__ . " <br /></span></p>"); } else { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} <br /></span></p>"); } printf("<p><span class='red'> Script execution aborted. <br /></span>"); printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>"); echo "<p> {$sql_query} </p>"; exit; } if ($result->num_rows) { print "<option " . $selected . " value=\"0\"> none</option>\n"; //select no category while ($row = $result->fetch_array(MYSQLI_ASSOC)) { $id = $row['category_id']; $cat = $row['category']; $selected = " selected=\"selected\" "; if ($category_id != $id) { $selected = ""; } print "<option " . $selected . " value=\"" . $id . "\">" . $space . stripslashes($cat) . "</option>\n"; $color = list_catsform($id, $lev + 1, $color, "", $category_id); } } return $color; }
function approve_newsites() { global $db_con, $mysql_table_prefix, $show_categories, $debug, $dba_act, $add_auth; global $sites_per_page, $sug_start, $whois_admin, $whois_ext, $include_dir; // do we have categories defined by our Admin? $category = ''; $sql_query = "SELECT * from " . $mysql_table_prefix . "categories"; $result = $db_con->query($sql_query); if (!($rows = $result->num_rows)) { $category = -1; } $sql_query = "SELECT * FROM `" . $mysql_table_prefix . "addurl` LIMIT 0 , 30"; $result = $db_con->query($sql_query); if ($debug && $db_con->errno) { $err_row = __LINE__ - 2; printf("<p><span class='red'> MySQL failure: %s \n<br /></span></p>", $db_con->error); if (__FUNCTION__) { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} in function(): " . __FUNCTION__ . " <br /></span></p>"); } else { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} <br /></span></p>"); } printf("<p><span class='red'> Script execution aborted. <br /></span>"); printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>"); echo "<p> {$sql_query} </p>"; exit; } $count = 1; if ($result->num_rows) { while ($row = $result->fetch_array(MYSQLI_ASSOC)) { $all[] = $row; } $links = '0'; $start = $sug_start; $num_rows = $result->num_rows; $pages = ceil($num_rows / $sites_per_page); // Calculate count of required pages if ($start > $pages) { $start = $pages; } if ($start < 1) { $start = '1'; } // As $start is not yet well defined, this is required for the first result page if ($start == '1') { $from = '0'; // Also for first page in order not to multipy with 0 } else { $from = ($start - 1) * $sites_per_page; // First $num_row of actual page } $fromm = $from + 1; $to = $num_rows; // Last $num_row of actual page $rest = $num_rows - $start; if ($num_rows > $sites_per_page) { // Display more then one page? $rest = $num_rows - $from; $to = $from + $rest; // $to for last page if ($rest > $sites_per_page) { $to = $from + $sites_per_page; } // Calculate $num_row of actual page } // display result header echo "\n <div class='submenu cntr'>| Sites for Approval |</div>\n <div class='tblhead'>\n <br /><br />\n <table width='97%'>\n <tr>\n <td class='tblhead sml'>Displaying suggested URLs " . $fromm . " - " . $to . " from " . $num_rows . "</td>\n </tr>\n </table>"; for ($i = $from; $i < $to; $i++) { // prepare result for this new URL $n = $i + 1; $url = $all[$i]['url']; $title = $all[$i]['title']; $description = $all[$i]['description']; $created = $all[$i]['created']; $account = $all[$i]['account']; $authent = $all[$i]['authent']; if ($whois_admin) { require_once "{$include_dir}/domain_whois.php"; // load the WHOIS class $list = ""; $whois = new whois(); //new class $whois_res = $whois->lookup($url, $whois_ext, $list); unset($whois); $whois_server = $whois_res['whoisserver']; $whois_result = $whois_res['result']; $whois_answer = $whois_res['answer']; } echo "\n <br />\n Site {$n} awaiting approval:<br /><br />\n <form action='admin.php' method='post'><input type='hidden' name='f' value='29' />\n <table width='80%'>\n <tr class='y3 odrow'>\n <td class='cntr' ></br>User suggestion:</td>\n <td> </td>\n </tr>\n <tr class='y3 odrow'>\n <td>\n URL:\n </td>\n <td class='left' ><input size='50' type='text' name=\"url\" value=\"{$url}\" />\n \n <a target=\"_blank\" href=\"{$url}\">visit</a>\n </td>\n </tr>\n <tr class='y3 odrow'>\n <td>Title:\n </td>\n <td class='left' ><textarea rows='1' name='title' cols='38'>{$title}</textarea>\n </td>\n </tr>\n <tr class='odrow'>\n <td>Description:\n </td>\n <td class='left' ><textarea rows='5' name='short_desc' cols='38'>{$description}</textarea>\n </td>\n </tr>"; if ($show_categories == '1' && $category != -1) { echo "\n <tr class='y3 odrow'>\n <td>\n Category:\n </td>\n <td class='left' ><select name=\"cat\">\n "; $category_id = $all[$i]['category_id']; list_catsform(0, 0, "white", "", $category_id); echo "\n </select>\n </td>\n </tr>\n "; } echo " <tr class='y3 odrow'>\n <td>suggested:\n </td>\n <td class='left' ><input size='50' type='text' name=\"created\" value=\"{$created}\" />\n </td>\n </tr>\n <tr class='odrow'>\n <td>by:\n </td>\n <td class='left' ><input size='50' type='text' name=\"dispatcher\" value=\"{$account}\" />\n </td>\n </tr>"; if ($add_auth == '1') { echo "<tr class='y3 warn'>\n <td>Authentication code:\n </td>\n <td class='left' ><input size='50' type='text' name=\"authent\" value=\"{$authent}\" />\n Admin input required</td>\n </tr>"; } if ($whois_admin) { echo "<tr class='y3 odrow'>\n <td class='cntr' ></br>WHOIS report:</td>\n <td> </td>\n </tr>\n <tr class='y3 odrow'>\n <td>Result:\n </td>\n <td class='left' ><input size='50' type='text' name=\"whois_result\" value=\"{$whois_result}\" />\n </td>\n </tr>\n <tr class='y3 odrow'>\n <td>Server:\n </td>\n <td class='left' ><input size='50' type='text' name=\"whois_server\" value=\"{$whois_server}\" />\n </td>\n </tr>\n <tr class='odrow'>\n <td>Server answer:\n </td>\n <td class='left' ><textarea rows='5' name='whois_answer' cols='38'>{$whois_answer}</textarea>\n </td>\n </tr>"; } echo "\n </table>\n <table width='80%'>\n <tr class='y3 cntr odrow sml'>\n <td>\n <input type='submit' name='approve' value='Approve' /> \n <input type='submit' name='delete' value='Reject' /> \n <input type='submit' name=\"bann\" value=\"Ban !\" />\n <input type='hidden' name=\"domain\" value=\"{$url}\" />\n </td>\n </tr>\n </table>\n </form>\n <br />"; } } echo "\n </div>"; if ($pages > 1) { // If we have more than 1 result-page echo "\n <div class='submenu cntr y5'>\n Result page: {$start} from {$pages}\n <br /><br />\n Page selection: \n "; if ($start > 1) { // Display 'First' echo "<a href='admin.php?f=28&sug_start=1'>First</a> \n "; if ($start > 5) { // Display '-5' $minus = $start - 5; echo "<a href='admin.php?f=28&sug_start={$minus}'>- 5</a> \n "; } } if ($start > 1) { // Display 'Previous' $prev = $start - 1; echo "<a href='admin.php?f=28&sug_start={$prev}'>Previous</a> \n "; } if ($rest >= $sites_per_page) { // Display 'Next' $next = $start + 1; echo "<a href='admin.php?f=28&sug_start={$next}'>Next</a> \n "; if ($pages - $start > 5) { // Display '+5' $plus = $start + 5; echo "<a href='admin.php?f=28&sug_start={$plus}'>+ 5</a> \n "; } } if ($start < $pages) { // Display 'Last' echo "<a href='admin.php?f=28&sug_start={$pages}'>Last</a>\n "; } echo "\n </div>\n "; } }
<tr> <td>".$sph_messages['Title']."</td> <td><input type='text' name='title' size='52' maxlength='100'></td> </tr> <tr> <td><br /><br />".$sph_messages['Description']."</td> <td><textarea wrap='physical' class='farbig' rows='5' name='description' cols='40'></textarea></td> </tr> "; if($show_categories =='1') { // if Admin selected, show categories echo "<tr> <td>".$sph_messages['Category']."</td> <td><select name=\"category_id\" size=\"1\"> "; list_catsform (0, 0, "white", ""); echo "</select> </td> </tr> "; } echo " <tr> <td>".$sph_messages['Account']."</td> <td><input type='text' name='email' size='52' maxlength='100'></td> </tr> "; if($captcha == 1) { // if Admin selected, show Captcha echo "
function list_catsform($parent, $lev, $color, $message, $category_id) { // global $db, DEBUG; if ($lev == 0) { print "\n"; } $space = ""; for ($x = 0; $x < $lev; $x++) { $space .= " - "; } $query = "SELECT * FROM " . TABLE_PREFIX . "categories WHERE parent_num={$parent} ORDER BY category LIMIT 0 , 300"; $result = mysql_query($query); if (DEBUG > '0') { echo mysql_error(); } if (mysql_num_rows($result) != '') { while ($row = mysql_fetch_array($result)) { $id = $row['category_id']; $cat = $row['category']; $selected = " selected "; if ($category_id != $id) { $selected = ""; } print "<option " . $selected . " value=\"" . $id . "\">" . $space . stripslashes($cat) . "</option>\n"; $color = list_catsform($id, $lev + 1, $color, "", $category_id); } } return $color; }
function approve_newsites() { echo "<div class='submenu cntr'>| Sites for Approval |</div>\r\n\t\t\t<div class='tblhead'>\r\n\t\t\t<p>\n\n</p>\r\n\t\t"; $query = "SELECT * FROM `" . TABLE_PREFIX . "addurl` LIMIT 0 , 30"; $result = mysql_query($query); if (DEBUG > '0') { echo mysql_error(); } $count = 1; if (mysql_num_rows($result) != '') { while ($row = mysql_fetch_array($result)) { echo "Site {$count} awaiting approval:\r\n\t\t\t\t\t<p>\n\n</p>\r\n\t\t\t\t\t<form action=index.php method=post>\r\n\t\t\t\t\t\t<input type=hidden name=f value=29>\r\n\t\t\t\t\t\t<table width='80%'>\r\n\t\t\t\t\t\t\t<tr class='odrow'>\r\n\t\t\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t\t\tUrl: \r\n\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t<td class='left' >\r\n\t\t\t\t\t\t\t\t\t<input size=50 type=text name=\"url\" value=\"" . $row['url'] . "\">\r\n\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t<a target=\"_blank\" href=\"" . $row['url'] . "\">visit</a>\r\n\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t<tr class='odrow'>\r\n\t\t\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t\t\tTitle: \r\n\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t<td class='left'>\r\n\t\t\t\t\t\t\t\t\t<input size=50 type=text name=\"title\" value=\"" . $row['title'] . "\">\r\n\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t<tr class='odrow'\r\n\t\t\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t\t\tDescription: \r\n\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t<td class='left' >\r\n\t\t\t\t\t\t\t\t\t<textarea rows=5 name=short_desc cols=38>" . $row['description'] . "</textarea>\r\n\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t"; if (Configure::read('show_categories') == '1') { echo "\r\n\t\t\t\t\t\t<tr class='odrow'>\r\n\t\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\tCategory: \r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t<td class='left' ><select name=\"cat\">\r\n\t\t\t\t\t\t"; $category_id = $row['category_id']; list_catsform(0, 0, "white", "", $category_id); echo "\r\n\t\t\t\t\t\t\t</select>\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t"; } echo "<tr class='odrow'>\r\n\t\t\t\t\t\t<td>suggested: \r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t<td class='left' ><input size=50 type=text name=\"created\" value=\"" . $row['created'] . "\">\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='odrow'>\r\n\t\t\t\t\t\t<td>by: \r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t<td class='left' ><input size=50 type=text name=\"dispatcher\" value=\"" . $row['account'] . "\">\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t</table>\r\n\t\t\t\t\t<table width=\"80%\">\r\n\t\t\t\t\t\t<tr class=\"x1 cntr odrow\">\r\n\t\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t\t<input type=\"submit\" name=\"approve\" value=\"Approve\" /> \r\n\t\t\t\t\t\t\t\t<input type=\"submit\" name=\"delete\" value=\"Reject\" /> \r\n\t\t\t\t\t\t\t\t<input type=\"submit\" name=\"bann\" value=\"Ban !\" />\r\n\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"domain\" value=\"" . $row['url'] . "\" />\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t</table>\r\n\t\t\t\t\t</dd>\r\n\t\t\t\t\t</form>\r\n\t\t\t\t\t<p>\n\n\n</p>\r\n\t\t\t\t\t"; $count++; } } echo "\r\n\t\t\t</div>\r\n\t\t"; }
function approve_newsites() { global $mysql_table_prefix, $show_categories; echo "<div class='submenu cntr'>| Sites for Approval |</div>\r\n <div class='tblhead'>\r\n <p>\n\n</p>\r\n "; $query = "SELECT * FROM `" . $mysql_table_prefix . "addurl` LIMIT 0 , 30"; $result = mysql_query($query); echo mysql_error(); $count = 1; if (mysql_num_rows($result) != '') { while ($row = mysql_fetch_array($result)) { echo "Site {$count} awaiting approval:\r\n <p>\n\n</p>\r\n <form action=admin.php method=post><input type=hidden name=f value=29>\r\n <table width='80%'> \r\n <tr class='odrow'>\r\n <td>\r\n Url: \r\n </td>\r\n <td class='left' ><input size=50 type=text name=\"url\" value=\"" . $row['url'] . "\">\r\n \r\n <a target=\"_blank\" href=\"" . $row['url'] . "\">visit</a>\r\n </td>\r\n </tr>\r\n <tr class='odrow'>\r\n <td>Title: \r\n </td>\r\n <td class='left' ><input size=50 type=text name=\"title\" value=\"" . $row['title'] . "\">\r\n </td>\r\n </tr>\r\n <tr class='odrow'\r\n <td>Description: \r\n </td>\r\n <td class='left' ><textarea rows=5 name=short_desc cols=38>" . $row['description'] . "</textarea>\r\n </td>\r\n </tr>\r\n "; if ($show_categories == '1') { echo "\r\n <tr class='odrow'>\r\n <td>\r\n Category: \r\n </td>\r\n <td class='left' ><select name=\"cat\">\r\n "; $category_id = $row['category_id']; list_catsform(0, 0, "white", "", $category_id); echo "\r\n </select>\r\n </td>\r\n </tr>\r\n "; } echo "<tr class='odrow'>\r\n <td>suggested: \r\n </td>\r\n <td class='left' ><input size=50 type=text name=\"created\" value=\"" . $row['created'] . "\">\r\n </td>\r\n </tr>\r\n <tr class='odrow'>\r\n <td>by: \r\n </td>\r\n <td class='left' ><input size=50 type=text name=\"dispatcher\" value=\"" . $row['account'] . "\">\r\n </td>\r\n </tr>\r\n </table>\r\n <table width='80%'>\r\n <tr class='x1 cntr odrow'>\r\n <td>\r\n <input type=submit name=approve value=Approve> \r\n <input type=submit name=delete value=Reject> \r\n <input type=submit name=\"bann\" value=\"Ban !\">\r\n <input type='hidden' name=\"domain\" value=\"" . $row['url'] . "\">\r\n </td> \r\n </tr> \r\n </table>\r\n </dd>\r\n </form>\r\n <p>\n\n\n</p>\r\n "; $count++; } } echo " \r\n </div>\r\n "; }