Welcome! Log In Create A New Profile

Advanced

add url submit form

Posted by HBD 
HBD
add url submit form
October 20, 2011 07:35PM
On this add url form from this other post [url=http://www.sphider.eu/forum/read.php?3,1914,page=1]An old url post for add url page[/url]

does anyone know the fix so that it doesn't show up as Not Indexed after you index it?

what happens is that it does index it but instead of changing it to the date indexed it adds a new line for that and keeps the old Not Indexed line also

but if I add a site just using the admin area and then index it, it works properly, doesn't make sense since the indexing script is separate than this add url script
Re: add url submit form
December 25, 2011 05:04AM
I took several hours and modified the files from the original post to make just 2 files. So far it works perfect. I haven't found a solution for the URL parsing yet, but I'm working on it.

This file should be named: addurl.php
<?php 

/////////////////////////////////////////////////// 
// start of php header 
/////////////////////////////////////////////////// 

session_start(); 

$include_dir = "./include"; 

$template_dir = "./templates/"; 

$settings_dir = "./settings"; 
$language_dir = "./languages"; 

include("$settings_dir/conf.php"winking smiley; 
include("$include_dir/commonfuncs.php"winking smiley; 
require_once("$language_dir/en-language.php"winking smiley; 
require_once("$include_dir/searchfuncs.php"winking smiley; 
require_once("$include_dir/categoryfuncs.php"winking smiley;
require_once("$settings_dir/database.php"winking smiley; 
include ("$template_dir/$template/header.html"winking smiley; 
include ("$language_dir/$language-language.php"winking smiley; 
//require_once("$template_dir/$template/addurl.html"winking smiley; 
include("$template_dir/$template/footer.html"winking smiley; 

///////////////////////////////////////////////////// 
// end of php header 
// start of php body 
///////////////////////////////////////////////////// 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Sphider administrator tools</title>
<link rel="stylesheet" href="admin.css" type="text/css" />
</head>
<body>
	
<?php
// did the user press the add url button 
if(isset($_POST['addurl'])) 
{ 
// DO THE TUNING CODE MATCH 
if ($_POST['validate'] == $_SESSION['mystring']) 
{ 
// make sure the url is not empty 
if ($_POST['url'] != '')
{ 
global $mysql_table_prefix; 

// get the values of the other text box 

$short_desc = addslashes($_POST['short_desc']); 
$title = addslashes($_POST['title']); 
$compurl=parse_url("".$_POST['url']);	
if ($compurl['path']=='')
	$url = $_POST['url']."/";	
$result = mysql_query("select site_ID from ".$mysql_table_prefix."sites where url='$url'"winking smiley; 
echo mysql_error(); 
$rows = mysql_numrows($result); 
if ($rows==0 ) 
{ 
mysql_query("INSERT INTO ".$mysql_table_prefix."sites (url, title, short_desc) VALUES ('$url', '$title', '$short_desc')"winking smiley; 
echo mysql_error(); 
$result = mysql_query("select site_ID from ".$mysql_table_prefix."sites where url='$url'"winking smiley; 
echo mysql_error(); 
$row = mysql_fetch_row($result); 
$site_id = $row[0]; 
$result=mysql_query("select category_id from ".$mysql_table_prefix."categories"winking smiley; 
echo mysql_error(); 
while ($row=mysql_fetch_row($result)) 
{ 
$cat_id=$row[0]; 
if ($cat[$cat_id]=='on') 
{ 
mysql_query("INSERT INTO ".$mysql_table_prefix."site_category (site_id, category_id) values ('$site_id', '$cat_id')"winking smiley; 
echo mysql_error(); 
} 
} 
If (!mysql_error())	
{ 
$message = "<br/><center><b><font color=red>Thank you, You Site has been added</font></b></center>" ; 
} 
else 
{ 
$message = mysql_error(); 
} 
} 
else 
{ 
$message = "<center><b>Site already in database</b></center>"; 
} 
echo $message; 
} 
else 
{ 
echo "You must enter a valid url, press your back button and try again"; 
} 
} 
} 
?>

<!--addurl form-->
<div ID="notes"><center> 
<h4>Share your place on the net with us.</h4> 
<p style="font-size: medium">
We add and update new sites to our index each time we crawl the web, and we invite you to submit your URL here.<br>
We do not add all submitted URLs to our index, and we cannot make any predictions or guarantees about when or if they will appear.</p> 
<p style="font-size: medium"> 
Please enter your full URL, including the prefix. For example: <code>[http://www.example.com]</code>.<br>
You may also add a title or description of the content of your page.<br>
These are used only for our information and do not affect how your page is indexed or used by us.</p> 
<p style="font-size: medium"> 
<b>Please note</b>: Only the top-level page from a host is necessary; you do not need to submit each individual page.</p> 
</center>
</div> 
<br/>
<div id="addurlctrl" align="center"><center><table>
<form action="addurl.php" method="post">
<input type="hidden" name="f" value="1">
<input type="hidden" name="af" value="2">
<tr><td><b>URL:</b></td><td align ="right"></td><td><input type="text" name="url" size="60" value ="http://"></td></tr>
<tr><td><b>Title:</b></td><td></td><td> <input type="text" name="title" size="60"></td></tr>
<tr><td><b>Short description:</b></td><td></td><td><textarea name="short_desc" cols="45" rows="3" wrap="virtual"></textarea></td></tr>
<tr><td>Category:</td><td></td><td>
<?php  walk_through_cats(0, 0, '');?></td></tr>
<tr> 
<td></td> 
<td></td> 
<td><p style="font-size: small">To help us distinguish between sites submitted by individuals and<br> 
those automatically entered by software robots, please type the numbers<br> 
shown here into the box below.</p>
</td> 
</tr> 
<tr> 
<td></td> 
<td></td> 
<td><img src="verify.php" height="60"></td> 
</tr> 
<tr> 
<td></td> 
<td></td> 
<td><input type="text" name="validate" size="20" MAXLENGTH="10"></td> 
</tr> 
<tr> 
<td></td> 
<td></td> 
<tr><td></td><td></td><td><input type="submit" id="submit" value="Add" name="addurl"></td></tr></form></table></center></div>
<!--end form-->

<?php
function walk_through_cats($parent, $lev, $site_id) {
		global $mysql_table_prefix;
		$space = "";
		for ($x = 0; $x < $lev; $x++)
			$space .= "&nbsp;&nbsp;&nbsp;&nbsp;";

		$query = "SELECT * FROM ".$mysql_table_prefix."categories WHERE parent_num=$parent ORDER BY category";
		$result = mysql_query($query);
		echo mysql_error();
		
		if (mysql_num_rows($result) <> '')
			while ($row = mysql_fetch_array($result)) {
				$id = $row['category_id'];
				$cat = $row['category'];
				$state = '';
				if ($site_id <> '') {
					$result2 = mysql_query("select * from ".$mysql_table_prefix."site_category where site_id=$site_id and category_id=$id"winking smiley;
					echo mysql_error();
					$rows = mysql_num_rows($result2);

					if ($rows > 0)
						$state = "checked";
				}

				print $space . "<input type=checkbox name=cat[$id] $state>" . $cat . "<br/>\n";
				;
				walk_through_cats($id, $lev + 1, $site_id);
			}
	}

////////////////////////////////////////////////////// 
// end of php body 
/////////////////////////////////////////////////////// 
?> 
</body>
</html>


This file should be called: verify.php
<?php 

////////////////////////////////////////////////////////////////////////// 
// START OF HEADER 
////////////////////////////////////////////////////////////////////////// 

/* 
Name: Guillaume Swolfs 
Date: May 9 2006 
File: verify.php 

Description: THIS PAGE CREATE THE VERIFY TEXT AND IMAGE FOR THE REGISTER PAGE 

Copyright(c) 2006 by Guillaume Swolfs, All Rights Reserved. 
Any rights not expressly granted herein are reserved. 

Illegal tampering or redistribution of these files is illegal 

*/ 

header("Content-type: image/png"winking smiley; 

////////////////////////////////////////////////////////////////////////// 
// END OF HEADER 
////////////////////////////////////////////////////////////////////////// 

////////////////////////////////////////////////////////////////////////// 
// START OF DOCUMENT 
////////////////////////////////////////////////////////////////////////// 

session_start(); 

$myfirstimage = ImageCreateTrueColor(200, 60); 

$img_width = imagesx($myfirstimage); 
$img_height = imagesy($myfirstimage); 

$purple = ImageColorAllocate($myfirstimage, 255, 0, 255); 
$white = ImageColorAllocate($myfirstimage, 255, 255, 255); 
$black = imagecolorallocate($myfirstimage, 0, 0, 0); 
$red = imagecolorallocatealpha($myfirstimage, 255, 0, 0, 75); 
$green = imagecolorallocatealpha($myfirstimage, 0, 255, 0, 75); 
$blue = imagecolorallocatealpha($myfirstimage, 0, 0, 255, 75); 
//$lightblue = imagecolorallocatealpha($myfirstimage, 0, 0, 50, 255); 
$grey = imagecolorallocatealpha($myfirstimage, 0, 102, 102, 102); 

ImageFill($myfirstimage, 0, 0, $purple); 

imagefilledellipse($myfirstimage, ceil(rand(5,$img_width - 5)), ceil(rand(0,$img_height)), 30, 30, $green); 
imagefilledellipse($myfirstimage, ceil(rand(5,$img_width - 5)), ceil(rand(0,$img_height)), 30, 30, $blue); 
imagefilledellipse($myfirstimage, ceil(rand(5,$img_width - 5)), ceil(rand(0,$img_height)), 30, 30, $red); 
imagefilledellipse($myfirstimage, ceil(rand(5,$img_width - 5)), ceil(rand(0,$img_height)), 30, 30, $white); 
//imagefilledellipse($myfirstimage, ceil(rand(5,$img_width - 5)), ceil(rand(0,$img_height)), 30, 30, $lightblue); 
imagefilledellipse($myfirstimage, ceil(rand(5,$img_width - 5)), ceil(rand(0,$img_height)), 30, 30, $grey); 

imagefilledrectangle($myfirstimage, 0, 0, $img_width, 0, $white); 
imagefilledrectangle($myfirstimage, $img_width - 1, 0, $img_width - 1, $img_height - 1, $black); 
imagefilledrectangle($myfirstimage, 0, 0, 0, $img_height - 1, $black); 
imagefilledrectangle($myfirstimage, 0, $img_height - 1, $img_width, $img_height - 1, $black); 

imagefilledellipse($myfirstimage, ceil(rand(5,$img_width - 5)), ceil(rand(0,$img_height)), 30, 30, $green); 
imagefilledellipse($myfirstimage, ceil(rand(5,$img_width - 5)), ceil(rand(0,$img_height)), 30, 30, $blue); 
imagefilledellipse($myfirstimage, ceil(rand(5,$img_width - 5)), ceil(rand(0,$img_height)), 30, 30, $red); 
imagefilledellipse($myfirstimage, ceil(rand(5,$img_width - 5)), ceil(rand(0,$img_height)), 30, 30, $white); 
//imagefilledellipse($myfirstimage, ceil(rand(5,$img_width - 5)), ceil(rand(0,$img_height)), 30, 30, $lightblue); 
imagefilledellipse($myfirstimage, ceil(rand(5,$img_width - 5)), ceil(rand(0,$img_height)), 30, 30, $grey); 

imagefilledellipse($myfirstimage, ceil(rand(5,$img_width - 5)), ceil(rand(0,$img_height)), 30, 30, $green); 
imagefilledellipse($myfirstimage, ceil(rand(5,$img_width - 5)), ceil(rand(0,$img_height)), 30, 30, $blue); 
imagefilledellipse($myfirstimage, ceil(rand(5,$img_width - 5)), ceil(rand(0,$img_height)), 30, 30, $red); 
imagefilledellipse($myfirstimage, ceil(rand(5,$img_width - 5)), ceil(rand(0,$img_height)), 30, 30, $white); 
//imagefilledellipse($myfirstimage, ceil(rand(5,$img_width - 5)), ceil(rand(0,$img_height)), 30, 30, $lightblue); 
imagefilledellipse($myfirstimage, ceil(rand(5,$img_width - 5)), ceil(rand(0,$img_height)), 30, 30, $grey); 

imagefilledellipse($myfirstimage, ceil(rand(5,$img_width - 5)), ceil(rand(0,$img_height)), 30, 30, $green); 
imagefilledellipse($myfirstimage, ceil(rand(5,$img_width - 5)), ceil(rand(0,$img_height)), 30, 30, $blue); 
imagefilledellipse($myfirstimage, ceil(rand(5,$img_width - 5)), ceil(rand(0,$img_height)), 30, 30, $red); 
imagefilledellipse($myfirstimage, ceil(rand(5,$img_width - 5)), ceil(rand(0,$img_height)), 30, 30, $white); 
//imagefilledellipse($myfirstimage, ceil(rand(5,$img_width - 5)), ceil(rand(0,$img_height)), 30, 30, $lightblue); 
imagefilledellipse($myfirstimage, ceil(rand(5,$img_width - 5)), ceil(rand(0,$img_height)), 30, 30, $grey); 

$mystring = substr(rand(), 0, 6); 

$_SESSION['mystring'] = Setstring(); 

imageString($myfirstimage, 5, 20, 30, $_SESSION['mystring'], $black); 

ImagePNG($myfirstimage); 

imagedestroy($myfirstimage); // Flush Image 

function Setstring() 
{ 
$mystring = substr(rand(), 0, 6); 

return $mystring; 
} 

////////////////////////////////////////////////////////////////////////// 
// END OF DOCUMENT 
////////////////////////////////////////////////////////////////////////// 
?>
Just copy and paste the code into a new file each. NotePad++ is the best to use for this. Name them appropriately and place them in the "root" of the Sphider directory. Putting a link into whatever page you want for the add url submission page and such is entirely up to you. Hope this helps everyone out there who has been trying to get this to work for them. By the way, where the smiles are you need to place a "(" in the other direction, or SHIFT KEY+ 0.



Edited 4 time(s). Last edit at 12/28/2011 07:46PM by memyidesu.
Re: add url submit form
December 25, 2011 08:00AM
Nice job, thanks!winking smiley
Re: add url submit form
January 29, 2012 10:19AM
Yo Peeps,

I have worked on this a little more and I have a few tweaks. I will post them as soon as I am done. smiling smiley

[url=http://www.memyidesusoftware.com]Memyidesu Software[/url]
[url=http://www.machinecore.info]XMachinecor3X Spider[/url]
Re: add url submit form
February 01, 2012 05:40AM
Yo Peeps,

Ok. Here it is. I finally got the category check to work right and reduced the code a bit to make the file size smaller. Still working on the URL validation. Anyway, here you go.

Update: Couldn't help myself. I had to edit the code to make better use of the header and footer templates. smiling bouncing smiley

<?php 

/////////////////////////////////////////////////// 
// start of php header 
/////////////////////////////////////////////////// 
//Modified by: Memyidesu aka: The White Rabbit

session_start(); 

$include_dir = "./include"; 

$template_dir = "./templates/"; 

$settings_dir = "./settings"; 
$language_dir = "./languages"; 

include("$settings_dir/conf.php"winking smiley; 
include("$include_dir/commonfuncs.php"winking smiley; 
extract (getHttpVars());
require_once("$settings_dir/database.php"winking smiley; 
include ("$language_dir/$language-language.php"winking smiley; 
include("$template_dir/$template/header.html"winking smiley; 

///////////////////////////////////////////////////// 
// end of php header 
///////////////////////////////////////////////////// 
?>
<?php
/////////////////////////////////////////////////////
// start of php body
////////////////////////////////////////////////////		

// did the user press the add url button 
if(isset($_POST['addurl'])) 
{ 
// DO THE TUNING CODE MATCH 
if ($_POST['validate'] == $_SESSION['mystring']) 
{ 
// make sure the url is not empty 
if ($_POST['url'] != '')
{ 
global $mysql_table_prefix; 

// get the values of the other text box 

$short_desc = addslashes($_POST['short_desc']); 
$title = addslashes($_POST['title']); 
$compurl=parse_url("".$_POST['url']);	
if ($compurl['path']=='')
	$url = $_POST['url']."/";	
$result = mysql_query("select site_ID from ".$mysql_table_prefix."sites where url='$url'"winking smiley; 
echo mysql_error(); 
$rows = mysql_numrows($result); 
if ($rows==0 ) { 
mysql_query("INSERT INTO ".$mysql_table_prefix."sites (url, title, short_desc) VALUES ('$url', '$title', '$short_desc')"winking smiley; 
echo mysql_error(); 
$result = mysql_query("select site_ID from ".$mysql_table_prefix."sites where url='$url'"winking smiley; 
echo mysql_error(); 
$row = mysql_fetch_row($result); 
$site_id = $row[0]; 
$result=mysql_query("select category_id from ".$mysql_table_prefix."categories"winking smiley; 
echo mysql_error(); 
while ($row=mysql_fetch_row($result)) { 
$cat_id=$row[0]; 
if ($cat[$cat_id]=='on') { 
mysql_query("INSERT INTO ".$mysql_table_prefix."site_category (site_id, category_id) values ('$site_id', '$cat_id')"winking smiley; 
echo mysql_error(); 
} 
} 
If (!mysql_error())	{ 
$message = "<br/><center><b><font color=red>Thank you, You Site has been added</font></b></center>" ; 
} else { 
$message = mysql_error(); 
} 
} else { 
$message = "<center><b>Site already in database</b></center>"; 
} 
echo $message; 
} 
else 
{ 
echo "You must enter a valid url, press your back button and try again"; 
}
} 
}  
?>

<!--addurl form-->
<center><h1>Add your website to SEO Spider</h1></center>
<div ID="notes"><center> 
<h4>Share your place on the net with us.</h4> 
<p style="font-size: medium">
We add and update new sites to our index each time we crawl the web, and we invite you to submit your URL here.<br>
We do not add all submitted URLs to our index, and we cannot make any predictions or guarantees about when or if they will appear.</p> 
<p style="font-size: medium"> 
Please enter your full URL, including the prefix. For example: <code>[http://www.example.com]</code>.<br>
You may also add a title or description of the content of your page.<br>
These are used only for our information and do not affect how your page is indexed or used by us.</p> 
<p style="font-size: medium"> 
<b>Please note</b>: Only the top-level page from a host is necessary; you do not need to submit each individual page.</p> 
</center>
</div> 
<br/>
<div id="addurlctrl" align="center"><center><table>
<form action="addurl.php" method="post">
<input type="hidden" name="f" value="1">
<input type="hidden" name="af" value="2">
<tr><td><b>URL:</b></td><td align ="right"></td><td><input type="text" name="url" size="60" value ="http://"></td></tr>
<tr><td><b>Title:</b></td><td></td><td> <input type="text" name="title" size="60"></td></tr>
<tr><td><b>Short description:</b></td><td></td><td><textarea name="short_desc" cols="45" rows="3" wrap="virtual"></textarea></td></tr>
<tr><td>Category:</td><td></td><td>
<?php  walk_through_cats(0, 0, '');?></td></tr>
<tr> 
<td></td> 
<td></td> 
<td><p style="font-size: small">To help us distinguish between sites submitted by individuals and<br> 
those automatically entered by software robots, please type the numbers<br> 
shown here into the box below.</p>
</td> 
</tr> 
<tr> 
<td></td> 
<td></td> 
<td><img src="verify.php" height="60"></td> 
</tr> 
<tr> 
<td></td> 
<td></td> 
<td><input type="text" name="validate" size="20" MAXLENGTH="10"></td> 
</tr> 
<tr> 
<td></td> 
<td></td> 
<tr><td></td><td></td><td><input type="submit" id="submit" value="Add" name="addurl"></td></tr></form></table></center></div>
<!--end form-->

<?php

function walk_through_cats($parent, $lev, $site_id) {
		global $mysql_table_prefix;
		$space = "";
		for ($x = 0; $x < $lev; $x++)
			$space .= "&nbsp;&nbsp;&nbsp;&nbsp;";

		$query = "SELECT * FROM ".$mysql_table_prefix."categories WHERE parent_num=$parent ORDER BY category";
		$result = mysql_query($query);
		echo mysql_error();
		
		if (mysql_num_rows($result) <> '')
			while ($row = mysql_fetch_array($result)) {
				$id = $row['category_id'];
				$cat = $row['category'];
				$state = '';
				if ($site_id <> '') {
					$result2 = mysql_query("select * from ".$mysql_table_prefix."site_category where site_id=$site_id and category_id=$id"winking smiley;
					echo mysql_error();
					$rows = mysql_num_rows($result2);

					if ($rows > 0)
						$state = "checked";
				}

				print $space . "<input type=checkbox name=cat[$id] $state>" . $cat . "<br/>\n";
				;
				walk_through_cats($id, $lev + 1, $site_id);
			}
	}

////////////////////////////////////////////////////// 
// end of php body 
/////////////////////////////////////////////////////// 
?>
<?php include("$template_dir/$template/footer.html"winking smiley; ?>

[url=http://www.memyidesusoftware.com]Memyidesu Software[/url]
[url=http://www.machinecore.info]XMachinecor3X Spider[/url]



Edited 1 time(s). Last edit at 02/01/2012 08:22AM by memyidesu.
Re: add url submit form
September 05, 2013 08:00PM
Yo Peeps,

I changed this up a bit to be a bit more flexible. I've added a couple of templates and a captcha feature from codefuture. You can find all the info at this forum I put up: [url=http://www.seochatboard.com/read.php?26,2]http://www.seochatboard.com/read.php?26,2[/url]

This is a direct link to the files and code for this project. There is a lot more that will be getting put up, so check back now and then.

UPDATE: Had to change the forum out. phpBB and SMF just don't work. I am using Phorum now and no issues. New link has been posted above.

[url=http://www.memyidesusoftware.com]Memyidesu Software[/url]
[url=http://www.machinecore.info]XMachinecor3X Spider[/url]



Edited 1 time(s). Last edit at 09/21/2013 08:37PM by memyidesu.
Sorry, only registered users may post in this forum.

Click here to login