
luci2oo9
Members-
Posts
10 -
Joined
-
Last visited
luci2oo9's Achievements
Newbie (1/14)
0
Reputation
-
all problems solved. thank you all for assistance. topic can be closed / deleted.
-
i want to show all, but i have some mixed functions there, one function index() and second function transfer() that is not created... if you look at the code you will se that: function index() { if something .... print "...something"; -> and here is the transfer part, that id like to transform to function if back to function index print "...whatever"; } // end function index as you can see, if i create function transfer() this will reside inside function index () and thats no good for me. if i pull out function transfer(), after i will create it, well... don't know how to explain, but when function posting something will not post in that place, on HTML, it will post were i pulled it. can't find all words in english to explain better, damn
-
in my actual script, when player is accesing bank.php he sees on screen Deposit and Withdraw, Transfer part and the logs with Ultimile 5 transferuri (primite) & (trimise) - in english Last 5 transfers (received and sent). when player inserts amount and id in transfer part and sends the form, the bellow lines from script does not appear/post anymore (the last 5 transfers logs and the transfer part dedicated for user transfers).
-
reoptimised the transfer part: global $userid; $_POST['xferu'] = abs((int) $_POST['xferu']); $_POST['money'] = abs((int) $_POST['money']); $xferuser = $_POST['xferu']; $q=$db->query("SELECT * FROM users WHERE userid={$_POST['xferu']}"); $r=$db->fetch_row($q); if($r['userid'] != $xferuser) { print " <br /> This user doesn't exist! <br /> <br /> <a href=\"bank.php\">< Inapoi la Transferuri Bancare</a> <br /> <br /> <br /> </div> <div><img src='images/generalinfo_btm.jpg' alt='' /></div> <br /> </div> </div> </div> </div> </div> "; exit; } this is the full transfer part: "; global $userid; $_POST['xferu'] = abs((int) $_POST['xferu']); $_POST['money'] = abs((int) $_POST['money']); $xferuser = $_POST['xferu']; $q=$db->query("SELECT * FROM users WHERE userid={$_POST['xferu']}"); $r=$db->fetch_row($q); if($r['userid'] != $xferuser) { print " <br /> This user doesn't exist! <br /> <br /> <a href=\"bank.php\">< Inapoi la Transferuri Bancare</a> <br /> <br /> <br /> </div> <div><img src='images/generalinfo_btm.jpg' alt='' /></div> <br /> </div> </div> </div> </div> </div> "; exit; } if($_POST['xferu'] == $userid) { print " <br /> Nu iti poti trimite bani singur! <br /> <br /> <a href=\"bank.php\">< Inapoi la Transferuri Bancare</a> <br /> <br /> "; } else { if((int) $_POST['money']) { if($_POST['money'] > $ir['money']) { print " <br /> Nu ai atata cash disponibil!<br /> Retrage din cont suma dorita apoi reincearca transferul.<br /> <br /> <a href=\"bank.php\">< Reincearca</a> <br /> <br /> "; } else { $db->query("UPDATE users SET money=money-{$_POST['money']} WHERE userid=$userid"); $db->query("UPDATE users SET money=money+{$_POST['money']} WHERE userid=$xferuser"); print " <br /> I-ai trimis suma de \${$_POST['money']} utilizatorului cu ID-ul $xferuser. <br /> <br /> <a href=\"bank.php\">< Inapoi la Transferuri Bancare</a> <br /> <br /> "; event_add($xferuser,"Ai primit un transfer bancar de \${$_POST['money']} de la {$ir['username']}.",$c); $it=$db->query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$xferuser"); $er=$db->fetch_row($it); $db->query("INSERT INTO cashxferlogs VALUES ('', $userid, $xferuser, {$_POST['money']}, unix_timestamp(), '{$ir['lastip']}', '{$er['lastip']}')"); } } else { print " <table width=\"90%\" class=\"table\" border=\"1\"> <tr><th colspan=\"2\">Transfer Bancar intre Jucatori</th></tr> <tr> <form action='bank.php' method='post'> <td>Beneficiar:</td> <td><input type='text' STYLE='color: black; background-color: white;' name='xferu' /></td> </tr> <tr> <td>Suma:</td> <td><input type='text' STYLE='color: black; background-color: white;' name='money' /></td> </tr> <tr> <td colspan=\"2\" align=\"center\"><input type='submit' STYLE='color: black; background-color: white;' value=' Trimite ' /></td> </form> </tr> </table> <br /> <table width=\"90%\" class=\"table\" border=\"1\"> <tr> <th colspan=\"4\">Ultimile 5 Transferuri (efectuate)</th> </tr> <tr> <td width=\"190px;\"><b>Data</b></td> <td width=\"190px;\"><b>Beneficiar</b></td> <td width=\"190px;\"><b>Suma</b></td> </tr> "; $q=$db->query("SELECT cx.*,u1.username as sender, u2.username as sent FROM cashxferlogs cx LEFT JOIN users u1 ON cx.cxFROM=u1.userid LEFT JOIN users u2 ON cx.cxTO=u2.userid WHERE cx.cxFROM=$userid ORDER BY cx.cxTIME DESC LIMIT 5"); while($r=$db->fetch_row($q)) { if($r['cxFROMIP'] == $r['cxTOIP']) { $m="<span style='color:red;font-weight:800'>MULTI</span>"; } else { $m=""; } print "<tr> <td>" . date("F j, Y, g:i:s a",$r['cxTIME']) . "</td><td>{$r['sent']} [{$r['cxTO']}] </td> <td> \${$r['cxAMOUNT']}</td> </tr>"; } print " </table> "; and finally, this is the part that i want to appear permanently on the HTML output, until player inserts amount and id for transfer, action that will post in HTML the if else messages from Transfer when checking ID and that stuff: print " <table width=\"90%\" class=\"table\" border=\"1\"> <tr><th colspan=\"2\">Transfer Bancar intre Jucatori</th></tr> <tr> <form action='bank.php' method='post'> <td>Beneficiar:</td> <td><input type='text' STYLE='color: black; background-color: white;' name='xferu' /></td> </tr> <tr> <td>Suma:</td> <td><input type='text' STYLE='color: black; background-color: white;' name='money' /></td> </tr> <tr> <td colspan=\"2\" align=\"center\"><input type='submit' STYLE='color: black; background-color: white;' value=' Trimite ' /></td> </form> </tr> </table> don't know how to separate this all, to make a function... 1st problem, and 2nd problem lays down at what i said earlier - i have created this all in a function named function index() and don't know how to move function transfer() to be located outside function index() not in it. or how is the best fit for this script page anyway? thanks.
-
lucky3809, i just saw you reply now, after few minutes after resolving the issue already, and yes, you were very very close to solution i adopted. for me, it worked like this: global $db,$ir,$c,$userid; $_GET['userid'] = abs((int) $_GET['userid']); $_GET['xferu'] = abs((int) $_GET['xferu']); $_POST['xferu'] = abs((int) $_POST['xferu']); $_POST['money'] = abs((int) $_POST['money']); $xferuser = $_POST['xferu']; $q=$db->query("SELECT * FROM users WHERE userid={$_POST['xferu']}"); $r=$db->fetch_row($q); if($r['userid'] != $xferuser) { print " <br /> This user doesn't exist! <br /> <br /> <a href=\"bank.php\">< Inapoi la Transferuri Bancare</a> <br /> <br /> <br /> </div> <div><img src='images/generalinfo_btm.jpg' alt='' /></div> <br /> </div> </div> </div> </div> </div> "; exit; } now running other issue, that does not mean as functionality but as optimised code. at the top of script i have does cases with deposit/whitdraw and transfer that calls functions in my code. i want to put the above code in a function, with all other if else from Transfer section... i tried to close function index with } and do function transfer() with all conditions, but im confused because creating function Transfer here, is like creating a function in another function... how can i create this as a function in this place (in this place, i mean that the HTML code generated by PHP should be here but the function elsewhere). sorry about my english.
-
i also tried: global $db,$ir,$c,$userid; $_GET['userid'] = abs((int) $_GET['userid']); $_GET['xferu'] = abs((int) $_GET['xferu']); $_POST['xferu'] = abs((int) $_POST['xferu']); $_POST['money'] = abs((int) $_POST['money']); $xferuser = $_POST['xferu']; if($_POST['xferu'] < 1) { print " <br /> This user doesn't exist! <br /> <br /> <a href=\"bank.php\">< Inapoi la Transferuri Bancare</a> <br /> <br /> <br /> </div> <div><img src='images/generalinfo_btm.jpg' alt='' /></div> <br /> </div> </div> </div> </div> </div> "; but with no luck. were is the problem? the whole scope in this is to merge sendcash.php with bank.php, thats why im trying to fix this. also on the bank.php we will have logs for received/transmited funds. i saw this on another game and i like it... i know that it's something messed up about the form for transfer to Beneficiar also, but can't seem to find the erros.
-
Guest: mccodes v2, not ravan script... css file from ravan (for structure use). Im trying to use the clean codes from MC, almost clean... until i f***d them up.
-
Script47: i need both to check non-existant ID in db, not only if no ID inserted. Veramis: copied and tested with your modifications, result: from line 146 bellow the php does not output any other html in browser... so doesn't show da data divs/tabels bellow. I guess my problem lays not only in function that i don't know how to resolv, but in the actual form that starts at line 231. Any other ideas? Im near cutting my veins after 3 days looking into this code... only. - - - Updated - - - Script47: also, userid in this page is set by the user logged in, but i need to test the user that im transfering to... in my case, the specified xferu from the form post action.
-
Script47, i repeat, im a beginner. If someone wants to help me, it has to be done from scratch.... the function i mean, the whole process for checking the ID from the form that is dedicated for the transfer. Anyway, thanks for your clues... Peter, yes you are right, the function is called at beginning but it doesn't exist now... i had that function at line 146 as a test, among other tests, but it didn't worked for me, or something went bad and i deleted it, as the rest of the tests. I posted the whole file for someone to help me with the function, with the form and with other elements regarding "transfer". Also, i gues that positioning the function at line 146 interfered with the above function in the file... and other bugs that i saw, anyway it seems like the situation exceeds my level this time. Can you help resolving this issue please? Thanks guys.
-
Ok, i made some changes in the MCcodes v2 framework, and im stuck with a problem. I tried with !$_POST['id'] and with $db->num_rows($q)==0 but still, no luck. In my project i modified bank.php so that players can transfer directly from there to other players, also giving them the change to see logs and deposit/whitdraw money from bank. All is working perfectly, except the transfer cash scripts, because it transfers cash to non-existant users. I also tried numerous other methods, but still no luck. I belive that this is because im a really beginner in php, also. Could somebody point me with a good solution please? I really need to sort this one tiny little problem for you guys, big enormous for me. LE: problem solved.