Jump to content

ssnavely76

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ssnavely76's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. <?php require_once('../lib/config.php'); require_once('Smarty.class.php'); require_once('Forms.class.php'); require_once('Functions.class.php'); require_once('Error.class.php'); require_once('User.class.php'); require_once('Mailer.class.php'); require_once('Utils.class.php'); require_once('HtPasswd.class.php'); if(!isset($_REQUEST['action'])){ $_REQUEST['action']='regform'; } switch ($_REQUEST['action']){ case 'edit': require_once('auth_db.php'); $ht = new HtPasswd( SITE_DOC_ROOT . '/members/.htpasswd'); $user_id = User::idFromEmail($_SERVER['PHP_AUTH_USER']); $user = new User($user_id); $smarty = new Smarty(); $smarty->compile_dir = SITE_DOC_ROOT . '/templates_c'; $smarty->assign('user', $user); $smarty->assign('has_access', $ht->isUser($_SERVER['PHP_AUTH_USER'])); $smarty->assign('states', Forms::statesArray()); $smarty->assign('countries', Forms::countriesArray()); $smarty->assign('action', 'update'); $smarty->assign('period1_active', PERIOD1_ACTIVE); $smarty->assign('period1_value', PERIOD1_VALUE); $smarty->assign('period1_interval', Forms::interval2String(PERIOD1_INTERVAL)); $smarty->assign('amount1', AMOUNT1); $smarty->assign('period2_active', PERIOD2_ACTIVE); $smarty->assign('period2_value', PERIOD2_VALUE); $smarty->assign('period2_interval', Forms::interval2String(PERIOD2_INTERVAL)); $smarty->assign('amount2', AMOUNT2); $smarty->assign('period3_value', PERIOD3_VALUE); $smarty->assign('period3_interval', Forms::interval2String(PERIOD3_INTERVAL)); $smarty->assign('amount3', AMOUNT3); $smarty->display(SITE_DOC_ROOT . '/templates/head.tpl'); $smarty->display(SITE_DOC_ROOT . '/templates/user_edit.tpl'); $smarty->display(SITE_DOC_ROOT . '/templates/foot.tpl'); break; case 'insert': $err = 0; // Clean up the passwords $_POST['user_password'] = trim($_POST['user_password']); $_POST['user_password_confirmation'] = trim($_POST['user_password_confirmation']); $user = new User(); $user->user_firstname = $_POST['user_firstname']; $user->user_lastname = $_POST['user_lastname']; $user->user_email = $_POST['user_email']; $user->user_password = $_POST['user_password']; $user->user_telephone = $_POST['user_telephone']; $user->user_fax = $_POST['user_fax']; $user->user_address = $_POST['user_address']; $user->user_address2 = $_POST['user_address2']; $user->user_city = $_POST['user_city']; $user->user_state = $_POST['user_state']; $user->user_country = $_POST['user_country']; $user->user_postcode = $_POST['user_postcode']; $msg = ''; // Validate data $err = $user->validateRegForm(); if($err > 0){ $msg .= $err>1?"Some required fields need correction":"A required field needs correction"; } if($_POST['user_password'] != $_POST['user_password_confirmation']){ $err++; $msg .= '<br />Passwords do not match'; } elseif(strlen(trim($_POST['user_password'])) < 5){ $err++; $msg .= '<br />Password is too short'; } $smarty = new Smarty(); $smarty->compile_dir = SITE_DOC_ROOT . '/templates_c'; if($err > 0){ $smarty->assign('msg', $err>1?"Some required fields need correction":"A required field needs correction"); $smarty->assign('user', $user); $smarty->assign('states', Forms::statesArray()); $smarty->assign('countries', Forms::countriesArray()); $smarty->assign('action', 'insert'); $smarty->assign('period1_active', PERIOD1_ACTIVE); $smarty->assign('period1_value', PERIOD1_VALUE); $smarty->assign('period1_interval', Forms::interval2String(PERIOD1_INTERVAL)); $smarty->assign('amount1', AMOUNT1); $smarty->assign('period2_active', PERIOD2_ACTIVE); $smarty->assign('period2_value', PERIOD2_VALUE); $smarty->assign('period2_interval', Forms::interval2String(PERIOD2_INTERVAL)); $smarty->assign('amount2', AMOUNT2); $smarty->assign('period3_value', PERIOD3_VALUE); $smarty->assign('period3_interval', Forms::interval2String(PERIOD3_INTERVAL)); $smarty->assign('amount3', AMOUNT3); $smarty->display(SITE_DOC_ROOT . '/templates/head.tpl'); $smarty->display(SITE_DOC_ROOT . '/templates/user_edit.tpl'); $smarty->display(SITE_DOC_ROOT . '/templates/foot.tpl'); exit(); } // Everything is good. Insert the user. $user->insertUser(); if($user->err_no != 0){ if($user->err_no == 1062){ $smarty->assign('msg', 'E-mail adress already registered. <a href="index.php?action=sendpw">Click here if you would like to us to email a password reminder</a>.'); $smarty->assign('user', $user); $smarty->assign('states', Forms::statesArray()); $smarty->assign('countries', Forms::countriesArray()); $smarty->assign('action', 'insert'); $smarty->assign('period1_active', PERIOD1_ACTIVE); $smarty->assign('period1_value', PERIOD1_VALUE); $smarty->assign('period1_interval', Forms::interval2String(PERIOD1_INTERVAL)); $smarty->assign('amount1', AMOUNT1); $smarty->assign('period2_active', PERIOD2_ACTIVE); $smarty->assign('period2_value', PERIOD2_VALUE); $smarty->assign('period2_interval', Forms::interval2String(PERIOD2_INTERVAL)); $smarty->assign('amount2', AMOUNT2); $smarty->assign('period3_value', PERIOD3_VALUE); $smarty->assign('period3_interval', Forms::interval2String(PERIOD3_INTERVAL)); $smarty->assign('amount3', AMOUNT3); $smarty->display(SITE_DOC_ROOT . '/templates/head.tpl'); $smarty->display(SITE_DOC_ROOT . '/templates/user_edit.tpl'); $smarty->display(SITE_DOC_ROOT . '/templates/foot.tpl'); exit(); }else{ Error::errorMsg($user->err_msg); } exit(); } // Send mail to autoresponder if(AUTORESPOND_ACTIVE != 0){ $mail = new Mailer(); $mail->from = $user->user_firstname . ' ' . $user->user_lastname . ' <' . $user->user_email . '>'; $mail->to = AUTORESPOND_TO; $mail->subject = AUTORESPOND_SUBJECT; $mail->msg = AUTORESPOND_BODY; $mail->send(); } header('Location: index.php?action=pay&user_id=' . $user->user_id. '&user_membership=' . $_POST['user_membership']); break; case 'pay': if(!isset($_REQUEST['user_id'])){ Error::errorMsg('Unable to determine user id'); } if(!isset($_REQUEST['user_membership'])){ Error::errorMsg('Unable to determine membership'); } $user = new User($_REQUEST['user_id']); $user->user_telephone = Utils::parsePhone($user->user_telephone); $smarty = new Smarty(); $smarty->compile_dir = SITE_DOC_ROOT . '/templates_c'; $smarty->assign('user', $user); $smarty->assign('action_url', PAYPAL_URL); $smarty->assign('paypal_account', PAYPAL_ACCOUNT); switch($_REQUEST['user_membership']){ case 'period1': $smarty->assign('membership_name', SITE_NAME . ' ' . PERIOD1_VALUE . ' ' . Forms::interval2String(PERIOD1_INTERVAL) . ' ' . ' Trial Membership'); $smarty->assign('membership_id', 'Period1'); break; case 'period2': $smarty->assign('membership_name', SITE_NAME . ' ' . PERIOD2_VALUE . ' ' . Forms::interval2String(PERIOD2_INTERVAL) . ' ' . ' Trial Membership'); $smarty->assign('membership_id', 'Period2'); break; case 'period3': $smarty->assign('membership_name', SITE_NAME . ' ' . PERIOD3_VALUE . ' ' . Forms::interval2String(PERIOD3_INTERVAL) . ' ' . ' Renewable Membership'); $smarty->assign('membership_id', 'Period3'); break; } $smarty->assign('a1', AMOUNT1); $smarty->assign('p1', PERIOD1_VALUE); $smarty->assign('t1', PERIOD1_INTERVAL); $smarty->assign('a2', AMOUNT2); $smarty->assign('p2', PERIOD2_VALUE); $smarty->assign('t2', PERIOD2_INTERVAL); $smarty->assign('a3', AMOUNT3); $smarty->assign('p3', PERIOD3_VALUE); $smarty->assign('t3', PERIOD3_INTERVAL); $smarty->assign('paypal_return_url', PAYPAL_RETURN_URL); $smarty->assign('paypal_cancel_url', PAYPAL_CANCEL_URL); $smarty->assign('paypal_notify_url', 'http://' . $_SERVER['HTTP_HOST'] . SITE_URL_ROOT . '/paypal/ipn.php'); $smarty->assign('paypal_icon', PAYPAL_ICON); $smarty->display(SITE_DOC_ROOT . '/templates/head.tpl'); $smarty->display(SITE_DOC_ROOT . '/templates/payment.tpl'); $smarty->display(SITE_DOC_ROOT . '/templates/foot.tpl'); break; case 'update': require_once('auth_db.php'); $err = 0; // Clean up the passwords $_POST['user_password'] = trim($_POST['user_password']); $_POST['user_password_confirmation'] = trim($_POST['user_password_confirmation']); $user_id = User::idFromEmail($_SERVER['PHP_AUTH_USER']); if($user_id < 1){ Error::errorMsg('Unable to determine user id'); } $user = new User($user_id); $old_email = $user->user_email; $user->user_firstname = $_POST['user_firstname']; $user->user_lastname = $_POST['user_lastname']; $user->user_email = $_POST['user_email']; $user->user_telephone = $_POST['user_telephone']; $user->user_fax = $_POST['user_fax']; $user->user_address = $_POST['user_address']; $user->user_address2 = $_POST['user_address2']; $user->user_city = $_POST['user_city']; $user->user_state = $_POST['user_state']; $user->user_country = $_POST['user_country']; $user->user_postcode = $_POST['user_postcode']; // Validate data $err = $user->validateRegForm(); $smarty = new Smarty(); $smarty->compile_dir = SITE_DOC_ROOT . '/templates_c'; if($err > 0){ $smarty->assign('msg', $err>1?"Some required fields need correction":"A required field needs correction"); $smarty->assign('user', $user); $smarty->assign('has_access', $ht->isUser($user->user_email)); $smarty->assign('states', Forms::statesArray()); $smarty->assign('countries', Forms::countriesArray()); $smarty->assign('action', 'update'); $smarty->assign('period1_active', PERIOD1_ACTIVE); $smarty->assign('period1_value', PERIOD1_VALUE); $smarty->assign('period1_interval', Forms::interval2String(PERIOD1_INTERVAL)); $smarty->assign('amount1', AMOUNT1); $smarty->assign('period2_active', PERIOD2_ACTIVE); $smarty->assign('period2_value', PERIOD2_VALUE); $smarty->assign('period2_interval', Forms::interval2String(PERIOD2_INTERVAL)); $smarty->assign('amount2', AMOUNT2); $smarty->assign('period3_value', PERIOD3_VALUE); $smarty->assign('period3_interval', Forms::interval2String(PERIOD3_INTERVAL)); $smarty->assign('amount3', AMOUNT3); $smarty->display(SITE_DOC_ROOT . '/templates/head.tpl'); $smarty->display(SITE_DOC_ROOT . '/templates/user_edit.tpl'); $smarty->display(SITE_DOC_ROOT . '/templates/foot.tpl'); exit(); } if($_POST['user_password']!=''){ if($_POST['user_password'] != $_POST['user_password_confirmation']){ $err = -1; } elseif(strlen(trim($_POST['user_password'])) < 5){ $err = -2; } // Passwords do not match or too short if($err < 0){ if($err == -1){ $smarty->assign('msg', 'Passwords do not match'); } else { $smarty->assign('msg', 'Password is too short'); } $smarty->assign('user', $user); $smarty->assign('has_access', $ht->isUser($user->user_email)); $smarty->assign('states', Forms::statesArray()); $smarty->assign('countries', Forms::countriesArray()); $smarty->assign('action', 'update'); $smarty->assign('period1_active', PERIOD1_ACTIVE); $smarty->assign('period1_value', PERIOD1_VALUE); $smarty->assign('period1_interval', Forms::interval2String(PERIOD1_INTERVAL)); $smarty->assign('amount1', AMOUNT1); $smarty->assign('period2_active', PERIOD2_ACTIVE); $smarty->assign('period2_value', PERIOD2_VALUE); $smarty->assign('period2_interval', Forms::interval2String(PERIOD2_INTERVAL)); $smarty->assign('amount2', AMOUNT2); $smarty->assign('period3_value', PERIOD3_VALUE); $smarty->assign('period3_interval', Forms::interval2String(PERIOD3_INTERVAL)); $smarty->assign('amount3', AMOUNT3); $smarty->display(SITE_DOC_ROOT . '/templates/head.tpl'); $smarty->display(SITE_DOC_ROOT . '/templates/user_edit.tpl'); $smarty->display(SITE_DOC_ROOT . '/templates/foot.tpl'); exit(); } $user->user_password = $_POST['user_password']; } $user->updateUser(); $ht = new HtPasswd(SITE_DOC_ROOT . '/members/.htpasswd'); if($user->err_no != 0){ if($user->err_no == 1062){ $smarty->assign('msg', 'E-mail adress already registered. <a href="index.php?action=resetpw">Click here if you would like to reset your password</a>.'); $smarty->assign('user', $user); $smarty->assign('has_access', $ht->isUser($user->user_email)); $smarty->assign('states', Forms::statesArray()); $smarty->assign('countries', Forms::countriesArray()); $smarty->assign('action', 'update'); $smarty->assign('period1_active', PERIOD1_ACTIVE); $smarty->assign('period1_value', PERIOD1_VALUE); $smarty->assign('period1_interval', Forms::interval2String(PERIOD1_INTERVAL)); $smarty->assign('amount1', AMOUNT1); $smarty->assign('period2_active', PERIOD2_ACTIVE); $smarty->assign('period2_value', PERIOD2_VALUE); $smarty->assign('period2_interval', Forms::interval2String(PERIOD2_INTERVAL)); $smarty->assign('amount2', AMOUNT2); $smarty->assign('period3_value', PERIOD3_VALUE); $smarty->assign('period3_interval', Forms::interval2String(PERIOD3_INTERVAL)); $smarty->assign('amount3', AMOUNT3); $smarty->display(SITE_DOC_ROOT . '/templates/head.tpl'); $smarty->display(SITE_DOC_ROOT . '/templates/user_edit.tpl'); $smarty->display(SITE_DOC_ROOT . '/templates/foot.tpl'); exit(); } else { Error::errorMsg($user->err_msg); exit(); } } if(!$ht->isUser($old_email)){ header('Location: index.php?action=pay&user_id=' . $user->user_id. '&user_membership=' . $_POST['user_membership']); exit(); } else { if($_POST['user_password']!=''){ $ht->deleteUser($old_email); $ht->addUser($user->user_email, $_POST['user_password']); } } Functions::redirectMsg('Registration Updated', 'index.php?action=edit'); break; case 'sendpw': $smarty = new Smarty(); $smarty->compile_dir = SITE_DOC_ROOT . '/templates_c'; if(isset($_POST['email'])){ $_POST['email'] = trim($_POST['email']); if($_POST['email']==''){ $smarty->assign('msg', 'E-mail address must not be blank'); } elseif (!$id = User::idFromEmail($_POST['email'])){ $smarty->assign('msg', 'Unknown e-mail address.'); }else{ $user = new User($id); $smarty->assign('user', $user); $msg = $smarty->fetch(SITE_DOC_ROOT . '/templates/send_pw_mail_msg.tpl'); $mail = new Mailer(); $mail->to = $user->user_firstname . ' ' . $user->user_lastname . '<' . $user->user_email . '>'; $mail->subject = 'Password reminder for ' . SITE_NAME; $mail->msg = $msg; $mail->send(); Functions::redirectMsg('Your password has been sent.<br>It should arrive in your e-mail shortly.', SITE_URL, '', 5, false); exit(); } } $smarty->display(SITE_DOC_ROOT . '/templates/head.tpl'); $smarty->display(SITE_DOC_ROOT . '/templates/send_pw.tpl'); $smarty->display(SITE_DOC_ROOT . '/templates/foot.tpl'); break; case 'regform': default: $user = new User(); $smarty = new Smarty(); $smarty->compile_dir = SITE_DOC_ROOT . '/templates_c'; $smarty->assign('user', $user); $smarty->assign('has_access', false); $smarty->assign('states', Forms::statesArray()); $smarty->assign('countries', Forms::countriesArray()); $smarty->assign('action', 'insert'); $smarty->assign('period1_active', PERIOD1_ACTIVE); $smarty->assign('period1_value', PERIOD1_VALUE); $smarty->assign('period1_interval', Forms::interval2String(PERIOD1_INTERVAL)); $smarty->assign('amount1', AMOUNT1); $smarty->assign('period2_active', PERIOD2_ACTIVE); $smarty->assign('period2_value', PERIOD2_VALUE); $smarty->assign('period2_interval', Forms::interval2String(PERIOD2_INTERVAL)); $smarty->assign('amount2', AMOUNT2); $smarty->assign('period3_value', PERIOD3_VALUE); $smarty->assign('period3_interval', Forms::interval2String(PERIOD3_INTERVAL)); $smarty->assign('amount3', AMOUNT3); $smarty->display(SITE_DOC_ROOT . '/templates/head.tpl'); $smarty->display(SITE_DOC_ROOT . '/templates/user_edit.tpl'); $smarty->display(SITE_DOC_ROOT . '/templates/foot.tpl'); break; } ?>
  2. I'm currently tring to develope a membership site but I am having an issue with my registration. Below is the error that I'm getting. Can someone please help. Thanks Error: Table 'MSMSnavely.tblUsers' doesn't exist
  3. I am having an issue with data not being sent to my email. The form works the way it should except for the data is coming up blank in my email that I recieve. This is the result from my test ------------------------------------------- E-MAIL SENT FROM http://www.domain.com Name: Phone: Email: Comments: -------------------------------------------- Below is what I have come up with. Can enyone please help ________________________________________________________________________________ Contactus.html ________________________________________________________________________________ <form method="POST" action="contact.php" onSubmit="return _CF_checkPaymentForm(this)"> <table width="300" border="0" cellpadding="0" cellspacing="0"> <tr align="left" valign="middle"> <td width="80" align="right" scope="row"><span class="bold">Name ::<br /> </span></td> <td><input name="name" type="text" id="name" onBlur="MM_validateForm('name','','R','phone','','R','email','','RisEmail');return document.MM_returnValue" size="20" /> </td> </tr> <tr align="left" valign="middle"> <td align="right" scope="row"> </td> <td> </td> </tr> <tr align="left" valign="middle"> <td align="right" scope="row"><span class="bold">Phone ::</span></td> <td><input name="phone" type="text" id="phone" size="20" /></td> </tr> <tr align="left" valign="middle"> <td width="80" align="right" scope="row"> </td> <td> </td> </tr> <tr align="left" valign="middle"> <td width="80" align="right" scope="row"><span class="bold">Email ::<br /> </span></td> <td><input name="email" type="text" id="email" size="20" /></td> </tr> </table> <table width="300" border="0" cellpadding="0" cellspacing="0"> <tr align="left" valign="middle"> <td width="80" scope="row"> </td> <td> </td> </tr> <tr align="left" valign="middle"> <td width="80" align="right" valign="top" scope="row"><span class="bold">Comments ::<br /> </span></td> <td><textarea name="comments" cols="30" rows="7" id="comments"></textarea> <br /> <br /> <input type="reset" name="Reset" value="Reset" /> <input type="submit" name="Reset2" value="Submit" /></td> </tr> </table> </form> _____________________________________________________________ contact.php _____________________________________________________________ <?php // this is the info that comes on the email when it's ok to send! $domain_url = "domain.com"; $msg = "E-MAIL SENT FROM http://www.".$domain_url . "\n"; $msg .= "Name: $name\n"; $msg .= "Phone: $phone\n"; $msg .= "Email: $email\n"; $msg .= "Comments: $comments\n"; $to = "domain.com"; $subject = $domain_url . " - Contact Us Web Form"; $mailheaders = "From: Contact Us ".$domain_url . " Web Form \n \n"; //$mailheaders .= "Reply-To: info@emailaddress.com\n\n"; mail($to, $subject, $msg, $mailheaders); header("Location: contact_thanks.htm"); ?>
  4. [quote author=hussain link=topic=99611.msg392341#msg392341 date=1152165273] check u r filename it machtes with the filename u have written in code [/quote] :D :D :D :D :D BooYa. Thanks guys I appreciate the help. The txt file was just supposed to be random stuff. I didn't realize that if I put a bunch of code in there it would try to execute it. It just says "tacos" now.
  5. [quote author=Crayon Violent link=topic=99611.msg392333#msg392333 date=1152163513] well your code should work. make sure that fileRead.txt is in the same directory as your script and it is spelled exactly the same way. btw, what do you mean by you get "nothing" ? is it completely a blank screen? [/quote] Yes completely blank. It shows the URL but the page is blank. Thanks for your effort Crayon Violent. Can anyone else help? I just can't see the content that I am requesting from the script. The page is blank. Can someone check this page to see if they can see it? http://www.onlinedoctorfind.com/Ex/Content/fileContent2.php
  6. [quote author=Crayon Violent link=topic=99611.msg392333#msg392333 date=1152163513] well your code should work. make sure that fileRead.txt is in the same directory as your script and it is spelled exactly the same way. [/quote] Its in the same directory. Do you think it could be the settings on my computer? Well its coming from GOdaddy it shouldn't be a problem should it?
  7. [quote author=Crayon Violent link=topic=99611.msg392331#msg392331 date=1152163257] repost your code, because you shouldn't be [/quote] I just uploaded it <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF"> <?php $file = 'fileRead.txt'; $fh = fopen( $file, 'r') or die('No content!'); $data = fread($fh, filesize($file)) or die('No content!'); fclose($fh); echo $data; ?> </body> </html>
  8. [quote author=Crayon Violent link=topic=99611.msg392328#msg392328 date=1152162754] $fh = fopen('$file', 'r') or die('Unable to read content!'); you have single quotes around $file this enterprets $file literally so it's trying to open a file called $file not fileread.txt  you should either use double quotes " " or no quotes at all [/quote] Okay, I took it out but still am getting the same thing.
  9. I know this might be a normal question, but its driving me crazy. I'm just learning and doing an exercise on pulling data from a .txt file. Unfortunately I cannot seem to find the problem. When I upload the script it's coming up blank instead of the content. I will try to give you as much detail as possible. 1.  I created a php file called (fileContent2.php) with the following code http://www.onlinedoctorfind.com/Ex/Content/fileContent2.php **************** <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF"> <?php $file = 'fileRead.txt'; $fh = fopen('$file', 'r') or die('Unable to read content!'); $data = fread($fh, filesize($file)) or die('Unable to read content!'); fclose($fh); echo $data; ?> </body> </html> ****************** 2. I created my .txt file http://www.onlinedoctorfind.com/Ex/Content/fileRead.txt 3. Uploaded them to my godaddy account 4. I get nothing Can anyone help? PLEEEEEEEEEEEEEEAAAAAAAAAAAAAAAAAAASSSSSSSSSSSSSSSSSSEEEEEEEEEEEEEEEEEEE
×
×
  • 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.