Help - Search - Members - Calendar
Full Version: Php Myadmin Inaacessible
Zymic Webmaster Forums > Zymic Free Web Hosting > Zymic Free Web Hosting - General Discussion & Help
Adonis Lee Villamor
Redirect Loop

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

The browser has stopped trying to retrieve the requested item. The site is redirecting the request in a way that will never complete.

* Have you disabled or blocked cookies required by this site?
* NOTE: If accepting the site's cookies does not resolve the problem, it is likely a server configuration issue and not your computer.
Gutic
QUOTE(Adonis Lee Villamor @ Feb 8 2009, 07:01 AM) *
Redirect Loop

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

The browser has stopped trying to retrieve the requested item. The site is redirecting the request in a way that will never complete.

* Have you disabled or blocked cookies required by this site?
* NOTE: If accepting the site's cookies does not resolve the problem, it is likely a server configuration issue and not your computer.


Me too. sad.gif
HappyGL
Same for me. Since yesterday. (I wanted to save my DB when I saw the little problems with zaidooh cr*p).
Straystudio
Same with me, too (Italy).

As for read-only purphoses, to retrieve or check data from Your MySQL storage, simply set variables

$user = "straystudio_xxxx";
$pass = "xXxXxx";

in the below file, then save it as a common filename.php in Your filemanager at here.
Be aware, anyone knowing its URL might browse Your databases, not modifying data, though; so, name it strangeNameXrh.php and remove it from Internet after use.
I intentionally to demonstrative purphose, am keeping the layout pretty primitive; an "Enter Password" step could be added to protect this file from public eye; any customized query could be addressed to database, as well.

CODE

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><title>MySQL / PHP Readonly</title>

</head>
<body bgcolor="#E0E0EF" style="font-family: Helvetica, Arial;">

<h2><font color='orange'>PHPMyAdmin - Retrieving Panel</font></h2>
<form name="general" action="<?php echo $_SERVER['PHP_SELF']?>" method="post">

<?php

$user = "";
$pass = "";


mysql_connect("localhost", $user, $pass) or die (mysql_error());

$databases = mysql_query("SHOW DATABASES") or die (mysql_error());
$how_many = mysql_num_rows($databases);
print "<br>User <b> ".$user." </b> currently runs <b> ".$how_many." </b> Databases (out of 5+1 allowed).
<br>
";

while($i<$how_many){
print "<br>";
print_r(mysql_fetch_array($databases));
$i++;
}
$i=0;

$db = $_POST['db'];

mysql_select_db($db);
?>
<br>
<br><br>
<input value="<?php echo $db ?>" type="text" name="db">
<input value="Select Database" type="submit" > <small><i>(copy-paste from above)</i></small><br><br>

<?php
$tables = mysql_query("SHOW TABLES");
if (!$tables){
print mysql_error();
} else {

$how_many = mysql_num_rows($tables);
print "DATABASE <b>".$db."</b> currently runs <b>".$how_many."</b> TABLES.
<br>
";

while($i<$how_many){
print "<br>";
print_r(mysql_fetch_array($tables));
$i++;
}
$i=0;

$tb = $_POST['tb'];
?>
<br>
<br><br>
<input value="<?php echo $tb ?>" type="text" name="tb">
<input value="View TABLE" type="submit" name="tb_sbmt"><br><br>

<?php
}

$describe = mysql_query("DESCRIBE ".$tb);
if ($tb==""){
} else {
if (!$describe){
print mysql_error();
} else {

$how_many_fields = mysql_num_rows($describe);

print "TABLE <b>".$tb."</b> Structure consists of <b>".$how_many_fields."</b> COLUMN Fields.
<br>
";

while($i<$how_many_fields){
print "<br>";
print_r(mysql_fetch_array($describe));
$i++;
}
$i=0;

print "<br>
<br>
<div align='center'><tt><b>---------- Data ----------</b></tt></div>
";



$select = mysql_query("SELECT * FROM ".$tb) or die (mysql_error());
$how_many = mysql_num_rows($select);

$how_many_boxes=$how_many_fields*2+5;

while($i<$how_many){
print "# <b>".$i."</b><textarea rows='".$how_many_boxes."' style='width: 100%;'>
";
print_r(mysql_fetch_array($select));
print "</textarea>";
print "<hr>";
$i++;
}
$i=0;

print "
<br>
<br> END";

}
}

