Note that there are some explanatory texts on larger screens.

plurals
  1. POI want to change the length of the shortened ID in PHPurl
    primarykey
    data
    text
    <p>I've installed PHPurl a URL shortener (from <a href="http://blondish.net/resources/scripts/phpurl/" rel="nofollow noreferrer">http://blondish.net/resources/scripts/phpurl/</a>) to my website and customised it to the style of my site.</p> <p>Everything works okay, except it generates the URL id by adding one number each time. For example: .<a href="http://)jpine.co.uk/1" rel="nofollow noreferrer">http://)jpine.co.uk/1</a> then to .<a href="http://jpine.co.uk/2" rel="nofollow noreferrer">http://jpine.co.uk/2</a></p> <p>I want it to look a bit more like bit.ly and have .<a href="http://jpine.co.uk/42t8hnf" rel="nofollow noreferrer">http://jpine.co.uk/42t8hnf</a> - a random generated number. I'm not sure how to do this but I'm relatively sure that it calculates it in the create.php. Here it is below:</p> <pre><code>&lt;? include("config.php"); if (strstr($_SERVER['HTTP_REFERER'], $root)); else { header ("Location: $rooturl"); } $ip = $_SERVER['REMOTE_ADDR']; $url = mysql_real_escape_string($_POST['url']); if(preg_match('|^http(s)?://[a-z0-9-]+(\.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url)) { if (empty($_POST['tag'])) { $query = mysql_query("INSERT INTO $table (ip,url) VALUES ('$ip','$url')") or die('MySQL error: '.mysql_error()); $qs = mysql_insert_id(); } else { if (ereg('^[a-zA-Z0-9]+[a-zA-Z0-9]+$', $_POST['tag'])) { $tag = mysql_real_escape_string($_POST['tag']); $query = mysql_query("select * from $table where `tag` = '$tag';") or die('MySQL error: '.mysql_error()); if (mysql_num_rows($query) != 0) die("This tag has already been used! Please press back button on your browser and choose another tag!"); else { $query = mysql_query("insert $table (ip,url,tag) VALUES ('$ip','$url','$tag')") or die('MySQL error: '.mysql_error()); $qs = $tag; } } else die('Your tag contains invalid characters! Only alphabets and numbers allowed! Please press back button on your browser and choose another tag!'); } $link = $destination . $qs; require 'create_template.php'; } else echo 'URL is invalid'; ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload