How to create a php login script for mssql

  • I am tring to write a PHP login script for mssql that a member would be able to sign-in and download a zip file automic and then sign off automatic. This is what I have so far and I am not sure that part is correct:

    <?php

    $myServer = "localhost";

    $myUser = "your_name";

    $myPass = "your_password";

    $myDB = "examples";

    //connection to the database

    $dbhandle = mssql_connect($myServer, $myUser, $myPass)

      or die("Couldn't connect to SQL Server on $myServer");

    //select a database to work with

    $selected = mssql_select_db($myDB, $dbhandle)

      or die("Couldn't open database $myDB");

     

    Not sure what to write here to download a zip file from a certain directory.

    //close the connection

    mssql_close($dbhandle);

    ?>

  • I am not sure what do you want to do.  Your code connect to the database as you want to make a query. In this case you can display the result in the browser. Downloading a zip file is something else. You should locate the file on the file system and then make a download through an object.

    Or you have the zip file stored in the DB ?

  • What I am trying to do is only let a members be able to download the zip file.

    So I want them to login in and have it verify they are a member and once they are verified I want it to automatically download the zip file that that I have setup in a directory and then automatically log off.

    I want this to be a seperate login from the normal login that they use for the entry into the database.

  • Still don't know if a get you right. You can make for instance a table with members and authenticate them and then redirect to the download.

  • I guess I don't know to make it any plainer,

    I Just want a PHP script that will sign a person in and if they are a member it will download this zip file.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply