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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.