Jump to content

roger01

Members
  • Posts

    10
  • Joined

  • Last visited

roger01's Achievements

Member

Member (2/5)

0

Reputation

  1. thank you. using ' would display (), but it worked with " " thank you again been struggling with this for a few hours now
  2. Hello So i have 0 knowledge in php, i just need to implement this captcha: i have a webserver php file which contains: $content .= "<some html code>"; i have the captcha code which looks like this: if (!class_exists('KeyCAPTCHA_CLASS')) { include('keycaptcha.php'); } $kc_o = new KeyCAPTCHA_CLASS(); echo $kc_o->render_js(); so far, the only way i've managed to make it display the captcha on the page is by doing this: $content .= "<first part of html code>"; if (!class_exists('KeyCAPTCHA_CLASS')) { include('keycaptcha.php'); } $kc_o = new KeyCAPTCHA_CLASS(); echo $kc_o->render_js(); $content .= "<second part of html code>"; now, the problem is, the captcha isn't displayed where the html code is, but as the first thing on the page, in the upper left corner. any idea how to make it display inside the html code? the html code is actually a <form> thank you!
  3. Hello I currently have this code: $timeBetweenClaims = 1800; $timeQuery = mysqli_query($conn, "SELECT * FROM users WHERE addy = '$userAddy'"); $timeResult = mysqli_fetch_assoc($timeQuery); $timeDif = $time - $timeResult['time']; $timeLeft = gmdate("i:s", $timeBetweenClaims - $timeDif); if($timeDif < $timeBetweenClaims){ $message = "Wait 30 minutes before posting. Timeleft: $timeLeft"; } how to make $timeLeft auto countdown til 0 so users don't have to refresh the page every few minutes to see the progress on timeleft? thank you!
  4. if i understand this correctly, this is for reading the columns, right? i've managed to gather something up to insert into the table by using this in insert.php: $ipaddy = mysqli_real_escape_string($link, $_SERVER['REMOTE_ADDR']); $btcaddy = mysqli_real_escape_string($link, $_POST['message']); $sql = "INSERT INTO contest_submissions (btc_address, ip_address) VALUES ('$ipaddy', '$btcaddy')"; if(mysqli_query($link, $sql)){ echo "Records added successfully."; } else{ echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); and <form action="insert.php"> but while using the txt file, i had this code writing the file: if (isset($_POST['message'])) { if (isset($_SESSION['token']) && $_POST['token'] == $_SESSION['token']) { $message = htmlentities($_POST['message']); $ipaddy = $_SERVER['REMOTE_ADDR']; $fp = fopen('./messages.txt', 'a'); fwrite($fp, "$ipaddy $message <br /> \n"); fclose($fp); } } $token = md5(uniqid(rand(), true)); $_SESSION['token'] = $token; and i've noticed there weren't any trash POST like ZAP' ZAP" ZAP ZAP' ZAP" ZAP%<br/> ZAP%' whatever this was.. could it be that the mysql will be flooded upon with that trash if the simple script is used?
  5. yes, but i only used two columns: SELECT * FROM `contest_submissions` ; +-----------------------+------------------------------------+---------------+ | contest_submission_id | btc_address | ip_address | +-----------------------+------------------------------------+---------------+ | 1 | 1KZsSb1ZsQrB1FXzFdnhFL2GuPGTjUKLhi | 192.168.100.3 | +-----------------------+------------------------------------+---------------+ 1 row in set (0.00 sec) oh, and i made botw btc_address and ip_aadress unique, i hope there won't be problems
  6. i know you are right. my php knowledge is next to 0 and i was trying to avoid the sql method because i have no idea how to do it and couldn't allow myself to ask here 'hey can someone write up a whole script for me?' so that's why i dogged that answer, not because i don't want to do. thank you for your answer, i've managed to get something really medieval working, getting the btc addresses in a txt and running a crontab every 5 minutes with uniq and awk that txt
  7. thank you for your answers! meanwhile, i got a lot of weird POST submissions so i came up with this (i found the code, actually): <?php session_start(); if (isset($_POST['message'])) { if (isset($_SESSION['token']) && $_POST['token'] == $_SESSION['token']) { $message = htmlentities($_POST['message']); $ipaddy = $_SERVER['REMOTE_ADDR']; $fp = fopen('./btcs.txt', 'a'); fwrite($fp, "$ipaddy $message <br /> \n"); fclose($fp); } } $token = md5(uniqid(rand(), true)); $_SESSION['token'] = $token; ?> <form method="POST" onsubmit="return checkform(this);"> <input type="hidden" name="token" value="<?php echo $token; ?>" /> <input type="text" maxlength="34" pattern="^[12][a-km-zA-HJ-NP-Z1-9]{25,34}$" name="message" required><br /> <input type="submit" value="Sign-up!"> i wanted to have the ips stored aswell so i can iptables drop whoever uses post injection or whatever but in don't want to show it on the website so i'm using this: <?php $lines = file('btcs.txt'); foreach ($lines as $line) { $parts = explode(' ', $line); echo isset($parts[1]) ? $parts[1] : 'N/A'; echo "<br>"; } ?> i'm just trying to run this for a couple of days so i don't need anything fancy like store it in a sql. however, it would be nice if the last part of the code will remove the duplicate btc addresses (there still are visitors that post the same btc address over and over again:), anyone knows how to do that? thank you very much!
  8. Hello I want to run a contest on my website and i am asking visitors to post their names and BTC addresses and i'll use random.org's list randomizer to pick one from the list what i did so far: <?php if ($_POST) { $name = $_POST['commentName']; $txt = $_POST['commentBTC']; $handle = fopen("comments.html","a"); fwrite($handle, "<b>" . $name . "</b> : " . $txt . "<br/>"); fclose($handle); } ?> and ] <form action="" method="POST" onsubmit="return checkform(this);"> Some Name: <input type="text" maxlength="10" name="commentName"/><br> BTC Address: <input type="text" maxlength="34" pattern="^[123][a-km-zA-HJ-NP-Z1-9]{25,34}$" name="commentBTC" required/><br> so i get a html list, which is great. the problem is that some visitors are signing up multiple times is there a way to check 'comments.html' for 'commentBTC' and if exists, to deny signing up? i can drop the 'commentName' field if it's easier to have only a bitcoin address list. help? thank you!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.