• +91 946005504
  • ankitagrawal.an@gmail.com

Generate Random Password and Update it


function makeRandomPassword()
{
$pass="";
$salt="abchefghjkmnpqrstuvwxyz0123456789";
srand((double)microtime()*1000000);
$i=0;
while ($i<=7) {
$num=rand()%33;
$tmp=substr($salt,$num,1);
$pass=$pass.$tmp;
$i++;

}
return $pass;
}
$random_password=makeRandomPassword();
$newpass=md5($random_password);
$sql="update table_name set password='".$newpass."' where email='".$email."'";
$sqlexecute=mysqli_query($conn,$sql);

Share on Google+Share on FacebookTweet about this on TwitterEmail this to someone

Insert form details to database and then redirect to Paypal using javascript in php

<!--insert into database-->
<?php 
if(isset($_POST['submit'])){
$email=$_POST['email'];
$amount=$_POST['amount'];
$sql = "INSERT INTO payment(emailid , pay_amount) VALUES('".$email."','".$amount."')"; 
$result=$mysqli_query($conn, $sql);
}
?>

<!--form-->
<form method="post" action="">
<input type="email" name="email">
<input type="text" name="amount">
<button name="submit">Pay</button>
<?form>

<!--paypal form-->
<form id="paypal_submit_form" action="https://www.sandbox.paypal.com/cgi-bin/webscr"  method="post">
<input type="hidden" name="add" value="1">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="yourbusinessid@b.com">
<input type="hidden" name="item_name" value="Donation">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="action" value="formaction">
<input type="hidden" name="email" id="emailid"  value="<?php echo $_POST['email'];?>" >
<input type="hidden" id="amountid" name="amount"  value="<?php echo $_POST['amount'];?>" >
</form>

<!--Javascript-->
<script type="text/javascript">
document.getElementById("paypal_submit_form").submit();
</script>
Share on Google+Share on FacebookTweet about this on TwitterEmail this to someone