...

View Full Version : Automatic link adding script..



MPCODER
01-16-2004, 02:54 PM
Hello,
Can anyone please give me a script that can let the visitors automatically add links and stuff on my linkpage so that i don't have to add every link myself, and maybe logs the ip of users that post a link. (to prevent abuse).
Cheers MPCODER
:thumbsup:

Nightfire
01-16-2004, 03:36 PM
Maybe http://www.hotscripts.com will help you? You still want to be able to check the links though, as for all you know someone on dial up could just reconnect after adding a link and ad another link each time.

MPCODER
01-16-2004, 04:23 PM
I looked on Hotscripts... haven't found what i was looking for.
Maybe someone could give me one that lets simply let users add links like this: http://www.codeonrequest.nl/freelinks.php, it says at the bottom of the page, "Nieuwe Link" which means New link, and you can add one by clicking on the button and the link automatically is added to the page.
Please help me :thumbsup:,
(BTW i wanted it to log ip adresses so people wont add links to sites that i DONT want links to such as hack sites, porn, and that kind of stuff)

murphyz
01-17-2004, 01:39 AM
I'm a beginner with PHP myself, but thought I would give this a shot...of which some of it works but it does need improving (read: can one of CFnuts you help? :))

The script below will add the link someone enters, along with logging their IP.

I am still figuring out how to get it to check that the link isn't already in the database (which shouldn't be too hard, but it is getting late and I'm sleepy).

The other problem with the script is that is seems to add a row to the database whenever someone enters the page. As I say, it works, but it's scrappy and needs improving.

Table = Links
Fields = link_number, link, ip


<?php
// logs
$IP = getenv('REMOTE_ADDR');
$yourlink = $_POST['yourlink'];
$insert= "INSERT INTO links (link,ip) VALUES ('$yourlink','$IP') ";
if ( @mysql_query($insert) ) {
}
else {
die('<p>Error performing this update: ' . mysql_error() . '</p>');
}

// Request the existing Links

$links = @mysql_query("SELECT link FROM links WHERE link LIKE 'http://%.%'");

if (!$links) {
die("<p>Error performing query: " . mysql_error() . "</p>");
}
while ($row = mysql_fetch_array($links) ) {
$linklist = $row['link'];
echo '<a href="'.$linklist.'">'.$linklist.'</a><BR>';
}

?>
<br>

<form action="riddles.php" method="post">
<div align="center">your link:
<input name="yourlink" type="text" value="http://" />
<input type="submit" value="GO" />
</div>
</form>


Mxx

Nightfire
01-17-2004, 11:10 AM
The way to get around it adding empty rows is to check if the submit button has been pressed.



<?php
if(isset($submitbuttonname){
php stuff here
}else{
html form here, submitbuttonname not been used.
}
?>

MPCODER
01-17-2004, 04:23 PM
Murphyz.. your script uses MySQL, i dont have a MySQL database.... But i have something simmiliar now.

DsgnrsTLZAdmin
01-17-2004, 04:53 PM
I'll write one for you. Get in contact with me.


E-mail: dodgerida67@aol.com
AIM ID: dodgerida67

stevan
01-17-2004, 09:01 PM
you really need to have mysql for a links script

Ask your provider I bet yuo have it and do not know it most servers have it and php on them.

THe best for free is WSN LINKS BASIC You do not have to know php or anything else really

If yuo need help on this email i will help you on this as I have it on all my sites

STEVE:thumbsup:

MPCODER
01-17-2004, 09:22 PM
No i dont need MySQL for a script like that. I have a simmiliar script now that doesn't uses MySQL.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum