Jump to content

burtybob

Members
  • Posts

    105
  • Joined

  • Last visited

Posts posted by burtybob

  1. This is a basic login script it might need a minor edit to make it work for you in the way you want but that should mean just basic php knowledge.

     

    LOGIN FORM

    <html>
    <body><form action="welcome.php" method="post"><br>
    Username: <input type="text" name="username" /><br>
    Password: <input type="password" name="password" /><br>
    <input type="submit" />
    </form></body>
    </html>

     

     

     

    LOGIN CHECK AGAINST DATABASE

    <?php
    include('config.php');
    mysql_connect($database,$username,$password);
    @mysql_select_db(contacts) or die( "Unable to select database");
    $query="SELECT * FROM login";
    $result=mysql_query($query);
    
    $num=mysql_numrows($result);
    
    mysql_close();
    
    
    $user=mysql_result($result,$i,"Username");
    $pass=mysql_result($result,$i,"Password");
    $location=mysql_result($result,$i,"Location");
    
    $user2 = $_POST['username'];
    $pass2 = $_POST['password'];
    
    if ($user == $user2 && $pass == $pass2) {
    echo "<a href=$location>Your Profile</a>";
    } elseif ($user != $user2 && $pass != $pass2) {
    echo "incorrect username and password";
    }else {
    echo "wah me not pingu";
    }
    ?> 
    

     

    LOGIN CONFIG FILE

    <?php //config.php
    $database = "your database";
    $username = "database username";
    $password = "database password";
    ?>
    

     

     

     

     

  2. In profile.php

    <form method="GET" action="?">
    <input type=textbox name=text>
    <input type=submit>
    </form>
    <?php 
    $id = $_GET[text];
    include ('$id.php');
    echo $data;
    ?>

    In 123.php

    <?php
    $data = ben
    ?>

     

    Yet whenever i put 123 in the text box it just gives me a blank page other than the text box?

    I now understand the get a lot better thank you guys and girls (if any of you are girls) so i guess some things are just easier to understand when explained in another way so i thank you all for that and please can you help on this bit.

    I am on MSN if it easier my msn is bobob24@hotmail.co.uk.

     

  3. i have read the  phpmanual and many tutorials and i did a search on here and i am still stuck.

    I can do forms but i cant understand how the URL bit works i will give an example

    On websites they use like

    profile.php?id=123

    and i dont understand how the id=123 bit is generated is it connect to mysql then something else?

    I understand everything in green but not the red bits?

×
×
  • 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.