Manually "Add a Site" for your Users
September 22, 2007 09:58PM
Here is an experimental code to let your Users manually "Add a Site".

Add a new File "addurl.php" in the root directory eg. search.php


<?php

//error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING); 
error_reporting(E_ALL); 
$include_dir = "./include"; 
include ("$include_dir/commonfuncs.php"winking smiley;
//extract(getHttpVars());

$include_dir = "./include"; 
$template_dir = "./templates"; 
$settings_dir = "./settings"; 
$language_dir = "./languages";


require_once("$settings_dir/database.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;


include "$settings_dir/conf.php";

include "$template_dir/$template/header.html";
include "$language_dir/$language-language.php";


require_once("$template_dir/$template/addurl.html"winking smiley;

include "$template_dir/$template/footer.html";
?>

Add a new File addurl.html in your templates Folder


<div align=center><center><table>
<form action=admin/admin.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>
</td><td>
</td></tr>
<tr><td></td><td></td><td><input type=submit id="submit" value=Add></td></tr></form></table></center></div>
<?php

This adds manually add sites in your database like http://google.com/addurl
Propably there has to be a chance to control those urls, but at the moment i have no ideas on that.

Feel free to post your ideas as i´m not a PHP Pro.
To be continued

Greets Franky

------
Die Gedanken sind frei...



Edited 1 time(s). Last edit at 09/22/2007 11:08PM by franky.
Re: Manually "Add a Site" for your Users
October 18, 2007 01:35PM
hey friend

every time i go to add a site from the form it's wants USERNAME and PASSWORD from Admin panel.
Re: Manually "Add a Site" for your Users
October 31, 2007 10:12AM
nothing?
Re: Manually "Add a Site" for your Users
November 17, 2007 05:08AM
It does the same for me. Is there any way to post it in the admin panel without being an admin?
Re: Manually "Add a Site" for your Users
November 17, 2007 06:30AM
1. create a file addurl.php and place it in the same directory as your search.php

<?php

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

session_start();

$include_dir = "./include";

$template_dir = "./templates/standard/";

$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;
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
/////////////////////////////////////////////////////

// did the user press the add url button
if(isset($_POST['addurl']))
{
// DO THE TUNNING 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']);
$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/><b><font color=red></font>Thank you, You Site has been added</font></b>" ;

}
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";
}
}
}

//////////////////////////////////////////////////////
// end of php body
///////////////////////////////////////////////////////
?>

2.) create a file addurl.html and place it in /template/standard/ directory watch out for my css

<DIV ID="notes">
<h4>Share your place on the net with us.</h4>

<p>
<font size="-1">We add and update new sites to our index each time
we crawl the web, and we invite you to submit your URL here. We do not<br>
add all submitted URLs to our index, and we cannot make any predictions
or guarantees about when or if they will appear. </font></p>
<p>
<font size="-1">Please enter your full URL, including the</font> <code>http://</code>
<font size="-1">prefix. For example:</font> <code>http://www.google.com/</code>.
<font size="-1"><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 Google. </font></p>
<p>
<font size="-1"><b>Please note</b>: Only the top-level page from a
host is necessary; you do not need to submit each individual page.</font></p>
</div>

<div ID="addurlctl">
<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>
</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>
</td>
<tr>
<td></td>
<td></td>
<td>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.
</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>
<td>
<input type=submit id="submit" value=Add name="addurl" >
</td>
</tr>
</form>
</table>
</center>
</div>

3.) create another file verify.php and place it in the main directory where your main search script. This the tricky part, make sure you php has load the gd moduale for php graphics.

<?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
//////////////////////////////////////////////////////////////////////////
?>

