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();
?>
Track downloads' status
Hello,I need to make somehow, some system, to track whether downloads are completed or failed. I tried to make this via php.Tried to limit the connection speed for smaller downloads (to have the time
Error: SQL Syntax; Line 1
Code: <?php require "global_settings.php"; ?><title><?php echo $sitetitle; ?></title><center><style
Call to undefined function mysql_fetch_accoc()
New to php/mysql coding. What's wrong with this sequence, or am I just not seeing to obvious?Getting, "Call to undefined function mysql_fetch_accoc()" at line n, whereline n is referring to
Calander Basic Spript help
hi, just starting out with PHP and have the following script: <?php //This gets today's date $date =time () ; //This puts the day, month, and year in seperate variables $day = date('d', $date)
Help with PHP and checkboxes
I am posting this for a friend of mine, i wrote a small script for her to process her form data to an email but in testing i am having trouble getting the checkbox data to display in the email it
PHP Directory Listing Not working
Hey Guys,I need help, I tried a ton of directory listing scripts and they all don't work. Althogh the normal Apache Directory Indexing does work when you visit. The URL is
This is driving me nuts!
This insert query looks to be alright, however I get this error:QuoteYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
Sum of Values in an Array
This is probably really simple... but it's been years since I've written anything, so bare with me!I've got a MySQL database setup with a table that has multiple fields, where one is a numerical
Users and Groups with PHP Classes
Hi,I have setup what I hope to be a good working User class. Now I want to introduce group membership and group permissions. Before doing so, I have a couple of questions.Firstly, because users and
Need help in Generating Combinations
Need help generating all possible combination of names in an arrayLets say i have the following array:$names = array("jack","john","Adam","Mike");Now my goal is