<?php 

// Start YOURLS engine

require_once( dirname(__FILE__).'/includes/load-yourls.php' );

?>

<!DOCTYPE html>

<html>
<head>
<title>bq.io - URL Shorterner</title>
<link rel="stylesheet" href="<?php echo YOURLS_SITE; ?>/css/share.css?v=<?php echo YOURLS_VERSION; ?>" type="text/css" media="screen" />
<link href="style.css" rel="stylesheet" type="text/css">
<script src="<?php echo YOURLS_SITE; ?>/js/jquery-1.6.1.min.js" type="text/javascript"></script>
<script src="<?php echo YOURLS_SITE; ?>/js/ZeroClipboard.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script>
<script type="text/javascript">ZeroClipboard.setMoviePath( '<?php echo YOURLS_SITE; ?>/js/ZeroClipboard.swf' );</script>
<script src="<?php echo YOURLS_SITE; ?>/js/share.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script>
</head>

<body>
<div id="shell">
<div id="navigation">
<a href="http://content-available-to-author-only.io"><img src="images/logo.png" alt="logo" width="250px" /></a>
<ul class="nav">
<li class="active"><a href="http://content-available-to-author-only.io/index.php">Home</a></li>
<li><a href="http://content-available-to-author-only.io/about.php">About</a></li>
<li><a href="http://content-available-to-author-only.io/contact.php">Contact</a></li>
</ul>
</div>
<div id="container">
<?php



    // Part to be executed if FORM has been submitted

	if ( isset($_REQUEST['url']) ) {

  require_once('recaptchalib.php');
  $privatekey = "6LcoeuUSAAAAAArVbLbmg_IChTZtEu8w9lIX9BPU";
  $resp = recaptcha_check_answer ($privatekey,
                                $_SERVER["REMOTE_ADDR"],
                                $_POST["recaptcha_challenge_field"],
                                $_POST["recaptcha_response_field"]);

  if (!$resp->is_valid) {
    // What happens when the CAPTCHA was entered incorrectly
    die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
         "(reCAPTCHA said: " . $resp->error . ")");
  } else {
    // Your code here to handle a successful verification
  

		$url     = yourls_sanitize_url( $_REQUEST['url'] );

		$keyword = isset( $_REQUEST['keyword'] ) ? yourls_sanitize_keyword( $_REQUEST['keyword'] ): '' ;

		$title   = isset( $_REQUEST['title'] ) ? yourls_sanitize_title( $_REQUEST['title'] ) : '' ;



		$return  = yourls_add_new_link( $url, $keyword, $title );

		

		$shorturl = isset( $return['shorturl'] ) ? $return['shorturl'] : '';

		$message  = isset( $return['message'] ) ? $return['message'] : '';

		$title    = isset( $return['title'] ) ? $return['title'] : '';

		

		echo <<<RESULT

		<h2>URL has been shortened</h2>

		<p>Original URL: <code><a href="$url">$url</a></code></p>

		<p>Short URL: <code><a href="$shorturl">$shorturl</a></code></p>

		<p><strong>$message</strong></p>
		
		RESULT;

		

		// Include the Copy box and the Quick Share box

		yourls_share_box( $url, $shorturl, $title );

}

	// Part to be executed when no form has been submitted

	} else {
		$site = YOURLS_SITE;

		echo <<<HTML
		<h2>Enter a new URL to shorten</h2>

		<form method="post" action="">

		<p><label>URL: <input type="text" name="url" value="http://" size="70" /></label></p>

		<p><label>Optional custom keyword: $site/<input type="text" name="keyword" size="8" /></label></p>

		<p><input type="submit" value="Shorten" /></p>
		
		HTML; 
		
		require_once('recaptchalib.php');
		$publickey = "6LcoeuUSAAAAAKQqUjhqgjp9df7MkbmKrJp9itAr"; // you got this from the signup page
		echo recaptcha_get_html($publickey);
		
	}
?>
</div>
<div id="footer">
  <p>Powered by <a href="http://y...content-available-to-author-only...s.org/" title="YOURLS">YOURLS</a> v<?php echo YOURLS_VERSION; ?></p>
</div>
</div>
</body>
</html>