Jump to content

dominic600

Members
  • Posts

    117
  • Joined

  • Last visited

    Never

Everything posted by dominic600

  1. so even tho it just says 'pass' in the database its really not just 'pass'?
  2. yeah i have the md5 hash thing twice on activat and register. but i have $pass is $password == $repassword but one problem i seen was i created 2 accounts 2 different emails and when i went into the database to look at them for some reason it made the passwords 'pass' when i did not input that for the passwords..
  3. i did and i canged them all to &getcode and still samething.
  4. yeah i did. the tutorial im following said to do that..
  5. so ive went over this thing a few times and i cant see what im doing wrong, after following the tutorial.. anyways i fixed a few errors, mainly spelling and syntax errors, but for somereason on my when i go to activate the account, when i type my account and password in it says its incorrect... <?php $title = "Trucks Profiles - Activate your account"?> <?php require("styles/top.php"); ?> <div id='full'> <?php $getcode = $_GET['code']; $form = "<form action='activate.php' method='post'> <table> <tr> <td>Activate Code:</td> <td><input type='text' name='code' value='$getcode'></td> </tr> <tr> <td>Username:</td> <td><input type='text' name='username'></td> </tr> <tr> <td>Password:</td> <td><input type='password' name='password'></td> </tr> <tr> <td></td> <td><input type='submit' name='submitbtn' value='Activate'></td> </tr> </table> </form>"; if ($_POST['submitbtn']){ $code = strip_tags($_POST['code']); $username = strip_tags($_POST['username']); $password = strip_tags($_POST['password']); if ($code && $username && $password){ if (strlen($code) == 25){ $pass = md5(md5($password)); require("scripts/connect.php"); $query = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$pass'"); $numrows = mysql_num_rows($query); if ($numrows == 1){ $row = mysql_fetch_assoc($query); $dbcode = $row['code']; if ($code == $dbcode){ mysql_query("UPDATE users SET active='1' WHERE username='$username'"); echo "You are now active, you may now log in."; } else echo"Your Activation code is incorrect."; } else echo "Your Username and/or Password are incorrect."; } else echo "Invalid Code."; } else echo "You did not fill out all the fields."; } else echo "$form"; ?> </div> <?php require("styles/bottom.php"); ?>
  6. lol i will if i cant figure it out on my own. i dont wanna rely only on people on the fourms to fix my code. lol
  7. im trying to make a website for peope to make a 'profile' for there trucks. and where the can update it to allow others to see what they have done to there trucks and allow them to talk to other users with the same kind of truck as them about problems and stuff they are having. but im not quite done with problems now lol i got to the activate page and now theres another issue... lol
  8. problem solved, what happend was i thought my database name was 'users' turns out it was 'user' lol my site is back on track. thank you for all your help tho phpSensi, hopefully after this website i can come and help people on here!
  9. oh ok, well i guess ill look around at some stuff for a while. if i dont find anything ill just find a new hosting site or something.
  10. when i change my password to that i get a page full of errors saying access denied.. but when i put my password back it goes back to 'no database selected'
  11. yeah, it has that. i accendently deleted it.. but yeah. Im not sure what to do.. lol
  12. okay, just 1 thing tho.. i put in all my information in the connect.php as it is on my hosting service and it still does not work. do you see anything that could be wrong with this? <?php $server = "mysql4000webhost.com"; $dbuser = "a38806_dominic"; $dbpass = "1992"; $database = "users"; mysql_connect($server, $dbuser, $dbpass); mysql_select_db($database); ?>
  13. okay, i did what you said phpsensi and i ran it and this time alls it says on the page is "no database selected" so does that mean that kickstart is right that i dont have the right info for my connect.php to work correctly
  14. dang, well is there anything else i can send you that could possibly help. but like 96, the one with the error says: $numrows = mysql_num_rows($query);
  15. Anything to help me, help you, help me but yeah, i still get that error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/a3888506/public_html/register.php on line 96 but ill be sure to change the date thing.
  16. im hoping thats what it is your wanting to look at. -- Host: localhost -- Generation Time: Aug 06, 2011 at 06:08 PM -- Server version: 5.1.57 -- PHP Version: 5.2.17 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -- -- Database: `a3888506_user` -- -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `first_name` varchar(50) COLLATE latin1_general_ci NOT NULL, `last_name` varchar(75) COLLATE latin1_general_ci NOT NULL, `username` varchar(50) COLLATE latin1_general_ci NOT NULL, `email` varchar(250) COLLATE latin1_general_ci NOT NULL, `password` varchar(75) COLLATE latin1_general_ci NOT NULL, `avatar` varchar(60) COLLATE latin1_general_ci NOT NULL, `bio` text COLLATE latin1_general_ci NOT NULL, `website` varchar(250) COLLATE latin1_general_ci NOT NULL, `youtube` varchar(50) COLLATE latin1_general_ci NOT NULL, `last_login` varchar(50) COLLATE latin1_general_ci NOT NULL, `active` tinyint(1) NOT NULL, `code` varchar(25) COLLATE latin1_general_ci NOT NULL, `locked` tinyint(1) NOT NULL, `date` varchar(50) COLLATE latin1_general_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ; -- -- Dumping data for table `users` --
  17. ok, but what do i use to put in the field 1 and 2?
  18. so heres my error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/a3888506/public_html/register.php on line 96 i see some stuff online in searches i have done but idk what to do about it. im guessing it cant connect to the database because of this ? idk.. but heres my code if it would help at all. <?php require("styles/top.php"); ?> <div id='content'> <div id='full'> <?php $form = "<form action='register.php' method='post'> <table> <tr> <td></td> <td>Fields indicating <font color='red'>*</font> are require.</td> </tr> <tr> <td>First Name:</td> <td><input type='text' name='firstname'><font color='red'>*</font></td> </tr> <tr> <td>Last Name:</td> <td><input type='text' name='lastname'><font color='red'>*</font></td> </tr> <tr> <td>Username:</td> <td><input type='text' name='username'><font color='red'>*</font></td> </tr> <tr> <td>E-mail:</td> <td><input type='text' name='email'><font color='red'>*</font></td> </tr> <tr> <td>Password:</td> <td><input type='password' name='password'><font color='red'>*</font></td> </tr> <tr> <td>Confirm Password:</td> <td><input type='password' name='repassword'><font color='red'>*</font></td> </tr> <tr> <td>Avatar:</td> <td><input type='file' name='avatar'></td> </tr> <tr> <td>Website:</td> <td><input type='text' name='website'></td> </tr> <tr> <td>Youtube User Name:</td> <td><input type='text' name='youtube'></td> </tr> <tr> <td>Bio:</td> <td><textarea name='bio' cols='35' rows='5'></textarea></td> </tr> <tr> <td></td> <td><input type='submit' name='submitbtn' value='Register'></td> </tr> </table> </form>"; if ($_POST['submitbtn']){ $firstname = strip_tags($_POST['firstname']); $lastname = strip_tags($_POST['lastname']); $username = strip_tags($_POST['username']); $email = strip_tags($_POST['email']); $password = strip_tags($_POST['password']); $repassword = strip_tags($_POST['repassword']); $website = strip_tags($_POST['website']); $youtube = strip_tags($_POST['youtube']); $bio = strip_tags($_POST['bio']); $name = $_FILES['avatar'] ['name']; $type = $_FILES['avatar'] ['type']; $size = $_FILES['avatar'] ['size']; $tmpname = $_FILES['avatar']['tmpname']; $ext = substr($name, strrpos($name, '.')); if ($firstname && $lastname && $username && $email && $password && $repassword){ if ($password == $repassword){ if (strstr($email, "@") && strstr($email, ".") && strlen($email) >= 6){ require("scripts/connect.php"); $query=mysql_query("SELECT * FROM users WHERE username='$username' "); $numrows=mysql_num_rows($query); if ($numrows == 0){ $query=mysql_query("SELECT * FROM users WHERE email='$email' "); $numrows=mysql_num_rows($query); if ($numrows == 0){ $pass = md5(md5($password)); $date = date("F d, Y"); if($name){ move_uploaded_file($tmpname, "avatars/$username.$ext"); $avatar = "$username.$ext"; } else $avatar = "default_avatar.png"; $code = substr (md5(rand(11111111111, 999999999999999)), 2, 25); mysql_query("INSERT INTO users VALUES ('', '$firstname', '$lastname', '$username', '$email', 'pass', '$avatar', '$bio', '$website', '$youtube', '', '0', '$code', '0', '$date')"); $webmaster = "Admin@trucksite.com"; $subject = "Activate Your Account!"; $headers = "From: Admin <$webmaster>"; $message = "Hello $firstname.\n\nWelcome to trucksite below is a link for you to activate your account!.\n http://tprofiletesting.net23.net/activate.php?code=$code"; mail($email, $subject, $message, $headers); echo "Your activation email has been sent to <b>$email</b>."; } else echo "That email is currently in use."; } else echo "That username is currently in use."; } else echo "You did not enter a vaild email."; } else echo "Your passwords did not match."; } else echo"You did not fill in all the required fields."; } echo "$form"; ?> </div> <div id='footer'><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a></div> <body> </body> </html>
  19. i got this error. Parse error: syntax error, unexpected $end in /home/a3888506/public_html/register.php on line 1
  20. Sorry, i thought you ment that one.. here the actuall one <?php require("styles/top.php"); ?> <div id='content'> <div id='full'> <?php $form = "<form action='register.php' method='post'> <table> <tr> <td></td> <td>Fields indicating <font color='red'>*</font> are require.</td> </tr> <tr> <td>First Name:</td> <td><input type='text' name='firstname'><font color='red'>*</font></td> </tr> <tr> <td>Last Name:</td> <td><input type='text' name='lastname'><font color='red'>*</font></td> </tr> <tr> <td>Username:</td> <td><input type='text' name='username'><font color='red'>*</font></td> </tr> <tr> <td>E-mail:</td> <td><input type='text' name='email'><font color='red'>*</font></td> </tr> <tr> <td>Password:</td> <td><input type='password' name='password'><font color='red'>*</font></td> </tr> <tr> <td>Confirm Password:</td> <td><input type='password' name='repassword'><font color='red'>*</font></td> </tr> <tr> <td>Avatar:</td> <td><input type='file' name='avatar'></td> </tr> <tr> <td>Website:</td> <td><input type='text' name='website'></td> </tr> <tr> <td>Youtube User Name:</td> <td><input type='text' name='youtube'></td> </tr> <tr> <td>Bio:</td> <td><textarea name='bio' cols='35' rows='5'></textarea></td> </tr> <tr> <td></td> <td><input type='submit' name='submitbtn' value='Register'></td> </tr> </table> </form>"; if ($_POST['submitbtn']){ $firstname = strip_tags($_POST['firstname']); $lastname = strip_tags($_POST['lastname']); $username = strip_tags($_POST['username']); $email = strip_tags($_POST['email']); $password = strip_tags($_POST['password']); $repassword = strip_tags($_POST['repassword']); $website = strip_tags($_POST['website']); $youtube = strip_tags($_POST['youtube']); $bio = strip_tags($_POST['bio']); $name = $_FILES['avatar'] ['name']; $type = $_FILES['avatar'] ['type']; $size = $_FILES['avatar'] ['size']; $tmpname = $_FILES['avatar']['tmpname']; $ext = substr($name, strrpos($name, '.')); if ($firstname && $lastname && $username && $email && $password && $repassword){ if ($password == $repassword){ if (strstr($email, "@") && strstr($email, ".") && strlen($email) >= 6){ require("scripts/connect.php"); $query = mysql_query("SELECT * FROM users WHERE username='$username'"); $numrows = mysql_num_rows($query); if ($numrows == 0){ $query = mysql_query("SELECT * FROM users WHERE email='$email'"); $numrows = mysql_num_rows($query); if ($numrows == 0){ $pass = md5(md5($password)); $date = date("F d, Y"); if($name){ move_uploaded_file($tmpname, "avatars/$username.$ext"); $avatar = "$username.$ext"; } else $avatar = "default_avatar.png"; $code = substr (md5(rand(11111111111, 999999999999999)), 2, 25); mysql_query("INSERT INTO users VALUES ('', '$firstname', '$lastname', '$username', '$email', 'pass', '$avatar', '$bio', '$website', '$youtube', '', '0', '$code', '0', '$date')"); $webmaster = "Admin@trucksite.com"; $subject = "Activate Your Account!"; $headers = "From: Admin <$webmaster>"; $message = "Hello $firstname.\n\nWelcome to trucksite below is a link for you to activate your account!.\n http://tprofiletesting.net23.net/activate.php?code=$code"; mail($email, $subject, $message, $headers); echo "Your activation email has been sent to <b>$email</b>."; } else echo "That email is currently in use."; } else echo "That username is currently in use."; } else echo "You did not enter a vaild email."; } else echo "Your passwords did not match."; } else echo"You did not fill in all the required fields."; } echo "$form"; ?> </div> <div id='footer'><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a></div> <body> </body> </html>
  21. <?php $server = ""; $dbuser = ""; $dbpass = ""; $database = ""; mysql_connect($server, $dbuser, $dbpass); mysql_select_db($database); ?>
  22. I got it working haha but now everything works but i get a warning: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/a3888506/public_html/register.php on line 96 and line 96 reads: $numrows = mysql_num_rows($query);
  23. i think somewhere let me look around the site.. and www.000webhost.com
  24. i put in localhost instead, and its the same error. Im trying to find out where to create a new user in phpmyadmin but i cant seem to find it..
  25. not that you say that i think i do have the user and or password wrong. im going to go make a new user on there and try all new dbuser and password. Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server at 'reading initial communication packet', system error: 111 in /home/a3888506/public_html/scripts/connect.php on line 8
×
×
  • 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.