Sistema de links sin mysql 
Tuesday, July 31, 2012, 06:52 PM - Php
Sencillo sistema de links para ofrecer a los visitantes que incluyan su pagina web
El script consta de 2 archivos txt y 6 con php , los archivos a crear son emails.txt, links.txt, footer.php, header.php, index.php, linklist.php, submit.php y variables.php , aparte se tiene que conseguir una imagen gif llamada browser.gif
Primero creamos los documentos vacios emails.txt, links.txt , estos van a ser la base de datos donde se van almacenar los links , bien , ahora los codigos





por orden como los puse arriba para comprobar que no falte ninguno

footer.php

<center>
<br>
<font size="4">
<?php
echo $text3 ?>
<br>
<?php echo $text4 ?><br>
<a href="<?php echo $url2 ?>" target=_blank">
<?php
echo $urltext2 ?>
</a></font> <br>
</center><br>
<div align="center"><a href="submit.php"><font size="3" face="Verdana, Arial, Helvetica, sans-serif">Click
Here To Submit Your Site</font></a></div><br>
</html>


header.php

<?php
require "variables.php";
?>
<html>
<head>
<title><?php echo $title ?> </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<body bgcolor="#006699" text="#FFFFFF" link="#FFFFFF" vlink="#FFFF00" alink="#FF0000"><font color="#FFFFFF" size="1" face="verdana">
<br>
<center><font size="4">
<?php echo $text1 ?>
<br>
<?php echo $text2 ?>
<br>
<a href="<?php echo $url1 ?>" target=_blank">
<?php
echo $urltext1 ?>
</a><br></font>
</center><br>

<div align="center"><a href="submit.php"><font size="3" face="Verdana, Arial, Helvetica, sans-serif">Click Here To Submit Your Site</font></a></div><br>


index.php

<?php
include "header.php";
?>
<?php
$data = file('links.txt');
$data = array_reverse($data);
foreach($data as $element) {
$element = trim($element);
$pieces = explode("|", $element);
echo $pieces[2] . $pieces[1] . "" . $pieces[0] . "";
}
?>
<?php
include "footer.php";
?>


linklist.php

<?php
require "variables.php";
if ($wsname == "") {
echo "You must fill out a site name.";
exit;
}
else
if ($wsurl == "") {
echo "You must fill out a site URL.";
exit;
}
else
if ($description == "") {
echo "You must put a description.";
exit;
}
else
if ($email == "") {
echo "You must enter your email.";
exit;
}
else
$textfile = ("links.txt");
$textfile2 = ("emails.txt");
$fp = fopen($textfile, "a+");
fputs ($fp, "<center><table><tr><td bgcolor=666666 width=500 height=20><font size=2><img src=$imagedir/browser.gif><strong><a href=http://$wsurl target=_blank><font size=4>$wsname</font></a></strong></td></tr><tr><td bgcolor=cccccc width=400><font size=2><font color=000000>$description</font></td></tr></table></center><br><br>\n");
fclose($fp);
$fp = fopen($textfile2, "a+");
fputs ($fp, "$email\n");
fclose($fp);
echo "<html> <title>$title</title><body bgcolor=006699 text=FFFFFF link=FFFFFF vlink=FFFF00 alink=FF0000><font color=FFFFFF size=3 face=verdana><br><center><br> $text1<br>$text2 <br><a href=\"$url1 \" target=_blank\"> $urltext1</a><br><br>Your site has been successfully added. <a href=$viewpage>Click here</a> to view the Link List page.</center></html>";
?>



submit.php

<?php
require "variables.php";
?>
<html>
<head>
<title><?php echo $title ?> </title>
</head>
<body bgcolor="#006699" text="#FFFFFF" link="#FFFFFF" vlink="#FFFF00" alink="#FF0000">
<center><font size="4">
<?php
echo $text1 ?>
<br>
<?php echo $text2 ?><br>
<a href="<?php echo $url1 ?>" target=_blank">
<?php
echo $urltext1 ?>
</a><br>
<font color="#000000">Submit you site for an Instant Free Listing</font></font>
</center> <FORM METHOD="POST" ACTION="linklist.php">
<table width="500" border="0" align="center" cellpadding="2" cellspacing="2">
<tr>
<td><div align="right"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Website
Name:</font></strong> </div></td>
<td> <div align="left">
<INPUT TYPE="text" NAME="wsname" SIZE="30">
</div></td>
</tr>
<tr>
<td width="105"><div align="right"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Website
URL:</font></strong> </div></td>
<td width="195"> <div align="left">no http:// just www.&nbsp;
<INPUT TYPE="text" NAME="wsurl" SIZE="24">
</div></td>
</tr>
<tr>
<td><div align="right"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Description:</font></strong></div></td>
<td><textarea name="description" cols="26"></textarea></td>
</tr>
<tr>
<td><div align="right"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Email:</font></strong></div></td>
<td><input type="text" NAME="email"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><div align="center">By Submitting your link you agree to recieve mailings
from us.<br>
<INPUT TYPE="submit" value="Submit!">
</div></div>
</td>
</tr>
</table>
</form>

<center><font size="4">
<?php
echo $text1 ?>
<br>
<?php echo $text2 ?><br>
<a href="<?php echo $url2 ?>" target=_blank">
<?php
echo $urltext2 ?>
</a></font>
</center>
</html>


variables.php

<?php

// This is the page where you will put your free for fall links on. This is a URL!
$viewpage = "index.php";

// The directory to where you will upload your images. DO NOT END WITH TRAILING SLASH!
$imagedir = "images";

// Website Title
$title = "Title Of Link Page";

// Text 1 for top of pages
$text1 = "Your Text Here";

// Text 2 for top of pages
$text2 = "Second Line of Text";

// Link for Top Of Page
$url1 = "../index.php";

//URL 1 Text
$urltext1 = "Text Of URL";

// Text 1 for bottom of pages
$text3 = "Your Text Here";

// Text 2 for bottom of pages
$text4 = "Second Line of Text";

// Link for Top Of Page
$url2 = "../index.php";

//URL 1 Text
$urltext2 = "Text Of URL";
?>



se ponen todos los archivos dentro de una carpeta y se envian al servidor , la primera ves que se ejecuta el scripts da un error y se arregla despues de poner el primer link

Comentarios

Agregar comentario

Rellene los campos de abajo para dejar su comentario.









Extras (Negrita / Cursiva / URL / Imagen):








En este blog está activada la moderación. Tu comentario requiere que los administradores lo aprueben antes de hacerse visible.