#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    2
    Rep Power
    0

    Please help.. am lost in code (!)


    Hi all

    This is my first post here, and hope you can help me. I will try and explain what I need to do, and apologise in advance if this goes on a bit


    Step 1: Pass Parameters from the database (via URL) to specific page on an external site. (with the agreement of the external site owners)

    If all parameters have a value, then the user is automatically logged in to the external site and all is fine. This works perfectly already


    Step 2: If one specific parameter in Step 1 is empty (which it will be the first time each user clicks the link), then the page the parameters are sent to generates a value and sends it back to me.

    I need to write the new value directly into a database table and send a confirmation string straight back once it is written in. (this is a simple y/n parameter)

    Once this is done, the user is automatically logged in (as per step 1)

    The following times the user clicks the link, all parameters are complete and so they log in automatically.

    I am struggling with how to write the received variable into the database and send the confirmation.

    All of this has to be done without it being visible to the end user (ie: the scripting happens automatically when the link is clicked)

    Can anyone point me in the right direction on this, as I am seemingly going round in circles.

    Many many thanks in advance

    duggster
  2. #2
  3. No Profile Picture
    Overly white
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Location
    Fresno, CA
    Posts
    83
    Rep Power
    12

    Question


    Hmmm ok I think I'm following you. Here is what you should do. On page 2 if the variable, I'll just call it X, is empty then redirect back to a page on your site which will place the values in the database, then redirect back to the first site. Ok so here is some code to do it.
    Code:
    'step 2 page
    If Len(Request.Querystring("X")) = 0 Then
        Response.Redirect("http://www.yoursite.com/xismising.asp?whateveryouneedtosendback=value"
    End if
    Code:
    'step 2 your site write to db
    Dim X
    Dim intUser
    Dim SQL
    Dim Conn
    Set Conn = Sever.Createobject("ADODB.Connection")
    X=Request.Querystring("X")
    intUser=Request.Querystring("UserID")
    'do some checks to make sure this is
    'a value that you are expecting, such 
    'as Cint if it is supposed to be a 
    'number.  Or check for SQL syntax if it 
    'is supposed to be a string
    
    'Setup your connection here
    SQL = "UPDATE table SET field = " & X & " WHERE user = " & strUser & ";"
    Conn.Execute(SQL)
    
    Response.Redirect("http://www.theothersite.com/login.asp?whateveryouneedtosend=value")
    I didn't test this code at all and I may have made some silly mistakes so take it all with a pound of salt . Hopefully it points you in the right direction.
    Last edited by defjamninja; April 19th, 2003 at 06:11 PM.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    2
    Rep Power
    0

    thanks


    Thanks so much

    this is pretty much exactly what i needed

    having stared at the concept for so long, my brain had become fried and i had totally forgotten about using a simple redirect (!)

    You have helped me sooooo much thank you thank you thank you!

    Now all i need is for the external site owner to run a test and hope it comes together

IMN logo majestic logo threadwatch logo seochat tools logo