Jump to content
  • 0

help[cannot connect to database]


Question

Posted

'.mysql_error() ); $db_select = mysql_select_db( mySQL_database, $db_link ) or die( 'Error connecting to Database

 

'.mysql_error() ); if ($user == '') { print'Incorrect UserID'; mysql_close(); } else { $db_add = mysql_query( "INSERT INTO `accounts` VALUES ('$user', '$str', '0', '0', '')" ) or die( 'Error: '.mysql_error() ); } print 'Account Created

 

Enjoy youre gameplay.'; mysql_close(); ?>

afto to error m vgazei otan paw na ftiaxw account apo to site mou .. sto script vazw tin ip tis database diladi tin ip apo to pc mou kai to name tis database l2jarchid_db

episis to username = root

kai to password=

dn exw password

an mporei kapoios as mou pei giati m to vgazei afto

7 answers to this question

Recommended Posts

  • 0
Posted

na afto einai to script :

<?php
 define('mySQL_hostname', '77.49.177.119');  //database IP
 define('mySQL_database', 'l2jarchid_db');  //database name
 define('mySQL_username', 'root');  //database user
 define('mySQL_password', '');  //database password

 function l2j_encrypt($password) 
   {
       return base64_encode(pack("H*", sha1(utf8_encode($password))));
   }

 $str =  l2j_encrypt($_POST['pass']);

 $user = $_POST["name"];

 $db_link = mysql_pconnect( mySQL_hostname, mySQL_username, mySQL_password )
   or die( 'Error connecting to mysql<br><br>'.mysql_error() );

 $db_select = mysql_select_db( mySQL_database, $db_link )
   or die( 'Error connecting to Database<br><br>'.mysql_error() );

 if ($user == '') { print'Incorrect UserID'; mysql_close(); }
 else {
  $db_add = mysql_query( "INSERT INTO `accounts` VALUES ('$user', '$str', '0', '0', '')" )
    or die( 'Error: '.mysql_error() );
 }
 print 'Account Created<br><br>Enjoy youre gameplay.';
 mysql_close();
?>

EDIT: soz gia to double post

  • 0
Posted

na afto einai to script :

<?php
  define('mySQL_hostname', '77.49.177.119');  //database IP
  define('mySQL_database', 'l2jarchid_db');  //database name
  define('mySQL_username', 'root');  //database user
  define('mySQL_password', '');  //database password

  function l2j_encrypt($password) 
    {
        return base64_encode(pack("H*", sha1(utf8_encode($password))));
    }

  $str =  l2j_encrypt($_POST['pass']);

  $user = $_POST["name"];

  $db_link = mysql_pconnect( mySQL_hostname, mySQL_username, mySQL_password )
    or die( 'Error connecting to mysql<br><br>'.mysql_error() );

  $db_select = mysql_select_db( mySQL_database, $db_link )
    or die( 'Error connecting to Database<br><br>'.mysql_error() );

  if ($user == '') { print'Incorrect UserID'; mysql_close(); }
  else {
  $db_add = mysql_query( "INSERT INTO `accounts` VALUES ('$user', '$str', '0', '0', '')" )
    or die( 'Error: '.mysql_error() );
  }
  print 'Account Created<br><br>Enjoy youre gameplay.';
  mysql_close();
?>

EDIT: soz gia to double post

i ip p bales nomizo prp na ginei localhost

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...