Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    May 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SHA1 for an ad server on a vBulletin forum

    Hello,

    I'm trying to set up an ad at my vBulletin website (PHP/MySQL) and the instructions for the SHA1 part of the code is throwing me. Their instructions say:

    sig is calculated as follows: sha1(uid price vars description quantity weight your_password). The result will be base64 encoded. Variables that aren't used should be empty and do not have to be part of the calculation. The vars value used in the calculation should not be escaped/URLencoded.
    I don't know what the syntax is for entering that many components. I only need vars and your_password. I tried, and it threw this error:

    Security signature validation failed! Please notify the referring web site's administrator!
    Signature should be: sha1('' . '' . 'zipcode=78759' . '' . '' . '' . '' . '' . '_YOUR_PASSWORD_')
    So I changed the code to this:
    PHP Code:
    sha1('' '' 'zipcode={vb: raw criteriaDisplay}' '' '' '' '' '' 'my-password'
    And it continues to throw the same error. (The {vb: raw criteriaDisplay} is a vBulletin variable that is properly converted to the right number when seen in View Source. I also hard-coded the number and it still throws the same error.)

    What is the proper syntax for writing the SHA1 hash with this many components?
    Last edited by tomwood2; 05-28-2011 at 05:08 AM.

  • #2
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,486
    Thanks
    279
    Thanked 32 Times in 31 Posts
    have you tried the comma , delimiter instead of the dot . ? and also put a ; after the close )

    i dont know if this will work or not but try it.

    Code:
    $whatever = sha1('' , '' , 'zipcode={vb: raw criteriaDisplay}' , '' , '' , '' , '' , '' , 'my-password'); 
    
    echo $whatever;
    Last edited by durangod; 05-28-2011 at 06:59 AM.

  • #3
    New to the CF scene
    Join Date
    May 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This is also inside a hyperlink to their site for the ad setup page.

    Code:
    <a href="their_url/advertise/1366?vars=zipcode%3D{vb: raw criteriaDisplay}&sig=sha1('' , '' , 'zipcode={vb: raw criteriaDisplay}' , '' , '' , '' , '' , '' , 'my_password');">Create and place an ad in this forum.</a>
    I tried that (was wondering about the closing ; ) and no go. I don't know where an echo command would go.

  • #4
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,486
    Thanks
    279
    Thanked 32 Times in 31 Posts
    i just put the echo for testing thats all, sorry about that. im thinking about this

    inside your site put this (assuming your in a php file)


    $whatever = sha1('' , '' , 'zipcode={vb: raw criteriaDisplay}' , '' , '' , '' , '' , '' , 'my-password');

    echo $whatever; // this is just as a test to make sure that $whatever is loaded you can get rid of this

    then in your link on the same php page

    ok after sig=

    try this

    Code:
    <?php echo $whatever;?>
    Last edited by durangod; 05-28-2011 at 01:54 PM.

  • #5
    New to the CF scene
    Join Date
    May 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm embarrassed to say, I'm still too noobish and misunderstood how this all worked.

    I've been trying to execute this in the vBulletin template and they don't do PHP. I have to get the SHA1 value in the PHP script, before the template is rendered, and then call it into the template.

    I asked this same question over at DevShed, hope it's okay to link -

    sha1-for-an-ad-server-on-a-vbulletin-forum


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •