// add if (isset($_POST['selectaction']) && $_POST['selectaction'] == 'add') { $linkName = $db->sanitize($_POST['linkname']); $linkAddr = $db->sanitize($_POST['linkaddr']); $linkDesc = $db->sanitize($_POST['linkdesc']); $passcode = $db->sanitize($_POST['hpc']); $pre_refcode = mt_rand(1000, 9999); $post_refcode = strlen($linkName); $refcode = $pre_refcode + $post_refcode; if (strpos($linkAddr, "http://") === 0) { $OK_linkAddr = $linkAddr; } else { $OK_linkAddr = 'http://' . $linkAddr; } $db->query("SELECT COUNT(*) FROM ilink WHERE linkaddr='{$OK_linkAddr}'"); $checkLink = implode($db->fetch_assoc()); if ($checkLink == 1) { echo 'ERROR! The link already exists!'; } else { if ($linkName == '') { echo '<strong>Error:</strong> Link Name is required.'; } else { if ($linkAddr == '') { echo '<strong>Error:</strong> Link Address is required.'; } else { if ($passcode == '') { echo '<strong>Error:</strong> One-time passcode is required.'; } else { if (!validateLinkName($linkName)) { echo '<strong>Error:</strong> Only alphanumerics, underscore, dot and white space are allowed.'; } else {
$passcode = $row['passcode']; $refcode = $row['refcode']; echo '<tr>'; echo '<td>' . $refcode . '</td><td><a href="' . $linkAddr . '">' . $linkName . '</a><br/>'; echo stripslashes(rtrim($linkDesc)) . '</td><td id="indicator-' . $linkID . '"></td>'; echo '</tr>'; } } $db->close(); echo '</tbody> </table>'; //echo '</div> //</div>'; $db2 = new hnSQL(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME, false); $querydb2 = $db2->query("SELECT * FROM ilink ORDER BY id"); while ($row2 = $db2->fetch_assoc($querydb2)) { $linkID2 = $row2['id']; echo ' <script> $(document).ready(function () { checkStatus' . $linkID2 . '(' . $linkID2 . '); setInterval(function(){checkStatus' . $linkID2 . '(' . $linkID2 . ');}, 900000); }); function checkStatus' . $linkID2 . '(sharerID) { $("#indicator-' . $linkID2 . '").html("<span class=\\"label label-warning\\">Checking</span>"); $.ajax({ type: "GET", url: "check.php?id=" + sharerID + "&i=" + Math.random(), success: function(data){