then you must disable the entry update,delete function and remove the password/session check from the connect.php

why don't you make this url shortener with a user registration ?

After a login, a user could see simple statistic from the url's,
edit/update/delete is available.

Hello,
jjozsi

    i want to display a simple page contain a button or the enter URL text box
    when user enter the long URL it convert to the short URL that's it & will display a user......

    now???

      Hello!

      Tomorrow i can make you a code, with a little explanation.

      jjozsi

        meddycool;10897709 wrote:

        thax dude

        It asks a label and an url from the visitor, but i added an image activation,
        to keep the bots away:
        It checks the url and label from the database before insert.
        http://phpcode.hu/url/show.php?id=5

        You can modify the result url in shortener_added.php
        But i have no time to make explanation video.

        Hello, jjozsi

          djjjozsi;10897832 wrote:

          It asks a label and an url from the visitor, but i added an image activation,
          to keep the bots away:
          It checks the url and label from the database before insert.
          http://phpcode.hu/url/show.php?id=5

          You can modify the result url in shortener_added.php
          But i have no time to make explanation video.

          Hello, jjozsi

          dude when i am going to run the code abouve u have provided me
          it give an error in shortener_add.php

          Notice: Undefined variable: fail in /www/obxhost.net/m/y/h/myhotspot/htdocs/test/shortener_add.php on line 8

          Notice: Undefined variable: fail in /www/obxhost.net/m/y/h/myhotspot/htdocs/test/shortener_add.php on line 13

          Notice: Undefined variable: fail in /www/obxhost.net/m/y/h/myhotspot/htdocs/test/shortener_add.php on line 18

            thax
            tel me one more thing what the sql query to display table in descending order all coloum

              i want to display he result in desc order ..........
              what the sql querry for this
              here is the sql query

              CREATE TABLE shorturl (
              link_id int(11) NOT NULL auto_increment,
              link_url text NOT NULL,
              link_desc text NOT NULL,
              link_count int(11) NOT NULL default '0',
              PRIMARY KEY (link_id)
              ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Short URL';

              <?php
              session_start();
              $ERR = "";
              $MES = "";
              // Short URL Script - Settings
              $Admin_Password = "demo"; // This is case sensitive. You'll want to change this.
              
              $Path_To_Script = "http://www.myhotspot.co.cc/u.php"; // e.g http://www.yourdomain.com/u.php The path to the redirect script.
              
              $Database_Username = "myhotspot_crazy";
              $Database_Password = "159995";
              $Database_Name = "myhotspot_test";
              $Database_Host = "localhost";
              
              // END OF SETTINGS
              
              function shorturl_error($error){
                 echo $error;
                 }
              
              $Logged_In = $_SESSION['Logged_In'];
              $action = $_POST['action'];
              
              if($action == "login"){
                 $check_pass = $_POST['form_password'];
                 if($check_pass == $Admin_Password){ $_SESSION['Logged_In'] = 1; $Logged_In = 1; }
                 else { $ERR = $ERR . "<br>The password is incorrect."; }
                 }
              
              if($action == "logout"){
                 $_SESSION['Logged_In'] = 0;
                 $_SESSION = array();
                 $Logged_In = 0;
                 session_destroy();
                 }
              
              $DBConn = mysql_connect($Database_Host, $Database_Username, $Database_Password) or die(shorturl_error("Could not connect to database server. Check your settings."));
              $DB_DB = mysql_select_db($Database_Name, $DBConn) or die(shorturl_error("Could not connect to database ($Database_Name). Perhaps you don't have the right permissions on this DB. Check your settings"));   
              
              if($action == "create"){
                 $add_url = $_POST['form_url'];
                 $desc = $_POST['form_desc'];
                 if($add_url == "http://" || (!$add_url)){ $ERR = $ERR . "<br>You must enter a URL to redirect to!"; }
                 if(!$ERR){
                    $sql = mysql_query("INSERT INTO shorturl (link_url,link_desc) VALUES ('$add_url','$desc')");
                    if(!$sql){ $ERR = $ERR . "<br>The redirect URL couldn't be added. Check your settings and try again."; }
                    if($sql){ 
                       $new_url = $Path_To_Script . "?" . mysql_insert_id();
                       $MES = $MES . "<br>The redirect URL has been added. Your new Short URL is: " . $new_url;
                       }
                    }
                 }
              
              if($action == "delete"){
                 $delete_id = $_POST['id']; 
              
                 $sql = mysql_query("DELETE FROM shorturl WHERE link_id = '$delete_id'");
                 if(!$sql){ $ERR = $ERR . "<br>The redirect couldn't be deleted. Please check your settings and try again."; }
                 if($sql){ $MES = $MES . "<br>Redirect deleted!"; }
                 }
              
              if($action == "edit"){
                 $edit_id = $_POST['id'];
                 $sql = mysql_query("SELECT * FROM shorturl WHERE link_id = '$edit_id' LIMIT 1");
                 if($sql){
                         while($row = mysql_fetch_array($sql)){
                          foreach( $row AS $key => $val ){
                          $$key = stripslashes( $val );
                             }}
                 ?>
                 <form method="post" name="editform">
                  <p><span class="required">URL Destination</span><br><input type="text" name="form_url" value="<?php echo $link_url; ?>" maxlength="255" size="25"><input type="hidden" name="action" value="edit2"><input type="hidden" name="edit_id" value="<?php echo $edit_id; ?>"><br><span>Description</span><br><input type="text" name="form_desc" value="<?php echo $link_desc; ?>" maxlength="50" size="25"><input type="submit" name="submit" value="Edit"></p>
              </form>
              <?php
                       }
                       }
              
              if($action == "edit2"){
                 $add_url = $_POST['form_url'];
                 $desc = $_POST['form_desc'];
                 $edit_id = $_POST['edit_id'];
                 if($add_url == "http://" || (!$add_url)){ $ERR = $ERR . "<br>You must enter a URL to redirect to!"; }
                 if(!$ERR){
                    $sql = mysql_query("UPDATE shorturl SET link_url='$add_url',link_desc='$desc' WHERE link_id = '$edit_id'") or die(mysql_error());
                    if(!$sql){ $ERR = $ERR . "<br>The redirect URL couldn't be updated. Check your settings and try again."; }
                    if($sql){
                       $new_url = $Path_To_Script . "?" . mysql_insert_id();
                       $MES = $MES . "<br>The redirect URL has been modified.";
                    }
                    }
              }
              
              if($action == "clearall"){
              
                 $sql = mysql_query("UPDATE shorturl SET link_count='0' WHERE link_count > 0");
                 if(!$sql){ $ERR = $ERR . "<br>The counts could not be reset. Please check your settings and try again."; }
                 if($sql){ $MES = $MES . "<br>Counts have been reset!"; }
                 }
              ?>
              
              <html>
              
              <head>
              <title>Short URL Admin</title>
              <style>
              <!--
              body { font-family:Verdana,sans-serif; font-size:12px; }
              p { font-family:Verdana,sans-serif; font-size:12px; }
              p.copyright { font-family:Verdana,sans-serif; font-size:10px; }
              h1 { font-family:Verdana,sans-serif; font-weight:bold; font-size:16px; }
              h2 { font-family:Verdana,sans-serif; font-weight:bold; font-size:14px; }
              span.required { font-family:Verdana,sans-serif; font-weight:bold; font-size:12px; }
              
              .table_header { font-family:Verdana,sans-serif; font-weight:bold; font-size:12px; }
              p.error { text-align:center; margin:5px; padding:5px; border-width:2px; border-color:rgb(204,204,204); border-style:solid; }
              -->
              </style>
              </head>
              
              <body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
              <h1>Short URL Admin</h1>
              <br>
              <?php
              if($ERR){ echo "<p class=\"error\">" . $ERR . "</span>"; }
              if($MES){ echo "<p class=\"error\">" . $MES . "</span>"; }
              if(!$Logged_In){
              ?>
              <form method="post" name="login_form">
                  <p><span class="required">Password</span>&nbsp;<input type="hidden" name="action" value="login"><input type="password" name="form_password" maxlength="255" size="25"> 
                  <input type="submit" name="submit" value="Enter"></p>
              </form>
              <?php
              }
              
              if($Logged_In == "1"){
              ?>
              
              <p>Short URL allows you to create shorter URL's and keeps track of how many 
              times a link has been clicked. It's useful for managing downloads, keeping track 
              of outbound links and for masking URL's. Clicking the Clear All Clicks button 
              will reset the count for each entry.</p>
              
              <h2>Current Redirects</h2>
              <table border="1" cellspacing="0" width="100%" bordercolordark="white" bordercolorlight="black">
                  <tr>
                      <td width="25%">
                          <p><span class="table_header">Short URL<br></span>(The URL to use)</p>
                      </td>
                      <td width="35%">
                          <p><span class="table_header">Real URL<br></span>(Where it redirects to)</p>
                      </td>
                      <td width="10%">
                          <p><span class="table_header">Description</span></p>
                      </td>
                      <td width="15%">
                          <p><span class="table_header">Amount of Clicks</span></p>
                      </td>
                      <td width="15%">
                          <p><span class="table_header">Manage</span></p>
                      </td>
                  </tr>
              <?php
                 $sql = mysql_query("SELECT * FROM shorturl"); 
                      $link_check = mysql_num_rows($sql);
              
                   while($row = mysql_fetch_array($sql)){
                      foreach( $row AS $key => $val ){
                      $$key = stripslashes( $val );
                         }
              ?>
                  <tr>
                      <td width="25%">
                          <p><?php echo $Path_To_Script . "?" . $link_id; ?></p>
                      </td>
                      <td width="35%">
                          <p><?php echo $link_url; ?></p>
                      </td>
                      <td width="10%">
                          <p><?php echo $link_desc; ?></p>
                      </td>
                      <td width="15%">
                          <p><?php echo $link_count; ?></p>
                      </td>
                      <td width="15%">
                          <p><form method="post" name="delete"><input type="hidden" name="action" value="delete"><input type="hidden" name="id" value="<?php echo $link_id; ?>"><input type="submit" value="Delete"></form><form method="post" name="edit"><input type="hidden" name="action" value="edit"><input type="hidden" name="id" value="<?php echo $link_id; ?>"><input type="submit" value="Edit"></form></p>
                      </td>
                  </tr>
              <?php } ?>
              </table>
              <h2>Create Redirect</h2>
              <form method="post" name="createform">
                  <p><span class="required">URL Destination</span><br><input type="text" name="form_url" value="http://" maxlength="255" size="25"><input type="hidden" name="action" value="create"><br><span>Description</span><br><input type="text" name="form_desc" maxlength="50" size="25"><input type="submit" name="submit" value="Create"></p>
              </form>
              <h2 class="copyright">Clear All Clicks</h2>
              <form method="post" name="clear_all_clicks">
                  <p><input type="hidden" name="action" value="clearall"><input type="submit" name="submit" value="Clear All Clicks"></p>
              </form>
              
              <p align="center"><form method="post" name="logout"><input type="hidden" name="action" value="logout"><input type="submit" name="submit" value="Logout Admin"></form></p>
              <?php
              }
              ?>
              <p class="copyright">Coded by <a href="http://www.harleyquine.com" target="_blank">Harley</a>. Support page for <a href="http://www.kinkydress.com/php-scripts/short-url/" target="_blank">Short URL</a>.</p>
              </body>
              
              </html>
              
                djjjozsi;10898012 wrote:

                hello,
                Here is the file:

                http://www.phpcode.hu/url/shortener_add.rar

                With this code, you can hide the warning messages, which are useful for troubleshooting, but not suggested on a live site.

                // Turn off all error reporting
                error_reporting(0);
                

                still
                its not working.........:quiet:

                  i want to display he result in desc order ..........
                  what the sql querry for this
                  here is the sql query

                  <?php
                     $sql = mysql_query("SELECT * FROM shorturl ORDER BY link_id DESC");
                          $link_check = mysql_num_rows($sql);
                  
                       while($row = mysql_fetch_array($sql)){
                          foreach( $row AS $key => $val ){
                          $$key = stripslashes( $val );
                             }
                  ?> 
                    meddycool;10898019 wrote:

                    still
                    its not working.........:quiet:

                    Download once, i changed the undefined variables a little bit
                    http://phpcode.hu/url/show.php?id=5

                    Did you see the activation image in my version? If you click on shortener_add.php ?

                      And did you try to troubleshoot the errors shown on the image.php page?

                      Notice: Use of undefined constant authsp - assumed 'authsp' in /www/obxhost.net/m/y/h/myhotspot/htdocs/test/image.php on line 15

                      Warning: Cannot modify header information - headers already sent by (output started at /www/obxhost.net/m/y/h/myhotspot/htdocs/test/image.php:15) in /www/obxhost.net/m/y/h/myhotspot/htdocs/test/image.php on line 15

                      Notice: Undefined variable: black in /www/obxhost.net/m/y/h/myhotspot/htdocs/test/image.php on line 56

                      Notice: Undefined variable: black in /www/obxhost.net/m/y/h/myhotspot/htdocs/test/image.php on line 57

                      Notice: Undefined variable: black in /www/obxhost.net/m/y/h/myhotspot/htdocs/test/image.php on line 58

                      Warning: Cannot modify header information - headers already sent by (output started at /www/obxhost.net/m/y/h/myhotspot/htdocs/test/image.php:15) in /www/obxhost.net/m/y/h/myhotspot/htdocs/test/image.php on line 59

                      EDIT: @: His PHP setup supports GD, as the image is generated; he/she just needs to fix the errors above.

                        bradgrafelman;10898056 wrote:

                        And did you try to troubleshoot the errors shown on the image.php page?

                        Thanks to show me the weak point of this image.php!

                        i changed image.php:
                        http://phpcode.hu/url/show.php?id=5

                          djjjozsi;10898064 wrote:

                          i think i should make a code-chat 🙂

                          ya i must bee 😃