+ Reply to Thread
Results 1 to 9 of 9
Thread: Making this read ini files:)
-
06-30-2009 05:31 AM #1Member
- Join Date
- Apr 2009
- Posts
- 47
Making this read ini files:)
Wow everthing didnt get past when i did this well my Php sucksHTML 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). ?>
-
06-30-2009 04:35 PM #2Senior 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 syntaxCurrently deployed in support of OEF XI-XII
-
06-30-2009 06:39 PM #3Member
- Join Date
- Apr 2009
- Posts
- 47
I dont get what u mean lol
-
06-30-2009 07:28 PM #4Senior 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
The 'contents' variable now contains all the data in the .ini file.PHP Code:<?php
$filename = "myFile.ini";
$handle = fopen($filename,"r");
$contents = fread($handle,filesize($filename);
?>Currently deployed in support of OEF XI-XII
-
06-30-2009 07:39 PM #5Member
- 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
-
06-30-2009 07:44 PM #6Senior 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
-
06-30-2009 08:07 PM #7Member
- 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'");
-
06-30-2009 09:57 PM #8Senior Member
- Join Date
- May 2008
- Posts
- 248
-
07-01-2009 03:48 AM #9Member
- Join Date
- Apr 2009
- Posts
- 47
Lol told you i dont know anytihng about Php but thats what im trying to make it do.


LinkBack URL
About LinkBacks



Reply With Quote