I know the tuning code is simple, if you have a better one please let me know. I know this code works, you can see it run at http://daymoon.no-ip.ca/addurl.php
Re: Manually "Add a Site" for your Users
November 17, 2007 12:55PM
Continuous function without When shipping form is recharged page but does not add url to the base datos.Tampoco displays your site has been added
Re: Manually "Add a Site" for your Users
November 17, 2007 05:10PM
I figured out what the prob is. What's happening is the code works through the admin script which requires for the admin to be logged in to access it so unless the submiter is the admin he's not going to be able to submit a site. I came to the conclusion that the only thing needed is a separate script that accesses the database via database.php and a form that submits the results to a file named submit.php from there it accesses the database and send the proper data to the right tables. I will start working on this asap.
Re: Manually "Add a Site" for your Users
November 17, 2007 07:01PM
I am not sure what you are saying. The function does add a url to the database and lets you know it has been added without taking the user to the admin page. It also has the tuning code.
Re: Manually "Add a Site" for your Users
November 17, 2007 07:05PM
I solved the problem with this second version.

1.)In addurl.php find:
include("$include_dir/commonfuncs.php"winking smiley;

2.)After Add:
require_once("$settings_dir/database.php"winking smiley;

3.)In the same file find:
$template_dir = "./templates/standard/";

4.)Replace with:
$template_dir = "./templates/";

Thats it! now it should work, and put the url in the database and it will show up in your admin panel with the "not indexed" status. so you can add the "Only index new" mod and then when you log into your admin panel and theres new submissions you can just hit "index new" and you done

-Tyler
Re: Manually "Add a Site" for your Users
November 18, 2007 08:30PM
I am in the process of changing allot of the code (new classes) and that is where the confusion came about. I thought I changed the includes back to where they were. Sorry about that.
Re: Manually "Add a Site" for your Users
November 18, 2007 11:54PM
If you can help me... I tryed to get the little CAPTCHA picture to be white and orange but I couldn't get it. it kept going to black and white.

Can someone please help me?

Thanks
-Tyler

PS. I don't know if you forgot to change the paragraphs but they say the exact same thing as google and so, if you updating the code I suggest you change that so that no one gets in trouble by google.



Edited 1 time(s). Last edit at 11/18/2007 11:56PM by Skeletron.
Re: Manually "Add a Site" for your Users
November 19, 2007 12:21AM
My only guess is you are missing the php extension to make it work. check out http://ca3.php.net/gd for help.
Re: Manually "Add a Site" for your Users
December 21, 2007 11:01PM
Dont know what i did wrong but i created the files as said, changed some codes as said but the only thing that appears is my sitelogo and nothing else.

Could someone help please?
Re: Manually "Add a Site" for your Users
December 22, 2007 05:56AM
I am not sure what is going on there however you must make you are using php 5 and you edit your ini file to load the gd2.dll also make sure all the includes and file locations are correct.
Re: Manually "Add a Site" for your Users
December 23, 2007 06:19PM
Yes is working now, i must have done something wrong

I just have a issue in the admin. After indexing a site the status stays at Not indexed but schould change to the indexing date?


Thank you

anthony
Re: Manually "Add a Site" for your Users
January 09, 2008 04:24AM
No message is displayed when the site is submitted. The message in addurl.php is not displayed when successfully done.

ALso, any chance of a cron job to auto index at least the first level of links on the domain? That way the main links on the site are indexed immediately but to do a full index, it requires admin.
Re: Manually "Add a Site" for your Users
January 09, 2008 05:15AM
Never mind on the message, it's there just not how I wanted it.

