Jump to content

Html

Members
  • Content count

    304
  • Joined

  • Last visited

  • Days Won

    1

Html last won the day on September 20 2011

Html had the most liked content!

Community Reputation

7 Neutral

1 Follower

About Html

  • Rank
    Member
  • Birthday 03/17/1989

Contact Methods

  • ICQ
    0

Profile Information

  • Location
    Greater London
  1. Posting comments into a Mysql database?

    In honest truth, I haven't learnt anything by memory. I just did what the video explained, and got the functioning problem solved by that guy. He left some comments as you can see. But yeah, I'm rudderless here, I don't know where to go from here.
  2. Posting comments into a Mysql database?

    Sure, but how do I learn without the knowledge, I watched the video because that was the way I could learn, and so far I have got somewhere with this, I'm stuck with this error, as well beyond once logging in, text box post text to an index page linked with the user created on the database. I need examples to continue with this.
  3. Posting comments into a Mysql database?

    Hmm, I watched the video which he explained what to do, and so on and then he made those custom clips of how to get the pages to work with the free web host since what I tried just didn't work, so i was lucky to stumble on his videos and the fact that he could respond, which I mentioned in the above posts. So what he did, was correct, could you not copy what is there and may be try on your host? I imagine you have a host free or paid. I don't know what to do, what exactly do suggest I do to get this login to work, I want to able to post to the user rich's index page, that is my goal here. I think using what is there I feel is the correct step for now, it isn't a public site, so I'm not concerned about security. The hash he provided removed or remains isn't that good at all? I remember reading about Yahoo via Yahoo news and the UK's the Guardian newspaper about not having various data encrypted well.
  4. Posting comments into a Mysql database?

    This below is what loads the index.php page, so after registration of the registration.php page, it loads again, with a link to go to the index to login. There is a comment which states account registered. <?php session_start(); require 'connect.inc.php'; if (isset($_POST['uname']) and isset($_POST['pwd']) and !empty($_POST['uname']) and !empty($_POST['pwd'])) { $uname = mysqli_real_escape_string($conn, $_POST['uname']); $pwd = $_POST['pwd']; $check = "SELECT * FROM users WHERE uname = '$uname'"; $res = mysqli_query($conn, $check); $row = mysqli_fetch_assoc($res); if (mysqli_num_rows($res)<1) { echo 'That user wasn\'t found'; } else { $pwd = PASSWORD_VERIFY($pwd, $row['pwd']); $dbuser = $row['uname']; $dbpwd = $row['pwd']; if ($uname == $dbuser and $pwd == $dbpwd) { $id = $row['id']; $_SESSION['id'] = $id; header("Location: dashboard.php"); exit(); } else { echo 'That username and password didn\'t match'; } } } ?> <!DOCTYPE html> <html> <head> <title>Login</title> </head> <body> <h3>Login</h3> <form action="dashboard.php" method="POST"> <!-- This line should have been set to the current page were editing --> <input type="text" name="uname" placeholder="Username"><br> <input type="password" name="pwd" placeholder="Password"><br> <input type="submit"> </form> <p>Click <a href="registration.php">HERE</a> to register</p> As for the code, this or that, I didn't create any of it, all based off that man's video tutorial on youtube, I lucky enough to get this working thanks to him. You clearly know much better at Pre hyper text processor language, that is something I do remember about the acronym php.
  5. Posting comments into a Mysql database?

    Nope, the login link then loads after registering, and once clicked type in the username and password, and it goes nowhere.
  6. Posting comments into a Mysql database?

    Hmm, okay, seems informative enough. As for the code which is the obvious problem, the database was created using the control panel setting and the rows added, so that wasn't a problem. It is the code and posting to the database which does work on my example register, but to login into a dashboard, that doesn't work. What could I have done to stop that from working? I found some php files on a storage disk, that somebody had made for me in 2007, but a year after I gave up on the web design interest. The difference between then and now is the video site with narrated tutorials, so a book isn't a must, but a book is helpful for reference. Like I stated I viewed a clip, and I was lucky enough to get the help of that man who narrated a couple of clips explaining why I couldn't get the code all above to work, so he created an account on the free web host and tested it out. I haven't got a reply from him. He may be busy, or doesn't care much to help me beyond what he did help me with.
  7. Posting comments into a Mysql database?

    Unfortunately, after having tried months ago using some random videos, and they turned out not to be useful when I tried here to get some help with them, but how it was setup the connected wasn't there. So now with the other tutorial I saw last month, the code is now out of date from what you've stated. So I'm now stuck. Hmm, okay to break it down, I want to send some details to the Mysql db, so include email and password, I have the login there. Is it enough to use index.php, and then another page for the posting of the details to the mysql? Because from that to the registration where that is even more, I find that all confusing. And once I register, the dashboard doesn't load. So logining doesn't work once registered. I don't know what I could of done, all I did was add a login html code above the registration, unless the code was designed to fail after a few tries, I don't know. Thanks.
  8. Posting comments into a Mysql database?

    Oh, well I didn't know any of this. I assumed it was okay, other clips show similar stuff. I was glad this guy helped me out, It is a start. Hmm, well could you create a simple post email and pwd with up to date code for me? I can then try get some kind of a login link for it.
  9. Posting comments into a Mysql database?

    The person who helped correct the php code he had made in his video, made it so that if I created rich1, it can't be created again. As for, the table so okay lets just keep really basic, one user has a comment box that posts to the accounts index, which I don't have one for the username, first I can't even get into the dashboard. He did leave some comments, but I'm still rusty with all of this, it was only a week or ago he corrected and made it work with a free host. He had created his own account and based the example files off it, and recorded some clips explaining a little of he did. <?php require 'connect.inc.php'; if (isset($_POST['fname']) and isset($_POST['lname']) and isset($_POST['uname']) and isset($_POST['pwd']) and isset($_POST['pwd2']) and !empty($_POST['fname']) and !empty($_POST['lname']) and !empty($_POST['uname']) and !empty($_POST['pwd']) and !empty($_POST['pwd2'])) { $fname = mysqli_real_escape_string($conn, $_POST['fname']); $lname = mysqli_real_escape_string($conn, $_POST['lname']); $uname = mysqli_real_escape_string($conn, $_POST['uname']); $pwd = $_POST['pwd']; $pwd2 = $_POST['pwd2']; //The mysqli_real_escape_string prevents sql injection... We are hashing the passwords, so we don't need to do it on those lines. /*This line checks to make sure the passwords match*/if ($pwd != $pwd2) { echo 'The passwords you entered didn\'t match'; } else { $check = "SELECT * FROM users WHERE uname = '$uname'"; $res = mysqli_query($conn, $check); /*This line checks to make sure the user exists*/if (mysqli_num_rows($res)>0) { echo 'That username is taken.'; } else { $pwd = PASSWORD_HASH($pwd, PASSWORD_BCRYPT, array('cost' =>12)); $sql = "INSERT INTO users (fname, lname, uname, pwd) VALUES ('$fname', '$lname', '$uname', '$pwd')"; if (!mysqli_query($conn, $sql)) { echo 'Error!'; } else { echo 'Account created! <br> Click <a href="index.php">Here</a> to login'; } } } } ?> <!DOCTYPE html> <html> <head> <title>Register Account</title> </head> <body> <h3>Login</h3> <form action="dashboard.php" method="POST"> <input type="text" name="uname" placeholder="username"><br> <input type="password" name="pwd" placeholder="password"><br> <input type="submit" name="Login" value="Login"> <br> <h2>Create Account</h2> <form action="registration.php" method="POST"> <!-- This line should have been set to the current page were editing --> <input type="text" name="fname" placeholder="first name"><br> <input type="text" name="lname" placeholder="last name"><br> <input type="text" name="uname" placeholder="username"><br> <input type="password" name="pwd" placeholder="password"><br> <input type="password" name="pwd2" placeholder="confirm password"><br> <input type="submit" name="submit" value="Register"> </form> </body> </html> <?php session_start(); if (!isset($_SESSION['id'])) { header("Location: index.php"); //The above bit of code checks to make sure the user is logged in... If they're not, it will kick them back to the login page... } require 'connect.inc.php'; /*Dont change this line */$id = $_SESSION['id']; /*This line tells PHP to get the user information from mysql*/$getuser = "SELECT * FROM users WHERE id = '$id'"; $res = mysqli_query($conn, $getuser); /*This line will let you use $row['something here']' to pull information from the database*/$row = mysqli_fetch_assoc($res); echo 'Welcome, '. $row['fname']. '<br><a href="logout.php">Logout</a>'; //As you can see, we don't have a var in here called fname, so that's a good example of the mysqli_fetch_assoc function pulling the information 'fname' from the database. ?> <?php session_start(); require 'connect.inc.php'; if (isset($_POST['uname']) and isset($_POST['pwd']) and !empty($_POST['uname']) and !empty($_POST['pwd'])) { $uname = mysqli_real_escape_string($conn, $_POST['uname']); $pwd = $_POST['pwd']; $check = "SELECT * FROM users WHERE uname = '$uname'"; $res = mysqli_query($conn, $check); $row = mysqli_fetch_assoc($res); if (mysqli_num_rows($res)<1) { echo 'That user wasn\'t found'; } else { $pwd = PASSWORD_VERIFY($pwd, $row['pwd']); $dbuser = $row['uname']; $dbpwd = $row['pwd']; if ($uname == $dbuser and $pwd == $dbpwd) { $id = $row['id']; $_SESSION['id'] = $id; header("Location: dashboard.php"); exit(); } else { echo 'That username and password didn\'t match'; } } } ?> <!DOCTYPE html> <html> <head> <title>Login</title> </head> <body> <h3>Login</h3> <form action="index.php" method="POST"> <!-- This line should have been set to the current page were editing --> <input type="text" name="uname" placeholder="Username"><br> <input type="password" name="pwd" placeholder="Password"><br> <input type="submit"> </form> <p>Click <a href="registration.php">HERE</a> to register</p> </body> </html>
  10. Posting comments into a Mysql database?

    I had followed a youtube video tutorial, and got help from the creator of the video, as for a comment box I searched for that, so i returned here. So for this ID row in the users table, how would that work with rich1 login details? uname, fname, lname is an example of what is in the users table in site db. Well yes text, date and time. As for a login section on the registration.php page, how does that work? Or what could be the problem there?
  11. Posting comments into a Mysql database?

    The site database has the table called users, and then listed is a username and password. So for comments on an accounts index page, I'm not sure how this is suppose to work. I can't even get the registration page to get to the logout link page, I don't know what happened there. Once registered it would load a link on the same page and it would take me to the logout link. So there I want a comment box, which isn't really the problem, but getting it to post, as you stated "justsomeguy", I need to post the details to the site db. <h3>Login</h3> <form action="dashboard.php" method="POST"> <input type="text" name="uname" placeholder="username"><br> <input type="password" name="pwd" placeholder="password"><br> <input type="submit" name="Login" value="Login">
  12. Posting comments into a Mysql database?

    Honestly, I don't know. I have a database called site, so html code for the box and a submit button, and then what next?
  13. Hi, I have some pages setup, that create an account, I would like to post a comment to the accounts index page, there isn't an account index page, just a page that has a logout link. I know I need a comment box so the logout page can have that, but posting a comment in a comment box, would require an Id I guess, I used a tutorial to help me, and the creator of the tutorial helped me getting the whole login working as he configured his differently as it was done on a local system, and not a free web host. Thanks.
  14. I appreciate you now stating that. Flipping tutorials clips, may be the narrator was just out to generate some revenue. I once bought a python book last year, all I got was printouts, it was complete utter rubbish. So the example doesn't work at all?
  15. From what I can remember that was what the vid narrator displayed, so as for trying an API, an error which doesn't require any actual code or mysql, that doesn't work either. I actually did mentioned it on your profile, so profile doesn't accept messages. Something about stack over flow.
×