Advertisement
crap_inhuman

get_oauth_guid.php

Jul 31st, 2014
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.54 KB | None | 0 0
  1. <?php
  2. /*
  3.  * get_oauth_guid.php
  4.  *
  5.  *
  6.  */
  7.  
  8.     /*
  9.      *  Get the http.php file from http://www.phpclasses.org/httpclient
  10.      */
  11.  
  12.     $localhost = 'localhost';
  13.     $dbuser =  'user';
  14.     $dbpass = 'password';
  15.     $dbname = 'dbname';
  16.     $dbtable = 'dbtable';
  17.  
  18.     $f = $_GET["f"];
  19.  
  20.     $link = mysql_connect($localhost, $dbuser, $dbpass);
  21.     if (!$link)
  22.     {
  23.         die('Could not connect: ' . mysql_error());  // remove ?
  24.     }
  25.     $dbselect=mysql_select_db($dbname);
  26.     if (!$dbselect)
  27.     {
  28.         die ("Can't use database $dbname! : " . mysql_error()); // remove ?
  29.     }
  30.  
  31.      $sql = "SELECT accesstoken, accesstokensecret, guid FROM tmp_oauth WHERE guid = '$f'";
  32.     $query = mysql_query($sql) or die("Anfrage nicht erfolgreich");
  33.  
  34.     if(mysql_num_rows(mysql_query($sql)))
  35.     {
  36.         while ($getcode = mysql_fetch_array($query)){
  37.             $accesstoken = $getcode['accesstoken'];
  38.             $accesstokensecret = $getcode['accesstokensecret'];
  39.         }
  40.  
  41. ?>
  42. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  43. <html>
  44. <head>
  45. <title>Discogs OAuth client results</title>
  46. </head>
  47. <body>
  48. <?php
  49.         echo "AccessToken=" . $accesstoken . "<br/>";
  50.         echo "AccessTokenSecret=" . $accesstokensecret . " <br/><br/>";
  51.         echo "GUID=" . $f . " <br/><br/>";
  52.         echo "You can now close this window. <br/><br/>";
  53.         ?>
  54. </body>
  55. </html>
  56. <?php
  57.     }
  58.     else
  59.     {
  60. ?>
  61. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  62. <html>
  63. <head>
  64. <title>OAuth client error</title>
  65. </head>
  66. <body>
  67. <h1>OAuth client error</h1>
  68. <pre>Error: <?php echo HtmlSpecialChars($client->error); ?></pre>
  69. </body>
  70. </html>
  71. <?php
  72.     }
  73.  
  74. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement