03-08-2014, 10:50 PM
|
#2
|
|
• الانـتـسـاب » Jan 2013
|
• رقـم العـضـويـة » 109373
|
• المشـــاركـات » 2,821
|
• الـدولـة » الجيزه )))))))) kOMNDA (((((((((((
|
• الـهـوايـة » مساعده الاعضاء واحترام الاخرين
|
• اسـم الـسـيـرفـر » Private Server
|
• الـجـنـس » Male
|
• نقـاط التقييم » 51
|
|
|
reset statues points php
كود PHP:
<?php
//check that the user is logged if(!isset($_SESSION)){ session_start(); } if (isset($_SESSION['name'])) { $userID = $_SESSION['name']; } else { echo "<script>location.href='index.php'</script>"; die; } //makesure that the the variable char is present if(!isset($_GET["char"])){ echo "<script>location.href='controlpanel.php'</script>"; die; }
/************************************* *convert a date in the format AAAA-MM-DD *into numbers of days passed from 2000-01-01 *************************************/ function date2int($end) {
$start="2000-01-01"; $start_ts = strtotime($start); $end_ts = strtotime($end); $diff = $end_ts - $start_ts;
return round($diff / 86400); }
$titulo="Reset your status points"; require_once("./modules/include/Config.php"); require_once("./modules/include/sqlConn.php"); require_once("./modules/include/Security.php"); $check = new security(); $message = null; if($check->is_secure($_GET['char']) == false) $message[] = ""; if(count($message) > 0) { // char isnt safe echo "<script>location.href='index.php'</script>"; die; } mssql_select_db($dbName1, $dbConn) or die ("Couln't select database $dbName1"); //select the JID from this account $getUserJID = mssql_query("select * from TB_User where StrUserID = '".$_SESSION["name"]."'"); while ($row = mssql_fetch_array($getUserJID)) { $userJID = $row['JID']; //$userGM = $row['sec_content']; } mssql_select_db($dbName2, $dbConn) or die ("Couln't select database $dbName2"); //check that the char belong to te logged account $getCharID = mssql_query("select * from _User where UserJID = '$userJID'"); $charnumeros=0; while ($row = mssql_fetch_array($getCharID)) { $charID2 = $row['CharID']; if($charID2==$_GET['char']){ $charnumeros++; } } if($charnumeros==0){ echo "<script>location.href='index.php'</script>"; die; } //select char informations needed to reset $getCharInfos = mssql_query("select * from _Char where CharID = ".$_GET['char']); while ($row2 = mssql_fetch_array($getCharInfos)) { $charName = $row2['CharName16']; $charLevel = $row2['CurLevel']; } $erro=""; $reset = ($charLevel-1)+20; $remainStats = ($charLevel-1)*3; if($_GET["r"]=="true"){ //hoje it's the date from the present day $hoje=date2int(date("Y-m-d")); //does this char already made a reset sometime? $jaDeu=mssql_num_rows(mssql_query("select * from _Char_Reset where char_id='".$_GET['char']."'")); if($jaDeu>0){ //this is not the first time so let's know when it was $quandoDeu=mssql_query("select * from _Char_Reset where char_id='".$_GET['char']."'"); while ($row = mssql_fetch_array($quandoDeu)) { $charLastReset = $row['last_reset']; } //how much days ago? (today - last reset) $passaram=$hoje-$charLastReset;
//if already 7 days passed update else you must wait if($passaram>6){ mssql_query("update _Char_Reset set last_reset='$hoje' where char_id='".$_GET['char']."'"); }else{ $erro="You must wait ".(7-$passaram)." days to reset $charName again"; } }else{ //insert that today this char made a reset mssql_query("insert into _Char_Reset (char_id,last_reset) values ('".$_GET['char']."','$hoje')"); }
if($erro==""){ //here we make the reset itself if no errors occur $conteudo="<br><br><br><p align='center'><font color='#2ed900'>$charName's Status Points were reseted.</font></p>"; mssql_query("update _Char set Strength=$reset, Intellect=$reset, RemainStatPoint=$remainStats where CharID = ".$_GET['char']); }else{ $conteudo="<br><br><br><br><br><p align='center'><font color='red'>$erro</font></p>"; } }else{ //here we have a confirmation if the player is sure he want to make the reset $conteudo="<br><br><br><p align='center'>Are you sure you want to reset $charName's Status Points?</p><p align='center'>Remember that you can only reset it again after 7 days</font>"; $conteudo=$conteudo."<br><br><p align='center'><a href=\"reset.php?char=".$_GET["char"]."&r=true\"><img src=\"styles/img/cp/reset.png\" alt=\"\" border=\"0\"></a></p>"; } include("theme.php");
واحد بس كل 7 ايام
___
PHP Code for Changing Password
كود PHP:
<?php session_start(); include 'dbconfig.php';
$username = $_POST['username']; $password = $_POST['password']; $newpassword = $_POST['newpassword']; $confirmnewpassword = $_POST['confirmnewpassword']; $result = mysql_query("SELECT password FROM user_info WHERE user_id='$username'"); if(!$result) { echo "The username you entered does not exist"; } else if($password!= mysql_result($result, 0)) { echo "You entered an incorrect password"; } if($newpassword=$confirmnewpassword) $sql=mysql_query("UPDATE user_info SET password='$newpassword' where
user_id='$username'"); if($sql) { echo "Congratulations You have successfully changed your password"; } else { echo "Passwords do not match"; } ?>
|
|
|