Get exclusive CAP network offers from top brands

View CAP Offers

Php and SQL – Things we can do to make life better

allfreechips asked 4 years ago
Have you been adding your affiliate links page by page in 35 different spots then come to find you need to change your link? Or has this happened on even greater scales where your affiliate makes you change 12 casino links you have posted in 130 spots?

Why post the actual link when you can redirect with a single stored link?

SQL setup –

Table `casinos`

id – Integer / 25 / auto Increment / Set as Key
name – VCHAR / 255
link – VCHAR /255

Create that and have all your casinos in there (create a form to add /edit)

Then instead of making your links full you can use the following

yourdomain.com/casinolink.php?id=10

then in casinolink.php

[PHP]
include(“../configuration.php”); // Get SQL access
$id = ( isset($HTTP_GET_VARS) ) ? intval($HTTP_GET_VARS) : 0; / Pull in ID $
$id=mysql_real_escape_string($id); // Clean the string in case someone injects in URL
$get_rows=mysql_query(“select * from casinos where id=’$id'”);
$get_url=@mysql_fetch_array($get_rows);
$clickurl=$get_url[link]; // pull link to the casino for that ID

header(“Location: $clickurl”); // Redirect user to the casino
?>
[/PHP]

Now you post this link all over your sites, and when you need to change the URL, you just update the database ONCE!

15 Answers
Rob472 answered 4 years ago
A search engine that follows robots.txt will never visit the pages or directories in your disallow list. Therefore it will never know your redirects even exist. So how does it give credit for those links when it doesn’t know they exist? On the other hand, a lot more search engines ignore rel=”nofollow” than robots.txt so robots.txt is still a better way to make sure all the major search engines don’t give credit for those links.

AK answered 4 years ago
This chips guy is an html genius. I hope he can help me with my new vb forum.

allfreechips answered 4 years ago
Lol, Rob is the Professional, Ill help with what I can but I have not yet played with the 4.0 version.

robinpatrick2 answered 4 years ago
Yes that’s possible as well, although in a bigger picture where SQL contains entirely the data for affiliates via web forms reverting back to htaccess redirects becomes less beneficial. It also contributing a simple update line into the above code will also allow you to collect click inform per link.

robinpatrick2 answered 4 years ago
PHP and MySQL can be applied to create dynamically-generated HTML pages. It just with a little more know-how, you can also apply this combo with Apache to produce a dynamically-updated RSS feed.