# Probably easy, But I'm a newbie! QUICK QUESTION

**URL:** https://forum.kirupa.com/t/probably-easy-but-im-a-newbie-quick-question/77345
**Category:** programming
**Created:** [January 26, 2005, 5:30pm UTC](https://forum.kirupa.com/t/probably-easy-but-im-a-newbie-quick-question/77345 "2005-01-26T17:30:17Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Copernicus](https://avatars.discourse-cdn.com/v4/letter/c/d9b06d/32.png) [@Copernicus](https://forum.kirupa.com/u/Copernicus)
#### Post date: [January 26, 2005, 5:30pm UTC](https://forum.kirupa.com/t/probably-easy-but-im-a-newbie-quick-question/77345/1 "2005-01-26T17:30:17Z")

</div>

I have been dabbling in PHP and messin around with things, I really like it, tho it is a little tricky to understand.

However, I have a piece of script I just can’t wrap my head around.  
I know how to do a simple redirect in php, however, how can I make it redirect to the specified page at the bottom of this code? It’s probably pretty easy, but I have no clue, it has been stumping me for days already (literally)

```auto
<?php/ **generate_url.php** Script for generating URLs that can be accessed one single time.**//* Generate a unique token: */$token = md5(uniqid(rand(),1));/* This file is used for storing tokens. One token per line. */$file = "/tmp/urls.txt";if( !($fd = fopen($file,"a")) ) die("Could not open $file!");if( !(flock($fd,LOCK_EX)) ) die("Could not aquire exclusive lock on $file!");if( !(fwrite($fd,$token."
")) ) die("Could not write to $file!");if( !(flock($fd,LOCK_UN)) ) die("Could not release lock on $file!");if( !(fclose($fd)) ) die("Could not close file pointer for $file!");/* Parse out the current working directory for this script. */$cwd = substr( 

```

%4$s

```auto
 SERVER['PHP_SELF'],0,strrpos( 

```

%4$s

```auto
 SERVER['PHP_SELF'],"/"));/* Report the one-time URL to the user: */print "Use this URL to download the secret file:<br><br>
";print "<a href='http://". 

```

%4$s

```auto
 SERVER['HTTP_HOST']. "$cwd/get_file.php?q=$token'>
";print "http://". 

```

%4$s

```auto
 SERVER['HTTP_HOST']."/get_file.php?q=$token</a>
";?>

```

Any input would be greatly appreciated, If you have the time to briefly explain why this is, that would be awesome.CG
