Jump to content
Old threads will finally start getting archived ×

rachwilbraham

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Everything posted by rachwilbraham

  1. Hi! I have been baffled by this for at least an hour and a half now and I think I could do with some help! Basically, I have a registration form that inserts data into a mysql table then sends an email (with PEAR mail) with an activation code to the email address provided, then should redirect to another page when this process is completed, either to a 'success' page if the email is sent or an 'error' page if the email is not sent. At the moment the data is being inserted to the mysql table, but then the email is not being sent and I get the '404 Page Not Found' error for the ORIGINAL web address, not the redirect. I'm completely stumped! Here's the code: $md5pass = md5($_POST['pass2']); $activ_code = rand(10000,99999); $server = $_SERVER['HTTP_HOST']; $host = ereg_replace('www.','',$server); mysql_select_db($database, $connection); mysql_query("INSERT INTO users (`email`,`password`,`country`,`joined`,`activation_code`,`fname`,`lname`,`title`,`type`,`telephone`,`company`,`position`) VALUES ('$_POST[email]','$md5pass','$_POST[country]',now(),'$activ_code','$_POST[first_name]','$_POST[last_name]','$_POST[title]','4','$_POST[telephone]','$_POST[company]','$_POST[position]')") or die(mysql_error()); $message = "Thank you for registering an account with $server. Here are the login details...\n\n User Email: $_POST[email] \n Password: $_POST[pass2] \n Activation Code: $activ_code \n ____________________________________________ *** ACTIVATION LINK ***** \n Activation Link: http://$server/activate.php?usr=$_POST[email]&code=$activ_code \n\n _____________________________________________ Thank you. This is an automated response. PLEASE DO NOT REPLY. "; include_once "c:\php\PEAR\Mail.php"; $from = "email"; $to = $_POST['email']; $subject = "Registration Activation Code"; $body = $message; $host = "IP ADDRESS"; $username = "username"; $password = "password"; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) { header ( "Location: registrationerror.php"); //echo("<p>" . $mail->getMessage() . "</p>Failed"); } else { header ( "Location: registrationsuccess.php"); //echo("<p>Message successfully sent!</p>"); } I really appreciate any ideas on this one!! Thanks!
  2. Sorry I should have said - that was actually my original attempt. I then added the datesep variable afterwards as I thought that might make a difference....it didn't!
  3. Hi, I'm taking form variables and joining the string together to enter it as a date in a mysql table. My dates should look like 2009-03-23 in the mysql table. I've written the following code but it keeps giving me the year minus the month minus the day....sorry for being really dumb about this but how do i make sure the separator is recognised as text??? Thanks!! $datesep = "-"; $dob = ($_POST['BirthYear'].$datesep.$_POST['BirthMonth'].$datesep.$_POST['BirthDay']);
  4. OMG we can't believe its actually that simple!!! You wouldn't believe it but me n the boss have been trying to figure that out all day!!!! (we're in england....its nearly going home time!) Thank you so so so so so so much!!!! Our saviour!!! Lol!
  5. definitely agree with the bold text comment - its a bit too much when used on all the page text...but both nice sites... :)
  6. Hello! We are using a cookie (written in javascript and url encoded and decoded) to store form variables so that when the page is reloaded we can keep the form variables. We are having a problem with the email address field - the cookie only returns the email address up to the @ symbol and we have narrowed it down to the regexp function.... ??? if (func == 'read') { if (thisCookie != '') { var myregexp = new RegExp(nameQuery + '([\\w]*)'); var match = myregexp.exec(thisCookie); if (match != null && match.length > 1 && match[1] != '') { return match[1]; } } return null; } } Can anyone help?! Thanks in advance!
  7. Hello! I am currently writing a page that displays a list of records from a database and gives the option to delete a record. When the delete button is clicked a pop up window (called with Javascript) is opened to confirm the delete. On the confirm button we need to have the record deleted via the mySQL statement, then we need to close the pop up window and refresh the main page so that the site visitor can see that the record has been deleted from the list. Currently I can do either or, but not both!!! The delete query runs fine, but as soon as I add the javascript function to the button the delete query won't run! The javascript I am using is (in the head tags): <script type="text/javascript"> function refreshmain() { window.opener.location.href=window.opener.location.href; // refresh the main page window.opener.focus(); // focus on the main page window.close(); // close the popup page } </script> And on the button: <input type="submit" name="Confirm" id="Confirm" value="Confirm" <?php echo ("onclick=\javascript:refreshmain()"); ?> /> Does anyone know if I can add a bit of code into the php on the button to say run the delete query first, then call the javascript function?? Thanks!! ???
  8. Thank you! Problem sorted.... we had to use $filename1 = basename($_FILES['userfile']['name']); Thanks for your help!
  9. Hello everyone! I am creating an upload file form, and I need to be able to get the file name only (without the directory path) to update the image name field in my mySQL database. I'm doing this in dreamweaver cs4, just in case that makes any difference! Also, the database connections are all fine - we have tested that using a simple text input to update the database. ('userfile'=the form field where the user browses for the file / types in the directory path & file name) So far we have this...: if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "upload")) { $filename = $_FILES['userfile']; echo $filename; $slashpos = strrpos($filename,"\\"); echo $slashpos; $filename = substr($filename,($slashpos+1), strlen($filename)-($slashpos+1)); echo $filename; $updateSQL = sprintf("UPDATE rach230209 SET IMAGENAME=$filename WHERE PRODUCTID=%s", GetSQLValueString($_POST['PRODUCTID'], "int")); mysql_select_db($database_interdevdev, $interdevdev); $Result1 = mysql_query($updateSQL, $interdevdev) or die(mysql_error()); } Can anyone tell me where I am going wrong here?!?! The file is uploading no problem, but no text is going into my database!!! All help is appreciated!!!
×
×
  • 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.