Trying to design a "change password" tool. On my signup code I'm using base64_encode, now I am trying to decode it on the change password screen and having issues. Yes I am very new to this.
I keep returning a fail response with this. Help?
<?php
include("check_session.php");
include("online.php");
include("site.conf.php");
include("$base_dir/include/scTemplate.class.php");
include("$base_dir/include/timestamp.inc.php");
include("$base_dir/include/index.inc.php");
include("$base_dir/include/calendar.inc.php");
include("$base_dir/include/images.inc.php");
/****************************************************************
* open connection to mysql server *
****************************************************************/
$conn = mysql_connect($db_host, $db_user, $db_password);
mysql_select_db($db_name, $conn);
$sql = "select id from tbl_pm_message ";
$sql .= "where (id_to='$user_id') and (status='online') and
(flag='1')";
$result = mysql_query($sql);
$new_message = mysql_num_rows($result);
if (($old_password == "") || ($password1 == "") || ($password2 == "") ||
($password1 != $password2)) {
$error = "upt01";
}
else {
$old_password = base64_decode($old_password);
$password1 = base64_encode($password1);
$password2 = base64_encode($password2);
$sql = "select id from tbl_user where (id='$user_id') and
(code='$user_code') and ";
$sql .= "('$old_password') ";
$result = mysql_query($sql);
$rows = mysql_num_rows($result);
if ($rows > 0) {
$sql = "update tbl_user set ('$password1'),
status='active' ";
$sql .= "where (id='$user_id') and (code='$user_code')
";
$result = mysql_query($sql);
if ($result) {
$error = "";
}
else {
$error = "upt02";
}
}
else {
$error = "upt03";
}
}
/****************************************************************
* generate page *
****************************************************************/
$tpl = new scTemplate("$templates_dir/password_result.html");
$tpl->replace("SC_SI_BANNER", show_banner());
$tpl->replace("SC_SI_ADS", show_ads());
$tpl->replace("SC_SI_MENU", show_menu(1));
$tpl->replace("SC_SI_LOGO", show_logo());
$tpl->replace("SC_SI_RIGHTLOGO", show_rightlogo());
$tpl->replace("SC_SI_SEARCH", show_search());
$tpl->replace("SC_SI_NEWS", show_news());
$tpl->replace("SC_SI_MEMBER", show_member());
$tpl->replace("SC_SI_CALENDAR", show_calendar());
$tpl->replace("SC_SI_BOTTOM", show_bottom());
$tpl->replace("SC_SI_COPYRIGHT", show_copyright());
$tpl->replace("SC_USERNAME", $user_name);
$tpl->replace("SC_NEW", $new_message);
if ($error == "") {
$tpl->replace("SC_RESULT", "OK");
}
else {
$tpl->replace("SC_RESULT", "Failed");
}
$tpl->write();
?>
need help in php variable
i have a php variable on one pageCode: [Select]$lastId = mysql_insert_id($db);echo $lastId;i want to send this variable and the value in it to second page when i click on submit buttoni already tried
Displaying image pathname instead of image
HelloIm trying to upload and then display images from a mysql database - Its only basic and i only need one pic per user on the database hence why using mysqlI really need osme help as ive been going
Frustrated php Newbie
First off, I am pretty much a PHP nub. I can read and understand the language (most of the time) so I figured I could get this to work.So, my plan was to make a simple SQL server with a PHP bullitin
How to display value in drop down list after form has been reloaded
Please bear with me as I am very new to php and html.I have a form with several drop down menus, the one at the top shows a list that when an item is selected fills in the form below including the
BB_Code error
I'm having a problem with a custom built function and keep getting this error:Warning: Missing argument 1 for BB_Code::BB_Code(), called in /home/cra10002/public_html/mooglebook/input.php on line 21
Must be a string? Huh, what? HELP?
with the following script, I get Fatal error: Property name must be a string in /home/content/e/s/o/esone/html/test/123.php on line 24Anyone maybe know what is causing it?Code: <?phpfunction
How to validate from 2 possible answers
Hi I hope somebody can help me with what will probably be really simple, I'm pulling my hair trying to get my head round it.I've got a contact form and I would like to add to it a couple of simple
smart reading from a text file
Hello there fellow coders, i was wondering if one of you wouldnt mind helping me with this problem i seem to have hit:There is an application which i am currently coding, which writes everything that
Legal Issues for SAP ERP o ERP in general
Hi experts,
Embedding flash object in Else statement
This is my first major project in PHP and I'm having some trouble embedding a flash object in an Else statement. I've googled it several times, and looked at several sites and they all seem to