Jump to content

947740

Members
  • Posts

    755
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Male

947740's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. I don't think you should store an entire array in the database. Make an entry into the database for every ip that tries to vote on the poll, and when checking to see if they have voted, simply see if that IP is in the database anywhere.
  2. Move everything from $md5 = ... to imagepng($captcha); to a new file called image_gen.php, or w/e you want to call it. Make sure you start a session on that page as well. In your original document, make sure that the session is still started. Wherever you want the captcha, put this: <img src='image_gen.php' alt='Captcha Image' /> <?php //image_gen.php session_start(); // Make captcha $md5 = md5(microtime() * mktime()); $string = substr($md5,0,7); $captcha = imagecreatefrompng("./img/captcha.PNG"); $black = imagecolorallocate($captcha, 0, 0, 0); $line = imagecolorallocate($captcha,233,239,239); imageline($captcha,0,0,39,29,$line); imageline($captcha,40,0,64,29,$line); imagestring($captcha, 5, 20, 10, $string, $black); $_SESSION["CAPTCHA_CHALLENGE"] = md5($string); header("Content-type: image/png"); imagepng($captcha); ?> <?php // Original file session_start(); $result = " "; if($_GET["action"] == "proc"){ $response = $_POST["response"]; if($response != $_SESSION["CAPTCHA_CHALLENGE"]) $result = "The code you entered was incorrect."; else $result = "Correct!"; }?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Test</title> </head> <body> <div><?php echo $result; ?></div> <div id="test"> <h1>This is a test<h1> <form name="x" method="POST" action="Test.php?action=proc">Type the code on the right: <input type="text" name="response" size="7" maxlength="7"/> <img src="image_gen.php" alt='captcha image' /></form> </div> </body></html> I apologize about the white space issue, my copy and paste is not working right.
  3. <html> <head> <script language='javascript' type='text/javascript'> function add() { var total = document.getElementById("total"); var red = document.form.red.value; var blue = document.form.blue.value; var green = document.form.green.value; var sum = 0; if(document.form.red.checked == true) { var sum = parseInt(red) + sum; } if(document.form.blue.checked == true) { var sum = parseInt(blue) + sum; } if(document.form.green.checked == true) { var sum = parseInt(green) + sum; } total.innerHTML = sum; } </script> </head> <body> <form name='form' action='misc.php' method='post'> <input type='checkbox' name='red' value='2' /> <input type='checkbox' name='blue' value='4' /> <input type='checkbox' name='green' value='1' /> <input type='button' name='Calculate' value='Calculate' onclick='add()' /> </form> <div id='total'> </div> </body> </html>
  4. On your html page: <img src='nameoffilethatcreatesimage.php' alt='some text' />
  5. Based on what you want to do...javascript would be a much better solution. You wouldn't even have to send the user to a new page.
  6. It's probably because an error is displaying? Also, you can not have ANY characters before the <?php. That means you can't have spaces, either. Also, there are miscellaneous other errors in your script. For example, the parts where you call $_POST need to have ' around the field names. I fixed what I noticed: <?php $hostname = "test.net"; $username = "test"; $password = "test"; $dbname = "ifdcustomers"; $usertable = "CustomerInfo"; $EMAIL = "EMAIL"; $skillONE = "skillONE"; $con = mysql_connect("test.net","test","test"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("ifdcustomers", $con); $sql="INSERT INTO CustomerInfo (EMAIL, skillONE) VALUES ('{$_POST['EMAIL']}','{$_POST['skillONE']}')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } mysql_close($con) ?> I have a question...why do you declare all the variables at the top, but you don't use them for anything?
  7. I was hinting at the fact that you should try it.
  8. Ah, good question. The system is built so that only 1200 points (or the set value for the prize) can be bet/bid on that prize. Thanks again.
  9. Don't you need something... mysqli_connect_error(/*RIGHT HERE*/) ??? Like... mysqli_connect_error($dbc);
  10. http://en.wikipedia.org/wiki/Meta_refresh
  11. Ah, I kind of get what you are saying. Realistically, the problem is simple...I must be overthinking it. I had a thought of using 100 items in an array and then giving Bob 5/12 of those, Sue 4/12 of those, and Andy 3/12, and then make a random number between 1 and 100. I think it's basically the same idea...I like yours more, though, as it's a lot more simple. Thanks.
  12. $key will be redefined each time you do it...which means that $row will have ten different keys, along with 10 corresponding values. If you don't like my way, try this: $row[$position."_number"]
  13. Hrrrm...you might be able to. You might have issues, though, if CAS tightly controls the session variables. If you want a look at $_SESSION...just var_dump() it and see what you get. I don't know if that will provide any insight...wouldn't hurt to check, though.
×
×
  • 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.