Jump to content

idiotstrike

New Members
  • Posts

    6
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

idiotstrike's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello. I'm trying to allow a script to be run only in a certain defined directory on a defined host. What I use now is something like this: $host = $_SERVER[ 'HTTP_HOST' ] . $_SERVER[ 'REQUEST_URI' ]; $key = 'site.com/directory'; $works = stristr( $host, $key ); This works quite well. The only problem, while being a huge problem at the same time is this will return 1 even if it's in a directory like site.com/directory/something_else. What would be the best way to avoid this? I was thinking about finding whether a certain file( for example /core/class/class.mysql.php ) is located within the root directory and not further, but I'm not sure how to do this. I don't want to use neither protocol nor www in the $host variable because users can just go to the website without the protocol or www. and that will result in returning 0. If I'm being not clear here, here's an example: The user gets the application and installs it on site.com/directory. His license allows him to install it only to that directory, which is okay. But he decides to install several more copies in directories like site.com/directory/something_else or whatever. I want to avoid this.
  2. You need to divide it first and then round it. $Deposit = $GrandTotal * 0.5; $Deposit = round($Deposit, 2);
  3. http://cz.php.net/manual/en/function.fopen.php Anyway the file is opened successfully, the problem comes from file_exists().
  4. Afaik the slashes should be \\ or /. Btw: Sorry for the thread name, it should be file_exists(). Dunno what I was thinking about.
  5. Hello all. I have this code: <?php echo ' <br><br> <center> <table border="1" cellspacing="0" cellpadding="0" width="540"> <tr> <th bgcolor="3a3a3a" align="center"><font face="Arial, Helvetica, sans-serif" size="2"> Název mapy </font></th> <th bgcolor="3a3a3a" align="center"><font face="Arial, Helvetica, sans-serif" size="2"> Download </font></th> <th bgcolor="3a3a3a" align="center"><font face="Arial, Helvetica, sans-serif" size="2"> Screenshot </font></th> </tr>'; $file = fopen("T:/hns/cstrike/mapcycle.txt", "r"); while (($buffer = fgets($file, 4096)) != false) { if(file_exists("maps/".$buffer.".zip")) $download = "<a href='http://www.traxxzone.cz/maps/".$buffer.".zip'>Download</a>"; else $download = "---"; if(file_exists("maps/screenshots/".$buffer.".jpg")) $screen = "<a href='http://www.traxxzone.cz/maps/screenshots/".$buffer.".jpg'>Screenshot</a>"; else $screen = "---"; echo "<tr><th>".$buffer."</th><th>".$download."</th><th>".$screen."</th></tr>"; } echo "</table></center>"; fclose($file); ?> That should print out all maps listed in mapcycle.txt (counter-strike server) and if the mapname exists in maps/map_name.zip, then there is a download link. However it doesn't work as should. Map name is always true in first TH, no problems with that. However the link is all the time only on the last row (even if I change the map order in mapcycle.txt). Can anybody help me? Edit: And for the screenshots, there aren't any now, so I can't check.
  6. Hey guys, I've got a problem. Can anybody show me how to do it? Let's say there are 4 input fields: Year, month, day and hour. The user fills them like 2010, 12, 2, 3; and then I need a function to convert that date to datestamp with GMT +1. I was googling a whole afternoon, however came up with nothing. Thanks in advance!
×
×
  • 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.