SitePoint Sponsor

User Tag List

Results 1 to 19 of 19
  1. #1
    SitePoint Member
    Join Date
    Jan 2009
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Calling A CGI File Not Working...

    Ok, so I have a script to generate a key for some software, but it doesn't seem to be working.

    The file "keygen" is in my "cgi-bin" folder.

    Here's the code:

    PHP Code:
    //Required variables
    $regname strtoupper($_REQUEST["regname"]);

    $regname=str_replace(" ","",$regname);

    //Generate the Key.
    $key exec("QUERY_STRING='C1=6E94DC9069A3C59689B&C3=C5FCD0C6CAE4DD076D41&C6=B4D7CBF158FB9495F6216AA882D2EBE6D1BD2EF74B060C091F4852C712EF887BC217B1CB9D5ECD0CE84F7C001474683C04ADA284C757C0E8C356060EB85B68FC865AB322450114A5606343BCFC2BBED7D5D71E7C7B18FD97C0C744C2FFCF633E8D5DE977A327BB2BD34B1D2B82EAE551367D4EFA5D11AE422153E710F56CC206&C7=C681932549AF4E091682DE3E74EFB585E9DDF2F967C7EAAD945EB87F13F7012E81C8453D78B387999E4213F4DC9BD7B30ED5C5719E61EA1581355515D4A6E0740E21ACA264A8E5FD67CFB420E0471831C79B3494B5EAA81002E058EDF7010B2EF954333FD7F9C73D6254F49414BD1C76AC353CC2C36E2DE30327E20F662869D9&RegName=$regname&EncryptionConst=190213445&ModeID=1&SignatureBits=120' REQUEST_METHOD='GET' /home/daytrade/public_html/cgi-bin/keygen.cgi"); 

    //$key2 = str_replace("-", "", $key);
    $key2 str_replace("\n"""$key);
    echo
    "$key - $key2 - $regname"
    Is there a PHP function to call the cgi file, with that same file path, and test that it is finding it right?

    Thanks

  2. #2
    SitePoint Member
    Join Date
    Jan 2009
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Bump - $20 paypal bonus for help that leads to a solution.

  3. #3
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Can you utilise the keygen.cgi from the browser? Or rather, would the data you require be displayed by the browser if you went to the following URL..
    Code:
    http://.........../cgi-bin/keygen.cgi?C1=6E94DC9069A3C59689B&C3=C5FCD0C6CAE4DD076D41&C6=B4D7CBF158FB9495F6216AA882D2EBE6D1BD2EF74B060C091F4852C712EF887BC217B1CB9D5ECD0CE84F7C001474683C04ADA284C757C0E8C356060EB85B68FC865AB322450114A5606343BCFC2BBED7D5D71E7C7B18FD97C0C744C2FFCF633E8D5DE977A327BB2BD34B1D2B82EAE551367D4EFA5D11AE422153E710F56CC206&C7=C681932549AF4E091682DE3E74EFB585E9DDF2F967C7EAAD945EB87F13F7012E81C8453D78B387999E4213F4DC9BD7B30ED5C5719E61EA1581355515D4A6E0740E21ACA264A8E5FD67CFB420E0471831C79B3494B5EAA81002E058EDF7010B2EF954333FD7F9C73D6254F49414BD1C76AC353CC2C36E2DE30327E20F662869D9&RegName=$regname&EncryptionConst=190213445&ModeID=1&SignatureBits=120
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  4. #4
    Use The Cloud
    Join Date
    Jan 2006
    Location
    Boise, ID
    Posts
    556
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If so, then you should be able to load it like this:

    PHP Code:
    $key file_get_contents("http://url/cgi-bin/keygen.cgi?C1=6E94DC9069A3C59689B&C3=C5FCD0C6CAE4DD076D41&C6=B4D7CBF158FB9495F6216AA882D2EBE6D1BD2EF74B060C091F4852C712EF887BC217B1CB9D5ECD0CE84F7C001474683C04ADA284C757C0E8C356060EB85B68FC865AB322450114A5606343BCFC2BBED7D5D71E7C7B18FD97C0C744C2FFCF633E8D5DE977A327BB2BD34B1D2B82EAE551367D4EFA5D11AE422153E710F56CC206&C7=C681932549AF4E091682DE3E74EFB585E9DDF2F967C7EAAD945EB87F13F7012E81C8453D78B387999E4213F4DC9BD7B30ED5C5719E61EA1581355515D4A6E0740E21ACA264A8E5FD67CFB420E0471831C79B3494B5EAA81002E058EDF7010B2EF954333FD7F9C73D6254F49414BD1C76AC353CC2C36E2DE30327E20F662869D9&RegName=$regname&EncryptionConst=190213445&ModeID=1&SignatureBits=120"); 
    Edit:

    And probably urlencodeing the query string
    Brad Hanson, Web Applications & Scalability Specialist
    ► Is your website outgrowing its current hosting solution?
    ► PM me for a FREE scalability consult!
    ► USA Based: Available by Phone, Skype, AIM, and E-mail.

  5. #5
    SitePoint Member
    Join Date
    Jan 2009
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by SilverBulletUK View Post
    Can you utilise the keygen from the browser? Or rather, would the data you require be displayed by the browser if you went to the following URL..
    Code:
    6E94DC9069A3C59689B&C3=C5FCD0C6CAE4DD076D41&C6=B4D7CBF158FB9495F6216AA882D2EBE6D1BD2EF74B060C091F4852C712EF887BC217B1CB9D5ECD0CE84F7C001474683C04ADA284C757C0E8C356060EB85B68FC865AB322450114A5606343BCFC2BBED7D5D71E7C7B18FD97C0C744C2FFCF633E8D5DE977A327BB2BD34B1D2B82EAE551367D4EFA5D11AE422153E710F56CC206&C7=C681932549AF4E091682DE3E74EFB585E9DDF2F967C7EAAD945EB87F13F7012E81C8453D78B387999E4213F4DC9BD7B30ED5C5719E61EA1581355515D4A6E0740E21ACA264A8E5FD67CFB420E0471831C79B3494B5EAA81002E058EDF7010B2EF954333FD7F9C73D6254F49414BD1C76AC353CC2C36E2DE30327E20F662869D9&RegName=$regname&EncryptionConst=190213445&ModeID=1&SignatureBits=120
    Thanks for the response... That comes up with:

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, emailaddress and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

  6. #6
    SitePoint Member
    Join Date
    Jan 2009
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by bhanson View Post
    If so, then you should be able to load it like this:

    PHP Code:
    $key file_get_contents("cgi-bin/keygenC1=6E94DC9069A3C59689B&C3=C5FCD0C6CAE4DD076D41&C6=B4D7CBF158FB9495F6216AA882D2EBE6D1BD2EF74B060C091F4852C712EF887BC217B1CB9D5ECD0CE84F7C001474683C04ADA284C757C0E8C356060EB85B68FC865AB322450114A5606343BCFC2BBED7D5D71E7C7B18FD97C0C744C2FFCF633E8D5DE977A327BB2BD34B1D2B82EAE551367D4EFA5D11AE422153E710F56CC206&C7=C681932549AF4E091682DE3E74EFB585E9DDF2F967C7EAAD945EB87F13F7012E81C8453D78B387999E4213F4DC9BD7B30ED5C5719E61EA1581355515D4A6E0740E21ACA264A8E5FD67CFB420E0471831C79B3494B5EAA81002E058EDF7010B2EF954333FD7F9C73D6254F49414BD1C76AC353CC2C36E2DE30327E20F662869D9&RegName=$regname&EncryptionConst=190213445&ModeID=1&SignatureBits=120"); 
    Edit:

    And probably urlencodeing the query string
    Returns...
    Warning: file_get_contents(cgi-bin/keygenC1=6E94DC9069A3C59689B&C3=C5FCD0C6CAE4DD076D41&C6=B4D7CBF158FB9495F6216AA882D2EBE6D1BD2EF74B060C091F4852C712EF887BC217B1CB9D5ECD0CE84F7C001474683C04ADA284C757C0E8C356060EB85B68FC865AB322450114A5606343BCFC2BBED7D5D71E7C7B18FD97C0C744C2FFCF633E8D5DE977A327BB2BD34B1D2B82EAE551367D4EFA5D11AE422153E710F56CC206&C7=C681932549AF4E091682DE3E74EFB585E9DDF2F967C7EAAD945EB87F13F7012E81C8453D78B387999E4213F4DC9BD7B30ED5C5719E61EA1581355515D4A6E0740E21ACA264A8E5FD67CFB420E0471831C79B3494B5EAA81002E058EDF7010B2EF954333FD7F9C73D6254F49414BD1C76AC353CC2C36E2DE30327E20F662869D9&RegName=HUNTER&EncryptionConst=190213445&ModeID=1&SignatureBits=120) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error in

  7. #7
    SitePoint Member
    Join Date
    Jan 2009
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So the problem appears to be a "500 internal server error"... How's that fixed, anyone?

  8. #8
    Use The Cloud
    Join Date
    Jan 2006
    Location
    Boise, ID
    Posts
    556
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you paste the first couple of lines of the keygen.cgi script?

    And have you been able to get it to work at all? Did you write it?
    Brad Hanson, Web Applications & Scalability Specialist
    ► Is your website outgrowing its current hosting solution?
    ► PM me for a FREE scalability consult!
    ► USA Based: Available by Phone, Skype, AIM, and E-mail.

  9. #9
    SitePoint Member
    Join Date
    Jan 2009
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by bhanson View Post
    Can you paste the first couple of lines of the keygen.cgi script?

    And have you been able to get it to work at all? Did you write it?
    My programmer wrote it, but he doesn't know PHP.

    He's spent the weekend implementing it, using PHP... but left me to upload it to my server and reference keygen.cgi with the correct file path.

    Is a 500 internal server error common?

    When I open it in Notepad and Notepad++ it's just a load of symbols.

  10. #10
    Use The Cloud
    Join Date
    Jan 2006
    Location
    Boise, ID
    Posts
    556
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is it executable? Can you log SSH in and run: chmod +x /home/daytrade/public_html/cgi-bin/keygen.cgi

    Also, what is the output of $key when it is not working?
    Brad Hanson, Web Applications & Scalability Specialist
    ► Is your website outgrowing its current hosting solution?
    ► PM me for a FREE scalability consult!
    ► USA Based: Available by Phone, Skype, AIM, and E-mail.

  11. #11
    SitePoint Member
    Join Date
    Jan 2009
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by bhanson View Post
    Is it executable? Can you log SSH in and run: chmod +x /home/daytrade/public_html/cgi-bin/keygen.cgi

    Also, what is the output of $key when it is not working?
    The output of Key is nothing....

    I'll ask my host to run that in SSH, what shall I ask them to check, what is the outcome we are looking for.

    Thanks

  12. #12
    Use The Cloud
    Join Date
    Jan 2006
    Location
    Boise, ID
    Posts
    556
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by stockfire View Post
    The output of Key is nothing....

    I'll ask my host to run that in SSH, what shall I ask them to check, what is the outcome we are looking for.

    Thanks
    It shouldn't output anything. On a linux system in order to run a binary it must have an executable flag. Without this flag then it cannot be ran. You can do a check in PHP with something like this:

    PHP Code:
    var_dump(is_executable('/home/daytrade/public_html/cgi-bin/keygen.cgi')); 
    And have you actually seen keygen.cgi work?
    Brad Hanson, Web Applications & Scalability Specialist
    ► Is your website outgrowing its current hosting solution?
    ► PM me for a FREE scalability consult!
    ► USA Based: Available by Phone, Skype, AIM, and E-mail.

  13. #13
    SitePoint Zealot
    Join Date
    Jul 2008
    Posts
    143
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    is this definitely the right path?

    /home/daytrade/public_html/cgi-bin/keygen.cgi

    and do you get that 500 internal server error when opening the keygen.cgi url in your browser?
    |
    Add Your Robotics site to my Robot Directory: submit
    |
    Add Your Las Vegas Website to my Las Vegas Directory: submit

  14. #14
    SitePoint Zealot
    Join Date
    Jul 2008
    Posts
    143
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also... where are you calling the php file from? It's not in the cgi-bin too is it?

  15. #15
    SitePoint Member
    Join Date
    Jan 2009
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,

    I'm not too familiar with SSH, would you mind running a command for me at
    the request of a programmer?

    chmod +x /home/daytrade/public_html/cgi-bin/keygen.cgi

    Thanks

    *************************************

    Hello,

    That has been completed.

    regards,

    =====================
    Scott Sullivan
    Systems Administrator
    Liquid Web, Inc.

  16. #16
    SitePoint Member
    Join Date
    Jan 2009
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by IndyCash View Post
    is this definitely the right path?

    /home/daytrade/public_html/cgi-bin/keygen.cgi

    and do you get that 500 internal server error when opening the keygen.cgi url in your browser?

    No, it just shows a blank page, which it probably is supposed to.

  17. #17
    SitePoint Member
    Join Date
    Jan 2009
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by IndyCash View Post
    Also... where are you calling the php file from? It's not in the cgi-bin too is it?
    No, it's in "public_html".

  18. #18
    Use The Cloud
    Join Date
    Jan 2006
    Location
    Boise, ID
    Posts
    556
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does your script still not output a key?
    Brad Hanson, Web Applications & Scalability Specialist
    ► Is your website outgrowing its current hosting solution?
    ► PM me for a FREE scalability consult!
    ► USA Based: Available by Phone, Skype, AIM, and E-mail.

  19. #19
    SitePoint Member
    Join Date
    Jan 2009
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeh works now, PM me your paypal address. Thanks a lot.


Bookmarks

Posting Permissions

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