Jump to content
xisto Community

SilverFox1405241541

Members
  • Content Count

    204
  • Joined

  • Last visited

Everything posted by SilverFox1405241541

  1. In this tutorial I show a JS/PHP Timer. I use ingame password resetting as an example. I did borrow the JS from another online tutorial but the rest I did on my own. It works as its the source from my pass reset mostly. <?phpif ($action == 'action1') // this is the action being performed, example: index2.php?page=passreset{// Process ID would go here. It has the user's id, and other things depending on the process. However because this is used to fetch the process from the DB it cannot have things like time or date as thy change on the next page.//checks the processes table$check1 = mysql_query("SELECT * FROM ha_processes WHERE ID_MEMBER='$id'")or die(mysql_error()); $time_to_finish =60; // time to finish the process. This can have other variables but for this example its simple.// defines the process start time, the process name and the user starting the process. This starts the process.$start = mysql_query("INSERT INTO ha_processes (ID_MEMBER, name, started, tofinish, p_id) VALUES ('$id', 'PassReset', '$now', '$time_to_finish', '$p_id')")or die(mysql_error());?>Action being performed<script language="javascript">var loadedcolor='darkgray'; // PROGRESS BAR COLORvar unloadedcolor='lightgrey'; // COLOR OF UNLOADED AREAvar bordercolor='navy'; // COLOR OF THE BORDERvar barheight=15; // HEIGHT OF PROGRESS BAR IN PIXELSvar barwidth=300; // WIDTH OF THE BAR IN PIXELSvar waitTime=<?php echo $time_to_finish; ?>; // NUMBER OF SECONDS FOR PROGRESSBAR// THE FUNCTION BELOW CONTAINS THE ACTION(S) TAKEN ONCE BAR REACHES 100%.// IF NO ACTION IS DESIRED, TAKE EVERYTHING OUT FROM BETWEEN THE CURLY BRACES ({})// PRESENTLY, IT IS SET TO DO NOTHING, BUT CAN BE CHANGED EASILY.// TO CAUSE A REDIRECT TO ANOTHER PAGE, INSERT THE FOLLOWING LINE:// document.location.href="http://redirect_page.html";// JUST CHANGE THE ACTUAL URL OF COURSE :)var action=function(){hidebar();document.location.href="index2.php?action=passresetted"; // at leaset in our pass reset example}// THE FUNCTION BELOW CONTAINS THE ACTION(S) TO TAKE PLACE IF THE USER// CLICKS THE TIMERBAR. THIS CAN BE USED TO CANCEL THE TIMERBAR.// IF YOU WISH NOTHING TO HAPPEN, SIMPLY REMOVE EVERYTHING BETWEEN THE CURLY BRACES.var clickBar=function(){}//*****************************************************////********** DO NOT EDIT BEYOND THIS POINT **********////*****************************************************//var ns4=(document.layers)?true:false;var ie4=(document.all)?true:false;var blocksize=(barwidth-2)/waitTime/10;var loaded=0;var PBouter;var PBdone;var PBbckgnd;var Pid=0;var txt='';if(ns4){txt+='<table border=0 cellpadding=0 cellspacing=0><tr><td>';txt+='<ilayer name="PBouter" visibility="hide" height="'+barheight+'" width="'+barwidth+'" onmouseup="clickBar()">';txt+='<layer width="'+barwidth+'" height="'+barheight+'" bgcolor="'+bordercolor+'" top="0" left="0"></layer>';txt+='<layer width="'+(barwidth-2)+'" height="'+(barheight-2)+'" bgcolor="'+unloadedcolor+'" top="1" left="1"></layer>';txt+='<layer name="PBdone" width="'+(barwidth-2)+'" height="'+(barheight-2)+'" bgcolor="'+loadedcolor+'" top="1" left="1"></layer>';txt+='</ilayer>';txt+='</td></tr></table>';}else{txt+='<div id="PBouter" onmouseup="clickBar()" style="position:relative; visibility:hidden; background-color:'+bordercolor+'; width:'+barwidth+'px; height:'+barheight+'px;">';txt+='<div style="position:absolute; top:1px; left:1px; width:'+(barwidth-2)+'px; height:'+(barheight-2)+'px; background-color:'+unloadedcolor+'; font-size:1px;"></div>';txt+='<div id="PBdone" style="position:absolute; top:1px; left:1px; width:0px; height:'+(barheight-2)+'px; background-color:'+loadedcolor+'; font-size:1px;"></div>';txt+='</div>';}document.write(txt);function incrCount(){loaded++;if(loaded<0)loaded=0;if(loaded>=waitTime*10){clearInterval(Pid);loaded=waitTime*10;setTimeout('action()',100);}resizeEl(PBdone, 0, blocksize*loaded, barheight-2, 0);}function hidebar(){clearInterval(Pid);if(ns4)PBouter.visibility="hide";else PBouter.style.visibility="hidden";}function findlayer(name,doc){var i,layer;for(i=0;i<doc.layers.length;i++){layer=doc.layers[i];if(layer.name==name)return layer;if(layer.document.layers.length>0)if((layer=findlayer(name,layer.document))!=null)return layer;}return null;}function progressBarInit(){PBouter=(ns4)?findlayer('PBouter',document):(ie4)?document.all['PBouter']:document.getElementById('PBouter');PBdone=(ns4)?PBouter.document.layers['PBdone']:(ie4)?document.all['PBdone']:document.getElementById('PBdone');resizeEl(PBdone,0,0,barheight-2,0);if(ns4)PBouter.visibility="show";else PBouter.style.visibility="visible";Pid=setInterval('incrCount()',95);}function resizeEl(id,t,r,b,l){if(ns4){id.clip.left=l;id.clip.top=t;id.clip.right=r;id.clip.bottom=b;}else id.style.width=r+'px';}window.onload=progressBarInit;</script><small>Total Time to execute: <code><?php echo $time_to_finish; ?> Seconds</code>.<?php}// if the JS timer finishesif ($action == 'passresetted'){p_id goes here$passg = mt_rand (100000, 100000000); // this determines the pass in this example. In other cases al the other determining this would go here.//checks the processes table$check2 = mysql_query("SELECT * FROM ha_processes WHERE ID_MEMBER='$id' AND p_id='$p_id'")or die(mysql_error()); $row2 = mysql_fetch_array($check2);// this gets the old log values. This is for ingame logs, something you probably won't need but still here.$logcheck = mysql_query("SELECT * FROM logs WHERE ID_MEMBER='$id'")or die(mysql_error());$logs = mysql_fetch_array($logcheck);$logtime = date("D M d G:m Y");$log_ent = "\[$logtime\] \[localhost\] \[reset password FROM ";$log_ent2 = "$us2[Pass] TO xxxxxxxxx\]\n";$log_add = $log_ent.$log_ent2.$logs['log'];// this determines if the time is upif ($now - $row2['started'] >= $row2['tofinish']){// this actually updates the user's account$reset2 = mysql_query("UPDATE vpcs SET Pass='$passg' WHERE ID_MEMBER='$id'")or die(mysql_error());// this sends something to the ingame logs, logging the action$logsend = mysql_query("UPDATE logs SET log='$log_add' WHERE ID_MEMBER='$id'")or die(mysql_error());// this removes teh processes from the table. this is down to save space.$reset = mysql_query("DELETE FROM ha_processes WHERE ID_MEMBER='$id' AND p_id='$p_id'") ordie(mysql_error());echo "<code>R00t</code> Password Reset from ".$us2['Pass']." to ".$passg;}}?>This took me a while to make, I hope it helps someone. you can make it as variable as you want (I have edited it to be effected by in game software, hardware, etc and have made very unique but repeatable process IDs).
  2. Download WAMP5 (google it), it has Apache 2.4, MYSQL newest, PHP 5 and phpmyadmin. Install WAMP5. Start coding. The best way to learn php is just to do it. Use the internet as a reference book for commands you don't know/understand. Start with templates/pre-made scripts and then edit them and learn. Some tips: Don't use $_COOKIE. Use $_SESSION. Its more secure. Don't use $_GET or $_POST. $_REQUEST can handle both. Don't run a Mysql query and with one variable name then assign it a new one like a lot of tutorials show, that's plain stupid. Use good variable names, instead of $time3 make it $time_to_finish, for example. Use Include statements. In any input use strip_tags() and any MYSQL user based queries use addslashes() in the input. This prevent injection. Md5 is vulnerable, therefore MD5 something about 5 times. Comment code often using //
  3. Heh I got this one person's pass last night.Its not that hard.As for Nintendo (aka XPKiller)...seems as if he's an idiot according to HellFire121 Not just did he give out his pass he never used his hosting and has let it get in the negative.I know its obvious but some people do it. I have given pass(es) to things before, but before I did i changed it to something I don't use often and was ready to change it.
  4. Lol this is so funny.I fked a site up that gave me the pass (ofc i waited a long time).If its so obvious ask nintendo why he's telling you?
  5. Depends on what you define 'dynamic' as. To me dynamic is anything that is updated. Like for example the following I would call dynamic: <?php$date = date("Y-m-d");$time = date("g:s");echo "The time is ".$time." and the date is: ".$date;?> Anything that changes, that is altered in any manner I call dynamic. So in one sense dynamic is great.
  6. Also I'd like to add:always use valid XHTML 1.0 Transitional.Ensure Cross-Client Compatibility.NEVER use an html builder.
  7. I do believe non-custom CMS have thier place. For people who don't have time, don't care to or for w/e won't make they're own. If your site is only going to be a CMS then pre-made isn't that bad.
  8. The best is one you make yourself.Its lower on Bwidth use and its custom for whatever you need.IT also is implemented into your existing db.
  9. Notepad++ is a god send. I have been using it.ITs synatx highlighting, line numbering and tree viewing its AWESOME.I recommend it to anyone, anything, any day.I'm having to code on a PC without it and is like misery.
  10. Well I finished it as of this edit. I'll post a tutorial later.
  11. I need help on how to have a mysql value as a JS var.please post any hints/tips/how to do it. I had been doing it where the JS var = php var for the db data. That's not working it seems.Cheers,Silverfox
  12. It would fix gang violence a lot I feel. However I will admit my argument was very local (specific only to Texas and California really) and holds no bearing in Australia.Remember Chesso, we're half a world apart
  13. time1 = now(); // this is the time at th beginning of the execution $result = mysql_query("SELECT * where columnid =' 1'"); // always enclose queries in (). Also for now since your a starter use * for all. $r= mysql_fetch_array($result); $timetorefresh = $r['columnname']; if ($time1 == $timetorefresh) { $query2 = ("UPDATE tablename SET manafield = maxmanavalue"); if ($query1){ echo "Mana is restored. Current mana".$manavalue."; // use echo in php } } } else {} _linenums:0'>$timenow1 = now();$time1 = now(); // this is the time at th beginning of the execution$result = mysql_query("SELECT * where columnid =' 1'"); // always enclose queries in (). Also for now since your a starter use * for all.$r= mysql_fetch_array($result);$timetorefresh = $r['columnname'];if ($time1 == $timetorefresh){$query2 = ("UPDATE tablename SET manafield = maxmanavalue"); if ($query1){ echo "Mana is restored. Current mana".$manavalue."; // use echo in php }}}else {} That code probably has errors but I hope you get the point. Also you don't need to do the changing of names from query to result or result to r. As well NEVER use $_GET, $_POST or $_COOKIE. $_REQUEST can do all those in one. The field for refresh time could be an INT. If you've figured out the JS congratz, that's half the hard part. Below are some general codes that you an edit to fit your needs (comes in handy epically with my slap job above ) $now = time('now'); $difference = intval(($now - $jdate)/86400); // is an example of comparing how many days ago someone joined. $player = mysql_query("SELECT * FROM table WHERE ID_MEMBER='$id'") or die(mysql_error()); // example for mysql query $us = mysql_fetch_array( $player ); // example for the $r thinggy but I used us. You need only show the fetch_array thing in one name no need for // $us=blah blah or $reulst=$query. linenums:0'>$jdate = $us['dateRegistered'];$now = time('now');$difference = intval(($now - $jdate)/86400);// is an example of comparing how many days ago someone joined.$player = mysql_query("SELECT * FROM table WHERE ID_MEMBER='$id'")or die(mysql_error()); // example for mysql query$us = mysql_fetch_array( $player ); // example for the $r thinggy but I used us. You need only show the fetch_array thing in one name no need for // $us=blah blah or $reulst=$query. As for qhere to place it, I can't help other than in some file that is executed as possibly an url var (like file.php?action=mana). I'll be able to help more when I finish my timer
  14. I still don't think your all getting my point...as harmful as it can be the most harmful part is the related gang and violent crime.Marijuana has killed millions via the cartels/gangs/mafias that control the trafficking. That is why I was arguing it should be legalized is it would end that.The debated I wished to have started was not over the harmfulness of Marijuana and nor was this argument about IV drugs or drugs in general. I made clear that legalization I do not feel is the way for them.My point was that the violent gang crime related to it, at least where I live, is so bad that if legalization would stop that it would be possibly justified. Not many of you can hate and dispise drugs more than I probably do. I lost my father to them, my sister as screwed her life on them and I've grown up where the gang's continually fight (but luckily I've stayed out of them). So I want to make clear that I don't support harmful drugs of any sort. But something has to stop the killings...there are too many happening everyday in America (at least in Texas) and if the cops can't (or won't do it ) then legalization would at least take the power from the gangs (true coke and others would exist still but one major one down is good).Jeigh is it not a physical chemical response that gives people th feeling they have on the drug? therefore is it not in the most technical sense physically addicting?
  15. SilverLight Rocks! I love it, can you guess why?btw if any company wants to compete with flash go ahead! Competition is good and I can't blame Microsoft for competiting its cut throat
  16. okay I'm finally going to add my first timer into the game. So I'll read it and edit this post with any feedback.Thanks.
  17. Jeigh its addicting. Talk to any long time user of it and they're agree.
  18. 1. Do any of us live in China? I rest my case. 2. The answer to things like china is forcible revolution not proxies.3. Using a German proxy won't tell you how fast from Germany as you have to connect to the proxy.4. Open proxies can do just as good. You don't need anon. proxies.5. Most people have PCs anyways at home and don't need to use their school one for anything but BS.Tor is not blocked by an ISP and if your ISP doesn't want you getting it then get a new damn ISP. If I was an ISP I would like people following my guidelines. Look at it from their point of view.In 90% of all sites proxies that are anon. are not legitimate, epically in an online browser game.
  19. @ethergeek: If yo at school you have no bussniess logging onto most websites, epically those blocked. If your at work you need to be working. As a developer of a game where multiple accounts is a big no-no I find that blocking proxies would be great and important and that there is no need for anonymous proxies unless your doing something naughty.
  20. If you need it for Comhack it'd do the job, but I'd recommend manual activation for that. Privox (cantbustme, hidemyass, 250.eu, etc) proxies almost never change so you can block them like normal IPs. As for other proxies, maybe have a script that is needed to view the site? Because most proxies block scripts.
  21. Chesso I have a python script that blocks tor...but I know you hate python B)This is something I also am interested in due to NH.
  22. ...it'd be better...python is a joke. As for the rest of your post I mostly agree I don't think you can overly copyright layouts, that's like saying a forum system with two table divisions (one for the username/date/time and one for the message) is a copyright infringement...its not. There are only so many ways to skin a cat.
  23. Lol I just read about CP/M like the day before.I just don't like the eerm..outdated nature of Unix
  24. Microsoft has always been controversial. However thier ability to always start late and yet still take over the market share is amazing. Thier ability to make programs that appeal to the general user is also good. The history of MS is intersting
  25. Lol.No judge other than one paid for would give this to MS. Hopefully apple is pulled into it like you said as Linux doesn't have the money to fight.I like Windows and Microsucks but this over the edge.
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.