Couple Of small Things Need Help With

Discussion in 'Programming' started by gunnapaul2, Nov 10, 2007.

  1. #1
    Firstly can a mod close my other thread as Ive managed to upload my script and have got use to the best way of editing things.

    I just have a couple of other things I need some help with.

    1. Ive got an auction script and all the pictures have uploaded fine, but when I do a test auction and attempt to upload a picture with the auction the site just shows this:

    [​IMG]

    The picture has not uploaded and doesnt show in the auction.

    2. Is it possible to change the script to keep members logged in permenantly? At the moment it makes you sign in about 5 times just to post a new auction.

    3. How do I make sub-categories to sub-categories? i.e. Automotive - Cars -Aston Martin.

    I can get the first 2 right, but so far ive only managed to get Aston Martin under automotive or the main page?! Cannot get it under cars for the life of me!

    Thanks in advance for any help.
     
    gunnapaul2, Nov 10, 2007 IP
  2. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You would need to see if the image is being stored where it is supposed to be with the file number it is supposed to have. Just because it isnt showing doesnt mean it isnt uploading as if there is an error in filenaming protocol for the upload it would equally fail to show.

    2) Yes, you add a cookie to the log in process with some form of identifier in it (preferably not the persons username and password in clear format) and put a very long expiry date to it

    3) that depends on how you have written your script and if you are using a db or xml for the hierarchal data
     
    AstarothSolutions, Nov 10, 2007 IP
  3. mystery

    mystery Banned

    Messages:
    744
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Edited Post: Sorry for hijacking!
     
    mystery, Nov 11, 2007 IP
  4. gunnapaul2

    gunnapaul2 Member

    Messages:
    64
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #4
    Can mods delete the above post plz, dont really appreciate the hi-jacking of my thread thanks very much mystery.

    Back to the subject, Ive fixed the picture uploading problem.

    In reference to the categories and sub-categories they are written like this:

    %supercat = (
    antiques => 'Antiques & Art',
    auto => 'Automotive',
    baby => 'Baby & Toddler',
    bikes => 'Bicycles & Scooters',
    boats => 'Boats & Yachts',
    books => 'Books & Comics',
    xmas => 'Christmas Items',
    clothing => 'Clothing & Shoes',
    computing => 'Computing',
    consumer => 'Consumer Electronics',
    diy => 'DIY',
    disabled => 'Disabled Equipment',
    dvds => 'DVDs, Cds & Tapes',
    food => 'Food & Drink',
    Garden => 'Garden',
    house => 'Household',
    health => 'Health & Beauty',
    phones => 'Mobile & Home Phones',
    music => 'Music',
    gaming => 'PC & Video Gaming',
    Pets => 'Pets & Livestock',
    photo => 'Photography & Filming',
    sewing => 'Sewing & Crafts',
    sport => 'Sports & Fitness',
    toys => 'Toys & Games',
    tickets => 'Tickets & Passes',
    realestate => 'Real Estate',
    watches => 'Watches & Jewellery',
    wholesale => 'Wholesale & Bulk',
    Other => 'Anything Else',

    );


    auto01 => '<!--auto-->Cars',
    auto2 => '<!--auto-->Commercial',
    auto3 => '<!--auto-->Audio & ICE',
    auto4 => '<!--auto-->Vans',
    auto5 => '<!--auto-->Motorcycles & Scooters',
    auto6 => '<!--auto-->Collector Vehicles',
    auto7 => '<!--auto-->Cherished Plates',
    auto8 => '<!--auto-->Manuals',
    auto9 => '<!--auto-->Parts & Tuning',
    auto10 => '<!--auto-->Wheels & Tyres',
    auto11 => '<!--auto-->Other',

    Ive tried many different ways to get another sub-category under the cars sub-category but it just wont have it, I seriously hope this script allows it or my site will be bascially useless.

    Could you explain to me how i add the cookie that keeps members ogged in plz?

    thanks.
     
    gunnapaul2, Nov 11, 2007 IP
  5. gunnapaul2

    gunnapaul2 Member

    Messages:
    64
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #5
    Help? 8-?
     
    gunnapaul2, Nov 12, 2007 IP
  6. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #6
    If it is a script then you will need to have a look at how the code works to call categories.... dbs generally are not very good at hierarchical data - Oracle is the only one that I know that has any built in elements to help.

    If you google hierarchical database there will be many tricks on how to do it but XML is massively easier as it is hierarchical in nature - again it depends on how the script works will dictate how easy it will be to change.

    As to the loggin cookie.... well we (using .Net) would use something like the below - you would need to create your own reversable methodology for creating a "proofofID"

    Login Function - called after successful log in
    
    Protected Sub LoggedIn(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim LoginCookie As New HttpCookie("LoggedIn")
        LoginCookie.Expires = Now.AddMonths(6)
        LoginCookie.Item("Username") = Login1.UserName
        LoginCookie.Item("ProofOfID") = EncryptPassword(Login1.Password)
        Response.Cookies.Add(LoginCookie)
    End Sub
    
    Protected Function EncryptPassword(ByVal Password As String) As String
        '''' do something repeatable to create a proof of ID
        Dim ProofofID As String = "The results of the manipulation"
        Return ProofofID
    End Function
    
    Code (.Net):
    Global.asax file:
    
    Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
        ' Code that runs when a new session is started
        Dim LoginCookie As HttpCookie = Request.Cookies("LoggedIn")
         
        If Not LoginCookie Is Nothing Then
             Try
                Dim Username As String = LoginCookie.Item("Username")
                Dim Password As String = DecryptPassword(LoginCookie.Item("ProofOfID"))
                FormsAuthentication.Authenticate(Username, Password)
            Catch
                '''' details are invalid, delete cookie
                Response.Cookies.Remove("LoggedIn")
            End Try
        End If
    End Sub
    
    Protected Function DecryptPassword(ByVal ProofOfID As String) As String
        'Code to decrypt password
        Dim Password As String = "functions output"
        Return Password
    End Function
    
    Code (.Net):
     
    AstarothSolutions, Nov 12, 2007 IP
  7. gunnapaul2

    gunnapaul2 Member

    Messages:
    64
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #7
    Oh right i see.

    Ive just been told that it may not be possible to add further sub-categories without also adding a new page/background/etc. oh dear, im out of my league here.
     
    gunnapaul2, Nov 13, 2007 IP