Simple Admin Search URL
May 14, 2007 12:23PM
Search Box: Paste in the admin.php file on line No. 400

// SEARCH BOX
print "<div align=\"center\">
<p align=center>
<form method=\"post\" action=\"search_url.php\" style=\"margin:0\">
Search Url: <input type=\"text\" name=\"search_url\" size=\"25\">
<input type=\"submit\" name=\"surl\" value=\"Go!\">
</form>
</p>
<table cellspacing =\"0\" cellpadding=\"0\" class=\"darkgrey\"><tr><td><table cellpadding=\"3\" cellspacing=\"1\">
<tr class=\"grey\"><td align=\"center\"><b>Site name</b></td><td align=\"center\"><b>Site url</b></td><td align=\"center\"><b>Last indexed</b></td><td colspan=4></td></tr>\n";
} else {


Create a file named search_url.php

Pasted code to it

<?
include("../settings/database.php"winking smiley;
include "auth.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "[www.w3.org];
<html xmlns="[www.w3.org]; xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Sphider</title>
<link rel="stylesheet" href="admin.css" type="text/css" />
</head>
<body>
<div id="admin">
<div id="tabs">
<ul>
<li><a href="admin.php?f=2" id="selected">Sites</a> </li>
<li><a href="admin.php?f=categories" id="default">Categories</a></li>
<li><a href="admin.php?f=index" id="default">Index</a></li>
<li><a href="admin.php?f=clean" id="default">Clean tables</a> </li>
<li><a href="admin.php?f=settings" id="default">Settings</a></li>
<li><a href="admin.php?f=statistics" id="default">Statistics</a> </li>
<li><a href="admin.php?f=database" id="default">Database</a></li>
<li><a href="logout.php" id="default">Log out</a></li>
</ul>
</div>
<div id="main">
<div id="submenu">
</div>
<br>
<center>
<div style="width:755px;">
<div style="float:left; margin-right:0px;">
<div class="darkgrey">
<?
if(isset($_POST['surl'])){
// CHECK TO SEE IF IN THE DB
$url=$_POST['search_url'];
$chk1 = $url;
$chk2= array('http','https',':','/','//');
$chk3 = str_replace($chk2,'',$chk1);
$q1 = "SELECT * FROM ".$mysql_table_prefix."sites
WHERE (url LIKE '%".$chk1."%' OR url LIKE '%".$chk3."%')";
$r1 = mysql_query($q1) or die(mysql_error());
$a1 = mysql_fetch_array($r1);
$id=$a1['site_id'];
$url=$a1['url'];
$title=$a1['title'];
$desc=$a1['short_desc'];
$last_indexed=$a1['indexdate'];
$sd=$a1['spider_depth'];

$chk_numrows = mysql_num_rows($r1);
if($chk_numrows > 0){
?>
<table cellpadding="3" cellspacing="0">
<table cellpadding="5" cellspacing="1" width="640">
<tr >
<td class="grey" valign="top" width="20%" align="left">URL:</td>
<td class="white" align="left"><a href="<?php echo $url;?>" target="_blank"><?php echo $url;?></a></td>
</tr>
<tr>
<td class="grey" valign="top" align="left">Title:</td>
<td class="white" align="left"><b><?php echo $title;?></b></td>
</tr>
<tr>
<td class="grey" valign="top" align="left">Description:</td>
<td width="80%" class="white" align="left"><?php echo $desc;?></td>
</tr>
<tr>
<td class="grey" valign="top" align="left">Last indexed:</td>
<td class="white" align="left"><?php echo $last_indexed;?></td>
</tr>
</table>

</div>
</div>
<div id= "vertmenu">
<ul>
<li><a href=admin.php?f=edit_site&site_id=1>Edit</a></li>
<li><a href="admin.php?f=index&url=<?php echo $url;?>&reindex=1">Re-index</a></li>
<li><a href="admin.php?f=21&site_id=<?echo $id;?>">Browse pages</a></li>
<li><a href="admin.php?f=5&site_id=<?echo $id;?>" onclick="return confirm('Are you sure you want to delete? Index will be lost.')">Delete</a></li>
<li><a href="admin.php?f=19&site_id=<?echo $id;?>">Stats</a></li>
</div>
</ul>
</div>
</center>
<div class="clear">
<?
// SITES
$q2 = "select count(*) from ".$mysql_table_prefix."searchsites";
$r2 = mysql_query($q2) or die(mysql_error());
$a2 = mysql_fetch_array($r2);
// LINKS
$q3 = "select count(*) from ".$mysql_table_prefix."searchlinks";
$r3 = mysql_query($q3) or die(mysql_error());
$a3 = mysql_fetch_array($r3);
// CATEGORIES
$q4 = "select count(*) from ".$mysql_table_prefix."searchcategories";
$r4 = mysql_query($q4) or die(mysql_error());
$a4 = mysql_fetch_array($r4);
// KEYWORDS
$q5 = "select count(*) from ".$mysql_table_prefix."searchkeywords";
$r5 = mysql_query($q5) or die(mysql_error());
$a5 = mysql_fetch_array($r5);
?>
</div><br><br><br><center>Currently in database: <?php echo $a2[0];?> sites, <?php echo $a3[0];?> links, <?php echo $a4[0];?> categories and <?php echo $a5[0];?> keywords.<br><br></center>
<?
} else { echo "<p align=center><font color=\"#ff0000\"><b>URL: ? $url Found!</b></font></p>\n"; }
}
?>
</div>
</div>
</body>
</html>

that it done.



Edited 1 time(s). Last edit at 08/04/2007 02:38PM by searchMan.
Re: Simple Admin Search URL
May 14, 2007 12:30PM
opps I left out reindex depth Variable

replace this line
<li><a href="admin.php?f=index&url=<?php echo $url;?>&reindex=1">Re-index</a></li>

with this

<li><a href="admin.php?f=index&url=<?php echo $url;?>&reindex=<?php echo $sd;?>">Re-index</a></li>
Anonymous User
Re: Simple Admin Search URL
June 30, 2007 01:50PM
Anonymous User
Re: Simple Admin Search URL
June 30, 2007 03:40PM
SearchMan,

I wasn't quite right.

You explained it all in the title.

In fact, it is a "simple admin".
Re: Simple Admin Search URL
July 24, 2007 06:08PM
Hi, I would like to implement this feature, but when trying to add the code to line 400 im getting a syntax error, my admin.php has been modified with several of the mods posted on this forum, can you tell us the text that this needs to go above or below. --thanks.
Anonymous User
Re: Simple Admin Search URL
July 24, 2007 09:39PM
mike171562, I tried it, sucessfully, like this

A simple admin (searchMan)

Make a hard return/enter before this "statement" (line 392 of sphider-1.3.1f, available in the site)

?>
</ul>
</div>

<?php
print $message;
print "<br/>";
if (mysql_num_rows($result) > 0) {
print "<div align=\"center\"><table cellspacing =\"0\" cellpadding=\"0\" class=\"darkgrey\"><tr><td><table cellpadding=\"3\" cellspacing=\"1\">



and write/paste this (from searchMan, as of May 14, 2007 12:23PM)


// SEARCH BOX
print "<div align=\"center\">
<p align=center>
<form method=\"post\" action=\"search_url.php\" style=\"margin:0\">
Search Url: <input type=\"text\" name=\"search_url\" size=\"25\">
<input type=\"submit\" name=\"surl\" value=\"Go!\">
</form>
</p>
<table cellspacing =\"0\" cellpadding=\"0\" class=\"darkgrey\"><tr><td><table cellpadding=\"3\" cellspacing=\"1\">
<tr class=\"grey\"><td align=\"center\"><b>Site name</b></td><td align=\"center\"><b>Site url</b></td><td align=\"center\"><b>Last indexed</b></td><td colspan=4></td></tr>\n";
rec
Re: Simple Admin Search URL
July 25, 2007 02:50AM
If you have been modding Sphider, you may follow previous tecniques with a little change.

In admin.php create a new case under Tec's tecnique; to begin, give it the code that searchMan proposes to start, and follow messages that you get

// SEARCH BOX
print "<div align=\"center\">
<p align=center>
<form method=\"post\" action=\"search_url.php\" style=\"margin:0\">
Search Url: <input type=\"text\" name=\"search_url\" size=\"25\">
<input type=\"submit\" name=\"surl\" value=\"Go!\">
</form>
</p>
<table cellspacing =\"0\" cellpadding=\"0\" class=\"darkgrey\"><tr><td><table cellpadding=\"3\" cellspacing=\"1\">
<tr class=\"grey\"><td align=\"center\"><b>Site name</b></td><td align=\"center\"><b>Site url</b></td><td align=\"center\"><b>Last indexed</b></td><td colspan=4></td></tr>\n";
} else {
rec
Re: Simple Admin Search URL
July 26, 2007 09:05PM
searchMan,can you suggest a structure for the following tables considered in your script?

nsm_searchsites, nsm_searchlinks, nsm_searchcategories and nsm_searchkeywords

in

"...// SITES
$q2 = "select count(*) from nsm_searchsites";
$r2 = mysql_query($q2) or die(mysql_error());
$a2 = mysql_fetch_array($r2);
// LINKS
$q3 = "select count(*) from nsm_searchlinks";
$r3 = mysql_query($q3) or die(mysql_error());
$a3 = mysql_fetch_array($r3);
// CATEGORIES
$q4 = "select count(*) from nsm_searchcategories";
$r4 = mysql_query($q4) or die(mysql_error());
$a4 = mysql_fetch_array($r4);
// KEYWORDS
$q5 = "select count(*) from nsm_searchkeywords";
$r5 = mysql_query($q5) or die(mysql_error());
$a5 = mysql_fetch_array($r5);
..."
Re: Simple Admin Search URL
August 04, 2007 02:35PM
Sorry, they sould of been something like this

Also I have made changes to the original first post above. smiling smiley

$q2 = "select count(*) from ".$mysql_table_prefix."searchsites";
$r2 = mysql_query($q2) or die(mysql_error());
$a2 = mysql_fetch_array($r2);
// LINKS
$q3 = "select count(*) from ".$mysql_table_prefix."searchlinks";
$r3 = mysql_query($q3) or die(mysql_error());
$a3 = mysql_fetch_array($r3);
// CATEGORIES
$q4 = "select count(*) from ".$mysql_table_prefix."searchcategories";
$r4 = mysql_query($q4) or die(mysql_error());
$a4 = mysql_fetch_array($r4);
// KEYWORDS
$q5 = "select count(*) from ".$mysql_table_prefix."searchkeywords";
$r5 = mysql_query($q5) or die(mysql_error());
$a5 = mysql_fetch_array($r5);



Edited 2 time(s). Last edit at 08/04/2007 02:40PM by searchMan.
Sorry, only registered users may post in this forum.

Click here to login