Cyanide Posted February 2, 2008 Posted February 2, 2008 To convert a v2 mod to work with v1: Open the file you want to convert and find: include "globals.php"; replace that with: require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm); $h->menuarea(); now you will need to change all the sql querys to look like the mccodes v1 querys: examples: v1 query: mysql_query("UPDATE users SET exp=exp+{$exga}, energy=0 WHERE gang={$ir['gang']}", $c); v2 query: $db->query("SELECT * FROM users WHERE userid={$_POST['userid']}"); when you are done the v2 query should look like this: mysql_query("SELECT * FROM users WHERE userid={$_POST['userid']}"); *note* there are fast ways to do this using dreamweaver or wordpad* Using DreamWeaver: Press CTRL+F, this will bring up the search / replace function type this in the first box: $db-> type this in the replace with box: mysql_ click replace all, and you're done. Using Wordpad: press CTRL+H this will bring up the replace menu type this in the find what box: $db-> type this in the replace with box: mysql_ click ok and you're done. I hope this helps someone out. Quote
Krafty Posted February 2, 2008 Posted February 2, 2008 Re: Tutorial: v2 - v1 Conversion Not being mean..just putting up a simpler thing.. Convert V2 to V1 To convert from v2 to v1 you will need to simply do the opposite of the conversion from v1 to v2. In the v2 version find: include "globals.php"; And replace with: session_start(); require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $cm=money_formatter($ir['crystals'],''); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm,$cm); $h->menuarea(); Find all the places where it says: $db->query And replace it with: mysql_query Then you're done! Feel free to contact me.. [email protected] Quote
Cyanide Posted February 2, 2008 Author Posted February 2, 2008 Re: Tutorial: v2 - v1 Conversion thats the same thing i said in less detail lol...i just explained more for the newer coders Quote
Krafty Posted February 3, 2008 Posted February 3, 2008 Re: Tutorial: v2 - v1 Conversion Lol well +1 Quote
Cyanide Posted February 3, 2008 Author Posted February 3, 2008 Re: Tutorial: v2 - v1 Conversion +1 to you too Quote
jimmytubbs Posted March 7, 2008 Posted March 7, 2008 Re: Tutorial: v2 - v1 Conversion hi on the v2 mods if it says put 'query' in file cron_day.php for v1 what do u put it in? Quote
Floydian Posted March 7, 2008 Posted March 7, 2008 Re: Tutorial: v2 - v1 Conversion assuming your mysql.php file (or whatever the file that contains your mysql connection is call) is included in your cron file, and assuming the variable containing the connection is named $c, you can change: $db->query to mysql_query and add in a second argument to the function i.e., mysql_query($string, $c) instead of $db->query($string) Quote
Zero-Affect Posted April 22, 2008 Posted April 22, 2008 Re: Tutorial: v2 - v1 Conversion Sup Floydian hows tricks mate... Quote
Richard Posted May 21, 2008 Posted May 21, 2008 Re: Tutorial: v2 - v1 Conversion also, doesnt $db->fetch_row( have to be replaced with mysql_fetch_array( Quote
Richard Posted May 22, 2008 Posted May 22, 2008 Re: Tutorial: v2 - v1 Conversion also, $db->fetch_single goes to mysql_fetch_object Quote
Tezza` Posted May 22, 2008 Posted May 22, 2008 Re: Tutorial: v2 - v1 Conversion Hmm, ive never noticed that one ;)... guess i will change from now on. Quote
Halo Posted June 12, 2008 Posted June 12, 2008 Re: Tutorial: v2 - v1 Conversion What about: $db->num_rows Shouldn't that be: mysql_num_rows Quote
Halo Posted June 12, 2008 Posted June 12, 2008 Re: Tutorial: v2 - v1 Conversion I found another one that fixed my mod ? If you find: $db->result Replace With: mysql_result Quote
Magictallguy Posted June 12, 2008 Posted June 12, 2008 Re: Tutorial: v2 - v1 Conversion Right, so... include "globals.php"; becomes session_start(); require_once __DIR__.'/mysql.php'; global $c; require_once __DIR__.'/global_func.php'; if (!array_key_exists('loggedin', $_SESSION) or 0 == $_SESSION['loggedin']) { exit(header('Location: /login.php')); } $userid = array_key_exists('userid', $_SESSION) && ctype_digit($_SESSION['userid']) && $_SESSION['userid'] > 0 ? $_SESSION['userid'] : null; $is = mysql_query('SELECT u.*, us.* FROM users AS u INNER JOIN userstats AS us ON u.userid = us.userid WHERE u.userid = '.$userid, $c) or die(mysql_error()); if (!mysql_num_rows($is)) { session_unset(); session_destroy(); exit(header('Location: /login.php')); } $ir = mysql_fetch_assoc($is); check_level(); $fm = money_formatter($ir['money']); $cm = money_formatter($ir['crystals'], ''); $lv = date('F j, Y, g:i a', $ir['laston']); require_once __DIR__.'/header.php'; $h = new headers(); $h->startheaders(); $h->userdata($ir, $lv, $fm, $cm); $h->menuarea(); include "sglobals.php"; becomes session_start(); require_once __DIR__.'/mysql.php'; global $c; require_once __DIR__.'/global_func.php'; if (!array_key_exists('loggedin', $_SESSION) or 0 == $_SESSION['loggedin']) { exit(header('Location: /login.php')); } $userid = array_key_exists('userid', $_SESSION) && ctype_digit($_SESSION['userid']) && $_SESSION['userid'] > 0 ? $_SESSION['userid'] : null; $is = mysql_query('SELECT u.*, us.* FROM users AS u INNER JOIN userstats AS us ON u.userid = us.userid WHERE u.userid = '.$userid, $c) or die(mysql_error()); if (!mysql_num_rows($is)) { session_unset(); session_destroy(); exit(header('Location: /login.php')); } $ir = mysql_fetch_assoc($is); if(!in_array($ir['user_level'], array(2, 3, 5))) { exit(header('Location: /index.php')); } require_once __DIR__.'/header.php'; $h = new headers(); $h->startheaders(); check_level(); $fm = money_formatter($ir['money']); $cm = money_formatter($ir['crystals'], ''); $lv = date('F j, Y, g:i a', $ir['laston']); $h->userdata($ir, $lv, $fm, $cm); $h->smenuarea(); $db->query becomes mysql_query $db->fetch_row becomes mysql_fetch_assoc $db->num_rows becomes mysql_num_rows $db->fetch_single becomes mysql_result Quote
Halo Posted June 12, 2008 Posted June 12, 2008 Re: Tutorial: v2 - v1 Conversion Right so... include "globals.php"; becomes session_start(); require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $cm=money_formatter($ir['crystals'],''); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm,$cm); $h->menuarea(); $db->query becomes mysql_query $db->fetch_row becomes mysql_fetch_array $db->num_rows becomes mysql_num_rows $db->fetch_single becomes mysql_fetch_object $db->result becomes mysql_result Lol, maybe someone will come up with more :-P Quote
Magictallguy Posted June 13, 2008 Posted June 13, 2008 Re: Tutorial: v2 - v1 Conversion Oh shush xD Quote
iR00T Posted June 17, 2008 Posted June 17, 2008 Re: Tutorial: v2 - v1 Conversion ah tried it still didnt work well i tried on a login page a nice on did it neer ever loaded the page so i jsut hit undo save and it loaded the page fast i was like wow Quote
iR00T Posted June 18, 2008 Posted June 18, 2008 Re: Tutorial: v2 - v1 Conversion oh yeah thanks to MTG for this but this might help some newbie coders if you take that whole v1 part from the session start down to the mainmenu part put into a file called v1.php and just edit it like when u convert v2 to v1 put <? include "v1.php"; something like that it will help you loads than haveing all that codeing in there Quote
Halo Posted June 25, 2008 Posted June 25, 2008 Re: Tutorial: v2 - v1 Conversion Post of the time you need to change $db-> to mysql_ so just change: $db-> to mysql_ and do the rest :) Quote
Exemption Posted July 1, 2008 Posted July 1, 2008 Re: Tutorial: v2 - v1 Conversion Nice job though :mrgreen: Quote
iR00T Posted July 11, 2008 Posted July 11, 2008 Re: Tutorial: v2 - v1 Conversion Ok it says i have a error on lines 258 and 268 someone tell me what they are i havent found any .... :? here is lines 254-269 function gang_forums_viewtopic() { global $ir,$c,$userid,$gangdata; $tpcd=mysql_query("SELECT t.*,u1.* FROM gangforums_topics t LEFT JOIN users u1 ON t.gft_userid=u1.userid WHERE t.gft_id={$_GET['t']}",$c); mysql_query("UPDATE gangforums_topics SET gft_views=gft_views+1 WHERE gft_id={$_GET['t']}",$c); $topic=mysql_fetch_array($tpcd); $posts[0]['username']=$topic['username']; $posts[0]['userid']=$topic['userid']; $posts[0]['time']=$topic['gft_starttime']; $posts[0]['level']=$topic['level']; $posts[0]['nr']=1; $posts[0]['text']=str_replace("\n"," ",$topic['gft_text']); $cntr=0; $pq=mysql_query("SELECT r.*,u.* FROM gangforums_replies r LEFT JOIN users u ON r.gfr_userid=u.userid WHERE r.gfr_topic={$_GET['t']} ORDER BY gfr_posttime ASC;",$c); while($r=mysql_fetch_array($pq)) { Quote
Klikoka Posted July 12, 2008 Posted July 12, 2008 Re: Tutorial: v2 - v1 Conversion Ok it says i have a error on lines 258 and 268 someone tell me what they are i havent found any .... :? here is lines 254-269 function gang_forums_viewtopic() { global $ir,$c,$userid,$gangdata; $tpcd=mysql_query("SELECT t.*,u1.* FROM gangforums_topics t LEFT JOIN users u1 ON t.gft_userid=u1.userid WHERE t.gft_id={$_GET['t']}",$c); mysql_query("UPDATE gangforums_topics SET gft_views=gft_views+1 WHERE gft_id={$_GET['t']}",$c); $topic=mysql_fetch_array($tpcd); $posts[0]['username']=$topic['username']; $posts[0]['userid']=$topic['userid']; $posts[0]['time']=$topic['gft_starttime']; $posts[0]['level']=$topic['level']; $posts[0]['nr']=1; $posts[0]['text']=str_replace("\n"," ",$topic['gft_text']); $cntr=0; $pq=mysql_query("SELECT r.*,u.* FROM gangforums_replies r LEFT JOIN users u ON r.gfr_userid=u.userid WHERE r.gfr_topic={$_GET['t']} ORDER BY gfr_posttime ASC;",$c); while($r=mysql_fetch_array($pq)) { Have you added the Structure table? Quote
iR00T Posted July 15, 2008 Posted July 15, 2008 Re: Tutorial: v2 - v1 Conversion that is all you basiaclly need i gave u the error lines and a few extra that is the whole function that is messing up but atm i ave just restord my orginal when this has been fixed i will re do what i was doing :-) Quote
AlabamaHit Posted October 22, 2008 Posted October 22, 2008 Re: Tutorial: v2 - v1 Conversion LMAO you have no idea what he is saying.... Does your DB match that Info on the page.... is there gft_views in the table gangforums_topics??? Tell the error...dont just say error.. crap the error could be.. Internet Explore could not connect to website for as far as we know, lol... Quote
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.