Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > Web Development
You last visited: Today at 09:38

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



durch PHP in Mysql Datenbank Name oder IP ändern !!!

Discussion on durch PHP in Mysql Datenbank Name oder IP ändern !!! within the Web Development forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Oct 2009
Posts: 14
Received Thanks: 2
Exclamation durch PHP in Mysql Datenbank Name oder IP ändern !!!

Hallo liebe COM,

ich habe ein Problem mit Mysql und PHP.

Ich wollte mir ein PHP Script schreiben das auf die Mysql Datenbank (bestimmte Spalte) zugreift und dann mir sagt was da drin steht. Zudem will ich es gleich ändern in was neues!

Das heißt ich möchte gern ein Formular haben das anzeigt was grad drin steht und gleichzeitig ich das ändern kann, sodass es auch gleich in der db geändert wird.

PHP Code:
<?php
    
include("config_common.php");
         
/*Variablen zum Einfügen der Daten in die Datenbank*/
       
$mName             =   $_GET["mName"];
       
$mContactIP      =   $_POST["mContactIP"];
       

         
$aendern   =   "UPDATE my_links Set mContactIP = \"".$mContactIP."\" WHERE mName=".$_GET["mName"];

?>
<form action="<?php echo $_POST["PHP_SEL"]; ?>" method="post">
<?php

         $abfrage 
"SELECT * FROM my_links WHERE mName=".$_GET["mName"];
         
