Jump to content

please help


onthespot

Recommended Posts

it was not the echo but rather that I forgot a } at the end. Change the end of the script to this

[code=php:0]if(!$sql){
    echo 'There has been an error creating your account. Please contact the webmaster.';
}else{
    echo " Your account has now been created. You may login with the following information:<br>
<b>Login Id :</b> $loginid <br>
<b>Password</b> $password <br>";
}  
?>[/code]


Here is a login script

[code=php:0]<?php
session_start();
include ('includes/db.php');
array_pop($_POST);
if ( get_magic_quotes_gpc() ) {
    $_POST= array_map('stripslashes', $_POST);
}
$loginid= mysql_real_escape_string(trim($_POST['loginid']));
$password= mysql_real_escape_string(trim($_POST['password']));
$mdpwd= md5($password);

$sql= sprintf("SELECT COUNT(*) AS login_match FROM `login_tbl` WHERE `loginid` = '%s' AND `password`= '%s'", $loginid, $mdpwd);
$res= mysql_query($sql) or die(mysql_error());
$login_match= mysql_result($res, 0, 'login_match');

if ( $login_match == 1 ) {
    $_SESSION['loginid']= "$loginid";
    $login_id = $_SESSION['loginid'];
    echo " Welcome $login_id, you are now loged in. <a href=\"http://www.yoursite.com/yourpage.php\">Click here</a> to proceed";
   
} else {
    echo "Your password and username do not match. Please try again.";
include('your_login_form.html');//change this to your login form
// not logged in
}
?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/15442-please-help/page/2/#findComment-63380
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.