Can anyone help me in Changing Email address in CP?

Newbie Spellweaver
Joined
Nov 10, 2010
Messages
14
Reaction score
0
Code:
$account_id = stripslashes($_SESSION['user']);
$error = 0;

function valid2($word)
{
  $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@._";
  for($i=0;$i<strlen($word);$i++)
  {
    $ch = substr($word,$i,1);
  $nol = substr_count($chars,$ch);
  if($nol==0)
  {
    return true;
  }
  }
  return false;
}

$oldemail = $_POST['oldemail'];
$newemail = $_POST['newemail'];
$kodepribadi = $_POST['kodepribadi'];

if(valid2($oldemail))
{
                    echo("<script>alert('[E-Mail]Special Characters is Not Allowed'); location='javascript:history.back()'</script>");

}else if(valid2($newemail))
{
                      echo('<script language="Javascript">alert("[E-Mail]Special Characters is Not 

Allowed");location="javascript:history.back()" </script>');

}else if(valid2($kodepribadi))
{
                      echo('<script language="Javascript">alert("[NewPincode ReConfrim]Special Characters is Not 

Allowed");location="javascript:history.back()" </script>');

}else if(strlen($kodepribadi)>13)
{
                      echo('<script language="Javascript">alert("[New PinCode Reconfirm]Please Provide Only 13 Characters to Change 

PinCode");location="javascript:history.back()" </script>');

}else{
if($_POST['action']=='changeemail') {

   $error = 2;

   require("config.php");
   $account_id = stripslashes($_SESSION['user']);
   $kodepribadi = $_POST['kodepribadi'];
   $oldemail = $_POST['oldemail'];
   $newemail = $_POST['newemail'];



$oldemail = $_POST['oldemail'];
$oldemail = str_replace("'","",$oldemail);
$oldemail = str_replace(";","",$oldemail);
$oldemail = str_replace("!","",$oldemail);
$oldemail = str_replace("#","",$oldemail);
$oldemail = str_replace("$","",$oldemail);
$oldemail = str_replace("%","",$oldemail);
$oldemail = str_replace("^","",$oldemail);
$oldemail = str_replace("&","",$oldemail);
$oldemail = str_replace("*","",$oldemail);
$oldemail = str_replace("(","",$oldemail);
$oldemail = str_replace(")","",$oldemail);
$oldemail = str_replace(",","",$oldemail);
$oldemail = str_replace('"',"",$oldemail);
$oldemail = str_replace("=","",$oldemail);


$newemail = $_POST['newemail'];
$newemail = str_replace("'","",$newemail);
$newemail = str_replace(";","",$newemail);
$newemail = str_replace("!","",$newemail);
$newemail = str_replace("#","",$newemail);
$newemail = str_replace("$","",$newemail);
$newemail = str_replace("%","",$newemail);
$newemail = str_replace("^","",$newemail);
$newemail = str_replace("&","",$newemail);
$newemail = str_replace("*","",$newemail);
$newemail = str_replace("(","",$newemail);
$newemail = str_replace(")","",$newemail);
$newemail = str_replace(",","",$newemail);
$newemail = str_replace('"',"",$newemail);
$newemail = str_replace("=","",$newemail);











   echo "<div align=center>";

   $result = mssql_query ("SELECT UserName, UserPass, UserPass2, UserEmail, UserNum, UserPoint FROM UserInfo WHERE UserName = 

'$account_id' ");
   $rows=mssql_fetch_assoc($result); 
   extract($rows);

   $sandi = ($UserPass2);
   $emaillama = ($UserEmail);


if ($sandi==NULL) {
         echo '<script language="JavaScript">
      alert("Please Enter your Pincode");
      </script>';
      $error = 1;
   }

if ($oldemail==NULL) {
         echo '<script language="JavaScript">
      alert("Please Enter your E-Mail");
      </script>';
      $error = 1;
   }
if ($newemail==NULL) {
         echo '<script language="JavaScript">
      alert("Please Enter your Re-Typed New E-Mail");
      </script>';
      $error = 1;
   }

   if ($sandi!=$kodepribadi) {
         echo '<script language="JavaScript">
      alert("Typed PinCode is Incorrect");
      </script>';
      $error = 1;
   }

   if ($emaillama!=$oldemail) {
         echo '<script language="JavaScript">
      alert("Typed E-Mail is Incorrect");
      </script>';
      $error = 1;
   }

   if ((strlen($newemail)<4 ||strlen($newemail)>1000) && $newemail!="") {
         echo '<script language="JavaScript">
      alert("Type your New E-Mail Address");
      </script>';
      $error = 1;
   }

   echo "</div>";

}

if($error<2) {
   echo '<br><br><center><div style="width:546px; margin:0 0 0 10px; padding:10px; border:1px solid #484848; background:#0099CC; 

color:white; text-align:center; line-height:18px">
   Change E-Mail System.</div><br>      </tr>
   
   <form name="changeemail" action="" method="post" onsubmit="return checkform()" autocomplete="off">
      <table cellspacing=2 border=0 cellpadding=1 align=center>
         <tr>
            <td width=135 align=right>
               <font size=2> PinCode :  
            </td>
            <td>
               <div align=left>
                  <input type=password maxlength=13 name=kodepribadi tabindex="4" class="form_pay" 

style="width:150px;" />
               </div>
            </td>
         </tr>
         <tr>
            <td align=right>
               <font size=2> Old E-Mail Address :  
            </td>
            <td>
               <div align=right>
                  <input type=text maxlength=50 name=oldemail tabindex="4"  class="form_pay2" 

style="width:231px;" />
               </div>
            </td>
         </tr>
         <tr>
            <td align=right>
               <font size=2> New E-Mail Address :  
            </td>
            <td>
               <div align=right>
                  <input type=text maxlength=50 name=newemail tabindex="4"  class="form_pay2" 

style="width:231px;" />
               </div>
            </td>
         </tr>
      </table>
      <div align=center>
         <BR>
         <input type=hidden name=action value="changeemail">
         <input type=submit name=submit value="Submit" tabindex="5" class="btn2" 

style="font-size:12px;height:24px;width:70px;">
      </div>
   </form>
   
   
   ';
}

if($error==2) {

require("config.php");
$account_id = stripslashes($_SESSION['user']);
$newemail = ($newemail);

mssql_query("UPDATE RanUser.dbo.UserInfo SET UserEmail = '$newemail' WHERE UserName = '$account_id' ");

   echo '<script language="JavaScript">
      alert("Successfully Change E-Mail. Thank you.");
      </script>';
      $error = 1; quickrefresh('index.php');

}
}


?>



but it is not correctly alligned pls help me

---------- Post added at 04:00 AM ---------- Previous post was at 02:43 AM ----------

plss help me naman po...

---------- Post added at 04:02 AM ---------- Previous post was at 04:00 AM ----------

help po
 
Experienced Elementalist
Joined
Mar 25, 2010
Messages
244
Reaction score
13
try this one ...


Code:
<?php
// Edited kanashii

// 
require_once "sql_inject.php"; 
$bDestroy_session = TRUE; 
$url_redirect = 'index.php'; 
$sqlinject = new sql_inject('./log_file_sql.log',$bDestroy_session,$url_redirect);  
//

securitycheck($securitycheck);

$error = 0;

echo '

<script>
function isAlphaNumeric(value) {
	if (value.match(/^[a-zA-Z0-9]+$/)) {
		return true;
	} else {
		return false;
	}	
}

function checkform() {
	if(changeemail.kodepribadi.value=="") { 
		alert("Input Pass #2!") 
		return false; 
	}
	if(changeemail.oldemail.value=="") { 
		alert("Input Old Email!") 
		return false; 
	}
	if(changeemail.newemail.value=="") { 
		alert("Input New Email!") 
		return false; 
	}
	if(changeemail.oldemail.value==changeemail.newemail.value) { 
		alert("New Email must not same as Old Email!") 
		return false; 
	}
return true;
}
</script>
';

echopage('header', '<font color=white>Change Email</font>');

if($_POST['action']=='changeemail') {

	$error = 2;

	connectdb($CONFIG['dbdbname'], $CONFIG['dbaddress'], $CONFIG['dbuser'], $CONFIG['dbpass']);

	$kodepribadi = strtoupper(substr(md5($_POST['kodepribadi']),0,19));
	$oldemail = $_POST['oldemail'];
	$newemail = $_POST['newemail'];

	echo "<div align=center>";

	$result = mssql_query (sprintf(SELECT_USER_PASS, $_COOKIE['user']));
	$rows=mssql_fetch_assoc($result); 
	extract($rows);

	$sandi = ($UserPass2);
	$emaillama = ($UserEmail);

	if ($sandi!=$kodepribadi) {
		echo "<font color=red><Strong>Wrong Pass #2!</strong></font><p>";
		$error = 1;
	}

	if ($emaillama!=$oldemail) {
		echo "<font color=red><Strong>Wrong Old Email!</strong></font><p>";
		$error = 1;
	}

	if ((strlen($newemail)<4 ||strlen($newemail)>50) && $newemail!="") {
		echo "<font color=red><Strong>Input New Email!</strong></font><p>";
		$error = 1;
	}

	echo "</div>";

}

if($error<2) {
	echo "
	<BR>
	<form name='changeemail' action='home.php?page=changeemail' method='post' onsubmit='return checkform()' autocomplete='off'>
		<table cellspacing=2 border=0 cellpadding=1 align=center>
			<tr>
				<td width=100 align=right>
					<font size=2 color=black>PinCode :  
				</td>
				<td>
					<div align=right>
						<input type=password maxlength=16 name=kodepribadi>
					</div>
				</td>
			</tr>
			<tr>
				<td align=right>
					<font size=2 color=black>Old Email :  
				</td>
				<td>
					<div align=right>
						<input type=text maxlength=50 name=oldemail>
					</div>
				</td>
			</tr>
			<tr>
				<td align=right>
					<font size=2 color=black>New Email :  
				</td>
				<td>
					<div align=right>
						<input type=text maxlength=50 name=newemail>
					</div>
				</td>
			</tr>
		</table>
		<div align=center>
			<BR>
			<input type=hidden name=action value='changeemail'>
			<input type=submit name=submit value='   Submit   '>
		</div>
	</form>
	
	
	";
}

if($error==2) {

$newemail = ($newemail);
mssql_query(sprintf(UPDATE_EMAIL, $newemail, $UserName));

echo '
<div align=center>
<strong>Email has been successfully changed.</strong><br><br>
You will be redirected to the login page in 3 seconds or you can click <a href="logout.php">here</a>.
</div>
';
delayedrefresh('logout.php');

}

echopage('footer', '');


?>



just click like or thanks button if it is ok to you.. thanks..
 
Last edited:
Upvote 0
Newbie Spellweaver
Joined
Nov 10, 2010
Messages
14
Reaction score
0
gumagana naman po pla xa sir....
kaso ang pangit ng itsura....

see nyu po....


log in my account to see

Brilliant15 username
7847587475789 Password d po kc xa naka ayus e...
 
Upvote 0
Experienced Elementalist
Joined
Mar 25, 2010
Messages
244
Reaction score
13
please read the rules and regulation ..


max length error .

i cant enter the whole username and password .

try upload that rancp if you want ...

then ill try it to fix that ... just for free..
 
Upvote 0