Thursday, 29 April 2010

Stafford services.

Nicest services ever?

Wednesday, 7 April 2010

CSS Templates

http://www.code-sucks.com/index.php Basic CSS templates here.

Thickbox

So i've also been using the thickbox modal pop in java script to make nice modal boxes.Thickbox 3.1 here However my site is 900px wide and rather than covering the whole window I wanted it to simply cover the page.

To do this I added this to the css:

#TB_narrowbk {
    position: relative;
    z-index:102;
    top:0px;
    height:100%;
    width:900px;   
    margin-left: 100px;
    background-color:#000;
    filter:alpha(opacity=75);
    -moz-opacity: 0.75;
    opacity: 0.75;
}
and this to the java script

}else{//all others
            if(document.getElementById("TB_overlay") === null){
                $("body").append("
"); <-- modified this
                $("#TB_overlay").click(tb_remove);
                $("#TB_narrowbk").click(tb_remove); <-- added this
            }
        }
I can't be bothered to make it work with ie6. Damn ie6.

Tuesday, 6 April 2010

Read XML in asp

http://www.stardeveloper.com/articles/display.html?article=2000072801&page=1

OK solved.

So I have solved this user specific download "problem". Now I know it should be easy as most websites have user based dynamic content but as a newbie I struggled to read through the complicated code on some sites.

But 've now solved it :) My function queries the database to see what level of acces each user should have, it then is basically an if statement as I mentioned before to check to see what should be outputted. The function also reads the version.txt files to output the current software versions below the download link.

So this is the code  I call.

Function Pl1()

Session("P1") = 0
Session("ST") = 0

'Declare variable to hold the content of the version page
Dim strInclude
strInclude = getFileContents("updates/P1ver.txt")


Dim strConn        ' Our Connection string to access the database

' -- Create objects
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")


' Open the database connection object.
objConn.Open "driver={Microsoft Access Driver (*.mdb)}; dbq=" & Server.MapPath(MDB_URL) & "; uid=admin; pwd="


' ------Query database for P1
strSQL = "SELECT ID1 FROM " & USERS_TABLE & " WHERE (UID='" & Session("uid") & "');"

' Run Query
Set objRS = objConn.Execute(strSQL)

'check for records
if (objRS.BOF and objRS.EOF) then
    response.write "No records found"
    response.end
End if


    ' -- Output the contents of the Recordset to variable
    objRS.MoveFirst
    Do While Not objRS.EOF
        ' -- output the contents
        Session("P1")= objRS.Fields(0)
        ' -- move to the next record
        objRS.MoveNext
    Loop
'Close connections
    objRS.Close
    set objRS = Nothing
    objConn.Close
    set objConn = Nothing

' Write links
if Session("P1") then
    response.write "Platform Two
"
    Response.Write strInclude


Else
    response.write "Click here to upgrade to Platform One!
"
End if

End Function