?>


</form>


</body>
</html>

HappyGL
Straystudio, this just gave me an idea, I'll make a php file to export the mysql DB. I'll post reply ASAP.
HappyGL
Ok, it is done. Here is a link to the file:

SaveMyDB.php.rar

In case you can't get the file, here is the code:

CODE
<html>
<head>
<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=UTF-8'>
<title>Save My DATABASE</title>
<meta name='author' content='Dorin Grigore' />
</head>

<body>

<?php

echo "<center><table style='border: 1px solid black; background-color: #e3e3e3;'><tr><td>";

if ( $_POST && $_POST['delete_file'] == "go_ahead" )
{
mysql_connect( "$_POST[hostname]", "$_POST[username]", "$_POST[password]") or die(mysql_error());

unlink( $_POST['filename_to_delete'] );

echo "<font size='4' color='green'>File deleted successfully from server.</font>";
}
else if ( $_POST && $_POST['selected_db'] )
{
mysql_connect( "$_POST[hostname]", "$_POST[username]", "$_POST[password]") or die(mysql_error());

mysql_select_db( "$_POST[selected_db]" ) or die(mysql_error());

echo "<i>Database <b>$_POST[selected_db]</b> selected successfully.<br /><br />";

$myfile = fopen( "$_POST[filename]", 'w') or die("If you want to set permissions, check about CHMOD.");

echo "File <b>$_POST[filename]</b> created successfully.<br /><br />";

// Let's start writing to our newly created file

$mybigstring = "-- ----------------------\n";
$mybigstring .= "-- dumped base $_POST[selected_db] at ".date("d-M-Y")."\n";
$mybigstring .= "-- ----------------------\n\n\n";

// Get the list of tables and loop for each
$query = mysql_query( "SHOW TABLES" ) or die( mysql_error() );
while ( $row = mysql_fetch_row( $query ) )
{
$mybigstring .= "-- ----------------------\n";
$mybigstring .= "-- Creation of table $row[0]\n";
$mybigstring .= "-- ----------------------\n";

// Here we write the creation process of the table (it's structure)
$query2 = mysql_query( "SHOW CREATE TABLE $row[0]" );
while( $row2 = mysql_fetch_row( $query2 ) )
{
$mybigstring .= $row2[1].";\n\n";
}

// And here, we write the content of the table (insert into)
$tabledata = mysql_query( "SELECT * FROM $row[0]" ) or die( mysql_error() );
while ( $row_tabledata = mysql_fetch_row( $tabledata ) )
{
$mybigstring .= "INSERT INTO $row[0] VALUES (";

for ( $i = 0; $i < mysql_num_fields( $tabledata ); ++$i )
{
if( $i != 0 ) $mybigstring .= ", ";

$mybigstring .= "'";
$mybigstring .= addslashes( $row_tabledata[ $i ] );
$mybigstring .= "'";

}

$mybigstring .= ");\n\n";
}
}

// disconnect from MySQL
mysql_close();

fwrite( $myfile, $mybigstring );

fclose( $myfile );

echo "<form action='' method='post' name='frm' id='frm'>

Here is the link to download the exported file:<br /><a target='_blank' href='$_POST[filename]'>$_POST[filename]</a><br />(<small>Right click on the link and select 'Save as'.</small>)<br /><br /><br /><font size='4' color='red'>After you downloaded the file,<br />please click <input type='submit' value='here'> to delete-it from server!</font>

<input type='hidden' value='$_POST[hostname]' name='hostname'>
<input type='hidden' value='$_POST[username]' name='username'>
<input type='hidden' value='$_POST[password]' name='password'>
<input type='hidden' value='$_POST[filename]' name='filename_to_delete'>
<input type='hidden' value='go_ahead' name='delete_file'>

</form>";
}
else if ( $_POST )
{
if ( $_POST['filename'] && !$_POST['selected_db'] ) echo "<font color='red'>Please select a database.</font><br /><br />";

mysql_connect( "$_POST[hostname]", "$_POST[username]", "$_POST[password]") or die(mysql_error());

echo "<i>Connected successfully.</i><br /><br />Here are your databases,<br />please select one:<br /><br />";

$query = mysql_query( "SHOW DATABASES" ) or die (mysql_error());

echo "<form action='' method='post' name='frm' id='frm'>
<table style='border: 1px solid blue; background-color: #22e2e2; width: 100%;'><tr><td>

<input type='hidden' value='$_POST[hostname]' name='hostname'>
<input type='hidden' value='$_POST[username]' name='username'>
<input type='hidden' value='$_POST[password]' name='password'>";

while ( $row = mysql_fetch_array( $query ) )
{
echo "<input type='radio' name='selected_db' value='$row[0]'> $row[0]<hr />";
}

$rand_name = rand(1,99999);
//$rand_name .= md5(time());
$rand_name .= rand(1,99999);

echo "</td></tr></table><br /><br />

Please insert the name of the file in which you want to export:<br /><i><small>Note: The file will be saved in the same folder where this .php file is.<br />To save in a different folder, insert like this: <b>folder/anotherfolder/$rand_name.sql</b><br /><font color='red'>Also, make sure no one knows about this place.</font></small></i>
<input style='width: 100%' type='text' value='$rand_name.sql' name='filename'><br /><i><small>You need permissions to the folder to create the exported file.</small></i><br />

<input style='width: 100%' type='submit' value='Continue'>
</form>";
}
else
{
echo "<form action='' method='post' name='frm' id='frm'>
<table>
<i>Welcome to your database saver</i><br /><br />

<tr> <td style='border: 1px solid white;'>Hostname</td> <td style='width: 100%'><input type='text' name='hostname' value='localhost'></td> </tr>
<tr> <td style='border: 1px solid white;'>Username</td> <td><input type='text' name='username' value='root'></td> </tr>
<tr> <td style='border: 1px solid white;'>Password</td> <td><input type='password' name='password'></td> </tr>
<tr> <td style='border: 1px solid white;'>Connect</td> <td><input type='submit' value='Ok'></td> </tr>

</table>
</form>";
}

