Jump to content

mamaomphile

New Members
  • Posts

    5
  • Joined

  • Last visited

mamaomphile's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Because i have been trying everything and still not winning when i decided to come up with the coding above, my simple code was: <form action="forgotPsw.php" method="post"> Enter you Email Address: <input type="text" name="email"> <input type="submit" name="submit" value="Send"> </form> <?php error_reporting(0); $email=$_POST['email']; if($_POST['submit']=='Send') { require_once "dba/dba.php"; mysql_connect($svr, $dba, $pwd) or die(mysql_error); mysql_select_db($dbt); $query="select * from usertest where user_email='$email'"; $result=mysql_query($query) or die(error); if(mysql_num_rows($result)){ echo "User exist ----"; }else{ echo "No user exist with this email address----"; } if(mysql_num_rows($result)){ $code=rand(100,999); $message="You activation link is: http://10.10.200.250/cmsintranet/forgotPsw.php?email=$email&code=$code"; mail($email, "Subject Goes Here", $message); echo "Email sent"; }else{ echo "Email not sent"; } } ?> but still not working
  2. <form action="forgotPsw.php" method="post"> Enter you Email Address: <input type="text" name="email"> <input type="submit" name="submit" value="Send"> </form> With this code am trying to send an email using mail function, which is not doing that and with no errors displaying, so i cant really figure out what is the problem since its updating the database giving the write echo statements but the email is not going through? please assist me <?php error_reporting(0); $email=$_POST['email']; if($_POST['submit']=='Send') { require_once "my database"; mysql_connect($svr, $dba, $pwd) or die(mysql_error); mysql_select_db($dbt); $query="select * from users where Email='$email'"; $result=mysql_query($query) or die(error); // checks if the username is in use if(mysql_num_rows($result)){ echo "User exist ----"; }else{ echo "No user exist with this email address----"; } if(mysql_num_rows($result)){ //$code=rand(100,999); //$message="You activation link is: http://10.10.200.250/cmsintranet/forgotPsw.php?email=$email&code=$code"; //mail($email, "Activation link", $message); //send email $mail->Mailer = "smtp"; $mail->Host = "my host"; $mail->Port = 25; $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "i used an email address"; // SMTP username $mail->Password = "psw to the email"; // SMTP password //create a new random password $password = substr(md5(uniqid(rand(),1)),3,10); $pass = md5($password); //encrypted version for database entry $to = "$email"; $subject = "Account Details Recovery"; $body = "Hi $r->username, nn you or someone else have requested your account details. nn Here is your account information please keep this as you may need this at a later stage. nnYour username is $r->username nn your password is $password nn Your password has been reset please login and change your password to something more rememberable.nn Regards Site Admin"; $additionalheaders = "From: <email.......>rn"; mail($to, $subject, $body, $additionalheaders); //update database $sql = mysql_query("UPDATE users SET u_password='$pass' WHERE Email = '$email'")or die (mysql_error()); $rsent = true; //show any errors if (!empty($error)){ $i = 0; while ($i < count($error)){ //echo "<div class="msg-error">".$error[$i]."</div>"; $i ++; } } if ($rsent == true){ echo "<p>You have been sent an email with your account details to $email</p>"; } else { echo "<p>Please enter your e-mail address. You will receive a new password via e-mail.</p>"; } //echo "Email sent"; }else{ echo "Email not sent"; } } ?>
  3. The permissions are set on my server but still not working and with no errors, i even tested the upload code on my server and the code works just fine the problem comes once i call it on the Form, am not sure what to do anymore. my from looks like this: <h3 id="menu_head">Adding Gallery</h3> <form name="gallery" action="index.php?m=galleries&sm=newgallery&d=add" method="post"> <table id="form_table" align="center" width="60%"> <tr> <td>Gallery Name:</td><td><input type="text" name="name" size="50" style="width:240px;"></td> </tr> <tr> <td colspan="2"><br><strong>Description:</strong></td> </tr> <tr> <td colspan="2"><textarea name="content" cols="40" size="50" rows="5" style="width:500px; height:150px;"></textarea></td> </tr> <tr> <td colspan="2" align="left"> <?php include $_SERVER['DOCUMENT_ROOT']."/cmsintranet/testing.php"; ?> </td> </tr> </table> </form>
  4. Good Day need help, been trying this for so long now, i have a code for move_upload_file() it works very fine when i test the page alone but once i put it on the form on my website it doesnt work? here is my code - upload_file.php : <?php error_reporting(E_ALL); $allowedExts = array("gif", "jpeg", "jpg", "jpe", "png", "pjpeg", "x-png"); $allowedMimeTypes = array( 'application/msword','text/pdf','image/gif','image/jpeg','image/png'); $temp = explode(".", $_FILES["file"]["name"]); $extension = end($temp); if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/jpg") || ($_FILES["file"]["type"] == "image/jpe") || ($_FILES["file"]["type"] == "image/pjpeg") || ($_FILES["file"]["type"] == "image/x-png") || ($_FILES["file"]["type"] == "image/png")) && ($_FILES["file"]["size"] < 500000) && in_array($extension, $allowedExts)) { if ($_FILES["file"]["error"] > 0) { echo "Error: " . $_FILES["file"]["error"] . "<br>"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br>"; echo "Type: " . $_FILES["file"]["type"] . "<br>"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>"; echo "Stored in: " . $_FILES["file"]["tmp_name"]; if (file_exists("Images/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { chmod ("Images/", 0775); if (copy($_FILES["file"]["tmp_name"],"Images/" . $_FILES["file"]["name"])) { move_uploaded_file($_FILES["file"]["tmp_name"],"Images/" . $_FILES["file"]["name"]); echo "Stored in: " . "Images/" . $_FILES["file"]["name"]; } } } } else { echo "Invalid file"; } ?> Inside my form i have this link <?php include "/cmsintranet/testing.php"; ?> that is calling a testing.php page which looks like this: <html> <body> <form action="upload_file.php" method="post" enctype="multipart/form-data"> <label for="file">Filename:</label> <input type="file" name="file" id="file"><br> <button type="reset" value="Reset">Reset</button><input type="submit" value="Submit" id=""> </form> </body> </html> Please help me out since am not sure what exactly is the problem whether its my website cos the pages works just fine?
×
×
  • 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.