Jump to content


Mr-Chidi

Member Since 20 May 2008
Offline Last Active Jul 17 2013 10:34 AM

Topics I've Started

Alert Help

02 July 2013 - 11:33 AM

Hi.
firstly, I dunno if I should post here or in php, but my issue seems to Br intertwined. I have a jQuery newsletter form and I want to add PHP validation in it. My problem is I want a jQuery pop to show if the subscription is unsuccessful.

meanwhile I have a modal window I'd like to use it with, but the problem is how to call the script as all .


thanks

What could be wrong!

18 March 2013 - 01:48 AM

Hi all,

I am going bald on this one. :confused:

I wonder what could be wrong. I could login to my local server but cant login in a live server!

 

thanks all

 

<?php



if(isset($_POST['login'])){



$tbl_name="reg_users";



// Define $myusername and $mypassword

$username=$_POST['username'];

$password=$_POST['password'];



// To protect MySQL injection

$username = stripslashes($username);

$password = stripslashes($password);

$username = mysql_real_escape_string($username);

$password = mysql_real_escape_string($password);



if($username == ''){

    echo  "<font color='red' size='-2'><b>Pls Enter User ID</b></font>";

}

if($password == ''){

    echo "<font color='red' size='-2'><b>Pls Enter Password</b></font>";

}else{

$crypt_pass = md5($password);



//check for existance of username and password

$sql="SELECT * FROM $tbl_name WHERE username='$username' and password='$crypt_pass'";

$result=mysql_query($sql);



// Mysql_num_row is counting table row

$count=mysql_num_rows($result);



// If result matched $myusername and $mypassword, table row must be 1 row

if($count==1){

    

// Register username and password and redirect to login page"

$_SESSION['username'] = $username;

$_SESSION['password'] = $password;



header("location: ../folder/filename.php");

exit();

}

else {

//if no match found, echo out error message

echo "<font color='red' size='2'><b>Invalid User ID or Password</b></font><br>";

}    }

 }

ob_end_flush();

?>

Reset Password can't login

23 February 2013 - 05:32 AM

Hi all,

Below is a code to reset forgoten password, but i do not know why i cannot login with the resetted password?

ps: echo $password is to get the echoed password so that i can login with it.

Thanks


<?php

if(isset($_POST['submit'])){
	
	
	
	$email = addslashes(htmlentities($_POST['email']));
	
	if($email == ''){
		echo "<font color='#990000'><b><center>Email field empty</center></b></font>";
	}
	elseif(!filter_var($email, FILTER_VALIDATE_EMAIL)){
		echo "<font color='#990000'><b><center>Invalid email address</center></b></font>";
	}else{
		$q = "SELECT * FROM reg_users WHERE email = '$email' AND username = '$_SESSION[uname]' AND Security_no = '$_SESSION[sec_no]'";
		$r = mysql_query($q);
		if(mysql_num_rows($r)== 1){

		// Generate a random password
		$password = "";
		$alpha = array_merge(range('a','z'), range('A','Z'), range(2,9));
		$rand_key = array_rand($alpha, 6);
		foreach ($rand_key as $curKey){
		$password .= $alpha[$curKey];
		echo $password;
}
		echo "<br><br>";
		$crypt_pass = md5($password);
				
		//update the user password
		$q = "UPDATE reg_users SET password = '$crypt_pass' WHERE email = '$email' AND Security_no = '$_SESSION[sec_no]'";
		$r = mysql_query ($q) or die('Cannot complete update');
		
		//send mail
		$to = "jamboree@yahoo.com"; //$_POST['email'];
		$from = "forgot@example.com";
		$subject = "New password";
		$msg = "You recently requested that we send you a new password for fredcom.com. Your new password is: $password.\n
				Please log in at this URL: http://localhost/login.html \n
				Then go to this address to change your password: http://localhost/changepass.php";
				
		$success = mail("$to","$subject","$msg","From: $from\r\nReply-To:webmaster@example.com");
		
		if($success){
			echo "Password have been sent to you email address";
		}
		
		}else{
			echo "<font color='#990000'><b>Sorry, no such record in our databsae</b></font>";
		}
	}

}

?>

undefined variable (random password)

19 February 2013 - 01:44 AM

Hi all.

pls what could be wrong with this code? its saying undefined variable "password".

ps, if there's a better way, pls I won't mind knowing it.

thanks

uploading metre

11 February 2013 - 07:11 AM

hi.
I know next to nothing about Javascript but I want something done and I believe its Javascript that can do it for me. I want to integrate/add an uploading metre to my PHP code, so that when a user is transferring or uploading a file, it shows/pop out the metre to indicate the percentage done.

thanks

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com