Jump to content

mikenyc

Members
  • Posts

    13
  • Joined

  • Last visited

Posts posted by mikenyc

  1. We dont have a purpose, unfortunately :( .. well, most of us anyhow. They all just live for the sake of living, and that sucks !!! what is life if you cant help someone in need, what is life if you are just going through it head down, not seeing and NOT CARING where you are going.

     

    The purpose of humanity I think should be self awareness, careing for other people, while other people care for you, CARING ABOUT EARTH, because, when its gone.. well...

  2. I`m not so sure that you are new to php, because.. using mysql sockets is not some newbe thing to do :)

    but that again, if you are new, the code "Tjoene" should works just fine..

    you need to add this command in bold.

     

    $link = mysql_connect($host, $user, $password);

    mysql_select_db("name_of_your_database");

    if (!$link) {

     

    and for newbies much better site for learning is http://www.w3schools.com/php/default.asp

    and when you get some experience with PHP you can go to http://www.php.net .. much more information but for non experienced programmer it can be a little confusing..

     

    cheers

  3. btw @byron

    I don`t think that chaning order of action and method will effect anything ;),

     

    It would have never worked like this:

     

    echo "<form method=login.php action=post>";

     

    but not putting quotation will :)

     

    His quotes were in the right place and it would have worked fine but the correct way would have been to back slash it like this (also with correct method and action).

     

    echo "<form action=\"login.php\" method=\"post\">";

    OUUUUU.. sorry, my eyes are bad :/ I thought you meant that the right choice would be <form method=post action=login.php> and not <form ACTION=login.php method=post>

     

    Btw guys, mine post above isn`t displayed as I wrote it ://

  4. Wouldn`t it be better to have a db?

    So you can have multiple accounts?

     

    then it would be something like..

    Ofc first you would need a database, and table to hold usernames.

    You can do that with phpmyadmin in just a few mouse clicks, so I presume you know that part ( if you don`t, we will explain ofcourse :) ).

    I will also presume that the name of DB is... Lets say "useracc", and the table name "user" ..

    <?php
    //First, connection to mysql and database, I put these parameters for local testing ( when working in wamp or xamp, you should change it to your own parameters
    $conn = mysql_connect("localhost","root","");
    mysql_select_db("useracc");
    
    // Take username and pass from the form LOG IN FIELD
    $username = $_POST['username'];
    $password = '$_POST['password'];
    
    // Check if the form hasn't been submitted
    if (!isset($_POST['submit'])) {
    
    // Display the form
    echo "<form method='post' action='login'.php>";
    echo "<p>Please authorize to view site.</p>";
    echo "Username: <input type='text' name='username'><br>";
    echo "Password: <input type='password' name='password'><br>";
    echo "<input type='submit' name='submit'>";
    echo "</form>";
    
    // Check if the form has been submitted
    }else{
    
    //Compare users from database where $username = user and $password = password
    $query = mysql_query("SELECT * FROM users WHERE $username = user AND $password = password LIMIT 1");
    
    if (mysql_num_rows($query) >0){
    
    // If yes, start the session
    session_start();
    
    // Then create the session
    $_SESSION['username'] = $username;
    
    // Redirect to the site homepage
    header("location:index.php");
    
    // If not
    }else{
    
    // Die and show the error message
    die('Login details mismatched');
    
    // End of statement
    }
    
    // End of statement
    }
    
    ?>

     

    I`m used to this kind of user management, because now you can have multiple.....admins, lets say, each with they`re own user and password.

     

    btw @byron

    I don`t think that chaning order of action and method will effect anything ;), but not putting quotation will :)

  5. Yep, the ONE question. WHO ARE YOU.. what you like, why aren`t you doing what you like, why are you miserable, why do you make fun of other people ( it often not as they say 'just for laughter' but it has a root deep down in you )

    Fund yourself, you will find happines, find happines and you will find meaning of life !!!

    (btw I`m not advertising anything, nor I`m any kind of psychologist, so dont take my word for granted :D )

  6. hehe. Eternal question :)

    And the answer is.....

    HAPPINESS

    for some it is worshiping God, for some it`s partying, makin` money, LOVE, crafts making, making art ( hello, hobby photograph here :) )... and for some it is just to make others happy, to me, that is the best feeling, when I make someone smile, but TRULY smile and be happy, because of what I said or did :)

  7. I use EVERY browser to check if my sites work in every one :)

    well ot every but the big ones, opera, safari, FF, chrome, and last but LEAST important IE ( couldn`t render css properly untill IE 9 :/// and IE 9 has a whole bunch of add on toolbars, that are annoying!!!!)

     

    but for personal use, FF/chrome the best combination, FF because of add on, and chrome when I need to feel like flash :)

×
×
  • Create New...