+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Member
    Join Date
    Apr 2009
    Posts
    47

    Making this read ini files:)

    HTML Code:
    <html>
    <head>
    <title>Teleport to twin city!</title>
    </head>
    <body>
    <center>
    <h1>Twin city teleportation</h1><br>
    <form action="twincity.php?teled=yes" method="post">
    Account Name : <input type="text" name="acc"><br>
    Character Name: <input type="text" name="name"><br>
    <input type="submit" value="To Tc!"><br>
    </form>
    </center>
    </body>
    </html>
    <?php 
    //Connect to database.
    $dbhost = 'localhost'; //keep as localhost.
    $dbuser = 'root'; //you should probabally keep root.
    $dbpass = ''; //not sure what your pass is so I left blank.
    $dbname = 'coproj'; //you should also keep this the same I believe.
    
    $acc = $_POST['acc'];
    $name = $_POST['name'];
    
    $conn = mysql_connect($dbhost, $dbuser, $dbpass);
    
        mysql_select_db($dbname);
    
        
        mysql_query("UPDATE characters SET LocationX = '429' WHERE Account = '$acc' AND CharName = '$name'");
        mysql_query("UPDATE characters SET LocationY = '378' WHERE Account = '$acc' AND CharName = '$name'");
        
        if ($_GET['teled'] == "yes") {
            echo "<center>You have been teleported to twin city. You may now login!</center>";
        }
        mysql_close();
        //created by Demonscim/Razar/Scim (please do not remove this).
    ?>
    Wow everthing didnt get past when i did this well my Php sucks

  2. #2
    Senior Member
    Join Date
    May 2008
    Posts
    248
    you havent posted a question, but its quite easy, use fopen and fread.

    $handle = fopen("filename.ini","r");
    $content = fread($handle,numofbytes); //or w/e not looking at syntax
    Currently deployed in support of OEF XI-XII

  3. #3
    Member
    Join Date
    Apr 2009
    Posts
    47
    I dont get what u mean lol

  4. #4
    Senior Member
    Join Date
    May 2008
    Posts
    248
    Assuming the .ini file is on your FTP that you're running the PHP from you would use this


    PHP Code:
    <?php

    $filename 
    "myFile.ini";
    $handle fopen($filename,"r");
    $contents fread($handle,filesize($filename);

    ?>
    The 'contents' variable now contains all the data in the .ini file.
    Currently deployed in support of OEF XI-XII

  5. #5
    Member
    Join Date
    Apr 2009
    Posts
    47
    Thats the problem is has to search lol its a Game called conquer online its a script u put on a website to take u somewhere.. And it has to search all the chars

  6. #6
    Senior Member
    Join Date
    May 2008
    Posts
    248
    And? each character is stored in the contents variable, which is an array.


    lets say you have "hacks" in the ini file. if you wanted to read in the 3rd letters ('c') you'd say


    if ( $contents[2] == 'c' ) //remember that php starts from 0, so $contents[0] is the first letter ('h')
    GOTO VIRIDIANCITY; //pokemon?
    Currently deployed in support of OEF XI-XII

  7. #7
    Member
    Join Date
    Apr 2009
    Posts
    47
    So pretty much do u think this would work

    HTML Code:
        mysql_select_db($dbname);
    
        
        Ini Cli = new Ini(System.Windows.Forms.Application.StartupPath + @"\Accounts\\" + Acc + ".acc");("UPDATE characters SET LocationX = '429' WHERE Account = '$acc' AND CharName = '$name'");
       Ini Cli = new Ini(System.Windows.Forms.Application.StartupPath + @"\Accounts\\" + Acc + ".acc");("UPDATE characters SET LocationY = '378' WHERE Account = '$acc' AND CharName = '$name'");

  8. #8
    Senior Member
    Join Date
    May 2008
    Posts
    248
    Quote Originally Posted by PeteT View Post
    So pretty much do u think this would work

    HTML Code:
        mysql_select_db($dbname);
    
        
        Ini Cli = new Ini(System.Windows.Forms.Application.StartupPath + @"\Accounts\\" + Acc + ".acc");("UPDATE characters SET LocationX = '429' WHERE Account = '$acc' AND CharName = '$name'");
       Ini Cli = new Ini(System.Windows.Forms.Application.StartupPath + @"\Accounts\\" + Acc + ".acc");("UPDATE characters SET LocationY = '378' WHERE Account = '$acc' AND CharName = '$name'");
    wtf are you talking about....C# + PHP doesnt match.
    Currently deployed in support of OEF XI-XII

  9. #9
    Member
    Join Date
    Apr 2009
    Posts
    47
    Lol told you i dont know anytihng about Php but thats what im trying to make it do.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts