TyDoesVB
TyDoesVB

Reputation: 1

How to fetch text from a txt file or pastebin?

I was wondering how I would fetch text from a random line and display it, I plan on using this for login systems or random banner ad's on PageLoad, I know it's possible Ive seen it done on a CMS the creator used pastebin for the ad banner links like to the gif's and then displayed them randomly, can you also tell me how to read from paste bin as a login system host like read from 1 page for the username and another page for the Password, please don't link me to MySQL (if its even possible with MySQL) I have it but I am not that advanced.

Upvotes: 0

Views: 3142

Answers (1)

Sameer Alibhai
Sameer Alibhai

Reputation: 3178

  1. Load the text file in javascript, probably into an array, split by lines.
  2. Create a random number. var x=Math.Random(0,numLines)
  3. Load the string from the array at that index. ie document.write(results[x]);

Upvotes: 1

Related Questions