Pokaż wyniki od 1 do 3 z 3

Wątek: Problem z wypełnieniem parametrów połączenia do bazy da

  1. #1
    Zarejestrowany
    Dołączył
    Jan 2008
    Posty
    1

    Domyślnie Problem z wypełnieniem parametrów połączenia do bazy da

    OTO 2 pliki ktore trzeba edytowac i recznie wpisac dane dotyczace polaczenia z baza
    moze ktos jasniej w ktorych etapach tz gdzie co wpisac ??

    Kod:
    <?php
    
    
    $db = mysql_connect&#40;"localhost", "eternal_dbplayer", "fireball"&#41; or  Die&#40;"I cannot connect to the mysql server because&#58; " . mysql_error&#40;&#41;&#41;; 
    
    
    
    
    mysql_select_db&#40;"eternal_dsdatabase"&#41; or Die&#40;"DB Error !"&#41;; 
    
    function error&#40;$type&#41;&#123; 
    	if&#40;$type == "field"&#41;&#123; 
    		echo "<font color=red face=Arial>You have left fields blank. Please <a href=\"index.php\">relogin</a></font>"; 
    	&#125; 
    
    	if&#40;$type == "password"&#41;&#123; 
    		echo "<font color=red face=Arial>Incorrect password. Please <a href=\"index.php\">relogin</a></font><br>"; 
     		echo "<font color=red face=Arial>If you have forgotten your password, it can be sent to your email address.  <a href=\"index.php\">Request Password</a></font>"; 
     &#125; 
    
    	if&#40;$type == "jail"&#41;&#123; 
            $res = mysql_query&#40;"SELECT * FROM userdb WHERE email='$email'"&#41;; 
            $playerinfo = mysql_fetch_array&#40;$res&#41;; 
            echo "<font color=red face=Arial>You are in jail for another $playerinfo&#91;jailtime&#93; days.<p>Jailed by&#58; <b>$playerinfo&#91;jail_by&#93;</b> for reason&#58; <b>$playerinfo&#91;jail_reason&#93;</b>"; 
        &#125; 
    
    	if&#40;$type == "verify"&#41;&#123; 
    		echo "<font color=red face=Arial>Verification required. Please <a href=verify.php>login</a> here.</font>"; 
    	&#125; 
    &#125; 
    
    ?>




    Kod:
    <?php
    
    
    
    
    @session_start&#40;&#41;; 
    
    $db = mysql_connect&#40;"localhost", "eternal_dbplayer", "fireball"&#41; or   
    Die&#40;"I cannot connect to the database because&#58; " . mysql_error&#40;&#41;&#41;; 
    
    
    
    
    mysql_select_db&#40;"eternal_dsdatabase"&#41; or Die&#40;"DB Error !"&#41;; 
    $res = mysql_query&#40;"SELECT * FROM  
    userdb WHERE email = '$email'"&#41;; 
    $playerinfo = mysql_fetch_array&#40;$res&#41;; 
    mysql_free_result&#40;$res&#41;; 
    
    // Check Users Browser. If blacklisted, send them to Get-Bent!
    $agent =  
    $_SERVER&#91;'HTTP_USER_AGENT'&#93;; 
    $userip_addr = $_SERVER&#91;'REMOTE_ADDR'&#93;; 
    $leach_query =  
    mysql_query&#40;"SELECT agent FROM leachers WHERE verified='y' AND versioned='0'"&#41;; 
    while&#40;list&#40;$agent_db&#41;=mysql_fetch_array&#40;$leach_query&#41;&#41;&#123; 
    	if&#40;$agent == "$agent_db"&#41;&#123; 
    		 
    header&#40;"Location&#58; http&#58;//www.phpfreaks.com/get_bent.php"&#41;; 
    		exit&#40;&#41;; 
    	&#125; 
    &#125; 
    
    if &#40;!$dest&#41; &#123; 
    $notonboat = mysql_query&#40;"update fishdb set outonboat='N' where owner='$playerinfo&#91;id&#93;'"&#41;; 
    &#125; 
    
    $date1 = date&#40;H&#41;; 
    
    if &#40;$date1 == 0&#41; &#123; 
    $date11 = "21"; 
    &#125; 
    if &#40;$date1 == 1&#41; &#123; 
    $date11 = "22"; 
    &#125; 
    if  
    &#40;$date1 == 2&#41; &#123; 
    $date11 = "23"; 
    &#125; 
    if &#40;$date1 == 3&#41; &#123; 
    $date11 = "00"; 
    &#125; 
    if &#40;$date1 == 4&#41; &#123; 
    $date11 = "01"; 
    &#125; 
    if &#40;$date1 == 5&#41; &#123; 
    $date11 = "02"; 
    &#125; 
    if &#40;$date1 == 6&#41; &#123; 
    $date11 = "03"; 
    &#125; 
    if &#40;$date1 == 7&#41; &#123; 
    $date11 = "04"; 
    &#125; 
    if &#40;$date1 == 8&#41; &#123; 
    $date11 = "05"; 
    &#125; 
    if &#40;$date1 == 9&#41; &#123; 
    $date11 = "06"; 
    &#125; 
    if &#40;$date1 == 10&#41; &#123; 
    $date11 = "07"; 
    &#125; 
    if &#40;$date1 == 11&#41; &#123; 
    $date11 = "08"; 
    &#125; 
    if &#40;$date1 == 12&#41; &#123; 
    $date11 = "09"; 
    &#125; 
    if &#40;$date1 == 13&#41; &#123; 
    $date11 = "10"; 
    &#125; 
    if &#40;$date1 == 14&#41; &#123; 
    $date11 = "11"; 
    &#125; 
    if &#40;$date1 == 15&#41; &#123; 
    $date11 = "12"; 
    &#125; 
    if &#40;$date1 == 16&#41; &#123; 
    $date11 = "13"; 
    &#125; 
    if &#40;$date1 == 17&#41; &#123; 
    $date11 = "14"; 
    &#125; 
    if &#40;$date1 == 18&#41; &#123; 
    $date11 = "15"; 
    &#125; 
    if &#40;$date1 == 19&#41; &#123; 
    $date11 = "16"; 
    &#125; 
    if &#40;$date1 == 20&#41; &#123; 
    $date11 = "17"; 
    &#125; 
    if &#40;$date1 == 21&#41; &#123; 
    $date11 = "18"; 
    &#125; 
    if &#40;$date1 == 22&#41; &#123; 
    $date11 = "19"; 
    &#125; 
    if &#40;$date1 == 23&#41;  
    &#123; 
    $date11 = "20"; 
    &#125; 
    $date1 = $date11; 
    
    $date1b = date&#40;i&#41;; 
    
    if &#40;$date1 > 10&#41; &#123; 
    
    $date2 = "$date1&#58;$date1b"; 
    
    &#125; else &#123; 
    
    $date2 = "$date1&#58;$date1b"; 
    
    &#125; 
    
    $j = date&#40;j&#41;; 
    $m = date&#40;m&#41;; 
    
    
    
    
    $time = date&#40;"j\/m $date1&#58;$date1b&#58;s"&#41;; 
    $realtime = date&#40;"YzHis"&#41;; 
    
    
    
    
    mysql_query&#40;"update userdb set active='$time' where email='$email'"&#41;; 
    mysql_query&#40;"update userdb set active2='$realtime' where email='$email'"&#41;; 
    mysql_query&#40;"update userdb set ipaddress='$REMOTE_ADDR' where email='$email'"&#41;; 
    
    
    $rankname = array&#40; 
    "Peasent",
    "Valet",
    "Squire",
    "Knight",
    "Lord",
    "Dol",
    "Earl",
    "Count",
    "Thane",
    "Duke",
    "Archduke",
    "Royal"&#41;; 
    $rankypanky = $playerinfo&#91;rank&#93;; 
    $merank = "$rankname&#91;$rankypanky&#93;"; 
    
    // Days, months....etc..
    $dayday = date &#40;"D"&#41;; 
    if &#40;$dayday ==  
    "Mon"&#41;&#123;$newday == "Lunae Dies";&#125; 
    if &#40;$dayday == "Tue"&#41;&#123;$newday == "Martis Dies";&#125; 
    if &#40;$dayday ==  
    "Wed"&#41;&#123;$newday == "Mercurii Dies";&#125; 
    if &#40;$dayday == "Thu"&#41;&#123;$newday == "Jovis Dies";&#125; 
    if &#40;$dayday  
    == "Fri"&#41;&#123;$newday == "Veneris Dies";&#125; 
    if &#40;$dayday == "Sat"&#41;&#123;$newday == "Saturni Dies";&#125; 
    if  
    &#40;$dayday == "Sun"&#41;&#123;$newday == "Solis Dies";&#125; 
    $monmon = date &#40;"M"&#41;; 
    if &#40;$monmon == "Jan"&#41;&#123;$newmon  
    == "Month of Janus, God of doors and gates";&#125; 
    if &#40;$monmon == "Feb"&#41;&#123;$newmon == "Month of  
    Februalia, sacrifices are made to atone for sins";&#125; 
    if &#40;$monmon == "Mar"&#41;&#123;$newmon == "Month of  
    Mars, God of War";&#125; 
    if &#40;$monmon == "Apr"&#41;&#123;$newmon == "Month of Aperire, The buds open";&#125; 
    if  
    &#40;$monmon == "May"&#41;&#123;$newmon == "Month of Maia, the Goddess of growth of plants";&#125; 
    if &#40;$monmon ==  
    "Jun"&#41;&#123;$newmon == "Month of Juno, time of Goddess Junius";&#125; 
    if &#40;$monmon == "Jul"&#41;&#123;$newmon ==  
    "Month of Quintilis Julius";&#125; 
    if &#40;$monmon == "Aug"&#41;&#123;$newmon == "Month of Sextilis, Augustus  
    Caesar";&#125; 
    if &#40;$monmon == "Sep"&#41;&#123;$newmon == "Month of Septem";&#125; 
    if &#40;$monmon == "Oct"&#41;&#123;$newmon ==  
    "Month of Octo";&#125; 
    if &#40;$monmon == "Nov"&#41;&#123;$newmon == "Month of Novem";&#125; 
    if &#40;$monmon ==  
    "Dec"&#41;&#123;$newmon == "Month of Decem";&#125; 
    
    
    include "money_fns.php"; 
    
    function jailerror&#40;$type,  
    $email&#41;&#123; 
    	if&#40;$type == "jail"&#41;&#123; 
            $res = mysql_query&#40;"SELECT * FROM userdb WHERE  
    email='$email'"&#41;; 
            $playerinfo = mysql_fetch_array&#40;$res&#41;; 
            include&#40;"style5.css"&#41;; 
       
          Echo "<center><img src=\"image/top.gif\" border=0 height=51 width=350><br><br></center>"; 
       
          //echo "<body text=\"#800000\" bgcolor=\"#000000\"></body><font face=Arial>"; 
            echo  
    "<font color=red>You are in jail for another $playerinfo&#91;jailtime&#93; days.<p>Jailed by&#58;  
    <b>$playerinfo&#91;jail_by&#93;</b> for reason&#58; <b>$playerinfo&#91;jail_reason&#93;</b>"; 
        &#125; 
    &#125; 
    
    function gem&#40;$type&#41; 
    &#123; 
    if&#40;$type == "c"&#41;&#123; 
             echo "<img src=\"image/gem_crystal.gif\">"; 
    &#125; 
    if&#40;$type ==  
    "d"&#41;&#123; 
             echo "<img src=\"image/gem_diamond.gif\">"; 
    &#125; 
    if&#40;$type == "e"&#41;&#123; 
             echo  
    "<img src=\"image/gem_emerald.gif\">"; 
    &#125; 
    if&#40;$type == "r"&#41;&#123; 
             echo "<img  
    src=\"image/gem_ruby.gif\">"; 
    &#125; 
    &#125; 
    
    function error&#40;$type&#41; 
    &#123; 
    
    	if&#40;$type == "field"&#41;&#123; 
             
    include&#40;"style5.css"&#41;; 
            Echo "<center><br><br></center>"; 
            //echo "<body text=\"#800000\" bgcolor=\"#000000\"></body><font face=Arial>"; 
    		echo "<font color=red>You have left fields blank. Please <a href=\"index.php\">relogin</a>.</font>"; 
    	 
    &#125; 
    
    	if&#40;$type == "password"&#41;&#123; 
            include&#40;"style5.css"&#41;; 
            Echo  
    "<center><br><br></center>"; 
           // echo "<body text=\"#800000\" bgcolor=\"#000000\"></body><font face=Arial>"; 
    		echo "<font color=red>Incorrect password.  
    Please <a href=\"index.php\">relogin</a>.</font>"; 
    	&#125; 
    
    	if&#40;$type == "jail"&#41;&#123; 
             
    include&#40;"style5.css"&#41;; 
            Echo "<center><br><br></center>"; 
           // echo "<body text=\"#800000\" bgcolor=\"#000000\"></body><font face=Arial>"; 
            $res = mysql_query&#40;"SELECT * FROM userdb WHERE email='$email'"&#41;; 
            $playerinfo = mysql_fetch_array&#40;$res&#41;; 
            echo "<font color=red>You are in jail for another  
    $playerinfo&#91;jailtime&#93; days.<p>Jailed by&#58; <b>$playerinfo&#91;jail_by&#93;</b> for reason&#58;  
    <b>$playerinfo&#91;jail_reason&#93;</b>"; 
        &#125; 
    
    	if&#40;$type == "verify"&#41;&#123; 
             
    include&#40;"style5.css"&#41;; 
            Echo "<center><br><br></center>"; 
            //echo "<body text=\"#800000\" bgcolor=\"#000000\"></body><font face=Arial>"; 
    		echo "<font color=red>Verification required. Please <a href=verify.php>verify</a> here.</font>"; 
    	&#125; 
    &#125; 
    ob_end_flush&#40;&#41;; ?>



    Przykladowe dane do polaczenia z baza





    Kod:
       
     *  Panel PHPMyAdmin&#58; http&#58;//mysql1.yoyo.pl/
        * Adres serwera MySQL&#58; mysql1.yoyo.pl
        * Port&#58; 3306
        * Baza danych&#58; db4754756
        * Nazwa użytkownika&#58; db4754756
        * Hasło&#58; Takie jakie podałeż podczas tworzenia/migracji strony &#40;zmień&#41;

  2. #2
    Optymista :) Awatar htmlxp
    Dołączył
    Sep 2007
    Posty
    2,095

    Domyślnie Problem z wypełnieniem parametrów połączenia do bazy da

    Jak masz na samym początku

    Kod:
    $db = mysql_connect&#40;"localhost", "eternal_dbplayer", "fireball"&#41; or   
    Die&#40;"I cannot connect to the database because&#58; " . mysql_error&#40;&#41;&#41;; 
    
    
    
    
    mysql_select_db&#40;"eternal_dsdatabase"&#41; or Die&#40;"DB Error !"&#41;;
    To w odpowiednie pola wpisujesz :

    $db = mysql_connect("host bazy danych", "uzytkownik bazy", "haslo bazy danych") or
    Die("I cannot connect to the database because: " . mysql_error());




    mysql_select_db("nazwa bazy danych") or Die("DB Error !");


    Nie zapomnij usunąć linijek :

    Kod:
    if &#40;$_SERVER&#91;'SERVER_ADDR'&#93; != "69.93.30.2"&#41; &#123; 
    exit; 
    &#125;
    w odpowiednich plikach

    Jak dobrze pamietam są one w plikach gameconfig.php i head.php
    NIE POMAGAM NA GG, jeśeli zostaniesz zablokowany/a to nie miej do mnie pretensji. Zawsze lubię pogadać gdy mam na to czas. GG podaje jedynie do zgłaszania wszelkich problemów z forum jak i jego treści.

  3. #3
    Zarejestrowany
    Dołączył
    Dec 2007
    Posty
    65

    Domyślnie Problem z wypełnieniem parametrów połączenia do bazy da

    jest w header.php dzięki teraz nawet mi działa powinno być o tym w instalacji bo myżlałem że jest tylko w configu

