{"id":597,"date":"2009-10-19T22:49:49","date_gmt":"2009-10-20T01:49:49","guid":{"rendered":"http:\/\/wordpress.matbra.com\/?p=597"},"modified":"2010-08-03T18:14:48","modified_gmt":"2010-08-03T21:14:48","slug":"nova-versao-do-lurl-tiny-url","status":"publish","type":"post","link":"https:\/\/wordpress.matbra.com\/en\/2009\/10\/19\/nova-versao-do-lurl-tiny-url\/","title":{"rendered":"URL Shortener using Auto-Increment field."},"content":{"rendered":"<p>Good Night,<\/p>\n<p>This is a new version of URL-Shortener that don&#8217;t create random IDs to websites, it uses the auto-increment field and replace it to other base. <\/p>\n<p><!--more--><\/p>\n<p>It was necessary to create two new methods<br \/>\n[code lang=&#8221;php&#8221;]<br \/>\nfunction convertDecimalTo($decimal,$newBase,$str,$letters) {<br \/>\n\tif ($decimal >= $newBase) {<br \/>\n\t\t$x = $decimal % $newBase;<br \/>\n\t\t$y = $decimal \/ $newBase;<br \/>\n\t\t$str = $letters{$x} . $str;<br \/>\n\t\tif ($y < $newBase) { \n\t\t\t$str = $letters{$y} . $str;\n\t\t}\n\t\treturn convertDecimalTo($y,$newBase,$str,$letters);\n\t} else { \n\t\tif (strlen($str) == 0) { \n\t\t\t$str = $letters{$decimal} . $str;\n\t\t}\n\t\treturn $str;\n\t}\n}\nfunction convertBaseToDecimal($value,$newBase,$letters) { \n\t$sum = 0;\n\t$len = strlen($value);\n\t$end = $len-1;\n\tfor ($x=$end;$x>=0;$x&#8211;) {<br \/>\n\t\t$sum = $sum + strpos($letters,$value{$x}) * pow($newBase,($end &#8211; $x));<br \/>\n\t}<br \/>\n\treturn $sum;<br \/>\n}<br \/>\n[\/code]<\/p>\n<p>You can download the full new version to PHP4<br \/>\n<a href='http:\/\/wordpress.matbra.com\/2009\/10\/19\/nova-versao-do-lurl-tiny-url\/lurl2-php\/' rel='attachment wp-att-598'>URL Shortener (LURL) using auto increment field to generate the &#8220;TAG&#8221;<\/a><\/p>\n<p>Hope you enjoy,<br \/>\nMatheus<\/p>\n<p><a href=\"http:\/\/wordpress.matbra.com\/en\/2009\/07\/04\/graficos-para-seu-tiny-url\/\">Chart to your URL Shortener with Statistics. PHP4<\/a> <\/p>","protected":false},"excerpt":{"rendered":"<p>Good Night, This is a new version of URL-Shortener that don&#8217;t create random IDs to websites, it uses the auto-increment field and replace it to<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/wordpress.matbra.com\/en\/2009\/10\/19\/nova-versao-do-lurl-tiny-url\/\">Continue reading<span class=\"screen-reader-text\">URL Shortener using Auto-Increment field.<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[7,161,78,69],"tags":[323,13,79],"class_list":["post-597","post","type-post","status-publish","format-standard","hentry","category-aprendendo","category-code","category-mysql","category-php","tag-php","tag-programacao","tag-tinyurl","entry"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/psjGE-9D","_links":{"self":[{"href":"https:\/\/wordpress.matbra.com\/en\/wp-json\/wp\/v2\/posts\/597","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.matbra.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.matbra.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.matbra.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.matbra.com\/en\/wp-json\/wp\/v2\/comments?post=597"}],"version-history":[{"count":2,"href":"https:\/\/wordpress.matbra.com\/en\/wp-json\/wp\/v2\/posts\/597\/revisions"}],"predecessor-version":[{"id":787,"href":"https:\/\/wordpress.matbra.com\/en\/wp-json\/wp\/v2\/posts\/597\/revisions\/787"}],"wp:attachment":[{"href":"https:\/\/wordpress.matbra.com\/en\/wp-json\/wp\/v2\/media?parent=597"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.matbra.com\/en\/wp-json\/wp\/v2\/categories?post=597"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.matbra.com\/en\/wp-json\/wp\/v2\/tags?post=597"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}