Jump to content

Graxeon

Members
  • Posts

    260
  • Joined

  • Last visited

Everything posted by Graxeon

  1. Yeah this...can you point me in the right direction as to how to do it? (a guide or something)
  2. You know how some sites have links that run on tokens? Tokens are links that only stay alive for a certain amount of time (1 use, 1 day, 1 week, etc). Can someone explain to me what exactly it's called? I know there are different method / systems that do it but idk which one would be best for me. Personally I'm going for 1 use "tokens" for links. I also want to know how they're generated only by my server. I can only use PHP and don't have access to a database.
  3. It's alright, I got it to work. I took out the "else" and it's working perfectly. Thank you guys!
  4. I just changed the numbers for X and Y.
  5. This: 'test1' => array('x' => 123, 'y' => 456),
  6. I'm getting this error: Parse error: syntax error, unexpected T_STRING, expecting ')' in /file.php on line 4 Where exactly should the ')' be?
  7. Bump
  8. I have an input converter. Basically, say I call "file.php?a=test1" well the "file.php" would run this: <?php if (isset($_GET['a'])) { $converter = array('blankspot' => 'blanks', 'test1' => '123', 'test2' => '321', 'blankspothere' => 'blank'); $a = $_GET['a']; if (isset($converter[$a)) { header("Location: $converter"); exit; } } ?> That would just redirect me to "123". However...now I want to have 2 things that the input converts into. Example: file.php?a=test1 That script gives it 2 converts like: <?php if (isset($_GET['a'])) { $converter = array('blankspot' => 'blanks', 'test1' => $x=123 and $y=456, 'test2' => $x=321 and $y=654, 'blankspothere' => 'blank'); $a = $_GET['a']; if (isset($converter[$a)) { header("Location: $x.$y"); exit; } } ?> That would redirect to "123456" I don't know how to give it 2 converts so my coding is wrong. Help please?
  9. No, the last code that I provided was only an example of how I think my request would be. That code just creates a new file every time it is run. I want to write to the same file (not overwrite) every time it is run.
  10. I don't have access to MySQL, only PHP.
  11. Are you asking?: How do I redirect to a random link every time the page is viewed?
  12. I have a few PHP scripts that do basically the same thing but for different content. So I have these php files: a.php b.php c.php etc And they have different inputs: a.php?a=abstract a.php?a=abs a.php?a=attitude b.php?a=bob b.php?a=bat etc Now I want to create a log file that counts how many times each of those "?a=___" inputs are accessed. So it would be something like: $log = $_GET['a'] logfileto('http://site.com/log.php?a=' .$log) //Not sure what this code would be, just giving an example. //rest of my script here. And then log.php would be something like: $logged = $_GET['a'] writetolog($logged +1) //The +1 would refer to the "a.php?a=___" being accessed and adding on to the original count for that input. Again, not sure how this code would be. //Then tell the script to add this input if it hasn't been created already and add 1 to it. If it is created, then just add 1 to it. Idk how this code would be written. Now I've done something similar to this but it's not for keeping a log. Here's what I've done where I can write to a file: $time = $_SERVER['REQUEST_TIME']; $handle = fopen('lists/' . $time . 'file.xml', 'w'); fwrite($handle, $xml); fclose($handle); header('Location: lists/'. $time . 'file.xml'); So I'm guessing the code should be something similar to this. Can someone help me with this? I'm not too great at PHP so I don't know all of the different functions that can pull this off xD Edit: Oh, and to view the number of times the ".php?a=___" has been accessed, then something like this would be done: $count = $_GET['ca'] //Where "ca" would be like "log.php?ca=bob" //And if "bob" was accessed 37 times then it would output: echo $timesaccessed($count)
  13. Worked, thank you very much!
  14. Can anyone see the problem?
  15. I'm trying to get to "site.com/soccervideo.flv" within this XML file: <?xml version="1.0" encoding="utf-8"?> <playerconfig version="1.1"> <playlists> <playlist id=""> <items> <item id="soccervideo"> <videos> <video> <streams> <stream> <locations> <location seeking="yes"> http://site.com/soccervideo.flv </location> </locations> </stream> </streams> </video> </videos> </item> </items> </playlist> </playlists> </playerconfig> I tried this code but I get a blank page: <?php $url = $_GET['url']; $sxml = new SimpleXMLElement('http://site.com/embed/' .$url, NULL, TRUE); header("Location: {$sxml->playerconfig->playlists->playlist->items->videos->video->streams->stream->locations->location}"); ?> Help please? I'm not sure if this is the correct method of going about it.
  16. *sigh* alright... Oh well, thanks guys.
  17. Because you are directing your clients to make another request from another completely different server than yours. Ok, so how do I change my code to do what you just said? A plain old redirect doesn't work because apparently the browser or whatever is not recognizing it as a downloadable file. How do I redirect to that URL with the instructions that that file IS a downloadable file based on your statement?
  18. Then why is it that if you were to redirect to a 3mb image it only uses up your bandwidth for running the script and NOT for loading the 3mb image? Like so: <?php header('Location: http://server1.com/some3mbimage.jpg'); ?>
  19. xyz.php is on Server 2 Client 2's server Server 1 has file.ext xyz.php calls the file that's on Client 1's server xyz.php is part of different feature on Client 2's site so xyz.php is called whenever someone access Client 2's feature.
  20. From how I see it...apparently "readfile($file_url)" is causing the bandwidth usage to come from BOTH Client 1 and Client 2. What other way can I "readfile" on $file_url with the "header('Content" tags attached?
  21. @phpretard The code you gave does force a download. However, the downloaded file is 0 bytes so it's not downloading the real file. Also, even that 0 byte file is coming from Client 2's website so it's using his bandwidth. So even if that downloaded the correct file, apparently it's still using the wrong bandwidth. Oh and also: Your actual script didn't work as you put it. I had to take out the "if" statement to get the 0 byte download going. I don't know what $_SERVER['DOCUMENT_ROOT'] is, though. @Jay Why won't it work? Not sure why it would be a proxy. The code should work on whatever server it's on. Heck...it's going to be on Client 2's server so there is no third server involved
  22. Anyone know?
  23. Well...see the code that I gave uses up Client 2's bandwidth even the file itself is located on Client 1's server. So I'm trying to reverse that. The code you provided doesn't work because, again, the actual location of "file.ext" is encrypted and the location changes every time it is accessed. So, just redirecting to $file_url gives a BLANK page. I'm trying to force a "File Save As..." on that redirect link while using Client 1's bandwidth (like it should).
  24. I have 2 clients on 2 different servers/hosts. Client 1 has "file.ext" and Client 2 needs to load that file. The location of file.ext is encrypted so when Client 2 tries to access the file his browser doesn't force a "File Save As..." action so only a blank page comes up. This code forces the "File Save As..." action but it uses up Client 2's bandwidth. Client 2 is already paying for the file so we can't use his bandwidth. Client 1 is the one whose bandwidth needs to be used: <?php $file_url = "http://www.site.com/#####/file.ext/"; header("Content-Type: afile/ext"); header("Content-Disposition: attachment; filename=final.ext;" ); header("Content-Length: ".$size); //$size is part of the rest of the code. It's just a number like 112890. readfile($file_url); ?> How can I alter that code so that Client 1's bandwidth is used and not Client 2's (the guy that's downloading the file).
  25. Ok, thank you very much. I've learned many things today
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.