modiinfo.php
PHP Code:<?php
session_start();
require("./CustomSql.inc.php");
if (!(session_is_registered("CID"))){
print "<a href=\"login.php\">$front_pleaselogin</a>";
exit;
}
$db = new CustomSQL($DBName);
$showtable = true;
$errortag = false;
if (!empty($edituser)) {
if (empty($email)){
$errortag = true;
$errormsg = $error_emailempty;
}
if ($email!=$emailretype){
$errortag = true;
$errormsg = $error_emailretypewrong;
}
if (empty($css)){
$errortag = true;
$errormsg = $error_cssempty;
}
if (!$errortag){
$db->edituser($email,$css,$icq,$aol,$yahoo,$msn,$location,$occupation,$interests,$biography,$CID);
$showtable = false;
}
}
$userinfo = $db->getuserinfobyid($CID);
$email = $userinfo[0]["email"];
$css = $userinfo[0]["css"];
$icq = $userinfo[0]["icq"];
$aol = $userinfo[0]["aol"];
$yahoo = $userinfo[0]["yahoo"];
$msn = $userinfo[0]["msn"];
$location = $userinfo[0]["location"];
$occupation = $userinfo[0]["occupation"];
$interests = $userinfo[0]["interests"];
$biography = $userinfo[0]["biography"];
?>
<html>
<head>
<title><?php print "$front_modiinfo"; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php print "$front_charset"; ?>">
<link rel="stylesheet" href="./style/style.css" type="text/css">
<script language="JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
<?php
include("top.php3");
?>
<table width="770" border="0" cellspacing="1" cellpadding="0" align="center" class="table_01">
<tr>
<td class="table_02" width="160" valign="top">
<table width="160" border="0" cellspacing="0" cellpadding="4">
<tr>
<td> </td>
</tr>
<tr>
<td valign="top"><?php include("left.php"); ?></td>
</tr>
</table>
</td>
<td class="menu" bgcolor="#FFFFFF" valign="top" width="610">
<table border="0" cellspacing="0" cellpadding="4" width="610">
<tr>
<td bgcolor="#F2F2F2" class="menu_in">::<?php print "$front_modiinfo"; ?> <font color="#FF0000">*</font> <?php print "$front_requiredinfo"; ?></td>
</tr>
<?php
if ($errortag){
?>
<tr>
<td><font color="#FF0000"><?php print "$errormsg"; ?></font></td>
</tr>
<?php
}
?>
<tr>
<td>
<?php
if ($showtable){
?>
<form action="<?php print "$PHP_SELF"; ?>" method="POST">
<table border=0 cellpadding=2 cellspacing=2>
<tr><td width="120"><?php print "$front_email"; ?> : </td><td><input type="text" name="email" value="<?php print "$email"; ?>"> <font color="#FF0000">*</font></td></tr>
<tr><td><?php print "$front_emailagain"; ?> : </td><td><input type="text" name="emailretype" value=""> <font color="#FF0000">*</font></td></tr>
<tr><td><?php print "$front_css"; ?> : </td><td><input type="text" name="css" value="<?php print "$css"; ?>"> <font color="#FF0000">*</font></td></tr>
<tr><td><?php print "$front_icq"; ?> : </td><td><input type="text" name="icq" value="<?php print "$icq"; ?>"></td></tr>
<tr><td><?php print "$front_aol"; ?> : </td><td><input type="text" name="aol" value="<?php print "$aol"; ?>"></td></tr>
<tr><td><?php print "$front_yahoo"; ?> : </td><td><input type="text" name="yahoo" value="<?php print "$yahoo"; ?>"></td></tr>
<tr><td><?php print "$front_msn"; ?> : </td><td><input type="text" name="msn" value="<?php print "$msn"; ?>"></td></tr>
<tr><td><?php print "$front_location"; ?> : </td><td><input type="text" name="location" value="<?php print "$location"; ?>"></td></tr>
<tr><td><?php print "$front_occupation"; ?> : </td><td><input type="text" name="occupation" value="<?php print "$occupation"; ?>"></td></tr>
<tr><td><?php print "$front_interests"; ?> : </td><td><input type="text" name="interests" value="<?php print "$interests"; ?>"></td></tr>
<tr><td><?php print "$front_biography"; ?> : </td><td><input type="text" name="biography" value="<?php print "$biography"; ?>"></td></tr>
<tr><td></td><td><input type="submit" name="edituser" value="<?php print "$front_modiinfo"; ?>"></td></tr>
</table>
</form>
<?php
}
else{
?>
<a href="login.php"><?php print "$front_back"; ?></a>
<?php
}
?>
</td>
</tr>
<tr>
<td align="right"> </td>
</tr>
</table>
</td>
</tr>
</table>
<?php
include("bottom.php3");
?>
</body>
</html>
CustomSql.inc.php
it's not update in database when i making change from the form..PHP Code:<?php
require("./DbSql.inc.php");
Class CustomSQL extends DBSQL
{
// the constructor
function CustomSQL($DBName = "xxx_xxx")
{
$this->DBSQL($DBName);
}
function checkid($id)
{
$sql = "select id from users where id='$id'";
$result = $this->select($sql);
return $result;
}
function adduser($id,$password,$email,$css,$icq,$aol,$yahoo,$msn,$location,$occupation,$interests,$biography)
{
$sql = "insert into users (id,password,email,css,icq,aol,yahoo,msn,location,occupation,interests,biography) values ('$id','$password','$email','$css','$icq','$aol','$yahoo','$msn','$location','$occupation','$interests','$biography')";
$result = $this->insert($sql);
return $result;
}
function logincheck($id,$password)
{
$sql = "select id from users where id='$id' and password='$password'";
$result = $this->select($sql);
if (empty($result)) {
return 0;
}else{
$CID = $result[0]["id"];
return $CID;
}
}
function checkpassword($id,$password)
{
$sql = "select password from users where password='$password' and id='$id'";
$result = $this->select($sql);
if (empty($result)) {
return 0;
}else{
$CID = $result[0]["id"];
return $CID;
}
}
function emailcheck($email)
{
$sql = "select password from users where email='$email'";
$result = $this->select($sql);
if (empty($result)) {
return 0;
}else{
$password = $result[0]["password"];
return $password;
}
}
function getuserinfobyid($id)
{
$sql = "select * from users where id='$id'";
$result = $this->select($sql);
return $result;
}
function edituser($email,$css,$icq,$aol,$yahoo,$msn,$location,$occupation,$interests,$biography)
{
$sql = "UPDATE users SET email='$email',css='$css',icq='$icq',aol='$aol',yahoo='$yahoo',msn='$msn',location='$location',occupation='$occupation',interests='$interests',biography='$biography' WHERE id='$id'";
$results = $this->update($sql);
return $results;
}
function modifypass($password,$id)
{
$sql = "update users set password='$password' where id='$id'";
$results = $this->update($sql);
return $results;
}
}
?>



Reply With Quote

Bookmarks