Jump to content

simmsy

Members
  • Posts

    55
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

simmsy's Achievements

Member

Member (2/5)

0

Reputation

  1. Yea that was the problem thanks alot for that can carry on with it now
  2. yea the hashed passwords match and used length of 30 password but only used a 5 letter word to test
  3. I just tried echoing the md5($_POST['password']) and it is the same as the in the mysql from signup, so this is correct but still not being able to find it from the table? this is my registration code <?php include "connect.php"; $username = mysql_real_escape_string($_POST['username']); $password = md5($_POST['password']); $repassword = md5($_POST['re-password']); $email = mysql_real_escape_string($_POST['email']); if ($password==$repassword){ mysql_query("INSERT INTO users (username, password, email) VALUES ('$username', '$password','$email')"); echo "Sucess"; }else{ echo "Passwords do not match"; } mysql_close(); ?>
  4. Yea I tried this and comes up with wrong username or password, but when I removed the password from select it found the username so its something to do with the password but unsure what? thanks <?php include "connect.php"; $username = mysql_real_escape_string($_POST['username']); $password = md5($_POST['password']); $login="SELECT * FROM users WHERE username='$username' and password='$password'"; $result=mysql_query($login); $count=mysql_num_rows($result); if($count >0){ header("location: index.php"); }else{ echo "Wrong Username or Password"; } ?>
  5. Hi I have login query, pretty simple code but keeps coming up with wrong password even though I know its correct, any ideas? thanks <?php include "connect.php"; $username = mysql_real_escape_string($_POST['username']); $password = md5($_POST['password']); $login="SELECT * FROM users WHERE username='$username' and password='$password'"; $result=mysql_query($login); $count=mysql_num_rows($result); if($count==1){ session_register("username"); session_register("password"); header("location: index.php"); }else{ echo "Wrong Username or Password"; } ?>
  6. Hi im getting an error on my forum its lets me add one category then comes up with this error when trying to add another "ErrorDuplicate entry '0' for key 'PRIMARY'", im sure this is something simple im missing but cant find what? Here is the category code and forum code. Any help is appreciated. forum: <?php //create_cat.php include 'connect.php'; include 'header.php'; $sql = "SELECT categories.cat_id, categories.cat_name, categories.cat_description, COUNT(topics.topic_id) AS topics FROM categories LEFT JOIN topics ON topics.topic_id = categories.cat_id GROUP BY categories.cat_name, categories.cat_description, categories.cat_id"; $result = mysql_query($sql); if(!$result) { echo 'The categories could not be displayed, please try again later.'; } else { if(mysql_num_rows($result) == 0) { echo 'No categories defined yet.'; } else { //prepare the table echo '<table border="1"> <tr> <th>Category</th> <th>Last topic</th> </tr>'; while($row = mysql_fetch_assoc($result)) { echo '<tr>'; echo '<td class="leftpart">'; echo '<h3><a href="category.php?id=' . $row['cat_id'] . '">' . $row['cat_name'] . '</a></h3>' . $row['cat_description']; echo '</td>'; echo '<td class="rightpart">'; //fetch last topic for each cat $topicsql = "SELECT topic_id, topic_subject, topic_date, topic_cat FROM topics WHERE topic_cat = " . $row['cat_id'] . " ORDER BY topic_date DESC LIMIT 1"; $topicsresult = mysql_query($topicsql); if(!$topicsresult) { echo 'Last topic could not be displayed.'; } else { if(mysql_num_rows($topicsresult) == 0) { echo 'no topics'; } else { while($topicrow = mysql_fetch_assoc($topicsresult)) echo '<a href="topic.php?id=' . $topicrow['topic_id'] . '">' . $topicrow['topic_subject'] . '</a> at ' . date('d-m-Y', strtotime($topicrow['topic_date'])); } } echo '</td>'; echo '</tr>'; } } } include 'footer.php'; ?> Cat <?php //create_cat.php include 'connect.php'; include 'header.php'; echo '<br /><br /><br /><h2>Create a category</h2>'; if($_SESSION['signed_in'] == false | $_SESSION['user_level'] != 1 ) { //the user is not an admin echo 'Sorry, you do not have sufficient rights to access this page.'; } else { //the user has admin rights if($_SERVER['REQUEST_METHOD'] != 'POST') { //the form hasn't been posted yet, display it echo '<form method="post" action=""> Category name: <input type="text" name="cat_name" /><br /> Category description:<br /> <textarea name="cat_description" /></textarea><br /><br /> <input type="submit" value="Add category" /> </form>'; } else { //the form has been posted, so save it $sql = "INSERT INTO categories(cat_name, cat_description) VALUES('" . mysql_real_escape_string($_POST['cat_name']) . "', '" . mysql_real_escape_string($_POST['cat_description']) . "')"; $result = mysql_query($sql); if(!$result) { //something went wrong, display the error echo 'Error' . mysql_error(); } else { echo 'New category succesfully added.'; } } } include 'footer.php'; ?> mod edit: code in code tags please
  7. Ah I get you now! Well I select it from the mysql table its been saved to and is: "<div id='profileimage'><img src=".$image." width='200px' height='200px'></div> " but after looking at the source code the hyperlink is stopping at the white space in the title "<img src=http://www.fightwatcher.com/images/Blue "stops here! then no hyperlink after here!"hills.jpg width='200px' height='200px'></div>
  8. its getting the name just not displaying the image but it is displaying the images without any spaces in them
  9. $image = addslashes($_FILES['image']['name']); $target = "images/"; $target = $target . basename( $_FILES['image']['name']); //Writes the photo to the server if(move_uploaded_file($_FILES['image']['tmp_name'], $target)) {
  10. the photos that are images/white lillies.jpg, dont appear on the browser and show up as an x on them
  11. Hi im having trouble with uploading images with spaces in as they dont show up in the browser. Here is the code: $image = addslashes($_FILES['image']['name']); $target = "images/"; $target = $target . basename( $_FILES['image']['name']); //Writes the photo to the server if(move_uploaded_file($_FILES['image']['tmp_name'], $target)) { Any help would be appreciated.
  12. Hi im having trouble trying to get the javascript method 'onbeforeunload' into a php statement. What I wanted was if the user clicks refresh or closes the browser then update a table in mysql. Can anyone help with the code im not sure where to start? thanks
  13. how do i do the numbered(order) or increment?
  14. Yea I have the selected variables and ordered by $ DESC. But I want to list those echoed results from the table as 1, 2, 3 etc
  15. Hi I wanted to know how once I have selected and echoed the rows from mysql table how can I get it to number those rows that echo? etc 1. echo $variable 2. echo $variable 3. echo $variable 4. echo $variable 5. echo $variable Any help is appreciated
×
×
  • 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.