Skip to content

URL Shortener using Auto-Increment field.

Good Night,

This is a new version of URL-Shortener that don’t create random IDs to websites, it uses the auto-increment field and replace it to other base.

It was necessary to create two new methods
[code lang=”php”]
function convertDecimalTo($decimal,$newBase,$str,$letters) {
if ($decimal >= $newBase) {
$x = $decimal % $newBase;
$y = $decimal / $newBase;
$str = $letters{$x} . $str;
if ($y < $newBase) { $str = $letters{$y} . $str; } return convertDecimalTo($y,$newBase,$str,$letters); } else { if (strlen($str) == 0) { $str = $letters{$decimal} . $str; } return $str; } } function convertBaseToDecimal($value,$newBase,$letters) { $sum = 0; $len = strlen($value); $end = $len-1; for ($x=$end;$x>=0;$x–) {
$sum = $sum + strpos($letters,$value{$x}) * pow($newBase,($end – $x));
}
return $sum;
}
[/code]

You can download the full new version to PHP4
URL Shortener (LURL) using auto increment field to generate the “TAG”

Hope you enjoy,
Matheus

Chart to your URL Shortener with Statistics. PHP4

Published inAprendendoCodeMySQLphp

5,803 Comments

  1. Carterquoks Carterquoks

    «НаркоМед» основана группой узкопрофильных специалистов, чей опыт насчитывает более 15 лет в лечении зависимости. Клиника работает круглосуточно — вы можете рассчитывать на оперативное реагирование в любой час дня и ночи. Анонимность пациентов сохраняется на уровне медицинской тайны: персональные данные и диагноз не разглашаются.
    Подробнее тут – http://narkologicheskaya-klinika-ekaterinburg0.ru/narkologicheskaya-klinika-otzyvy-v-ekb/https://narkologicheskaya-klinika-ekaterinburg0.ru

Leave a Reply

Your email address will not be published. Required fields are marked *