Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

PHP / SQL / whatever!!!!

  • 18-08-2004 4:13pm
    #1
    Registered Users, Registered Users 2 Posts: 352 ✭✭


    Right I'm going nuts here cos I've been too busy to learn PHP and too busy to find any tools for this.... is there any easy way to have a login on your webpage. I just need a secure area with files.... if there's any easier way than PHP+MYSQL please tell me... if not, please gimme the basics on how to do it that way...

    Please bear in mind that I have never done any PHP before or used SQL before, but I'm not a total n00b so throw whatever yiz can at me.... just make it thorough... please

    Oh and I know this sounds like I'm too lazy to look for it but I got some info from me friend on this one and it was just a load of php and no instructions. me lost..... anyway, can anyone pleez help????? :):)


Comments

  • Registered Users, Registered Users 2 Posts: 151 ✭✭Paulmee


    I hav'nt done php in a while so I could not help you code-wise.

    http://www.hotscripts.com/PHP/index.html is the best resourse for php imo.

    You should be able to find something relevant in the Scripts_and_Programs link.

    Sorry i could'nt help any more.

    You could always use asp, php is more powerful.. Or you could use perl


  • Closed Accounts Posts: 59 ✭✭Fi_C**


    PHP and mySQL is actually a pretty easy way to have a secure login page, if ya don't have a php / mySQL environment set up then have a look at www.php.net - I learnt loads about php (setting it up and functions) from that site :)
    I have an old login page that i did in college using php and mysql so you can have a look at the code - it's not great but it should give ya an idea how it works!

    <?
    session_start();
    session_destroy();
    if(isset($_GET["username"]) && isset($_GET["password"]))
    {
    if(!session_is_registered("sUsername") )
    { echo $_GET["username"];
    session_register ("sUsername");
    $sUsername = $_GET;
    }
    if(!session_is_registered("sPassword") )
    {
    session_register ("sPassword");
    $sPassword = $_GET;
    }
    if(!session_is_registered("sAuthenticate"))
    {
    session_register ("sAuthenticate");
    $sAuthenticate = $_GET;
    }
    }
    include "../common/header1.php";

    if(!isset($_GET))
    {?>
    <form action=<?=$_SERVER?> method="get">
    <table align="center" border="0" class="list1" cellpadding="5" cellspacing="0" width="400">
    <tr class="list1_title">
    <th class="center">GxPSystems Employee Login</th>
    <tr><td> </td></tr>
    <tr>
    <td align="center"><b>Username:</b> <input type="text" name="username" value=""></td>
    <tr>
    <td align="center"><b>Password:</b> <input type="password" name="password" value=""></td>
    </tr>
    <tr>
    <td align="center"><input type="submit" class="button" name="login" value="Login"></td>
    </tr>
    <tr>
    <td ><a href="forgetPswd.php">>>Forgotton Password<<</a></td>
    </tr>
    </table>
    </form>

    <?}
    else {
    echo $sUsername ."<br> vars" .$sPassword;
    if(isset($sUsername) && isset($sPassword))
    {
    $conn= mysql_connect("localhost")
    or die("Could not connect");

    mysql_select_db("websiteDB")
    or die("Could not select database");

    $query = "select * from users where username=\"$sUsername\" AND password=\"$sPassword\";";

    $result = mysql_query($query)
    or die ("Could not Validate User");

    $num = mysql_num_rows($result); echo "num". $num;
    $row = mysql_fetch_array($result);
    $name = $row["name"];

    if($num!=0)
    {

    $authenticate = 1;
    //$_SESSION["authenticate"]:
    echo("redirect<meta http-equiv=\"refresh\" content=\"10; url=../Projects/frontProj.php\"><br>"); // change url to index

    }
    }


    }
    include "../common/footer.php"; ?>

    Sorry I know it's very longwinded, but I don't have time right now to condense it!
    There are sessions set up there too which are great to work with in PHP

    Anyway just set up a small users database and code away! (look at www.mysql.com ... phpMyAdmin is really handy too!!)
    Good luck with it

    Fi**


  • Registered Users, Registered Users 2 Posts: 538 ✭✭✭raphaelS


    Search for info on .htaccess... With that file you can "protect" folders on a web server without any PHP/MySQL, not as powerfull though but might fit your bill.

    Raphael


  • Registered Users, Registered Users 2 Posts: 19,608 ✭✭✭✭sceptre


    raphaelS wrote:
    Search for info on .htaccess... With that file you can "protect" folders on a web server without any PHP/MySQL, not as powerfull though but might fit your bill.
    Given that whatthe OP is looking for is pretty simple (an area he needs a password to get at), I'd run with Raphael's suggestion. Using .htaccess is probably as basic and as easy as you can get without getting someone else to do it for you.


  • Registered Users, Registered Users 2 Posts: 9,579 ✭✭✭Webmonkey


    You won't be able to actually protect the files unless you restrict folder access using .htaccess file but if you want me to make a script for you so they can log in to a secret area then i'll do it , it may be a few days thoguh as i havn't got much time on my hands atm


  • Advertisement
Advertisement