Informacje o wątku

Użytkownicy przeglądający ten wątek

Aktualnie 1 użytkownik(ów) przegląda ten wątek. (0 zarejestrowany(ch) oraz 1 gości)

Podobne wątki

  1. Problem z zapytaniem do bazy
    Przez Paryszek w dziale Problemy przy tworzeniu własnej gry
    Odpowiedzi: 7
    Ostatni post / autor: 08-10-2010, 15:31
  2. Problem z dwoma zapytaniami do bazy
    Przez Croos w dziale Problemy przy tworzeniu własnej gry
    Odpowiedzi: 4
    Ostatni post / autor: 03-10-2010, 15:19
  3. Problem -Dopasowywanie wyników z bazy
    Przez Mt! w dziale PHP / MySql
    Odpowiedzi: 3
    Ostatni post / autor: 16-02-2010, 12:42
  4. Problem z Wgraniem bazy
    Przez Nie zarejestrowany w dziale Mobstar
    Odpowiedzi: 8
    Ostatni post / autor: 23-10-2009, 23:44
  5. Pobieranie dancyh z bazy....Problem z get
    Przez mejeks w dziale Budowa gry via www
    Odpowiedzi: 7
    Ostatni post / autor: 19-08-2008, 17:34

Zakładki

Uprawnienia umieszczania postów

  • Nie możesz zakładać nowych tematów
  • Nie możesz pisać wiadomości
  • Nie możesz dodawać załączników
  • Nie możesz edytować swoich postów
  •