Jump to content

kellyalan

Members
  • Posts

    29
  • Joined

  • Last visited

Everything posted by kellyalan

  1. I figured that might be the case.... Any good references for php code writers would be appreciated, we're in Southern California.
  2. Thanks for the information. I have a small understanding of how the PHP works but I think we'll have to have the code evaluated by a php expert and possibly update the whole site.
  3. Hello We have a testing site where users create a profile then take an aptitude test. Was working fine several months ago but we're trying to set up tests now and when the user enters their information and hits submit, we get these errors. (first it was the white screen, then I turned on the errors and received this) Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in ~/inc/connect.inc.php on line 11 Notice: Undefined variable: i_price in ~/profile-2.inc.php on line 97 Fatal error: Call to undefined function session_register() in ~/profile-2.inc.php on line 101 I'm assuming the Fatal Error is what's causing the profile not to be set up(and thus get the white screen). The code in profile-2 is: # Create new record: $now = time(); $password_name = random_password(PASS_LENGTH); $password_hash = bin2hex(mhash(MHASH_MD5, $password_name)); $i_qry2 = db_qry("INSERT INTO reports(createdate,passhash,fname,lname,age,gender,sport,loc,phone,address1,address2,city,state,zip,email,price) VALUES ($now,'$password_hash','$f_firstname','$f_lastname',$f_age,$f_gender,'$f_sport','$f_loc','$f_phone','$f_address1','$f_address2','$f_city','$f_state','$f_zip','$f_email','$i_price')") or die("Error: profile-2, SQL request error #2 ".mysql_error()); $i_sid = mysql_insert_id($sql_link); # Register SID in session: session_register('r_id'); <<<<this is line 101 $_SESSION['r_id'] = $i_sid; session_register('r_pass'); $_SESSION['r_pass'] = ''; session_register('r_ccode'); $_SESSION['r_ccode'] = stripslashes($f_ccode); Does anyone have a suggestion on what might be the problem and how I go about fixing it? Thanks in advance.
  4. Sorry - here we go - some of this has come to light as the day progressed(I wasn't at the testing).... First issue was that we had 2 ipads so 2 people were taking the test at a time. Wordpress, after multiple logins and logouts from the same IP addresses, gave us a "spambot" alert - from the Jetpak plugin - so in the future, we'll use it as private browsing and in the meantime, have deactivated the Jetpak setting. We seem ok on that issue now. Multiple users can log into our site and they can go to the testing center. Second, in the backend - all PHP coded / not wordpress - we had our first 2 athletes simultaneously take the test - it worked, we got a PDF output with the athlete's test results. The next two athletes tried - one test worked, one test didn't. We can't figure out why one took and one didn't. Maybe user, error maybe not but everything we've gone over today indicated that this person took the test correctly and submitted correctly. The application doesn't crash, it simply seems to have only worked(registered all of the answers to the test and then output a pdf and an HTML version) 3/4 of the time. Ultimately, I'd like to locate someone who, since the code is from 2004, can look it over and give us an indication if we're out of date and if there might be anything we can do to modernize the process. Maybe PHP hasn't changed significantly in the 12 years since our test's inception but better to be safe than sorry. The site is http://manofsteelesports.com/home/ I've attached an small image of the output that the test provides us(as admins). We can show it in HTML format for the user, we can display it as a PDF, we can download it, or we can email to the user.
  5. Normally we do this test with one athlete at a time. However, recently we had 8 members of a team try to do it at once.
  6. Thanks for the reply. Do you have a suggestion for posting the code and/or hiring someone to take a quick look to see what might be the issue? (fingers crossed that it's a quick fix) There are a lot of php pages that come together to make the questionnaire/test.
  7. Hi We had an online aptitude test written for us back in 2004/2005. A user registers on our site then can take a test that evaluates what type of learner they are. After they complete the test, we can send them a .pdf report. The front end of our site is a wordpress site, the testing center is written in php. Once a user registers, they get a link on our site that sends them out of wordpress to the PHP testing pages. Question: if we have 4-5 users sign up at once ( which isn't a problem in wordpress ), is there a way to allow for those users to take the aptitude test all at once. As of now, the "testing center" part of our site is only allowing 1 user at a time. Is this how PHP works? Is it the hosting server? We are hosted by Network Solutions. The test is around 120 questions long and 3 pages. Thanks in advance.
  8. I used the above code but had to change the variable to $i and it seems to work. Huge thanks! I was worried I'd break the theme and our site would go down if I tried this on my own. Set up in a child theme. <div class="occult" > <!-- TEST this is where the specialities boxes link is <a <?php echo colors('a');?> href="<?php echo $slice[$i]['link']; ?>" class="link" ></a> --> <!-- This is the added in code to link specialities to web pages, NOT to classes - remove to set theme back to original --> <?php echo '<a ' . colors('a'); if($i ==0) { echo ' href="https://www.absolutept.com/tendinopathy/" class="link"></a>'; } elseif($i==1) { echo ' href="https://www.absolutept.com/back-pain/" class="link"></a>'; } elseif($i==2) { echo ' href="https://www.absolutept.com/senior-fall-prevention-program/" class="link"></a>'; } else { echo ' href="https://www.absolutept.com/post-surgical-rehabilitation/" class="link"></a>'; } ?> </div>
  9. thanks for the replies cyber - I'll try out your code today - appreciate the guidance
  10. Hello - I hope I explain this clearly... I have some php code that presently displays 4 boxes in a row with images. When you click on a box/image, you go to a web post. The code goes to the bottom, sets the link, then loops back for the next image and repeats the process. What I'm trying to do is break this code apart so that that I can make each image go to a different link - basically set it up as html - image with link to a page. ( 4 of these) However, I don't want to break the code or the page that it displays ( our home page ) Here's the code snippet: <div id="new-classes" class="carousel slide"> <!-- Wrapper for slides ufff--> <div class="carousel-inner"> <?php $pieces=array_chunk($gallery,4); $j=0; foreach ($pieces as $slice) { echo '<div class="item '; if($j==0){echo 'active';} echo '">'; foreach ($slice as $i => $conte) { ?> <div class="col-sm-6 col-md-3" > <div class="new-class" > <img src="<?php echo $slice[$i]['image']; ?>" alt="//" /> <div class="class-title" > <div class="occult" > TEST this is where the specialities boxes link is <a <?php echo colors('a');?> href="<?php echo $slice[$i]['link']; ?>" class="link" ></a> I duplicated the above line and put in a specific link but it makes all the images go to the same page <a <?php echo colors('a');?> href="https://www.absolutept.com/tendinopathy/" class="link" ></a> --> </div> <h3 <?php echo colors('h3');?>><?php echo $slice[$i]['title']; ?></h3> <p <?php echo colors('p');?> class="occult" ><?php echo wp_trim_words(insert_br($slice[$i]['desc']),10,'...'); ?></p> </div> </div> </div> <?php } //end slice echo '</div>'; $j++; } // end pieces ?> </div> our homepage is absolutept.com -- these images are the "specialties" section 3/4 of the way down In the theme( wordpress) - there's an option to enter specialties ( custom post type ) which we did but we don't want these links to go to those special posts, we want them to go to the pages that the user can find in the main menu I know this is breaking the set up of the theme but if it's doable, we'd like to try First - any idea if it's doable and if so, thoughts on how? =) Thanks in advance.
  11. on a follow up to this -- I've set up an AOL acct and a Gmail acct -- the email and .pdf attachment comes in perfectly through AOL but on Gmail, the .pdf get stripped into a MIME/text format -- is there a way to code the php to prevent this? I'm assuming the pdf is getting caught as spam (??)
  12. thanks for that -- it helped // I'm 90% there - now to do 4-5 test runs and I think I'm done
  13. follow up question: I'm using this code to go into the database to grab the email of our client if($i_qry1) { if($i_rec1=mysql_fetch_array($i_qry1)) { $i_email = $i_rec1["email"]; then I'm changing the email address to $to variable $to = $i_email; everything seems to work(message says sent successfully) except that the email never arrives if I replace $i_email with my personal email to test, it works -- am I writing this code incorrectly?
  14. thanks -- one more step done, got the email to go through - now I just need to set up the mail parameter to send to the correct email addresses // really appreciate the help
  15. Thanks for the code -- I have the PDF being created correctly but still not getting the email sent and the attachment working if (mail($to, $subject, $message, $headers)) { echo "<p>The email was sent.</p>"; -- the message does show up in my browser that the email was sent but it never shows up in my email box This is the code for grabbing the .pdf file from the folder and converting it into a variable right? $fileatt = "SQL.pdf";
  16. regarding the mail calls/function: @mail($i_email, ' Sports - Your Report', $i_message, $i_headers); >>> sends to client @mail('null@sight2k.com', 'Sports - Your Report', "ID - $i_get_sid", $i_headers); >>> sends to us to confirm and yes, the email shows up but the PDF, instead of arriving as an attachment, it arrives in binary so far I've taken out the @ symbol / decided to change Content-Type: APPLICATION/PDF; name=\"report.pdf\" to Content-Type: application/octet-stream; name=\"report.pdf\" (thought it might help but no luck ), still arrives as binary
  17. at some point, there must have been edits or changes to the code that resulted in it not working correctly but unfortunately, I don't know what those changes were. I have the feeling that it's a small correction but just don't know how to narrow the problem down
  18. do you mean this? --$i_boundary Content-Type: APPLICATION/PDF; name=\"report.pdf\" Content-transfer-encoding: base64 Content-Disposition: attachment; filename=\"report.pdf\" $data {$i_boundary}-- not sure - I didn't write the code, just trying to fix our issue =) -- should it be like this: --{$i_boundary and the ending be $i_boundary}-- as far as using PEAR, I'll look into it but I always seem to run into an issue since I'm including a .php file where the data is converted to the .pdf -- I'm not actually including a .pdf
  19. Hi - we're trying to attach a .pdf to an email and mail it to a client - not working -- here's the code - l'll highlight what I think I understand... =) I've inherited this php project and I'm in no way a PHP person though I can usually do minor fixes -- this is beyond me however. The owner of the site said that up until a year ago, this code was working. ps - I've tried incorporating swiftmailer and phpmailer but don't know how to configure those using this password verifying code and an "include" that's not a .pdf question - is this code fixable and if so, how? <?php orange = goes to database, verifies passwords, that the report was paid for, etc - oks access and sets the "to" email address as $i_email $i_get_sid = isset($_GET["sid"]) ? (int)$_GET["sid"] : $i_sid; $i_get_pass = isset($_GET["a"]) ? $_GET["a"] : $_SESSION['r_pass']; $i_get_pass = addslashes($i_get_pass); $i_qry1 = db_qry("SELECT * FROM reports WHERE sid={$i_get_sid} AND ispurchased=1 AND isenabled=1 AND passhash='$i_get_pass'") or die("Error: report-4, SQL request error #1 ".mysql_error()); if($i_qry1) { if($i_rec1=mysql_fetch_array($i_qry1)) { $i_fname = $i_rec1["fname"]; $i_lname = $i_rec1["lname"]; $i_email = $i_rec1["email"]; } db_free_result($i_qry1); } blue - imports the file where the pdf is generated using FPDF, gives it the variable $data and attaches(or embeds? - not sure) to the email if(!empty($i_email)) { ob_start(); include('inc/pages/report-3.inc.php'); $data = ob_get_contents(); ob_end_clean(); $data = wordwrap(base64_encode($data), 72, "\n", true); $i_boundary = '----------'.bin2hex(mhash(MHASH_MD5, time())); $i_headers = "From: oursite.com <info@oursite.com> green - sets the content of the email message X-Mailer: oursite.com PHP Mail (v1.0) Reply-To: oursite.com <info@oursite.com> X-Priority: 3 (Normal) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary=\"$i_boundary\""; $i_message = "--$i_boundary Content-Type: text/plain; charset=\"iso-8859-1\" Content-Transfer-Encoding: 7bit Dear ".$i_fname." ".$i_lname.", Here is the report you asked for, attached as an Adobe Acrobat document. If you do not already have one, an Adobe Acrobat reader can be downloaded for free at http://www.adobe.com/. ---- Best regards, Sports Team mailto:info@oursite.com --$i_boundary Content-Type: APPLICATION/PDF; name=\"report.pdf\" Content-transfer-encoding: base64 Content-Disposition: attachment; filename=\"report.pdf\" $data {$i_boundary}-- "; shows a new message in the browser to the user saying the emails been sent @mail($i_email, ' Sports - Your Report', $i_message, $i_headers); @mail('null@sight2k.com', 'Sports - Your Report', "ID - $i_get_sid", $i_headers); } header('Content-type: text/html'); $m_header = '<link href="shared/report.css" rel=stylesheet type="text/css">'; require_once($DOCUMENT_ROOT."inc/top-2.inc.php"); $i_get_sid = isset($_GET["sid"]) ? (int)$_GET["sid"] : $i_sid; $i_get_pass = isset($_GET["a"]) ? $_GET["a"] : $_SESSION['r_pass']; $i_get_pass = addslashes($i_get_pass); echo '<table cellpadding=0 cellspacing=0 border=0 width="100%">'; echo '<tr vAlign=top><td height=7><img src="images/1x1.gif" width=1 height=7></td></tr>'; echo '<tr height=28 style="background: url(images/bookm-bg.gif) repeat-x"><td width="100%"><nobr>'; echo '<img src="images/1x1.gif" width=5 height=1><a href="report.php?sid='.$i_get_sid.'&a='.urlencode($i_get_pass).'"><img src="images/bookm-42.gif" width=67 height=28 border=0></a><a href="report.php?sid='.$i_get_sid.'&a='.urlencode($i_get_pass).'&b=pdf"><img src="images/bookm-s3.gif" width=10 height=28 border=0><img src="images/bookm-52.gif" width=65 height=28 border=0></a> <a href="report.php?sid='.$i_get_sid.'&a='.urlencode($i_get_pass).'&b=/report.pdf"><img src="images/button-downloadpdf.gif" width=80 height=28 border=0></a> <a href="report.php?sid='.$i_get_sid.'&a='.urlencode($i_get_pass).'&b=email"><img src="images/button-emailpdf.gif" width=80 height=28 border=0></a>'; echo '</nobr></td><td><nobr><font style="font-size: 10px;"><a href="javascript:window.close();">Close Window</a> </font></nobr></td></tr></table>'; echo "<p> Thank you."; echo "<p> Your report has been successfully sent."; require_once($DOCUMENT_ROOT."inc/btm-2.inc.php"); // header("location: report.php?sid=$i_get_sid&a=".urlencode($i_get_pass)); ?> >>>>>The output is this instead of an email with attachment: ------------fd755da9fdf74bb9c832b8a95272fd4b Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Dear "client", Here is the report you asked for, attached as an Adobe Acrobat document. If you do not already have one, an Adobe Acrobat reader can be downloaded for free at http://www.adobe.com/. ---- Best regards, Sports Team mailto:info@oursite.com ------------fd755da9fdf74bb9c832b8a95272fd4b Content-Type: APPLICATION/PDF; name="report.pdf" Content-transfer-encoding: base64 Content-Disposition: attachment; filename="report.pdf" JVBERi0xLjMKMyAwIG9iago8PC9UeXBlIC9QYWdlCi9QYXJlbnQgMSAwIFIKL1Jlc291cmNl cyAyIDAgUgovQ29udGVudHMgNCAwIFI+PgplbmRvYmoKNCAwIG9iago8PC9GaWx0ZXIgL0Zs YXRlRGVjb2RlIC9MZW5ndGggMzE1Pj4Kc3RyZWFtCnicdVLLTsMwELznK+YIUnHtXTuxb0BL JbghIu6hpKgoaUqSgvr3rBNCAQlbstfemdnxg3CXaOUyfCTXOeYrA2OU1sg3uMmTN1jn4jL2 .....(goes on forever)
  20. Thanks for the replies and links -- I inherited this code and wasn't quite sure why this was used
  21. Just want to get clarification on what this does and why you'd want it displayed in email output: .bin2hex(mhash(MHASH_MD5, time())) Thanks
  22. sorry - I'm not entirely sure that I'm pulling the code from the correct .php file but I hope so, here's more of the code. If I should be looking for different code verbiage, please let me know what that may be and I'll go searching again. I was assuming that the bolded code below was what was sending the report directly to the client # Check this report (id) is not ordered yet and get athlete's information: $i_qry1 = db_qry("SELECT * FROM reports WHERE sid={$i_sid} AND ispurchased=0") or die("Error: order-2, SQL request error #1 ".mysql_error()); if($i_qry1) { if($i_rec1=mysql_fetch_array($i_qry1)) { # Send a cc authorization/processing request to authorize.net: $i_result = processCC($i_get_sid, $i_rec1["price"], $i_rec1["fname"], $i_rec1["lname"], $f_ccno, $f_ccexpdate_month, $f_ccexpdate_year, $i_rec1["address1"].' '.$i_rec1["address2"], $i_rec1["city"], $i_rec1["state"], $i_rec1["zip"], $i_rec1["email"]); switch($i_result[0]) { case 1: # Set this order as completed: $i_qry3 = db_qry("UPDATE reports SET ispurchased=1 WHERE sid={$i_sid}") or die("Error: order-2, SQL request error #3 ".mysql_error()); # Request a secret hash: $i_qry4 = db_qry("SELECT passhash FROM reports WHERE sid={$i_sid}") or die("Error: order-2, SQL request error #4 ".mysql_error()); if($i_qry4) { if($i_rec4=mysql_fetch_array($i_qry4)) { $i_passhash = $i_rec4["passhash"]; # Store this hash in the session: session_register('r_pass'); $_SESSION['r_pass'] = $i_passhash; setcookie("r_pass", $_SESSION['r_pass'], time()+60*60*24*354*15); # Email the secret link to the athlete: $i_secret_url = $set_baseurl.'report.php?sid='.$i_sid.'&a='.urlencode($i_passhash); $i_headers = "From: ManOfSteeleSports.com <info@manofsteelesports.com>\nX-Mailer: ManOfSteeleSports.com PHP Mail v1.0\nReply-To: ManOfSteeleSports.com <info@manofsteelesports.com>\nX-Priority: 3 (Normal)"; $i_message = 'Dear '.stripslashes($i_rec1["fname"]).' '.stripslashes($i_rec1["lname"]).', Thank you for purchasing the Mind of Steele Sports athletes report product. Please, keep this mail safe since you might need some of the information at a later time, and read the following sections of it carefully. To access your report at our site, please click on this link: '.$i_secret_url.' <a href="'.$i_secret_url.'">AOL users click here</a> Feel free to contact us at any time with questions; we will be happy to serve you. ---- Best regards, The Man of Steele Sports Team info@manofsteelesports.com'; @mail($i_rec1["email"], 'Man of Steele Sports - Thank You', $i_message, $i_headers); # Display page with the report link: include_once($DOCUMENT_ROOT."inc/top.inc.php"); echo '<h2>Thank you for your order!</h2>'; echo '<p>Thank you for your order from the <span class=mos>Man of Steele Sports</span> company!'; echo '<p>We value you as a customer and look forward to serving you again in the near future.'; echo '<p><a href="'.$i_secret_url.'" target=_blank><img src="images/view-report.gif" width=124 height=31 border=0></a>'; include_once($DOCUMENT_ROOT."inc/btm.inc.php"); } db_free_result($i_qry4); }
  23. Hi Prior to a few months ago, when a user hit the final submit button on our site (fitness testing) - the athlete's report (actually an email with a link to view their results) would be automatically be emailed to them and we'd also get an email confirming the test was taken. Now, we still get the confirmation email but the athlete doesn't receive an email. I've located this code and am wondering if there's additional code we need to add to get the process working again: # Email the secret link to the athlete: $i_secret_url = $set_baseurl.'report.php?sid='.$i_sid.'&a='.urlencode($i_passhash); $i_headers = "From: ManOfSteeleSports.com <info@manofsteelesports.com>\nX-Mailer: ManOfSteeleSports.com PHP Mail v1.0\nReply-To: ManOfSteeleSports.com <info@manofsteelesports.com>\nX-Priority: 3 (Normal)"; $i_message = 'Dear '.stripslashes($i_rec1["fname"]).' '.stripslashes($i_rec1["lname"]).', Thanks for the advice in advance!
  24. nevermind! Yes -- found it -- HUGE thanks for the help
  25. Thanks for the reply -- I tested it also by adding these to a test html page and uploading it -- however, do you have any advice as to how to find the original file that brings this report together to display it in the browser? I've downloaded the entire file, searched for embed and body - nothing is coming up. Isn't there one file that brings all of the pieces together? For example - here's the test page http://manofsteelesports.com/nonjphp/test-pdf.html here's the "real" page - http://manofsteelesports.com/nonjphp/report.php?sid=128&a=d728d31d84495231a61b35d1ad7ccdcd&b=pdf Really appreciate your help!
×
×
  • 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.