Jump to content

jackmcnally

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

Everything posted by jackmcnally

  1. Hi, Sorry for my very late reply, I have been busy! I did copy the script, but I have now wrote it myself. I have the form submitting to a PHP file (code shown below), that connects to the database and table and inputs the information provided. <?php header( 'Location: http://www.xxxxxx.com/yes.php' ) ; $con = mysql_connect("localhost","xxxxxx","xxxxxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("xxxxx", $con); $sql="INSERT INTO benotified (email, firstname, lastname) VALUES ('$_POST[email]','$_POST[firstname]','$_POST[lastname]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($con) ?> It works like a charm. I have tried using a modified version of it, including your function (as shown below), but Dreamweaver is telling me I have a syntax error. <?php $con = mysql_connect("localhost","xxxxx","xxxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("xxxxx", $con); SELECT COUNT(*) FROM xxxxx mysql_close($con) ?> As previously stated, I'm a wee bit of a PHP noob, but I am making pretty good progress with some tutorials! I learnt how to echo and write some basic stuff today without assistance! Yay! Thanks for all the help, I really appreciate it!
  2. Thanks for your answer. How would I connect this to a database? Where do I put the database name, and do I need to provide a cPanel username and password? Thanks, I'm a total PHP noob, but I'm learning... slowly!
  3. Hi, I have a 'pre-release' sign up form, where people put in their email address and name, and it transmits to a MYSQL database. That's working fine. What I want to do is to have a piece of text that reads: (insert pre release amount of signer upperers here) have signed up. Will you? I'm guessing that the amount of rows on the table, would end up being the number. How do I do this? Thanks, Jack
  4. Hey, So how exactly would I manage that like said above?
  5. Hi Guys, I've been looking for a clone script for this, but can't seem to find one, so I'll more than likely need to code it (unless you know of a clone). Basically, what I want to do is to have a tumblr like clone, where a user signs up, chooses a username, password and blog address (a subdomain of the root, or in a different folder (eg. www.gdfgdfg.com/blognamehere or www.blognamehere.gfdgdgdgg.com)), and then they are able to blog from a user panel (the software will be auto-installed to the sub-domain upon account creation). Thanks, Jack
  6. Thanks for that, I changed it to what you stated but it keeps saying that the query found 0 results when I type in the right username and email. Did you need me to do that UNIQUE thing, and if so, how would I do that? Thanks Heaps!
  7. Hey Guys, Would anyone be able to help me out here? I need this up and running asap Thanks so much! Jack
  8. Thanks for that, that was probabally the problem? Would you be able to tell me how I could fix that?
  9. Thank you so much, Michael, that looks as though it may work! Quick question, where would I put the redirect for each individual random choice? Thanks, Jack **EDIT** Just tried it, quick question: what is the purpose of the 1-7 dropdown. When I select one and click send nothing happens. I really do thank you - all - so much for your hope and ask you to excuse my PHP ignorance, I have just started a course, but want to finish this part soon! You have all helped me so much and I excuse myself if I have come across as needy!
  10. Hmmm.. Seems like I'm stuck! Would anyone be able to show me the modifications I would need to make on the above script in order to get it to work the way I want it to? Eg. I end up putting in 10 random choices. If the script selects number 8, the page is automatically redirected to numbereight.php Thanks!
  11. Is anyone else able to shed some light?
  12. Hi Guys, What I'm aiming for is a random choice generator from a list of variables, and when that choice is chosen, it redirects to a new page. Eg. Random Choice Generator spits out "John Smith" -- Browser redirects to "John Smith's" character card. Below I have the PHP script for the random choice (I think, I'm a total PHP noob!), I'm just having trouble with the redirect part. Any light you could shed would be much appreciated! And also, I do believe this code is just for one choice, would I just need to duplicate it x amount of times? <?php $stats[1] = 0; $stats[2] = 0; $stats[3] = 0; for ($i = 0; $i < 1000; $i++){ $choice = rand(1,3); if (!$i){ echo "First random choice: $choice<BR>\n"; } $stats[$choice]++; } reset($stats); while (list($num, $count) = each($stats)){ echo "$num: $count<BR>\n"; } ?> Thanks, Jack
  13. To further clarify, the moves will be like as follows SELECTION A >> SELECTION B >> SELECTION A >> SELECTION A >> SELECTION B >> SELECTION A >> DEAD
  14. Hi Guys, I appreciate your help! What I am doing is making a Choose Your Own Adventure Game and what I would like to do is the following. Record the moves of the person Put those moves on a page telling them their - say - 5 latest games Record the time it took them to complete the adventure Record that in a High Score database I know that I will need to employ the use of MYSQL databases and PHP, but I'm a total noob! Any help would be greatly appreciated! ~ Jack
  15. I have always had the prefix in. Eg. prefix_name
  16. Hi Guys, That fixed that error! But another has shown up. Forgive me, I am just starting out with PHP/MYSQL! I am used to HTML and CSS! Now, I am being told the following Would this have anything to do with the submitted row names not matching the actual row names? My row names (that should be the only ones used for this purpose) are password and username. I think the password one is right, but I have my doubts about username. Is the script calling it user instead? Thanks, Jack
  17. Thanks, you saved me! One last problem, I am being confronted with this error message Now, I know xxxx_xxxx is my database name and presume .users is the table name. I want .users to change to .fgusers6 . What would I need to edit to do this? Thanks, Jack
  18. @ Budski I am returned with the following error Does this have something to do with my connect.php file? I have written it below so you can lookover. <?php mysql_connect("localhost", "xxxdbusernamexxx", "xxxdbpasswordxxx"); mysql_select_db("xxxdbnamexxx"); ?> @Madtechie Now, that seems to have maybe fixed it! I am returned with the following But as said above, that may have to do with the connect.php file? Could you also please look over that and tell me of any errors? Thanking you ever so much! Jack
  19. Hi Guys, I have this MYSQL/PHP script for a forgotten password. This is the error I'm getting: This is the code <?php error_reporting (E_ALL ^ E_NOTICE); session_start(); $userid = $_SESSION['userid']; $username = $_SESSION['username']; ?> <!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Panemonium | Forgot Password</title> </head> <body> <?php if (!$username && !$userid){ if ($_POST['resetbtn']){ // get the form data $user = $_POST['user']; $email = $_POST['email']; // make sure info provided if ($user){ if ($email){ if ( (strlen($email) > 7) && (strstr($email, "@")) && (strstr($email, ".")) ){ // connect require("./connect.php"); $query = mysql_query("SELECT * FROM users WHERE username='$user'"); $numrows = mysql_num_rows($query); if ($numrows == 1){ // get info about account $row = mysql_fetch_assoc($query); $dbemail = $row['email']; // make sure the emial is correct if ($email == $dbemail){ // generate password $pass = rand(); $pass = md5($pass); $pass = substr($pass, 0, 15); $password = md5(md5("kjfiufj".$pass."Fj56fj")); // update db with new pass mysql_query("UPDATE users SET password='$password' WHERE username='$user'"); // make sure the paassword was changed $query = mysql_query("SELECT * FROM users WHERE username='$user' AND password='$password'"); $numrows = mysql_num_rows($query); if ($numrows == 1){ // create email vars $webmaster = "admin@nickfrosty.com"; $headers = "From: President Snow"; $subject = "Pandemonium Forgotten Password"; $message = "Tsk, Tsk, Tsk. Forgotten your password already? One more time and an execution may be in order. Your new password is below. You may rechange it in the Citizens Zone prefrences section.\n"; $message .= "Password: $pass\n"; //echo $pass."<br />"; if ( mail($email, $subject, $message, $headers) ){ echo "Your password has been reset. An email has been sent with your new password."; } else echo "An error has occured and your email was not sent containing your new password."; } else echo "An error has occured and the password was not reset."; } else echo "You enter the wrong email address."; } else echo "The username was not found."; mysql_close(); } else echo "Please enter a valid email address."; } else echo "Please enter you email."; } else echo "Please enter you username."; } echo "<form action='./forgotpass.php' method='post'> <table> <tr> <td>Username:</td> <td><input type='text' name='user' /></td> </tr> <tr> <td>Email:</td> <td><input type='text' name='email' /></td> </tr> <tr> <td></td> <td><input type='submit' name='resetbtn' value='Reset Password' /></td> </tr> </table> </form>"; } else echo "Please logout to view this page."; ?> </body> </html> Could someone please tell me where I've gone wrong? Thanks, Jack
×
×
  • 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.