Guest User

Untitled

a guest
Nov 28th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.55 KB | None | 0 0
  1. <?php
  2. // server info
  3. $server = 'localhost';
  4. $user = 'ss';
  5. $pass = 'oo';
  6. $db = 'ss';
  7.  
  8. $connection = mysql_connect($server, $user, $pass) or die ("Could not connect to server ... n" . mysql_error ());
  9. mysql_select_db($db) or die ("Could not connect to database ... n" . mysql_error ());
  10.  
  11.  
  12. if(isSet($_POST['username']))
  13. {
  14. $username = $_POST['username'];
  15. $username = mysql_real_escape_string($username);
  16. $sql_check = mysql_query("SELECT Username FROM users WHERE Username='$username'");
  17.  
  18. if(mysql_num_rows($sql_check))
  19. {
  20. echo '<font color="#cc0000"><STRONG>'.$username.'</STRONG> is already in use.</font>';
  21. }
  22. else
  23. {
  24. echo 'OK';
  25. }
  26.  
  27. }
  28.  
  29. ?>
  30.  
  31. <?php
  32.  
  33. include('../../../../configuration.php');
  34.  
  35. include('../../../../libraries/joomla/factory.php');
  36.  
  37. $config =& JFactory::getConfig();
  38.  
  39. // server info
  40. $server2 = $host;
  41. $user2 = $user;
  42. $pass2 = $password;
  43. $db2 = $db;
  44.  
  45. $connection = mysqli_connect($server2, $user2, $pass2) or die ("Could not connect to server ... n" . mysqli_error ());
  46. mysqli_select_db($db2) or die ("Could not connect to database ... n" . mysqli_error ());
  47.  
  48.  
  49. if(isSet($_POST['username']))
  50. {
  51. $username = $_POST['username'];
  52. $username = mysql_real_escape_string($username);
  53. $sql_check = mysql_query("SELECT username FROM #__users WHERE username='$username'");
  54.  
  55. if(mysql_num_rows($sql_check))
  56. {
  57. echo '<font color="#cc0000"><STRONG>'.$username.'</STRONG> is already in use.</font>';
  58. }
  59. else
  60. {
  61. echo 'OK';
  62. }
  63.  
  64. }
  65. ?>
  66.  
  67. include('../../../../configuration.php');
  68. $jc = new JConfig();
  69. $table = 'users';
  70. $users = $jc->dbprefix . $table;
  71. // connect to the database
  72. $mysqli = new mysqli($jc->host, $jc->user, $jc->password, $jc->db);
  73.  
  74. define( '_JEXEC', 1 );
  75. define( 'DS', DIRECTORY_SEPARATOR );
  76. define( 'JPATH_BASE', $_SERVER[ 'DOCUMENT_ROOT' ] );
  77.  
  78. require_once( JPATH_BASE . DS . 'includes' . DS . 'defines.php' );
  79. require_once( JPATH_BASE . DS . 'includes' . DS . 'framework.php' );
  80. require_once( JPATH_BASE . DS . 'libraries' . DS . 'joomla' . DS . 'factory.php' );
  81. $mainframe =& JFactory::getApplication('site');
  82.  
  83. define( 'JPATH_BASE', $_SERVER[ 'DOCUMENT_ROOT' ] ); // define JPATH_BASE on the external file
  84. require_once( JPATH_BASE . DS . 'libraries' . DS . 'import.php' ); // framework
  85. require_once( JPATH_BASE . DS . 'configuration.php' ); // config file
  86.  
  87. $db = JFactory::getDBO();
  88.  
  89. define('_JEXEC', 1);
  90. define('JPATH_BASE', dirname(__FILE__));
  91. define('DS', DIRECTORY_SEPARATOR);
  92. require_once JPATH_BASE.DS.'includes'.DS.'defines.php';
  93. require_once JPATH_BASE.DS.'includes'.DS.'framework.php';
  94.  
  95. $db =& JFactory::getDBO();
  96. $query = "SELECT ...";
  97. $db->setQuery($query);
  98. $db->query();
Add Comment
Please, Sign In to add comment