peterisgb Posted October 1, 2014 Posted October 1, 2014 Hi, For some reason my register.php isnt working right. It doesnt seem to post ID information into pdetails and userstats. Here is my register.php <?php session_start(); include "config.php"; include "language.php"; include "rfunctions.php"; if (filesize("config.php") <= 150) { header("Location: install.php"); } global $_CONFIG; define("MONO_ON", 1); require "class/class_db_{$_CONFIG['driver']}.php"; $db=new database; $db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']); $db->connect(); $c=$db->connection_id; $set=array(); $settq=$db->query("SELECT * FROM settings"); while($r=$db->fetch_row($settq)) { $set[$r['conf_name']]=$r['conf_value']; } $q=$db->query("SELECT userid FROM users"); $membs=$db->num_rows($q); $q=$db->query("SELECT userid FROM users WHERE bankmoney>-1"); $banks=$db->num_rows($q); $q=$db->query("SELECT userid FROM users WHERE gender='Male'"); $male=$db->num_rows($q); $q=$db->query("SELECT userid FROM users WHERE gender='Female'"); $fem=$db->num_rows($q); $total=0; //thx to http://www.phpit.net/code/valid-email/ for valid_email function valid_email($email) { // First, we check that there's one @ symbol, and that the lengths are right if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) { // Email invalid because wrong number of characters in one section, or wrong number of @ symbols. return false; } // Split it into sections to make life easier $email_array = explode("@", $email); $local_array = explode(".", $email_array[0]); for ($i = 0; $i < sizeof($local_array); $i++) { if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) { return false; } } if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name $domain_array = explode(".", $email_array[1]); if (sizeof($domain_array) < 2) { return false; // Not enough parts to domain } for ($i = 0; $i < sizeof($domain_array); $i++) { if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) { return false; } } } return true; } session_start(); print <<<EOF <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Infamous-Wars Register</title> <meta property="og:title" content="Infamous-wars" /> <meta property="og:description" content=" Infamous-Wars - Online Space Game, fight other players, war with planets, racing, build your own weapons and loads more. " /> <meta name="author" content="Peter Greenacre" /> <meta name="copyright" content="Copyright World-wars 2010-2013" /> <meta property="og:image" content="http://www.infamous-wars.com/title.png" /> <link rel="SHORTCUT ICON" href="favicon.ico" /> <link href="css/login.css" rel="stylesheet" type="text/css"> <script type="text/javascript"> var xmlHttp // xmlHttp variable function GetXmlHttpObject(){ // This function we will use to call our xmlhttpobject. var objXMLHttp=null // Sets objXMLHttp to null as default. if (window.XMLHttpRequest){ // If we are using Netscape or any other browser than IE lets use xmlhttp. objXMLHttp=new XMLHttpRequest() // Creates a xmlhttp request. }else if (window.ActiveXObject){ // ElseIf we are using IE lets use Active X. objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP") // Creates a new Active X Object. } // End ElseIf. return objXMLHttp // Returns the xhttp object. } // Close Function function CheckPasswords(password){ // This is our fucntion that will check to see how strong the users password is. xmlHttp=GetXmlHttpObject() // Creates a new Xmlhttp object. if (xmlHttp==null){ // If it cannot create a new Xmlhttp object. alert ("Browser does not support HTTP Request") // Alert Them! return // Returns. } // End If. var url="check.php?password="+escape(password) // Url that we will use to check the password. xmlHttp.open("GET",url,true) // Opens the URL using GET xmlHttp.onreadystatechange = function () { // This is the most important piece of the puzzle, if onreadystatechange = equal to 4 than that means the request is done. if (xmlHttp.readyState == 4) { // If the onreadystatechange is equal to 4 lets show the response text. document.getElementById("passwordresult").innerHTML = xmlHttp.responseText; // Updates the div with the response text from check.php } // End If. }; // Close Function xmlHttp.send(null); // Sends NULL insted of sending data. } // Close Function. function CheckUsername(password){ // This is our fucntion that will check to see how strong the users password is. xmlHttp=GetXmlHttpObject() // Creates a new Xmlhttp object. if (xmlHttp==null){ // If it cannot create a new Xmlhttp object. alert ("Browser does not support HTTP Request") // Alert Them! return // Returns. } // End If. var url="checkun.php?password="+escape(password) // Url that we will use to check the password. xmlHttp.open("GET",url,true) // Opens the URL using GET xmlHttp.onreadystatechange = function () { // This is the most important piece of the puzzle, if onreadystatechange = equal to 4 than that means the request is done. if (xmlHttp.readyState == 4) { // If the onreadystatechange is equal to 4 lets show the response text. document.getElementById("usernameresult").innerHTML = xmlHttp.responseText; // Updates the div with the response text from check.php } // End If. }; // Close Function xmlHttp.send(null); // Sends NULL insted of sending data. } // Close Function. function CheckEmail(password){ // This is our fucntion that will check to see how strong the users password is. xmlHttp=GetXmlHttpObject() // Creates a new Xmlhttp object. if (xmlHttp==null){ // If it cannot create a new Xmlhttp object. alert ("Browser does not support HTTP Request") // Alert Them! return // Returns. } // End If. var url="checkem.php?password="+escape(password) // Url that we will use to check the password. xmlHttp.open("GET",url,true) // Opens the URL using GET xmlHttp.onreadystatechange = function () { // This is the most important piece of the puzzle, if onreadystatechange = equal to 4 than that means the request is done. if (xmlHttp.readyState == 4) { // If the onreadystatechange is equal to 4 lets show the response text. document.getElementById("emailresult").innerHTML = xmlHttp.responseText; // Updates the div with the response text from check.php } // End If. }; // Close Function xmlHttp.send(null); // Sends NULL insted of sending data. } // Close Function. function PasswordMatch() { pwt1=document.getElementById('pw1').value; pwt2=document.getElementById('pw2').value; if(pwt1 == pwt2) { document.getElementById('cpasswordresult').innerHTML="<font color='green'>OK</font>"; } else { document.getElementById('cpasswordresult').innerHTML="<font color='red'>Not Matching</font>"; } } </script> <!-- Begin Main Content --> EOF; $IP = ($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; if(file_exists('ipbans/'.$IP)) { die("<b><font color=red size=+1>Your IP has been banned, there is no way around this.</font></b></body></html>"); } if($_POST['username']) { if($set['regcap_on']) { if(!$_SESSION['captcha'] or $_SESSION['captcha'] != $_POST['captcha']) { unset($_SESSION['captcha']); die("Captcha Test Failed<br /> ><a href='register.php'>Back</a>"); } unset($_SESSION['captcha']); } if(!valid_email($_POST['email'])) { die("Sorry, the email is invalid.<br /> ><a href='register.php'>Back</a>"); } if(strlen($_POST['username']) < 4) { die("Sorry, the username is too short.<br /> ><a href='register.php'>Back</a>"); } $sm=100; if($_POST['ref'] == "Referer ID Here") { $sm+=100; } $username=$_POST['username']; $username=str_replace(array("<", ">"), array("<", ">"), $username); $q=$db->query("SELECT * FROM users WHERE username='{$username}' OR login_name='{$username}'"); $q2=$db->query("SELECT * FROM users WHERE email='{$_POST['email']}'"); if($db->num_rows($q)) { print "Username already in use. Choose another.<br /> ><a href='register.php'>Back</a>"; } else if($db->num_rows($q2)) { print "E-Mail already in use. Choose another.<br /> ><a href='register.php'>Back</a>"; } else if($_POST['password'] != $_POST['cpassword']) { print "The passwords did not match, go back and try again.<br /> ><a href='register.php'>Back</a>"; } else { $_POST['ref'] = abs((int) $_POST['ref']); $IP = ($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; $q=$db->query("SELECT * FROM users WHERE lastip='$IP' AND userid={$_POST['ref']}"); if($db->num_rows($q)) { die("No creating referral multies. Bad dog.<br /> ><a href='register.php'>Back</a>"); } if($_POST['ref']) { $q=$db->query("SELECT * FROM users WHERE userid={$_POST['ref']}"); $r=$db->fetch_row($q); } $zom2=$db->query("SELECT * FROM hvzstats"); $hvz=$db->fetch_row($zom2); if($hvz['hvz'] ==1) { $zom=1; } else { $zom=0; } $db->query("INSERT INTO users (username, login_name, userpass, level, money, crystals, donatordays, user_level, energy, maxenergy, will, maxwill, brave, maxbrave, hp, maxhp, location, gender, signedup, email, bankmoney, lastip, lastip_signup, humanorzombie, Random_key) VALUES( '{$username}', '{$username}', md5('{$_POST['password']}'), 1, $sm, 1000, 0, 1, 12, 12, 100, 100, 5, 5, 100, 100, 1, '{$_POST['gender']}', unix_timestamp(), '{$_POST['email']}', -1, '$IP', '$IP', $zom, '".random_string('alnum', 32)."')"); $db->query("UPDATE users SET lastwin=2"); $db->query("UPDATE users SET lastlost=2"); $i=$db->insert_id(); $db->query("INSERT INTO userstats VALUES($i, '100', '100', '100', '100', '10')"); $db->query("INSERT INTO pdetails VALUES($i, '', '', 0, '', '', '', '', '', '')") or die(mysql_error()); if($_POST['ref']) { require "global_func.php"; $db->query("UPDATE users SET crystals=crystals+20000 WHERE userid={$_POST['ref']}"); event_add($_POST['ref'],"For refering $username to the game, you have earnt 20000 valuable Gold Coins!",$c); $db->query("INSERT INTO referals VALUES('$ia', {$_POST['ref']}, $i, unix_timestamp(),'{$r['lastip']}','$IP')"); $ia=$db->insert_id(); } // get data just entered $getUser = $db->query("SELECT userid, login_name, email, Random_key FROM users WHERE login_name = '{$username}'") or die(mysql_error()); $row = $db->fetch_assoc($getUser); // Send rego email $stamp = unix_timestamp; $to = $_POST['email']; $subject = "Infamous-Wars Account Activation"; $body = "Hello " . $username . ",\n\nThank you for registering at Infamous-Wars!\n\nClick this link to activate your account: http://www.infamous-wars.com/activate.php?ID=".$row['userid']."&key=".$row['Random_key']." \n\n -Lord Kernow"; $headers = "Infamous-Wars"; if (mail($to, $subject, $body, $headers)) {} print "You have signed up, enjoy the game.<br> > <a href='login.php'>Login</a> "; } } else { if($set['regcap_on']) { $chars="123456789"; $len=strlen($chars); $_SESSION['captcha']=""; for($i=0;$i<6;$i++) $_SESSION['captcha'].=$chars[rand(0, $len - 1)]; } print " <img src='title.jpg' height='0' width='0'> <!-- Begin Main Content --> <body> <table width='982' border='0' align='center' cellpadding='0' cellspacing='0' class='bg1'> <tr> <td><table width='982' border='0' align='center' cellpadding='0' cellspacing='0' class='bg2'> <tr> <td><table width='950' border='0' align='center' cellpadding='0' cellspacing='0'> <tr> <td width='677'><center><img src='images/title.png' alt='' width='677' height='141'></center></td> </tr> <tr> <td colspan='2' class='bg3' style='height:50px;'> <table width='950' border='0' cellspacing='0' cellpadding='0' style='height:50px;'> <tr> <td width='33'> </td> <td valign='middle' class='text2'> <a href='#.' class='link1'></a><a href='#' class='link1'></a><img src='images/spacer.gif' alt='' width='1' height='1' hspace='15'><a href='#' class='link1'></a><img src='images/spacer.gif' alt='' width='1' height='1' hspace='15'><a href='#' class='link1'></a><img src='images/spacer.gif' alt='' width='1' height='1' hspace='15'><a href='#' class='link1'></a><img src='images/spacer.gif' alt='' width='1' height='1' hspace='15'><a href='#' class='link1'></a> <table border='0' cellspacing='0' cellpadding='0'> <tr> <td><a href='login.php' class='link1'>$home</a></td> <td><img src='images/subpage1_02.jpg' alt='' width='2' height='16' hspace='15'></td> <td><a href='register.php' class='link1'>$register</a></td> <td><img src='images/subpage1_02.jpg' alt='' width='2' height='16' hspace='15'></td> </tr> </table></td> <td width='108' align='right' class='text1'><script language='JavaScript' type='text/javascript' src='date.js'></script></td> <td width='32'> </td> </tr> </table></td> </tr> </table> <table width='950' border='0' align='center' cellpadding='0' cellspacing='0'> <tr valign='top'> <td width='181'><table width='181' border='0' cellspacing='0' cellpadding='0'> <tr> <td class='text2' style='background-image:url(images/homepage09.jpg); height:40px;'><table width='181' border='0' cellspacing='0' cellpadding='0'> <tr> <td width='15'><img src='images/spacer.gif' alt='' width='15' height='40'></td> <td width='166' class='text2'>$nav</td> </tr> </table></td> </tr> <tr> <td style='background-image:url(images/homepage10.jpg); height:29px;'><table width='100%' border='0' cellspacing='0' cellpadding='0'> <tr> <td width='8%'><img src='images/spacer.gif' alt='' width='15' height='29'></td> <td width='92%'><a href='login.php' class='link1'>$login</a></td> </tr> </table></td> </tr> <tr> <td style='background-image:url(images/homepage10.jpg); height:29px;'><table width='100%' border='0' cellspacing='0' cellpadding='0'> <tr> <td width='8%'><img src='images/spacer.gif' alt='' width='15' height='29'></td> <td width='92%'><a href='register.php' class='link1'>$register</a></td> </tr> </table></td> </tr> <tr> <td style='background-image:url(images/homepage10.jpg); height:29px;'><table width='100%' border='0' cellspacing='0' cellpadding='0'> <tr> <td width='8%'><img src='images/spacer.gif' alt='' width='15' height='29'></td> <td width='92%'><a href='advertise.php' class='link1'>$adv</a></td> </tr> </table></td> </tr> <tr> <td style='background-image:url(images/homepage10.jpg); height:29px;'><table width='100%' border='0' cellspacing='0' cellpadding='0'> <tr> <td width='8%'><img src='images/spacer.gif' alt='' width='15' height='29'></td> <td width='92%'><a href='faq.php' class='link1'>$faq</a></td> </tr> </table></td> </tr> <tr> <td style='background-image:url(images/homepage10.jpg); height:29px;'><table width='100%' border='0' cellspacing='0' cellpadding='0'> <tr> <td width='8%'><img src='images/spacer.gif' alt='' width='15' height='29'></td> <td width='92%'><a href='tos.php' class='link1'>$tos</a></td> </tr> </table></td> </tr> <tr> <td style='background-image:url(images/homepage10.jpg); height:29px;'><table width='100%' border='0' cellspacing='0' cellpadding='0'> <tr> <td width='8%'><img src='images/spacer.gif' alt='' width='15' height='29'></td> <td width='92%'><a href='privacy_policy.php' class='link1'>$prvp</a></td> </tr> </table></td> </tr> <tr> <td style='background-image:url(images/homepage10.jpg); height:29px;'><table width='100%' border='0' cellspacing='0' cellpadding='0'> <tr> <td width='8%'><img src='images/spacer.gif' alt='' width='15' height='29'></td> <td width='92%'><a href='safety_tips.php' class='link1'>$saftip</a></td> </tr> </table> </td> </tr> <tr> <td style='background-image:url(images/homepage10.jpg); height:29px;'><table width='100%' border='0' cellspacing='0' cellpadding='0'> <tr> <td width='8%'><img src='images/spacer.gif' alt='' width='15' height='29'></td> <td width='92%'><a href='contact_us.php' class='link1'>$contus</a></td> </tr> </table></td> </tr> <tr/> <td style='background-image:url(images/homepage10.jpg); height:29px;'><table width='100%' border='0' cellspacing='0' cellpadding='0'> <tr> <td width='8%'><img src='images/spacer.gif' alt='' width='15' height='29'></td> <td width='92%'><a href='http://ividen.toolbar.fm' class='link1' target='_blank'>Our Toolbar</a></td> </tr> </table> <tr> <td><img src='images/homepage11.jpg' alt='' width='181' height='8'></td> </tr> </table> <table width='181' border='0' cellspacing='0' cellpadding='0'> <tr> <td style='background-image:url(images/); height:40px;'><table width='181' border='0' cellspacing='0' cellpadding='0'> <tr> <td width='15'><img src='images/spacer.gif' alt='' width='15' height='40'></td> </tr> </table></td> </tr> </table></td> <td width='589'><table width='589' border='0' cellspacing='0' cellpadding='0'> <tr> <td style='background-image:url(images/homepage13.jpg); height:40px;'><table width='181' border='0' cellspacing='0' cellpadding='0'> <tr> <td width='15'><img src='images/spacer.gif' alt='' width='26' height='40'></td> <td width='166' class='text2'><h2><legend>Infamous-Wars</legend></h2> </td> </tr> </table></td> </tr> <tr> <td><img src='images/spacer.gif' alt='' width='30' height='25'></td> </tr> <tr> <td><table width='535' border='0' align='center' cellpadding='0' cellspacing='0'> <tr> <td> "; print "<center><h3>{$set['game_name']} Registration</h3></center>"; print "<form action=register.php method=post><center> <table width='75%' class='table' cellspacing='1'> <tr> <center><td width='30%'>Username</td><center> <td width='40%'><input type=text name=username onkeyup='CheckUsername(this.value);' style='background-color:transparent;'></td> <td width='30%'><div id='usernameresult'></div></td> </tr> <tr> <td>Password</td> <td><input type=password id='pw1' name=password onkeyup='CheckPasswords(this.value);PasswordMatch();' style='background-color:transparent;'></td> <td><div id='passwordresult'></div></td> </tr> <tr> <td>Confirm Password</td><td><input type=password name=cpassword id='pw2' onkeyup='PasswordMatch();' style='background-color:transparent;'></td> <td><div id='cpasswordresult'></div></td> </tr> <tr> <th colspan='3'>E-Mail Address Must be Real And Valid to play this game.</th> </tr> <tr> <td>Email</td><td><input type=text name=email onkeyup='CheckEmail(this.value);' style='background-color:transparent;'></td> <td><div id='emailresult'></div></td> </tr> <tr> <th colspan='3'><small>Verification Link will be E-mailed to your E-mail Address</small></th> </tr> <tr> <td>Gender</td> <td colspan='2'><select name='gender' type='dropdown'> <option value='Male'>Male <option value='Female'>Female</select></td> </tr> <tr> <td>Referer ID</td><td colspan=2><input type=text name=promo style='background-color:transparent;'></td> </tr> <input type=hidden name=ref value='"; if($_GET['ref']) { print $_GET['ref']; } print "' />"; if($set['regcap_on']) { print "<tr> <td colspan=3><img src='captcha_verify.php?bgcolor=C3C3C3' /><br /> <input type='text' name='captcha' style='background-color:transparent;'/></td> </tr>"; } print " <tr> <td colspan=3 align=center><input type=submit value=Submit></td> </tr> </table> </form><br /> > <a href='login.php'>Go Back</a>"; } print <<<OUT </td> </tr> </table></td> </tr> <tr> <td><img src='images/spacer.gif' alt='' width='30' height='25'></td> </tr> <tr> <td style='background-image:url(images/homepage13.jpg); height:40px;'><table width='181' border='0' cellspacing='0' cellpadding='0'> <tr> <td width='15'><img src='images/spacer.gif' alt='' width='26' height='40'></td> <td width='166' class='text2'><h2></h2></td> </tr> </table></td> </tr> <tr> <td><img src='images/spacer.gif' alt='' width='30' height='25'></td> </tr> <tr> <td><table width='535' border='0' align='center' cellpadding='0' cellspacing='0'> <tr> <td width='218'><p class='text2'> </td> </table></td> </tr> </table> <br> <br></td> <td width='180'><table width='180' border='0' cellspacing='0' cellpadding='0'> <tr> <td width='180' style='background-image:url(images/homepage20.jpg); height:40px;'><table width='180' border='0' cellpadding='0' cellspacing='0'> <tr> <td width='15'><img src='images/spacer.gif' alt='' width='15' height='40'></td> <td width='166' class='text2'>$sitelog</td> </tr> </table></td> </tr> <tr> <td><form action='authenticate.php' method='post' name='login' onsubmit='return saveme();' > <table width='155' border='0' align='center' cellpadding='0' cellspacing='0'> <tr> <td colspan='2'> </td> </tr> <tr> <td colspan='2' class='text1' style='height:25px;'>$usname</td> </tr> <tr> <td colspan='2'><input type='text' name='username' style='background-color:transparent;'></td> </tr> <tr> <td colspan='2' class='text1' style='height:25px;'>$passv</td> </tr> <tr> <td colspan='2'><input type='password' name='password' style='background-color:transparent;'></td> </tr> <tr> <td colspan='2'> </td> </tr> <tr> <td width='115'><a href='forgot_password.php'>$passfg</a> </td> <td width='43' align='center'><input type='submit' value='$login' align='right' ></td> </tr> <tr> <td colspan='2'> <br /><br /></td> </tr> </table> </form> </td> </tr> </table> <table width='180' border='0' cellspacing='0' cellpadding='0'> <tr> <td width='180' style='background-image:url(images/homepage20.jpg); height:40px;'><table width='180' border='0' cellpadding='0' cellspacing='0'> <tr> <td width='15'><img src='images/spacer.gif' alt='' width='15' height='40'></td> <td width='165' class='text2'>$gameinfo</td> </tr></td> </table></td> </table> <table width='180' border='0' cellspacing='0' cellpadding='0'> <tr> <br /> <style type='text/css'> .style1 { text-align: center; } </style> <div class='style1'> $players $membs <br> $mal $male <br> $fems $fem</div> <br /> <center> <img src='and.png' height='20' width='20'> Get our Android App <img src='and.png' height='20' width='20'> <br /> <a href='http://www.appsgeyser.com/getwidget/WorldWars'><img src='android.png'></a> </center> </td></tr> </table></td> </tr> </table></td> </tr> <tr> <td> </td> </tr> <tr> <td class='style2' style='height:40px;'> </td> </tr> </table></td> </tr> </table> <table width='982' border='0' align='center' cellpadding='0' cellspacing='0'> <tr> <td class='style2'><i><center>World-Wars. Game Copyright ©2011-2012 Peter Greenacre.({$db->num_queries}) queries. </center></i></td> </tr> <tr> <td class='style2'> </td> </tr> <tr> <td class='style2'> </td> </tr> <tr> <td class='style2'> </td> </tr> </table> <td colspan="3 <div class='dotted_faded_box_home'>"> <table cellpadding="0" cellspacing="0" border="0" width="100%"> <tr> <div class='dotted_faded_box_home'> <td class="dgradl"> </td> <td class="dgrad"><center><strong> <td class="dgradr"> <div class='dotted_faded_box_home'></td> </tr> </table> </td> </tr> </table> </div> </div> </div> </div> </body> </html> </body> </html> EOF; OUT; ?> Quote
G7470 Posted October 1, 2014 Posted October 1, 2014 This is the line that I'm interested in: $i=$db->insert_id(); Could you post the code for this function? That's probably where the problem lies. ~G7470 Quote
peterisgb Posted October 1, 2014 Author Posted October 1, 2014 This is the line that I'm interested in: $i=$db->insert_id(); Could you post the code for this function? That's probably where the problem lies. ~G7470 Erm.... Get a copy of a default mccodes v2. go to register.php and go to line 288. default line of code Quote
G7470 Posted October 1, 2014 Posted October 1, 2014 That's not what I asked. I'll try to explain it differently...I am looking for the definition of the function insert_id. That function definition could help explain what the problem is with the code. The mysql function that I am looking for in this definition is something similar to this: mysql_insert_id() If you don't know what mysql_insert_id is, here's a link of reference: http://php.net/manual/en/function.mysql-insert-id.php Hopefully that makes more sense. ~G7470 Quote
peterisgb Posted October 1, 2014 Author Posted October 1, 2014 oh, i dont know where i would find that, its default system that i dont touch lol. Quote
lucky3809 Posted October 1, 2014 Posted October 1, 2014 Doesn't the variables need brackets?? Your insert query: $db->query("INSERT INTO referals VALUES('$ia', {$_POST['ref']}, $i, unix_timestamp(),'{$r['lastip']}','$IP')"); $ia, and I believe $i,$IP need those brackets {} or '".$ia." '".$i."' ... maybe I am wrong, but it needs to tell what is the variable. I am quite tired in this response lol. Quote
KyleMassacre Posted October 2, 2014 Posted October 2, 2014 Move your $i = $db->insert_id(); up a couple of lines and see if that works. The docs for it says that it grabs the id of the last query and there are 2 queries before calling that variable. Quote
G7470 Posted October 2, 2014 Posted October 2, 2014 Doesn't the variables need brackets?? Your insert query: $db->query("INSERT INTO referals VALUES('$ia', {$_POST['ref']}, $i, unix_timestamp(),'{$r['lastip']}','$IP')"); $ia, and I believe $i,$IP need those brackets {} or '".$ia." '".$i."' ... maybe I am wrong, but it needs to tell what is the variable. I am quite tired in this response lol. Lol not necessarily. All depends on the quotes and how the query is structured. $IP may cause some problems (if this was customized), but other than that variable, I'm pretty sure it would all work. Move your $i = $db->insert_id(); up a couple of lines and see if that works. The docs for it says that it grabs the id of the last query and there are 2 queries before calling that variable. Agreed with Kyle. Surprised I didn't even notice that despite the fact that I even got the reference of what it did right lol. Give his suggestion a try. ~G7470 Quote
peterisgb Posted October 2, 2014 Author Posted October 2, 2014 ok that works. thanks. strange on how it worked well anf fine for 4 years and then to stop working lol. thanks for the help guys 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.