$ergebnis mysql_query($abfrage);
         while (
$result mysql_fetch_object($ergebnis))
        if(!(
$_POST['ok']))
                     {
                     echo 
"

                                         <table>
                           <tr>
                                  <td class='content'>Bezeichnung</td>
                                  <td><input value='
$result->head' class='fields' name='mContactIP' type='text'></td>
                           </tr>
                           
                           <tr>
                                  <td><input type='submit' value='Daten senden' class='button' name='ok'></td>
                                  <td><input type='reset' value='Daten löschen' class='button'></td>
                              <br>
                              <hr>
                              <br><br>
                           </tr>
                    </table>
                                         "
;
                  }
              else if(
$_POST['ok'])
                  {
                          if(
strlen($mContactIP) <1$error 1;
                         

                    if(
$error == 0)
                          {
                             
//Variable zum Eintrag der Daten in die Datenbank
                               
$aendern   =   mysql_query($aendern) or die (mysql_error());
                                   echo 
"
                                             <html>
                                                 <head>
                                                     <meta http-equiv='refresh' content='5; URL=http://nasty.hopto.org/Gm/ip.php'>
                                                 </head>
                                             <body>
                                             Ihre Daten wurden erfolgreich in die Datenbank eingetragen
                                                </body>
                                             </html>
                                             "
;
                          }
                    else
                          {
                               echo 
"Es ist ein Fehler aufgetreten, bitte alle formulare ausfühlen!";
                          }
                  }
?>
</form>

Ich bitte doch um schnellstmöglicher Hilfe !!!

Liebe Grüße
Ethagar
Ethagar is offline  
Old 03/14/2010, 13:55   #2
 
Who dis?'s Avatar
 
elite*gold: 3
Join Date: Apr 2009
Posts: 3,899
Received Thanks: 1,807
Puh, sehr kompliziert und unsicher ist dein Script.
Mal aus dem Kopf:

PHP Code:
<?php
include("config_common.php");

if (isset(
$_POST['ok'])) {
    
$mName mysql_real_escape_string(trim($_GET['mName']));
    
$mContactIP mysql_real_escape_string(trim($_POST['mContactIP']));
    
        if (empty(
$mContactIP)) { $msg '<b>Fehler:</b> Bitte füllen Sie alle Felder aus!'; }
        else {
            
            
$edit mysql_query("UPDATE my_links SET mContactIP='".$mContactIP."' WHERE mName='".$mName."'");
            if (isset(
$edit)) { $msg 'Ihre Datenbank wurde erfolgreich bearbeitet!'; }
            
            
header("refresh:2;");
            exit(); } }
            
else {
    
    
$query mysql_query("SELECT * FROM my_links WHERE mName='".mysql_real_escape_string(trim($_GET['mName']))."'");
    
$db mysql_fetch_array($query);
        
        echo 
'<form action="" method="post">';
        echo 
'<table border="0" cellpadding="0" cellspacing="0"><tr>';
        echo 
'<td class="content">Bezeichnung</td>';
        echo 
'<td><input value="'.trim($db['mContactIP']).'" class="fields" name="mContactIP" type="text" /></td></tr>';
        echo 
'<tr><td><input type="submit" value="Daten senden" class="button" name="ok" /></td>';
        echo 
'<td><input type="reset" value="Daten löschen" class="button" /></td>';
        echo 
'<br /><hr /><br /><br /></tr></table></form>'; }
        
echo 
$msg;
?>
Who dis? is offline  
Old 03/14/2010, 15:36   #3
 
elite*gold: 0
Join Date: Oct 2009
Posts: 14
Received Thanks: 2
Also erstmal danke für die schnelle Antwort.

ABER :

erstens ist ein Fehler in dem Script drin
( Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\test.php on line 20 )

und

zweitens weiß die Datenbank ja garnicht von wem sie die IP ändern soll.

Soweit habe ich das ganze gerafft aber leider kann ich es nicht umsetzen.


Ich bitte um weitere Hilfe.
Ethagar is offline  
Old 03/15/2010, 21:48   #4
 
Nosferatu.'s Avatar
 
elite*gold: 22
Join Date: Jan 2008
Posts: 743
Received Thanks: 450
Quote:
Originally Posted by Ethagar View Post
die Datenbank ja garnicht von wem sie die IP ändern soll.
PHP Code:
$mContactIP=SERVER["remote_addr"];
$mName="Mustermann";

mysql_query("UPDATE my_links SET mContactIP='".$mContactIP."' WHERE mName='".$mName."'") or die('Is uns nicht bekannt.'); 
Nosferatu. is offline  
Reply


Similar Threads Similar Threads
MySQL datenbank pw ändern
12/26/2009 - Metin2 Private Server - 6 Replies
ist es irwie möglich bei hamachi server das db pw zu ändern
Design durch MySql oder phpmyadmin
11/03/2009 - Metin2 Private Server - 3 Replies
hallo com kann mir mal einer helfen bei funpic.de durch den mysql oder phpmyadmin einstellungen einen metin2 design zu machen es muss nicht von metin2.de sein ich will nur irgendein metin desgin also wie gesagt durch mysql oder phpmyadmin .... danke lg caglar
Flyff MySQL Datenbank
08/12/2008 - Flyff - 96 Replies
Hallo , EDIT: ich habe meine eigene datenbank erstellt diese ist besser^^ http://rapidshare.com/files/133656168/08083021510 8.sql.html Virus scan:Antivir: Nothing found ArcaVir: Nothing found Avast: Nothing found AVG: Nothing found
Kostenlose mySQL datenbank
10/10/2006 - Technical Support - 5 Replies
Hi, wollte grad nen Forum für nen Browsergame für meine Alli anlegen. Da ich auf meinem webspace keine DB mehr frei hab, hab ich einfach nen acc bei funpic gemacht und wollte davon ne mysql benutzt. Doch leider sagt der mir andauernd , cant connect to database (oda so ähnlich^^) Weiss wer woher ich ne kostenlose MySQL datenbank kriegen? (Falls es iwas bedeuten sollte, Software is PHPBB2 Plus)
e*pvp mysql datenbank fehler
04/21/2006 - Main - 9 Replies
Ladet das forum heute bei euch auch so larm und kriegt ihr auch manchmal so ne dumme message



All times are GMT +2. The time now is 09:38.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.