...

View Full Version : "Uploading" Links?



m7d7g7
04-15-2003, 10:57 PM
hey,
i have been looking around for a while and wanted to know if there is a PHP script for people "uploading" links. like have them put there name, a description of the link and the link it's self in a nice organized table? or something to that effect. just wondering.. havent found anything.

thanks :)
mike.

x_goose_x
04-15-2003, 11:19 PM
Quickly thrown together, but it'll do the job. You'll need to do some formatting.



<?php

$file = "links.htm";

$usr = $_POST['usr'];
$lnk = $_POST['lnk'];
$dsc = $_POST['dsc'];

if ( $usr && $lnk && $dsc ) {
$fa = fopen($file, "a");
$data = "<tr>\n<td>$usr</td>\n<td><a href='$lnk'>$lnk</a></td>\n<td>$dsc</td>\n<tr>\n";
fwrite($fa, $data);
fclose($fa);
}

if ( file_exists ($file) ) {
$fr = fopen($file, "r");
$links = fread($fr, filesize($file));
$links = "<table>\n<tr>\n<td>Name:</td>\n<td>Link:</td>\n<td>Description:</td>\n</tr>\n$links</table>\n";
fclose($fr);
}

?>

<form method="POST">
Name: <input type="text" name="usr"><br>
Link: <input type="text" name="lnk" value="http://"><br>
Description: <input type="text" name="dsc"><br>
<input type="submit" value="Add Link">
</form>

<br><br>

View the links:

<br><br>

<?=$links?>

<br><br>

What do you think?<br>

m7d7g7
04-15-2003, 11:43 PM
dang dude...lol. thanks.. going to try it out right now :)

m7d7g7
04-15-2003, 11:59 PM
awesome work. 2 questions.

how would i make ftp:// links work? http links work great but when i try an ftp link it just comes up http://. and when it posted how can i spread the name link and description apart alittle further? also any way to make the links not live (not clickable)?

thanks again,
mike

x_goose_x
04-16-2003, 03:17 AM
<?php

$file = "links.htm";

$usr = $_POST['usr'];
$lnk = $_POST['lnk'];
$dsc = $_POST['dsc'];

if ( $usr && $lnk && $dsc ) {
$fa = fopen($file, "a");
$data = "<tr>\n<td>$usr</td>\n<td>$lnk</td>\n<td>$dsc</td>\n<tr>\n";
fwrite($fa, $data);
fclose($fa);
}

if ( file_exists ($file) ) {
$fr = fopen($file, "r");
$links = fread($fr, filesize($file));
$links = "<table width='100%'>\n<tr>\n<td>Name:</td>\n<td>Link:</td>\n<td>Description:</td>\n</tr>\n$links</table>\n";
fclose($fr);
}

?>

<form method="POST">
Name: <input type="text" name="usr"><br>
Link: <input type="text" name="lnk"><br>
Description: <input type="text" name="dsc"><br>
<input type="submit" value="Add Link">
</form>

<br><br>

View the links:

<br><br>

<?=$links?>

<br><br>

What do you think?<br>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum