prepare('SELECT url FROM data WHERE shortlink=? ALLOW FILTERING'); $result = $session->execute($statement,array('arguments' => array($shortlink))); if ($result->count() != 0) { goto gen_shortlink; } } //$statement = new Cassandra\SimpleStatement('SELECT name FROM data WHERE id=5'); $statement = $session->prepare('SELECT url FROM data WHERE shortlink=? ALLOW FILTERING'); $options = array('arguments' => array($shortlink)); $result = $session->execute($statement,$options); if ($result->count() != 0) { printf('That GLink is already taken. Please try another one.'); exit; } $statement = $session->prepare('INSERT INTO data (id, url, shortlink, is_geo, radius, latitude, longitude, user, purgatory, hell, when_created) VALUES (now(),?,?,?,?,?,?,?,false, false, toTimestamp(now())) USING TTL ?;'); if ($is_geo == 1) { $options = array($url,$shortlink,boolval($is_geo),intval($radius), $latitude, $longitude, $_SESSION['user'], intval($ttl)); } else { $options = array($url,$shortlink,boolval($is_geo),null,null,null,$_SESSION['user'],intval($ttl)); } $result = $session->execute($statement,array('arguments' => $options)); //$stringRepresentation= json_encode($result[0]); //printf("%s\n\n\n",$stringRepresentation); //foreach($result as $row) { // if (is_null($row)) { // printf('Unsuccessful'); // } else { printf('Successful: The URL you entered was: %s and your GLink is: https://glink.zip/%s', $url,$shortlink); // } //} //printf('Done'); ?>