Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // server info
- $server = 'localhost';
- $user = 'ss';
- $pass = 'oo';
- $db = 'ss';
- $connection = mysql_connect($server, $user, $pass) or die ("Could not connect to server ... n" . mysql_error ());
- mysql_select_db($db) or die ("Could not connect to database ... n" . mysql_error ());
- if(isSet($_POST['username']))
- {
- $username = $_POST['username'];
- $username = mysql_real_escape_string($username);
- $sql_check = mysql_query("SELECT Username FROM users WHERE Username='$username'");
- if(mysql_num_rows($sql_check))
- {
- echo '<font color="#cc0000"><STRONG>'.$username.'</STRONG> is already in use.</font>';
- }
- else
- {
- echo 'OK';
- }
- }
- ?>
- <?php
- include('../../../../configuration.php');
- include('../../../../libraries/joomla/factory.php');
- $config =& JFactory::getConfig();
- // server info
- $server2 = $host;
- $user2 = $user;
- $pass2 = $password;
- $db2 = $db;
- $connection = mysqli_connect($server2, $user2, $pass2) or die ("Could not connect to server ... n" . mysqli_error ());
- mysqli_select_db($db2) or die ("Could not connect to database ... n" . mysqli_error ());
- if(isSet($_POST['username']))
- {
- $username = $_POST['username'];
- $username = mysql_real_escape_string($username);
- $sql_check = mysql_query("SELECT username FROM #__users WHERE username='$username'");
- if(mysql_num_rows($sql_check))
- {
- echo '<font color="#cc0000"><STRONG>'.$username.'</STRONG> is already in use.</font>';
- }
- else
- {
- echo 'OK';
- }
- }
- ?>
- include('../../../../configuration.php');
- $jc = new JConfig();
- $table = 'users';
- $users = $jc->dbprefix . $table;
- // connect to the database
- $mysqli = new mysqli($jc->host, $jc->user, $jc->password, $jc->db);
- define( '_JEXEC', 1 );
- define( 'DS', DIRECTORY_SEPARATOR );
- define( 'JPATH_BASE', $_SERVER[ 'DOCUMENT_ROOT' ] );
- require_once( JPATH_BASE . DS . 'includes' . DS . 'defines.php' );
- require_once( JPATH_BASE . DS . 'includes' . DS . 'framework.php' );
- require_once( JPATH_BASE . DS . 'libraries' . DS . 'joomla' . DS . 'factory.php' );
- $mainframe =& JFactory::getApplication('site');
- define( 'JPATH_BASE', $_SERVER[ 'DOCUMENT_ROOT' ] ); // define JPATH_BASE on the external file
- require_once( JPATH_BASE . DS . 'libraries' . DS . 'import.php' ); // framework
- require_once( JPATH_BASE . DS . 'configuration.php' ); // config file
- $db = JFactory::getDBO();
- define('_JEXEC', 1);
- define('JPATH_BASE', dirname(__FILE__));
- define('DS', DIRECTORY_SEPARATOR);
- require_once JPATH_BASE.DS.'includes'.DS.'defines.php';
- require_once JPATH_BASE.DS.'includes'.DS.'framework.php';
- $db =& JFactory::getDBO();
- $query = "SELECT ...";
- $db->setQuery($query);
- $db->query();
Add Comment
Please, Sign In to add comment