I'm looking into the auto index of just the first level of the domain upon entry.
Re: Manually "Add a Site" for your Users
January 09, 2008 04:28PM
Category forms don't show up when adding the URL... I want users to be able to select the categories for their site that they're adding.
Re: Manually "Add a Site" for your Users
February 07, 2008 04:13PM
it works good for me
Re: Manually "Add a Site" for your Users
February 08, 2008 12:40PM
I did something similar to this for our Sphider deployment ( http://www.petadvantage.com ). One issue I have run into, which I am sure others are experiencing the same thing, is the amount of spam submissions received.

We use a CAPTCHA challenge which stops most issues, however, we still get bots submitting - likely ones that are getting smarter.

My Planned Approach:
I am going to test something that should work. The bots that are coming by are submitting what looks to be similar to guest book entries. With that in mind, bots are stupid and do not read the CSS of a given page. I will be adding a few extra for fields that, via CSS, are not visible to the human visitor. The fields will be named "subject", "name", "feedback".

What I expect to occur is that human submitters will fill in the URL and Comments field but not the extra fields hidden by the CSS. The bots, however, will see the other fields and fill them in. During the form processing, I do not plan to change the visible behavior to the bot to make them think it was a successful submission. On the back side, silently dispose of the submitted data before entering into the DB for processing.

I'll try to get testing on this during the week next week as time permits. Your thoughts and feedback on this would be great. My current Add Your Site form doesn't use the code above, but the data capturing is essentially the same:
http://www.petadvantage.com/submit.php

-Bing
-------
Turn your Sphider into an Ads for Search and Ads for Content Advertising Network Free!
http://www.inclick.net



Edited 1 time(s). Last edit at 02/08/2008 09:51PM by inmotion.
Re: Manually "Add a Site" for your Users
March 16, 2008 05:33PM
Just a quick update, the form variables hidden via CSS did capture a number of auto-submitters that work around captcha.

-Bing
-------
Turn your Sphider into an Ads for Search and Ads for Content Advertising Network Free!
http://www.inclick.net
bgg
Re: Manually "Add a Site" for your Users
August 09, 2008 12:30PM
How to generate the default link submit form that is in the admin section be shown .. instead of the static user submit form?

which contains:

Link URL
Link Title
Link Desscription
Link Category (if there is):

Thanks!
Re: Manually "Add a Site" for your Users
September 24, 2008 04:03AM
I have a couple simple questions related to this Submit a Site page.

If I wanted the output text that says something like..."Thank you for submitting your website"...to be in a different color, like green for success and red for an error message, how would I do that? I don't know PHP, so I'm not sure what kind of tags I can add, if any.

I also noticed I can type just about anything in the url box and it accepts it. I tried to make it show one of the two errors in addurl.php, but I could not even if I type gibberish into the form. Any idea why?


Thanks,
Selym
Re: Manually "Add a Site" for your Users
March 29, 2009 08:44PM
an if block will control what text you want to show depending on error or success. also regarding the url box, you can use regular expression like the following. https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)? ,

i had implemented it in one of my test sites. lost everything. just downloaded the source code afresh. will give it a look and check back.

http://www.only2ndhand.com/ (Free ad postings - fast -easy)



Edited 1 time(s). Last edit at 03/29/2009 08:48PM by deepak.
Re: Manually "Add a Site" for your Users
March 30, 2009 04:27PM
Can someone please summarize this thread including the full code to do this?

http://www.lowcarbsearch.com
Re: Manually "Add a Site" for your Users
April 09, 2009 04:39AM
this does not work on the wordpress plugin

please update code
lex
Re: Manually "Add a Site" for your Users
June 04, 2009 03:28PM
mh0825 Wrote:
-------------------------------------------------------
> No message is displayed when the site is
> submitted. The message in addurl.php is not
> displayed when successfully done.
>
> ALso, any chance of a cron job to auto index at
> least the first level of links on the domain?
> That way the main links on the site are indexed
> immediately but to do a full index, it requires
> admin.

yes i have the same problem after submit no massege displayed for user adding the url please can some fix this?
lex
Re: Manually "Add a Site" for your Users
June 04, 2009 05:09PM
Anthony42 Wrote:
-------------------------------------------------------
> Yes is working now, i must have done something
> wrong
>
> I just have a issue in the admin. After indexing
> a site the status stays at Not indexed but
> schould change to the indexing date?
>
>
> Thank you
>
> anthony


and here is another problem im having as anthony42 is having
lex
Re: Manually "Add a Site" for your Users
June 04, 2009 05:09PM
Anthony42 Wrote:
-------------------------------------------------------
> Yes is working now, i must have done something
> wrong
>
> I just have a issue in the admin. After indexing
> a site the status stays at Not indexed but
> schould change to the indexing date?
>
>
> Thank you
>
> anthony


and here is another problem im having as anthony42 is having please tell us how to fix these problems
Re: Manually "Add a Site" for your Users
July 22, 2009 03:40AM
anything for the wordpress sphider plugin
Sorry, only registered users may post in this forum.

Click here to login