CODE NOT WORKING
Posted on
16th Feb 2014 07:03 pm by
admin
Code: [Select]<?php
//include shared codes
include '../lib/common.php';
include '../lib/db.php';
include '../lib/function.php';
include '../lib/User.php';
//construct password request for html
//ob_start();
?>
<form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>" method="post">
<P>Enter your user name .A new password wll be sent to the email address on file.</p>
<table>
<tr>
<td><label for="username">Username</label></td>
<td><input type="text" name="username" id="username" value="<?php if (isset($_POST['username'])) echo htmlspecialchars($_POST['username']); ?> "/> </td>
</tr>
<tr>
<td>
</td>
<td><input type="submit" value="Submit" /> </td>
<td><input type="hidden" value="submitted" value="1" /></td>
</tr><tr>
</tr>
</table>
</form>
<?php
//$form = ob_get_clean();
//show the form if this is the first time the page is viewed
if(!isset($_POST['submitted']))
{
$GLOBALS['TEMPLATE']['content'] = $form;
}
//otherwise process incoming data
else
{
//validate usernmae
if(User::validateUsername($_POST['usernmae']))
{
$use= User::getByUsername($_POST['usernmae']);
if(!$user->userId)
{
$GLOBALS['TEMPLATE']['content'] = '<p><strong>Sorry that account doesnot exists.</strong></p>
<p>Please try different user name</p>';
$GLOBALS['TEMPLATE']['content'] .= $form;
}
else
{
//generate a new password
$password= random_text(8);
echo $password;
//send the new password to the email address on record
$message= 'Your new password is: ' . $password;
mail($user->emailAddr, 'New password'. $message);
$GLOBALS['TEMPLATES']['content'] = '<p><strong>A new password has been emailed to you</strong></p>';
//store new password
$user->password=$password;
$user->save();
}
}
//there was invalid data
else
{
$GLOBALS['TEMPLATE']['content'] .= '<p><strong>You didnot provide a valid username</strong></p>';
$GLOBALS['TEMPLATE']['content'] .=$form;
}
}
//dsplay the page
include '../templates/template-page.php';
?>
//hi....
im getting prob with the above code it is not working.I think there is problem with ob_start(); or in $GLOBALS['TEMPLATES']['contents'].hhelp me please
No comments posted yet
Your Answer:
Login to answer
51
45
Other forums
Need Successful Return
Hello I am currently working a form here, and I have everything figured out except when I click the
How a counter of users ? such as ---> (231 Viewing)
I want to count how many users are actually viewing the page, How is that possible?
Thank you guy
Need help with a mail notify function
I was tasked with setting up a site that's been prewritten. The site is basically a form that captur
I need help with formatting date from mysql! with php!
Hello guys
*Note: this is a php question not MySQL question, please do not move it to mysql s
Conditions of info record - Error
When i created GR (901) and PO create automatic my PBXX is obtain the net price of info record but
in php, link returns to the line
When I add a link in a php page, the link word returns to the line (as a
would do)
Examp
Help =( !! Upload Pics [PHP script]
Hello
I need help with a php script [MULTIPLE UPLOAD IMAGES] , where I want to add a feature (wat
How to set pass login name from htaccess to php
When the user logs into my members page via htaccess, I'd like to retain the username so that I can
PHP Include not working
The website is http://www.grlistingservices.com
The code block is as follows:
<
add text and number image
hi guys ..
ok see i want the user to add their name and pick a number then click get it and i