echo "</td></tr></table></center>";

?>
</body>
</html>


With this file, you can connect to your database, select which one you want to export, insert the name of the file and proceed. After this, it will let you download the exported Mysql file and after you downloaded it, it will let you delete it from server.

If you have permission problems, just create a folder say "myDB" and CHMOD it (means you give rights to that folder). Export to it like this: "myDB/myfile.sql".
Straystudio
My hat off, HappyGL, great a job really; and quickly accomplished, too.
Just opening and closing Tags for BODY would by a nice addition ...

Hopefully, some hosting issues with zymic along these days are making a good opportunity arising for Us to gain on experience.

Those ones who have given Our layouts a try, should have discovered We all are supplied with kind of information_schema database as more, normally not shown on the PHPMyAdmin regular panel.
There is where configuration data are stored, user privileges included. So, a way to assing/revoke privileges would also be by handling those tables; even though, to avoid any damage risk, I would suggest for this to stay at the method of a piece of form accomplished apart, as suggested by CORAX and swordz.

Have a nice evening,
Enzo, (I)
HappyGL
Thank you. Hope this helps people who like me, wantend to save their databases too.
Adonis Lee Villamor
happygl, can you make something that will make me be able to modify my database? tongue.gif Ex: add tables, edit etc.
HappyGL
QUOTE(Adonis Lee Villamor @ Feb 15 2009, 01:44 AM) *
happygl, can you make something that will make me be able to modify my database? tongue.gif Ex: add tables, edit etc.


