Brad Posted May 29, 2010 Share Posted May 29, 2010 Can someone fix this it dont work as the coverter. <?php switch($_GET['convert']) { case 'to_v1': conv_v1(); break; case 'to_v2': conv_v2(); break; default: conv_home(); break; } function conv_home() { echo <<<EOF <title>MC Codes Converter</title> <center><h3>MC Codes Version Converter<h3> <form action=javascript:action; method='post'> <select onChange="this.form.action=this.options[this.selectedIndex].value;"> <option default value="">--Select One--</option> <option value="mccodes_converter.php?convert=to_v2">v1->v2</option> <option value="mccodes_converter.php?convert=to_v1">v2->v1</option> </select> <textarea rows='20' cols='100' name='convtext'></textarea> <input value='Convert' type='submit' /></center> EOF; } function conv_v2() { $convtext=($_POST['convtext']); $tobereplaced = array( 'mysql_query', 'fetch_array', 'mysql_', ); $replacedwith = array( '$db->query', 'fetch_row', '$db->', ); $convedtext = str_replace($tobereplaced, $replacedwith, $convtext); print "<center><title>Converted to V2</title> <h3>Converted to V2</h3> <textarea rows='20' cols='100' readonly>$convedtext</textarea></center>"; } function conv_v1() { $convtext=($_POST['convtext']); $tobereplaced = array( '$db->query', 'fetch_row', '$db->', ); $replacedwith = array( 'mysql_query', 'fetch_array', 'mysql_', ); $convedtext = str_replace($tobereplaced, $replacedwith, $convtext); print "<center><title>Converted to V1</title> <h3>Converted to V1</h3> <textarea rows='20' cols='100' readonly>$convedtext</textarea></center>"; } ?> Quote Link to comment Share on other sites More sharing options...
Brad Posted May 30, 2010 Author Share Posted May 30, 2010 help Quote Link to comment Share on other sites More sharing options...
Dominion Posted May 30, 2010 Share Posted May 30, 2010 it changes what its ment to change fine so whats wrong with it? Quote Link to comment Share on other sites More sharing options...
Brad Posted May 30, 2010 Author Share Posted May 30, 2010 it dont change though i will do something. I will change v2 to v1 include "global_func.php"; It changes to include \"global_func.php\"; That is not even right Quote Link to comment Share on other sites More sharing options...
Dominion Posted May 30, 2010 Share Posted May 30, 2010 if no one else does i will post a working won when i get the time for now use this Tutorial: v2 - v1 Conversion Quote Link to comment Share on other sites More sharing options...
Brad Posted May 30, 2010 Author Share Posted May 30, 2010 yeah i use that but i just wanna do it fast thanks mate Quote Link to comment Share on other sites More sharing options...
gurpreet Posted May 30, 2010 Share Posted May 30, 2010 yeah i use that but i just wanna do it fast thanks mate You've probably spent 10x longer tryin to fix this, than actually doing it the 'slow' way. Quote Link to comment Share on other sites More sharing options...
Brad Posted May 30, 2010 Author Share Posted May 30, 2010 Yeah it will be faster after it works cause then you can do loads Quote Link to comment Share on other sites More sharing options...
gurpreet Posted May 30, 2010 Share Posted May 30, 2010 Or you could spend 30 seconds doing it yourself? Quote Link to comment Share on other sites More sharing options...
Brad Posted May 30, 2010 Author Share Posted May 30, 2010 what when there are files which are like 1000 lines and that takes 30 sec Quote Link to comment Share on other sites More sharing options...
gurpreet Posted May 30, 2010 Share Posted May 30, 2010 How many files are there that are over 1000 lines? I can think of about 4-5, unless you have the huge paid mods, in which case the creator would happily convert it. Quote Link to comment Share on other sites More sharing options...
CJ - Twitch Posted May 30, 2010 Share Posted May 30, 2010 How about Ctrl + H? Do Ctrl + H type in the find box: "$db->" and in replace box: "mysql_" Do the same thing but replace "mysql_fetch_row" with "mysql_fetch_array" Simple eh? Quote Link to comment Share on other sites More sharing options...
Brad Posted May 30, 2010 Author Share Posted May 30, 2010 yeah that simple but do you have to use notepad i have dreamweaver Quote Link to comment Share on other sites More sharing options...
Brad Posted May 30, 2010 Author Share Posted May 30, 2010 but what about converting logins whats the code and with a coverter u upload it works in one click that simple Quote Link to comment Share on other sites More sharing options...
Zero-Affect Posted May 30, 2010 Share Posted May 30, 2010 $tobereplaced = array( '$db->query', 'fetch_row', '$db->', ); $replacedwith = array( 'mysql_query', 'fetch_array', 'mysql_', ); if ( $blah == 'v1') { $convedtext = str_replace($tobereplaced, $replacedwith, $convtext); } elseif ( $blah == 'v2' ) { $convedtext = str_replace($replacedwith, $tobereplaced, $convtext); } Bored... lol Quote Link to comment Share on other sites More sharing options...
Brad Posted May 30, 2010 Author Share Posted May 30, 2010 where does that go in it Quote Link to comment Share on other sites More sharing options...
AlabamaHit Posted May 30, 2010 Share Posted May 30, 2010 Give me til tonight. I will make everyone a working convertor. I just have to run down the road for a couple hours. Then I'll finish a when I get back. So don't everyone go making one, lol, I"m 85% done already, just have to handle some stuff, then I'll finish it. It will be done tonight. Maybe staff will sticky my post with it?? Quote Link to comment Share on other sites More sharing options...
Brad Posted May 30, 2010 Author Share Posted May 30, 2010 thanks Quote Link to comment Share on other sites More sharing options...
AlabamaHit Posted May 30, 2010 Share Posted May 30, 2010 Ok, this is not complete yet, but posting it so you know I haven't forgot...So far it appears it works on everything EXCEPT for the top of the page. I have not added that yet. When I get that in. I will Make another topic. Maybe the mods here will sticky it. Cause I know it will be useful to a lot of people. <?php /****** ***Mccode page converter ***Created by AlabamaHit ***Enjoy, and give credit where due. ******/ echo '<h2>Code Convertor</h2>'; if(isset($_POST['v1'])) { $old = array('fetch_row','$db->'); $new = array('fetch_assoc','mysql_'); $newtext = str_replace($old, $new, $_POST['code']); echo ' <h2>Code Converted to v1</h2> <form action="convertor.php" method="post" name="form"> <textarea rows="150" cols="150" name="code">'.$newtext.'</textarea> <input type="submit" name="v2" value="Go Back" /> </form>'; focus(); } else if(isset($_POST['v2'])) { $old = array('fetch_array','mysql_','global $ir'); $new = array('fetch_row','$db->','global $db,$ir'); $newtext = str_replace($old, $new, $_POST['code']); echo ' <h2>Code Converted to v2</h2> Just remeber there still might be some errors. This don\'t work 100% of the time. <form action="convertor.php" method="post" name="form"> <textarea rows="150" cols="150" name="code">'.$newtext.'</textarea> <input type="submit" name="v1" value="Go Back" /> </form>'; focus(); } else { echo ' Place code in text box and click on how to convert it. <form action="convertor.php" method="post" name="form"> <textarea rows="150" cols="150" name="code"></textarea> <input type="submit" name="v1" value="Convert to v1" /> <input type="submit" name="v2" value="Convert to v2" /> </form>'; focus(); } // //No reason really for this. //But I'm using it anyway. function focus() { echo '<script type="text/javascript" language="JavaScript">'; echo "document.forms['form'].elements['code'].focus();"; echo '</script>'; } ?> Remeber this is not done yet. Quote Link to comment Share on other sites More sharing options...
Guest Posted May 31, 2010 Share Posted May 31, 2010 How about Ctrl + H? Do Ctrl + H type in the find box: "$db->" and in replace box: "mysql_" Do the same thing but replace "mysql_fetch_row" with "mysql_fetch_array" Simple eh? Your saying simple eh? - I can say fail eh? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.