1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP encoder / scrambler

Discussion in 'PHP & Perl' started by loreen, Aug 22, 2008.

  1. loreen

    loreen Jr. VIP Jr. VIP Premium Member

    Feb 6, 2008
    Likes Received:
    Last edited: Aug 22, 2008
  2. barigain

    barigain Junior Member

    Aug 23, 2012
    Likes Received:
    It could be done without a database, yes. You could create a simple script with an arbitrary array of URLs and a text file with a number in it. The number tracks the index of the array for the URL to display. When the script is loaded, read the file, get the number, and display the associated URL. Then increment the number and write it back to the file unless the number now exceeds the size of the array - then write a zero back to the file.
    To accomplish this with the URLS in a file (and no counter), put all the URLs on a single line of text. Separate them with the | pipe character. On the following line, put a zero. Read in the first line and explode on the pipe character to make an array. Get the first element from the array, use that URL, and move the first array element to the end of the array. Implode the array with the pipe character back to a string and overwrite the file contents to the text file.
    Depending on your plan, this will or won't work with cookies. Since cookies are stored in the client browser, you can only track what the individual visitor has seen. If the entire audience needs to be considered, this will not help because you'd need a group array index to track, not an individual one.