diff options
author | Hugues Hiegel <hugues@hiegel.fr> | 2011-07-06 15:29:31 +0200 |
---|---|---|
committer | Hugues Hiegel <hugues@hiegel.fr> | 2011-07-06 15:29:31 +0200 |
commit | bd6ff6cf31048bc794e22a8d84bed08bcf93c188 (patch) | |
tree | e48a3ec90ea51ee0187c36eaea0c448fdb8b1a9e | |
parent | d8db7489e628e8bd4a232f185e3599f40626cced (diff) |
Rewrites URL to get canonical names, with leading .png for pictures -w/ backward compability-
-rw-r--r-- | .htaccess | 6 | ||||
-rw-r--r-- | BigLine.php | 4 | ||||
-rw-r--r-- | index.php | 22 |
3 files changed, 17 insertions, 15 deletions
@@ -1,11 +1,13 @@ Options -Indexes RewriteEngine On -RewriteCond %{REQUEST_URI} !^/BigLine/ +RewriteBase / + +RewriteRule ^(.*)/(.*)/(.*)/(.*).png$ /BigLine/$4/$1/$2/$3 [L] + RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /index/$1 [L] - # Permanently removed Redirect Gone /Badges Redirect Gone /Badges_v2 diff --git a/BigLine.php b/BigLine.php index 2f689d5..9f5832d 100644 --- a/BigLine.php +++ b/BigLine.php @@ -322,8 +322,8 @@ function touch_badge($username, $type, $style, $color) $res = mysql_query("SELECT hits FROM badges WHERE username='" . gpc_addslashes(strtolower($username)) . "' AND type='$type' AND style='$style' AND color='$color';"); $data = mysql_fetch_assoc($res); - if(mysql_num_rows($res)) - $hits = $data["hits"]; + //if(mysql_num_rows($res)) + $hits = @$data["hits"]; $hits++; $QUERY=sprintf("UPDATE badges SET hits=%s, lasthit='%s' WHERE username='%s' AND type='$type' AND style='$style' AND color='$color';", @@ -161,21 +161,21 @@ function change() <? } -$user = $_POST['user']; -$type = $_POST['type']; -$style = $_POST['style']; -$color = $_POST['color']; +$user = @$_POST['user']; +$type = @$_POST['type']; +$style = @$_POST['style']; +$color = @$_POST['color']; $pathinfo = explode("/", $_SERVER['PATH_INFO']); -if ($user == "") $user = $pathinfo[1]; -if ($type == "") $type = $pathinfo[2]; if ($type == "") $type = "TracksPerDay"; -if ($style == "") $style = $pathinfo[3]; -if ($color == "") $color = $pathinfo[4]; +if ($type == "") $type = @$pathinfo[1]; if ($type == "") $type = "TracksPerDay"; +if ($style == "") $style = @$pathinfo[2]; +if ($color == "") $color = @$pathinfo[3]; +if ($user == "") $user = @$pathinfo[4]; include("Config.BigLine.php"); -$PATH="<span name=\"_user\">".$user."</span>/<span name=\"_type\">".$type."</span>/<span name=\"_style\">$style</span>/<span name=\"_color\">".$color."</span>/"; +$PATH="<span name=\"_type\">".$type."</span>/<span name=\"_style\">$style</span>/<span name=\"_color\">".$color."</span>/<span name=\"_user\">".$user."</span>"; $URL=preg_replace('/<[^>]*>/', '', $PATH); ?> @@ -216,7 +216,7 @@ foreach ($Colors as $Color => $ColorCode) <td><input type="submit" value="Go!" /></td></tr> <tr> <td colspan=2 class="center"> -<img id="preview" src="/BigLine/<? echo $URL ;?>" alt="<? echo str_replace("_", $user, $Comment); ?>" /> +<img id="preview" src="/<? echo $URL ;?>.png" alt="<? echo str_replace("_", $user, $Comment); ?>" /> </td> </table> </form> @@ -224,7 +224,7 @@ foreach ($Colors as $Color => $ColorCode) <? if ($type != "UNAVAILABLE") { ?> <div class="code"> [url=http://lastfm.hiegel.fr/<? echo $PATH; ?>]<br /> - [img]http://lastfm.hiegel.fr/BigLine/<? echo $PATH; ?>[/img]<br /> + [img]http://lastfm.hiegel.fr/<? echo $PATH; ?>.png[/img]<br /> [/url] </div> <? } ?> |