Advertisement
Guest User

Untitled

a guest
Jul 11th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.99 KB | None | 0 0
  1. <?php
  2. $database=$_POST["database"];
  3. $username=$_POST["username"];
  4. $password=$_POST["password"];
  5. $hostname=$_POST["hostname"];
  6. if(file_exists("usuarios/$id.txt")){
  7. echo "<script>location.href='msg1.php?msg=existe&volt=index.php'</script>";
  8. }
  9. else{
  10. if($database==""){
  11. echo "<script>location.href='index.php';alert('Escriba El Nombre De La Base De Datos.');</script>";
  12. }
  13. if($username==""){
  14. echo "<script>location.href='index.php';alert('Escriba El usuario De La Base De Datos.');</script>";
  15. }
  16. if($password==""){
  17. echo "<script>location.href='index.php';alert('Escriba la Contrasena De La Base De Datos.');</script>";
  18. }
  19. @mysql_connect("$hostname","$username","$password") or die ($db = "<script>location.href='index.php';alert('Error al conectar a la Base de datos, Revisa los Datos');</script>");
  20. if($hostname==""){
  21. echo "<script>location.href='index.php';alert('Escriba El Host De La Base De Datos.');</script>";
  22. }
  23.  
  24. else{
  25. $salvar= "<?php
  26. /*=======================================================================
  27. | EGOCMS - Jorge40813,Juancarlos,Meth0d.
  28. | #######################################################################
  29. | EGOCMS instalador creado por Jorge40813. Por favor, no retire los créditos.
  30. | EGOCMS Instale creado por EGOCMS. Por favor, no retire los créditos.
  31. | Http: / / todomix.org
  32. |
  33. \======================================================================*/
  34.  
  35.  
  36. class MySQL
  37. {
  38. private \$connected = false;
  39. private \$hostname = \"$hostname\";
  40. private \$username = \"$username\";
  41. private \$password = \"$password\";
  42. private \$database = \"$database\";
  43. private \$link;
  44.  
  45. public function MySQL(\$host, \$user, \$pass, \$db)
  46. {
  47. \$this->connected = false;
  48. \$this->hostname = \$host;
  49. \$this->username = \$user;
  50. \$this->password = \$pass;
  51. \$this->database = \$db;
  52. }
  53.  
  54. public function IsConnected()
  55. {
  56. if (\$this->connected)
  57. {
  58. return true;
  59. }
  60.  
  61. return false;
  62. }
  63.  
  64. public function Connect()
  65. {
  66. \$this->link = mysql_connect(\$this->hostname, \$this->username, \$this->password) or \$this->error(mysql_error());
  67. mysql_select_db(\$this->database, \$this->link) or \$this->error(mysql_error());
  68.  
  69. \$this->connected = true;
  70. }
  71.  
  72. public function Disconnect()
  73. {
  74. if(\$this->connected)
  75. {
  76. @mysql_close(\$this->link) or \$this->error(\"could not close conn\");
  77. \$this->connected = false;
  78. }
  79. }
  80.  
  81. public function DoQuery(\$query)
  82. {
  83. \$resultset = @mysql_query(\$query, \$this->link) or \$this->error(mysql_error());
  84. return \$resultset;
  85. }
  86.  
  87. public function Evaluate(\$resultset)
  88. {
  89. return @mysql_result(\$resultset, 0);
  90. }
  91.  
  92. public function Error(\$errorString)
  93. {
  94. global \$core;
  95.  
  96. \$core->systemError('Database Error', \$errorString);
  97. }
  98.  
  99. public function __destruct()
  100. {
  101. \$this->disconnect();
  102. }
  103. }
  104.  
  105. ?>
  106. ";
  107. $abreid= fopen("../inc/class.db.mysql.php","w"); // Registrar El usuario
  108. fwrite($abreid,"$salvar");
  109. fclose($abreid);
  110.  
  111. echo "<script>location.href='msg1.php?msg=ok'</script>";
  112. }
  113. }
  114. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement