Example #1
0
function register_url_tag($url, $tag)
{
    global $MYSQL_TABLE_REDIRECTIONS;
    //echo $newtag;
    $query = "SELECT url FROM " . $MYSQL_TABLE_REDIRECTIONS . " WHERE tag='" . mysql_real_escape_string($tag) . "';";
    if (mysql_num_rows(mysql_query($query))) {
        //echo "tag existed";
        return register_url($url);
    } else {
        global $MYSQL_TABLE_REDIRECTIONS;
        global $logged_in;
        $tagger = "";
        if ($logged_in) {
            $tagger = $_SESSION['OPENID_IDENTITY'];
        } else {
            $tagger = 'guest';
        }
        $ipaddress = $_SERVER['REMOTE_ADDR'];
        $date_now = $mysqldate = date('Y-m-d H:i:s');
        $query = "INSERT INTO " . $MYSQL_TABLE_REDIRECTIONS . " value('{$tag}','{$url}','{$tagger}','{$ipaddress}','{$date_now}',0);";
        if (mysql_query($query)) {
            return $tag;
        } else {
            die("Cannot insert into Database for URL: {$url} and tag:{$tag}");
            return false;
        }
    }
}
Example #2
0
      <?php 
        _e("You have to");
        ?>
      <a href='<?php 
        print login_url();
        ?>
' class="comments-login-link">
      <?php 
        _e("log in");
        ?>
      </a>
      <?php 
        _e("or");
        ?>
      <a class="comments-register-link" href='<?php 
        print register_url();
        ?>
'>
      <?php 
        _e("register");
        ?>
      </a>
      <?php 
        _e("to post a comment");
        ?>
      . </div>
    <?php 
    }
    ?>
    <?php 
} else {
Example #3
0
                //get him to the the respected link
                header("Location: " . $url);
            }
        } else {
            //tag not found
            $message = <<<MSG
                         The tag you specified, <b><u>{$request_uri}</u></b> is not yet linked to any URL.
                        That also mean that it is available and you can use it to link one of your URL.<br/>
                        Enter a URL you want to link to the tag <b><u>{$request_uri}</u></b><br/><br/><form name='linkurl' action='#'>
                        <input name='url' type='text'   size='30' style="border: 1px #000000 solid;  solid;text-align: center;font-family: 'Arial, Sans-Serif';font-size:16px;background-color: #B1B1B1;padding: 5px;" onkeydown="if (event.keyCode==13) {document.linkurl.url.click();}" />
                        <input type='button' value='Link it!' onclick="parent.location='{$FULLPATH}{$request_uri}|'+document.linkurl.url.value"/>
                        </form>
MSG;
        }
    } elseif (valid_url($request_uri)) {
        if ($tag = register_url($request_uri)) {
            //tag registration successful
            //store this info and take it to the tag page where he will be congratulated
            $_SESSION['newtag'] = $tag;
            header("Location: " . $FULLPATH . $tag);
        } else {
            //the URL was valid but some error occured. Contact the admin.
            die('<br/>An error occured, URL not registered');
        }
    } elseif ($tag_url = get_tag_url($request_uri)) {
        if ($tag = register_url_tag($tag_url[1], $tag_url[0])) {
            //15min
            $_SESSION['newtag'] = $tag;
            header("Location: " . $FULLPATH . $tag);
        } else {
            //the URL and tag was valid but some error occured. Contact the admin.