Jump to content

angelali

Members
  • Posts

    128
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

angelali's Achievements

Member

Member (2/5)

0

Reputation

  1. It is working now... I forgot a ' at password...
  2. I get Warning: mysql_num_rows() expects parameter 1 to be resource, string given in C:\xampp\htdocs\cp\register.php on line 40 when I do: if (mysql_num_rows($cnick) > 0) {......................
  3. I made a registration form where I put both email address and username as UNIQUE key in database. I did that to preent duplicate email address and username to enter, and also to check if they have already registered, if yes, then the user will have to choose another email or username. I always do registration form where email address is only the UNIQUE key, but today, I'm putting both email address and username as UNIQUE. However, when I register, it gives me my error message to display when either the email address or username has already registered. Here my from below: <form action="register.php" method="post"> <table width="760"> <tr> <td><label>Your email address:</label></td> <td><input type="email" required size="45" maxlength="50" name="email"/></td> </tr> <tr> <td><label>Confirm your email address:</label></td> <td><input type="email" required size="45" maxlength="50" name="cemail"/></td> </tr> <tr> <td><label>Insert a nickname:</label></td> <td><input type="text" required size="45" maxlength="32" name="nick"/></td> </tr> <tr> <td><label>Insert a password:</label></td> <td><input type="password" required size="45" maxlength="32" name="pass"/></td> </tr> <tr> <td></td> <td><input type="submit" value="Register"/></td> </tr> </table> </form> <?php if ($_SERVER['REQUEST_METHOD'] == 'POST') { if(isset($_POST['email']) && isset($_POST['cemail']) && isset($_POST['nick']) && isset($_POST['pass'])) { $email = mysql_real_escape_string(strip_tags(trim($_POST['email']))); $cemail = mysql_real_escape_string(strip_tags(trim($_POST['cemail']))); $nick = mysql_real_escape_string(strip_tags(trim($_POST['nick']))); $pass = mysql_real_escape_string(strip_tags(trim($_POST['pass']))); if (empty($email) || empty($cemail) || empty($nick) || empty($pass)) { echo 'All fields marked with an asterisk are required!'; } else if (strlen($nick) > 32){ echo 'Your nickname cannot be more than 32 characters!'; } else if (!filter_var($email, FILTER_VALIDATE_EMAIL) || !filter_var($cemail, FILTER_VALIDATE_EMAIL)) { echo 'Your email address is invalid!'; } else if (strlen($email) > 50){ echo 'Your email address cannot be more than 50 characters!'; } else if ($email !== $cemail) { echo 'Your email address does not match!'; } else if (strlen($pass) > 32) { echo 'Your password cannot be more than 32 characters!'; } else { $con = @mysql_connect ('localhost', 'root', '') or die ('A problem has occurred,!'); @mysql_select_db ('db', $con) or die ('A problem has occurred!'); $pen = md5($pass); $register = "INSERT INTO reg (reg_ID, email, nickname, password) VALUES ('NULL', '$email', '$nick', $pen')"; mysql_query($register, $con); if (mysql_errno ($con) > 0) { echo 'Either the email address or the username has already taken!'; } else { echo "Registration Successful like a boss!"; mysql_close($con); } } } } ?> Well, each time I choose to make anew registration when choosing a new email address and nickname, I got this error: Either the email address or the username has already taken!...
  4. Elaborate on what? The header topic or my question?
  5. You dont need headers anymore now to display the image from database... I tried this many times and it works...
  6. Ok, I just want to know what you think, I have a table with 20 columns where one column will store the images database. The images which are being saved are just thumbnail pics, not exceeding 250px as width and height and also, not exceeding 20KB in size. So what do you think? Should I proceed to store the images in database?
  7. OK will change this... Mr Marcus, thank you very much man! I love Canada as well, so sad too far.... I live in the Indian Ocean... I'm new in PHP, well not that new, but I started with it in last December. My objective is not to be professional in it, as I'm more on front-end development than back-end. However, I'm a guy who wants to have at least an Intermediate level of knowledge in different back-end languages rather than mastering a single language. I'm still learning, have a lot to do, I have OO to learn (A real pain this OO), and after that, will touch Ruby... Too sad, ColdFusion is almost dead, else I would master it...as I love it.. Well, I added you as buddy list, thank you again man, you are great prince..
  8. And also for the array_map, can I insert strip_tags as well in it like: $ids = array_map('mysql_real_escape_string', 'strip_tags', $_POST['delete']);
  9. If I have asked you your country, this means I would invite you for a good day on the beach in my country, enjoying some chicks, beers and the sand....because IT IS WORKING PERFECTLY LOLLLLLLLLLL Thank youuuuuuuuuuuuu What should I do with this: else { trigger_error(mysql_error()); // remove once everything is working } You said remove it if it is working properly...
  10. Mr Marcus, where do you live? I mean which country?
  11. No its good now I think, let me check the database, then I will tell you.... give me 5 minutes...
  12. Hey wait....wait.... I think its good, you changed from row to assoc, I changed it to array....wait..
  13. Notice: Undefined index: imgname in C:\xampp\htdocs\troll\includes\images.php on line 53 And the permission denied warning.. I get the notice after correcting your codes earlier, forgot to paste it...when I replied you the previus message
  14. Warning: unlink(images/) [function.unlink]: Permission denied in C:\xampp\htdocs\troll\includes\images.php on line 53 The above the warning message. I set all permissions of my folders as FULL CONTROL on Windows, I don't know why iyt keeps asking this. Secondly, as the query is exeuting the image names which are stored in database, with that query $row['imgname'], I put it in a variable, and assign it to unlink function to delete the image.
×
×
  • 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.