kostenloser Webspace werbefrei: lima-city


Script erstellen, dass DB-Tabellen leert

lima-cityForumProgrammiersprachenPHP, MySQL & .htaccess

  1. Autor dieses Themas

    k*****u

    Hallo.
    Ich bin ja Admin von Hack-Attack und w?rde nun jeden 1. Tag im Monat um 18Uhr ene neue Runde starten.
    Hab mich also auf cronjobs.de angemeldet, dort schon alles eingetragen, jetzt muss ich den Script coden.
    Er soll also verschiedene Tabellen (aber nicht die ganze DB!) leeren wenn man die Datei cronjob.php aufrufe. Also habe ich so angefangen


    dbconnect.php
    <?php
    // Konfiguration:
    $db_host = 'localhost'; // Datenbankserver
    $db_user = 'USER37193'; // Benutzername
    $db_pass = '*******'; // Passwort
    $db_name = 'DB449600744'; // Datenbank
    ?>



    Tabellen die geleert werden sollen:
    abook_entrys
    attacks
    cboards
    clusterchat
    clusters
    cl_pacts
    cl_reqs
    da_participants
    distr_attacks
    logins
    logs
    mails
    pcs
    rank_clusters
    rank_users
    sysmsgs
    transfers
    upgrades

    Das d?rfte glaube ich kein Problem sein:
    Cronjob.php
    <?php
    include ("dbconnect.php");
    mysql_query("TRUNCATE TABLE `abook_entrys`,`attacks`,cboards`,`clusterchat`,`clusters`,`cl_pacts`,`cl_reqs`,`da_participants`,`distr_attacks`,`logins`,`logs`,`mails`,`pcs`,`rank_clusters`,`rank_users`,`sysmsgs`,`transfers,`upgrades`"
    ); 
    ?>



    Anders die Tabelle users, da sollen nur bestimmte Felder geleert werden, n?mlich:
    pcs
    stat
    clusterstat
    infotext
    newemail
    lastmail
    points
    cluster
    sid_ip
    sid_pc
    sid_lastcall
    locked
    locked_till
    locked_by
    locked_reason
    rank
    de_avail
    notitz


    Wie geht das?

    Beitrag ge?ndert am 18.08.2005 15:53 von k-jjacu
  2. Diskutiere mit und stelle Fragen: Jetzt kostenlos anmelden!

    lima-city: Gratis werbefreier Webspace für deine eigene Homepage

  3. $felder=array(pcs,stat,clusterstat,infotext,wemail,...);
    for($i=0;$i<count($felder);$i++)
    {
    mysql_query('UPDATE users SET '.$felder[$id].'=""');
    }

    so m?sste das funzen.
    Wenn Fragen sind, meine ICQ hast du ja.
  4. Autor dieses Themas

    k*****u

    Vielen Dank.
    Der Code sieht dann also letztendlich so aus


    Cronjob.php
    <?php
    
    include ("dbconnect.php");
    
    mysql_query("TRUNCATE TABLE `abook_entrys`,`attacks`,cboards`,`clusterchat`,`clusters`,`cl_pacts`,`cl_reqs`,`da_participants`,`distr_attacks`,`logins`,`logs`,`mails`,`pcs`,`rank_clusters`,`rank_users`,`sysmsgs`,`transfers,`upgrades`");
    
    $felder=array(pcs,stat,clusterstat,infotext,newemail,lastmail,points,cluster,sid_ip,sid,pc,sind_lastcall,locked,locked_till,locked_by,locked_reasion,rank,de_avail,notiz);
    for($i=0;$i<count($felder);$i++)
    {
    mysql_query('UPDATE users SET '.$felder[$id].'=""');
    }
     
    
    ?>


    &

    dbconnect.php
    <?php
    
    // Konfiguration:
    
    $db_host = 'localhost'; // Datenbankserver
    
    $db_user = 'USER37193'; // Benutzername
    
    $db_pass = '*******'; // Passwort
    
    $db_name = 'DB449600744'; // Datenbank
    
    ?>

  5. Autor dieses Themas

    k*****u


    Warning: mysql_query(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 9

    Warning: mysql_query(): A link to the server could not be established in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 9


    Kommt wenn ich nur meinen Teil poste. Wenn ich den Teil von Bladehunter dazu nehme, kommt die gleiche Fehlermeldung, nur statt er 9 eine 19 und gleich 9 x oder so.

    Google ergab das:
    http://www.schmidma.de/know-how/detail/schmidma-know-how86.htm


    :-(
  6. lol
    Kann es sein, das du ganz vergessen hast eine Verbindung zur MySQL Datenbank aufzubauen?
    Die Datei "dbconnect.php" zu includen reicht nicht, denn diese enth?lt legendlich die Einstellungen.
    Probiere es mal so :
    // Konfiguration:
    $db_host = 'localhost'; // Datenbankserver
    $db_user = 'USER37193'; // Benutzername
    $db_pass = '*******'; // Passwort
    
    $db_name = 'DB449600744'; // Datenbank
    $connect = mysql_connect ($db_host, $db_user, $db_pass);
    $select = mysql_query ('Use '.$db_name.'');


    Achja nochwas.
    Was machst du, wenn jemand fremdes die Datei aufruft?
    Es k?nnte n?mlich dann passieren, das ein User einfach jeden Tag die Datei aufruft und dann hast du den Salat!
  7. Autor dieses Themas

    k*****u

    die datei wird SEEHHHR gut versteckt werden, dass kanste mir glauben ;-)








    Fehlermeldung wenn ich cronjob.php aufrufe


    Warning: mysql_connect(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/webpages/lima-city/k-jjacu/html/Cronjob/dbconnect.php on line 14

    Warning: mysql_query(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/webpages/lima-city/k-jjacu/html/Cronjob/dbconnect.php on line 16

    Warning: mysql_query(): A link to the server could not be established in /home/webpages/lima-city/k-jjacu/html/Cronjob/dbconnect.php on line 16

    Warning: mysql_query(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 6

    Warning: mysql_query(): A link to the server could not be established in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 6

    Warning: mysql_query(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): A link to the server could not be established in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): A link to the server could not be established in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): A link to the server could not be established in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): A link to the server could not be established in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): A link to the server could not be established in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): A link to the server could not be established in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): A link to the server could not be established in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): A link to the server could not be established in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): A link to the server could not be established in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): A link to the server could not be established in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): A link to the server could not be established in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): A link to the server could not be established in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): A link to the server could not be established in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): A link to the server could not be established in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): A link to the server could not be established in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): A link to the server could not be established in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): A link to the server could not be established in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): A link to the server could not be established in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12

    Warning: mysql_query(): A link to the server could not be established in /home/webpages/lima-city/k-jjacu/html/Cronjob/crownjob.php on line 12



    wenn ich dbconnect.php aufrufe


    Warning: mysql_connect(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/webpages/lima-city/k-jjacu/html/Cronjob/dbconnect.php on line 14

    Warning: mysql_query(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/webpages/lima-city/k-jjacu/html/Cronjob/dbconnect.php on line 16

    Warning: mysql_query(): A link to the server could not be established in /home/webpages/lima-city/k-jjacu/html/Cronjob/dbconnect.php on line 16



    Beitrag ge?ndert am 18.08.2005 17:42 von k-jjacu

    Beitrag ge?ndert am 18.08.2005 17:44 von k-jjacu
  8. Wieso verstecken?
    Machs doch einfach so :

    if (isset ($_GET['irgendwas']) && $_GET['irgendwas'] === 'balblub') {
    // hier der restliche Code
    }
  9. Autor dieses Themas

    k*****u

    hab die fehlermeldung hinzugef?gt... wenn m?glich gaaanz schnell antworten, neue runde startet um 18 uhr w?r cool wenn ich die schon mit dem script starten k?nnte

    PS: Gl?ckw?nsch zum Theoretischem ;-)

    Beitrag ge?ndert am 18.08.2005 17:45 von k-jjacu
  10. :confused::confused::confused:
    Was hast du?
    Die Fehlermeldung zum Script hinzugef?gt?
    Das stelle ich mir ein bi?chen komisch vor. xD

    P.S.: Danke. :wink:
  11. Autor dieses Themas

    k*****u

    <?
    // Konfiguration:

    $db_host = 'mysql.lima-city.de'; // Datenbankserver

    $db_user = 'USER36942'; // Benutzername

    $db_pass = '...'; // Passwort



    $db_name = 'DB449600744'; // Datenbank

    $connect = mysql_connect ($db_host, $db_user, $db_pass);

    $select = mysql_query ('Use '.$db_name.'');
    ?>



    __________________



    <?php



    include ("dbconnect.php");
    mysql_query("TRUNCATE TABLE `abook_entrys`,`attacks`,cboards`,`clusterchat`,`clusters`,`cl_pacts`,`cl_reqs`,`da_participants`,`distr_attacks`,`logins`,`logs`,`mails`,`pcs`,`rank_clusters`,`rank_users`,`sysmsgs`,`transfers,`upgrades`");
    $felder=array(pcs,stat,clusterstat,infotext,newemail,lastmail,points,cluster,sid_ip,sid,pc,sind_lastcall,locked,locked_till,locked_by,locked_reasion,rank,de_avail,notiz);

    for($i=0;$i<count($felder);$i++)

    {
    mysql_query('UPDATE users SET '.$felder[$id].'=""');

    }





    ?>
  12. include ("dbconnect.php");

    was ist denn in dbconnect.php drin ?
    Ist das nicht im Prinzip ?berfl?ssig ?

    hm und ansonsten kann ich keine Fehler entdecken.
    Schreibe am besten direkt nach
    <?php

    folgendes:

    error_reporting(E_ALL);

    Und sag uns dann, was f?r Fehlermeldungen geliefert werden.
  13. Diskutiere mit und stelle Fragen: Jetzt kostenlos anmelden!

    lima-city: Gratis werbefreier Webspace für deine eigene Homepage

Dir gefällt dieses Thema?

Über lima-city

Login zum Webhosting ohne Werbung!