Forum Moderators: coopster

Message Too Old, No Replies

Update Link files

update a dynamic link

         

newb

11:23 pm on Feb 11, 2006 (gmt 0)

10+ Year Member



Hi webmasters of the world,
I have a really headache problem, i have 2 websites, one stores information like site1.com and the other stores data like site2.com.
People from another site always stealing my data links and linking to there sites, i have tried to using htaccess but it doesn't work for wma, and wmv files.
i'd like to rename the folder where i storing data in site2.com every day, but then my data in my site1.com will have to update links, this is too many links in database, i can't update it all at the same time.
so i think one solution can solve this problem is make a php tool, this tool can automatically update linking from site1 to site2 which i stored in a txt file, for example site2.com/folder/link.wma when i change the name "folder" in this site to site2.com/folderblalala/link.wma the site 1 can update the name "folder" to "folderblalala"
and my data storing in a text file like this:
data in a txt file in site1.com/data.txt

file name¦¦http: //site2.com/folder/link1.wma
file name¦¦http: //site2.com/folder/link2.wma
file name¦¦http: //site2.com/folder/link3.wma
file name¦¦http: //site2.com/folder/link3.wma
file name¦¦http: //site2.com/folder/link3.wma
............................................

all i need to do is update the renamed folder from site 2, but i don't know where to start, and don't know how to do, i hope some one can help me through this.
Thanks very much
Johny

newb

10:41 am on Feb 12, 2006 (gmt 0)

10+ Year Member



Somebody plz read this and help me out.

jatar_k

6:12 pm on Feb 13, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



do you want this to go both ways or is one site going to be the opnly one where changes are made?

newb

10:31 pm on Feb 13, 2006 (gmt 0)

10+ Year Member



Yes, at last one master answer my question, i think you can do this,
i think i only need to update links in the site1.com/data.txt doesn't matter what i rename the folder in site2.com, site 1 will update linking in the text file as the tool (if you can help me to make it) does it. the linking in the text file in site1.com/data.txt will keep the
file name¦¦http: //site2.com/$folder/linking.wma so the
file name¦¦http: //site2.com/ and /linking.wma
will be the same all the time only folder will be rename everyday.
Thanks

jatar_k

4:40 pm on Feb 14, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



well, if you want them to change together you would need some kind of communication between the two. To make it automated I would think you would need an array of names that one site could use. Then it could somehow post that new name to a file and the other site could look at the file and do the same.

Can't you just store all of your files above the root and use a script to link them? This would probably stop direct linking. You could then use the htaccess on the delivery script, which would be a php file.

newb

10:07 pm on Feb 14, 2006 (gmt 0)

10+ Year Member



Ok you have a good idea, but i don't know how to make the comunication between them 2, could you make this work?
second i'm trying protect link as you said too.
have a look at the code:
<?php
$ADMIN[defaulturl] = "http://example.com";

$okaysites = array("http://example.com","http://www.example.com");

$ADMIN[url_1] = "http://www.example.com/download.php3?product=";
$ADMIN[url_2] = "http://example.com";
$ADMIN[url_3] = "http://example.com/new";

//////////////////////////////////////////////////////

$reffer = $HTTP_REFERER;
if($reffer) {
$yes = 0;
while(list($domain, $subarray) = each($okaysites)) {
if (ereg("$reffer",$subarray)) {
$yes = 1;
}
}
$theu = "url"."_"."$site";
if ($ADMIN[$theu] AND $yes == 1) {
header("Location: $ADMIN[$theu]/$file");
} else {
header("Location: $ADMIN[defaulturl]");
}
} else {
header("Location: $ADMIN[defaulturl]");
}

?>

----------------------
readme file
1, Open download.php and edit these 3 varibles

$ADMIN[defaulturl] = It will redirect people to this url if they are trying to link to your downloads off there site
@okaysites = sites which can download files off your site
$ADMIN[url_1] = A location to a download folder with some downloads in it

(to add more download locations just put on a new line in the script)
$ADMIN[url_4] = "http://site.com";
$ADMIN[url_5] = "http://site.com";
$ADMIN[url_6] = "http://site.com";
and keep going up a number for as many as you want

2, Upload the script to your website

3, Now just link to the download you want by doing [yoursite.com...]
On that link it has ( site=1 ) that means it calls the download location ( $url_1 )
just change it to what you want so it calls the correct folder
------------------
i tried to change my linking but it doesn't work for me, could you see what the problem with this code?
thanks verry much
John

[edited by: jatar_k at 11:29 pm (utc) on Feb. 14, 2006]
[edit reason] examplified [/edit]

jatar_k

5:04 pm on Feb 15, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I don't see any glaring issues with that code

what exactly doesn't work?