Here is something simple :
http://grands-secrets.be/divers/executeSQL.php.rar

Edit : Updated the code.

You can only use one command at a time, INSERT etc.
CODE
CREATE, INSERT, UPDATE etc, read MySQL faq.


Take Straystudio's code to watch your database, and use this to execude SQL code:
CODE
<html>
    <head>
        <META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=UTF-8'>
        <meta name='author'             content='Dorin Grigore'>
    </head>

<body>

<center><table style="border: 1px solid black; background-color: #e3e3e3;"><tr><td>
<?php
if ( $_POST && $_POST['sql_code'] )
{
    mysql_connect( "$_POST[hostname]", "$_POST[username]", "$_POST[password]") or die(mysql_error());

    mysql_select_db( "$_POST[selected_db]" ) or die(mysql_error());

    // here is our code that we send to mysql
    mysql_query( stripslashes($_POST['sql_code']) ) or die( mysql_error() );

    // disconnect from MySQL
    mysql_close();

    echo "Done without errors.";
}
else if ( $_POST && $_POST['selected_db'] )
{
    mysql_connect( "$_POST[hostname]", "$_POST[username]", "$_POST[password]") or die(mysql_error());

    mysql_select_db( "$_POST[selected_db]" ) or die(mysql_error());

    echo "<i>Database <b>$_POST[selected_db]</b> selected successfully.<br /><br />
                <form action='' method='post' name='frm' id='frm'>

                <br />Insert SQL code:<br />
                <textarea name='sql_code' style='width: 400px; height: 250px;'></textarea><br /><br />

                <input type='hidden' value='$_POST[hostname]' name='hostname'>
                <input type='hidden' value='$_POST[username]' name='username'>
                <input type='hidden' value='$_POST[password]' name='password'>
                <input type='hidden' value='$_POST[selected_db]' name='selected_db'>

                <input type='submit' value='Execute'>
        </form>";
}
else if ( $_POST )
{
    if ( $_POST['filename'] && !$_POST['selected_db'] ) echo "<font color='red'>Please select a database.</font><br /><br />";

    mysql_connect( "$_POST[hostname]", "$_POST[username]", "$_POST[password]") or die(mysql_error());

    echo "<i>Connected successfully.</i><br /><br />Here are your databases,<br />please select one:<br /><br />";

    $query = mysql_query( "SHOW DATABASES" ) or die (mysql_error());

    echo "<form action='' method='post' name='frm' id='frm'>
            <table style='border: 1px solid blue; background-color: #22e2e2; width: 100%;'><tr><td>

    <input type='hidden' value='$_POST[hostname]' name='hostname'>
    <input type='hidden' value='$_POST[username]' name='username'>
    <input type='hidden' value='$_POST[password]' name='password'>";

    while ( $row = mysql_fetch_array( $query ) )
    {
        echo "<input type='radio' name='selected_db' value='$row[0]'> $row[0]<hr />";
    }

    echo "</td></tr></table>
            <input style='width: 100%' type='submit' value='Continue'>
        </form>";
}
else
{
    echo "<form action='' method='post' name='frm' id='frm'>
    <table>
    <i>Please login first</i><br /><br />

    <tr> <td style='border: 1px solid white;'>Hostname</td> <td style='width: 100%'><input type='text' name='hostname' value='localhost'></td> </tr>
    <tr> <td style='border: 1px solid white;'>Username</td> <td><input type='text' name='username' value='root'></td> </tr>
    <tr> <td style='border: 1px solid white;'>Password</td> <td><input type='password' name='password'></td> </tr>
    <tr> <td style='border: 1px solid white;'>Connect</td> <td><input type='submit' value='Ok'></td> </tr>

    </table>
    </form>";
}

?>
</td></tr></table></center>

</body>
</html>
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.