I am looking for someone to code a script that will display random links. For example, when they load my page: www.mysite.com It will randomly take them to another site which is in my list. I would also like the script to maintain some simple stats on the number of times the sites have been loaded. pm me if you can do this
addurl.php <?php //add mysql connection etc here if(isset($_POST['submit'])) { mysql_query("INSERT INTO websites(url) VALUES('".$_POST['url']."')") or die(mysql_error()); } else { ?> <form method="post"> <input type="text" name="url" /> <input type="submit" name="submit" /> </form> <? } ?> PHP: index.php <? //mysql connection stuff $sql=mysql_query("SELECT url FROM websites ORDER BY RAND() LIMIT 1"); $row=mysql_fetch_array($sql); header("Location: ".$row['url'].""); ?> PHP: Hardly took me any time to code it
Is it so hard to read the replies (4 in this case) before posting? QUOTE=Im The ONE;6458518]addurl.php <?php //add mysql connection etc here if(isset($_POST['submit'])) { mysql_query("INSERT INTO websites(url) VALUES('".$_POST['url']."')") or die(mysql_error()); } else { ?> <form method="post"> <input type="text" name="url" /> <input type="submit" name="submit" /> </form> <? } ?> PHP: index.php <? //mysql connection stuff $sql=mysql_query("SELECT url FROM websites ORDER BY RAND() LIMIT 1"); $row=mysql_fetch_array($sql); header("Location: ".$row['url'].""); ?> PHP: Hardly took me any time to code it [/QUOTE] That's vulnerable for SQL injection and contains no stats for the clicking. Plus you would also need to setup a database for it, my script uses text files instead.