Jump to content

djs1

Members
  • Posts

    15
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

djs1's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks for the reply. I'm able to use curl to get the data of a webpage, however, the GUI is only available through an IP Address. I'm having trouble with this. Here's the code I'm using: // Check for cURL if( !function_exists( 'curl_init' ) ) die( 'cURL is not installed.' ); // Create a cURL resource handler (cURL Handler = ch) $c = curl_init(); // Set options $c = curl_init('http://192.168.1.xx/u/r/l'); curl_exec($c); $output = curl_exec( $c ); curl_close( $c ); echo $output; Any ideas why this is returning a blank page? Thanks
  2. Hello, I'm working on a project where I would like to load the contents of one webpage (that I'm not hosting) into a webpage that I am hosting with the ability to access the DOM of the non-hosted page. What I would like to do is load a different page (GUI for an internal system) within my own webpage, and then be able to select elements within the GUI using jQuery and add CSS styling to them. I figured iframes would be the easiest way to handle this, but then learned about the Same Origin Policy, which denies access to the DOM of a non-hosted page in the iframe. So then I tried using a PHP Include statement to load the GUI within my page. I've run in to 2 roadblocks with this method: The first is that when I tested this method using google.com as the included site, as soon as you click on a link, it takes you outside of my site and on to google. I'll definitely need the ability for users to click around within the GUI but still remain within my site. The 2nd issue I'm having is simply including the GUI since it's web address is an IP Address. I keep getting the following error: Warning: include() [function.include]: Failed opening 'http://192.168.1.xx' for inclusion (include_path='.:/usr/local/lib/php') in /home1/public_html/example.com/example.php. If anyone has any advice as to whether it's possible to acheive this, I'd love to hear some feedback. Maybe PHP isn't even the answer. Maybe I'm going about this all wrong. I'm definitely open to any suggestions at this point! Thanks for reading, DJS
  3. Well, I finally got this working, and I figured I would post the answer, in hopes that it may be able to help someone else out there... function call_submit() { opener.document.estimator_form.item_price_1.value=document.child.prods.options[document.child.prods.selectedIndex].id window.opener.calculator(); self.close(); } Thanks!
  4. Thanks for the response. So my price text box contains the following event - onchange="calculator()". I took your advice and tried the following within the child window, but it still didn't trigger the onchange event. function call_submit() { opener.document.estimator_form.item_price_1.value=document.child.prods.options[document.child.prods.selectedIndex].id function calculator () { // function here } self.close(); } And within the calculator function I tried changing all instances of "document.getElementById" to "opener.document.getElementById". And like I said, neither way worked. Is this what you meant for me to do, or did I misunderstand?
  5. Hello, I'm working on a quote generator and I'm running into an issue with onChange events not firing when a text field is dynamically populated via a child window. Here's my setup: I have 3 text boxes (quantity, price, markup) that are multiplied together in order to give the total of that product. Each text box has an onChange event, that calls an external javascript file, which handles the multiplication and instantly updates the total of that product. Up to this point, everything works fine - - when I manually edit any of the 3 inputs, the total updates correctly. However, my problem is that I now have the "price" text box being dynamically populated, and when it updates it is not firing the onChange event attached to it. The text box is being filled by way of launching a child window and running the following code within it: function call_submit() { opener.document.estimator_form.item_price_1.value=document.child.prods.options[document.child.prods.selectedIndex].id self.close(); } So, as of right now, the following is happening - - I launch the child window, I select the product to add to the quote, the child window closes and the price is correctly populated within the "price" text box, BUT the total stays at zero. If I manually edit any of the fields, it then catches back up and properly updates the total. Is their any way to fire the onChange event at the time when the text field is populated from the child window? Any help would be appreciated. Thanks in advance.
  6. Hello, The code below allows a user to add new rows to a table, however I'm struggling with how to set a maximum limit on how many rows the user can add. I've tried to create a "while" loop, but haven't had any success. The ultimate goal is not only to limit the number of rows, but also to gray out, or change the class of the "add a row" link, so that the user is aware that they've reached the maximum limit. Can anyone show me what needs to be added to accomplish this? Thanks in advance! JavaScript Code of the Function: var next_row_index=2; function products_add_row() { var next_row_index,clone_row,clone,children,i,element,id,element_tbody;next_row_index=next_row_index;clone_row=document.getElementById('clone_row'); clone=clone_row.cloneNode(true); clone.id='products_row_'+next_row_index; clone.style.display=''; children=clone.getElementsByTagName('*'); for(i=0;i<children.length;i++) { element=children[i]; id=element.getAttribute("id"); if(id=='product_field') { element.id='product_field_'+next_row_index; element.setAttribute("name",'product_field_'+next_row_index); element.value='Add Product'; element.style.display='inline'; } } element_tbody=document.getElementById('products_tbody'); element_tbody.appendChild(clone); next_row_index++; } Code for the link that Creates the New Row: <a href="#" id="add_product" title="Add a New Product" class="add-product" onclick="products_add_row();return false;">Add a New Product</a>
  7. Hello, I'm trying to send an HTML formatted email when a user submits a form on my website. I've tested the email with several webmail applications and also with Apple's Mail.app and it works perfectly. The only place I'm having trouble is with MS Outlook (both 2003 and 2007). When the email is viewed in Outlook, I see the raw HTML code preceded with the following header info - "Content-type:text/html;charset=iso-8859-1". I've searched online and on this board for solutions and have tried them all, but I'm still having no luck. I've even directly copied and pasted other people's code, that they claim is working for them, and I still have no luck in Outlook, so there must be something I'm missing here. Can anyone shed some light on this for me or find a problem in my code below? Thanks! Dave <?php // ASSEMBLE HEADERS $to = "info@mydomain.com"; $subject = "Subject"; $headers = "From: $email\r\n"; $headers .= "Reply-To: $email\r\n"; $headers .= "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; // E-MAIL BODY $message = " <html> <body> <p> test </p> </body> </html> "; // CONFIRMATION MESSAGE if ( mail($to,$subject,$message,$headers) ) { echo "Thank you, your information has been submitted. You will be contacted shortly."; } else { echo "The email has failed! Please Resubmit your information. If this problem persists, please contact us at info@mydomain.com "; } ?>
  8. Great idea! I updated my SQL query, based on your suggestion, and I'm now getting the correct data populating the table... however, this part of the code: echo '<td>'.$row_Recordset1['pdfDocDetails'].'</td><td>'.$row_Recordset1['MarkerForFavourite'].'</td>'; is populating 2 times for each row. any idea why? Thanks!
  9. Thank you both for getting back to me. Here's my current code and more details on what I'm trying to accomplish: <?php session_start(); $user = $_SESSION['_amember_user']; $userlogin = $user[login]; $title = $_GET['title']; ?> <?php require_once('../../Connections/xxxxxx.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } // GET Video Info $colname_Recordset1 = "-1"; if (isset($_GET['location'])) { $colname_Recordset1 = $_GET['location']; } mysql_select_db($database_dsxpro, $dsxpro); $query_Recordset1 = sprintf("SELECT * FROM tutorials WHERE location = %s ORDER BY type, description ASC", GetSQLValueString($colname_Recordset1, "text")); $Recordset1 = mysql_query($query_Recordset1, $dsxpro) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); // GET PDF Files mysql_select_db($database_dsxpro, $dsxpro); $query_Recordset2 = sprintf("SELECT * FROM pdf WHERE video_id = ".$row_Recordset1['filename'].""; $Recordset2 = mysql_query($query_Recordset2, $dsxpro) or die(mysql_error()); $row_Recordset2 = mysql_fetch_assoc($Recordset2); $totalRows_Recordset2 = mysql_num_rows($Recordset2); // GET Favorites determined by Session Username $colname_Favorites = "-1"; if (isset($user)) { $colname_Favorites = $userlogin; } mysql_select_db($database_dsxpro, $dsxpro); $query_Favorites = sprintf("SELECT * FROM favorites WHERE username = %s", GetSQLValueString($colname_Favorites, "text")); $Favorites = mysql_query($query_Favorites, $dsxpro) or die(mysql_error()); $row_Favorites = mysql_fetch_assoc($Favorites); $totalRows_Favorites = mysql_num_rows($Favorites); //Clean up Description $searchArray = array("SA","UF", "PP", "TS", "FX", "FAX", "HD"); //REPLACE WITH $replaceArray = array(" "," ", " ", " ", " ", " ", " "); //Toggle Table Row Color $toggle=0; $tdtoggle = $toggle?'odd':'even'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title><?php echo $title;?></title> <style type="text/css"> <!-- Body { Background: transparent; } --> </style> <link href="css/mem.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="mainpage"> <div id="mainpage_content"> <h1><?php echo $title;?></h1> <?php echo $about; //Open table print("<br /><table width='515' border='0' cellpadding='0' cellspacing='0'> <tr width='515'><td> title placeholder </td></tr>"); // Begin Repeating Recordset do { if(isset($row_Recordset1['filename'])) { ?> <tr class="<?php echo $toggle?'odd':'even';$toggle = !$toggle; ?>"> <td colspan="4" width="515"> <!-- Video Type / Description [Populating from RECORDSET 1] --> <div id="videolisting"> <div id="vidinfo"> <a class="<?php echo $row_Recordset1['type']; ?>" href="videoplayer/videoplayer.php?filename=<?php echo $row_Recordset1['filename']; ?>&description=<?php echo $row_Recordset1['description']; ?>&type=<?php echo $row_Recordset1['type']; ?>&location=<?php echo $row_Recordset1['location']; ?>" target="_blank"><?php print str_replace($searchArray, $replaceArray, $row_Recordset1['description']); ?></a> </div> <!-- If User has Already Added this Video to their Favorites, Update Icon Here [Populating from FAVORITES] --> <!-- If Tutorial has an Accompanying PDF, Link Here [Populating from RECORDSET2] --> So up to this point the "Recordset1" Query is pulling Video titles from the Tutorials Database ... The 'Recordset2' Query is selecting PDF files whose ID matches the video name from 'Recorcordset1' ... And the "Favorites" Query is selecting only video titles that match the username of the logged in user. What I'm trying to add next is here within the "Recordset1" Repeating Recordset Loop: <div id="pdf"> If a PDF exists, print "something" else "print something else" </div> <div id="fav"> If a video title from the "Favorites" Query matches a video title from the "Recordset1" Query, print "something", else print "something else". </div> </div> </td> </tr> <?php }else break; } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?> That's where I'm getting lost. Any suggestions? Thanks!!
  10. I'm still very new to PHP, and running in to a problem when trying to execute a do/while loop inside another one. What I'm trying to achieve is that I want to display all of the records in one table that match my SQL Query defined as 'Recordset1'. And, while that is happening, I want to cross-reference my records in a 2nd table, and if the description in Table 2 Matches the Description in Table 1, print a results message right next to the description from 'Recordset1'. My problem isn't setting up the SQL queries - I'm currently able to get the correct results returned to me, as long as I print the results in a separate table... my problem is getting the results message to print RIGHT NEXT TO the results of 'Recordset1', because the 'Recordset1' results are inside of do/while loop. There is probably a very simple solution to this, and there's a good possibility that I'm approaching this the wrong way... I just can't wrap my head around it yet... If anyone has any input, it would be very appreciated! Thanks! -d. <?php do { if(isset($row_Recordset1['description'])) { ?> <tr> <td> <?php echo $row_Recordset1['description']?> <?php do{ $R1 = $row_Recordset1['description']; $R2 = $row_Recordset2['description']; if ($R1== $R2) { print("It's a Match<br />"); } else print("No Match<br />") }while ----????????????? ---- ?> </td> </tr> <?php }else break; } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
  11. No, you were correct, the flow of my process didn't make sense... and I appreciate you laying it out for me so that I could see the error for myself. What I didn't realize is that I could insert a value ( ie. $under_filename ) into the database without actually having a form field for it. That's why I was trying to force a hidden value. I did what you recommended and it's working properly now. Thanks for the help! -d
  12. Ok, thank you! ... you just got me one step closer! By moving my code above the mysql insert statement, the string replacement is at least successfully working... However, the string replaced result I'm getting is for the previous record. In other words, each time i enter data into the form, the database updates with the previous form's info. the result is always one behind. any suggestions? here's my code: Above mysql insert statement: <?php $description = str_replace("_"," ",$_POST['filename']); ?> Hidden Form Field: <input type="hidden" name="description" id="description" value="<?php echo $description; ?>"> thanks again!
  13. Hello, I'm pretty new to PHP, and I've successfully performed a string replacement when calling information FROM the DB... however, I'm curious if it's possible to perform a string replacement on a piece of information as it's being entered INTO the DB? example: I have a form with a text field called "filename", in which all of the words typed into it will be separated by underscores. So I'd like to have a hidden form field which says 'take the value of "filename" and perform a string replacement on it which strips out the underscores'. This way I'll have an underscored version AND a non-underscored version in the database. Is this possible? Thanks in advance! -d
  14. Thanks for getting back to me David. You were right, that snippet of code revealed a ton of errors that I was getting but unaware of. Now, I believe I followed your instructions correctly, and I tried a couple different variations of editing the code but I'm still receiving 2 emails at the admin address. Can you please take another look and see if I'm on the right track... <?php error_reporting(E_ALL); ini_set('display_errors', 1); //PULL DATABASE COMMANDS $f_name = $_REQUEST['f_name']; $l_name = $_REQUEST['l_name']; $email = $_REQUEST['email'] ; //HEADERS FOR BOTH EMAILS function send_email($from, $to, $subject, $message){ $headers = "From: ".$from."\r\n"; $headers .= "Reply-To: ".$from."\r\n"; $headers .= "Return-Path: ".$from."\r\n"; $headers .= "Content-type: text/html\r\n"; //SETUP USER EMAIL COMMANDS if (mail($to,$subject,$message,$headers) ) { echo "user email sent"; } else { echo "user email couldn't be sent"; } } //USER EMAIL $subject = "Subject"; $message = " <html> <head> <title> </title> </head> <body> <p>Thank you $f_name, </br></br> body</p> </body> </html> "; send_email("info@website.com", "$email", $subject , $message); //ADMIN EMAIL $subject = "subject"; $message = " <html> <head> <title> </title> </head> <body> <p>body</p> <table> <tr> <th>Name:</th> <td>$f_name $l_name</td> </tr> </table> </body> </html> "; send_email("info@website.com", "admin's address", $subject , $message); ?>
  15. Hello Everyone, I'm brand new to PHP, and have been doing a lot of searching, but just can't seem to figure out what I'm doing wrong. I found the code below online and edited it to fit my needs, which is to send 2 emails after a new user has created an account on our site. - One email goes to the new user and the 2nd one goes to the site admin. Now, the emails are successfully being sent, however the Admin receives 2 emails simultaneously. The first is correct, while the 2nd one is missing any database driven information. Lastly, when the new user form is submitted, the following string shows along the bottom of the "Thank You" page (where the email code is stored): "user email couldn't be sentadmin email couldn't be sentuser email sentadmin email couldn't be sent" If anyone can please tell me what I'm doing wrong, and how to eliminate the 2nd Admin Email from being sent, as well as that string of text, it would be appreciated! Or if I'm going about this the complete wrong way, I'm open to any suggestions on how to clean up this code. Thanks in advance! dave. - - - - - - - - - - - - - - - - - - - - - - - - <?php //PULL DATABASE COMMANDS $f_name = $_REQUEST['f_name']; $l_name = $_REQUEST['l_name']; $email = $_REQUEST['email'] ; //HEADERS FOR BOTH EMAILS function send_email($from, $to, $subject, $message){ $headers = "From: ".$from."\r\n"; $headers .= "Reply-To: ".$from."\r\n"; $headers .= "Return-Path: ".$from."\r\n"; $headers .= "Content-type: text/html\r\n"; //SETUP USER EMAIL COMMANDS if (mail($to,$subject,$message,$headers) ) { echo "user email sent"; } else { echo "user email couldn't be sent"; } //SETUP ADMIN EMAIL COMMANDS if (mail($admin_to,$admin_subject,$admin_message,$headers) ) { echo "admin email sent"; } else { echo "admin email couldn't be sent"; } } //USER EMAIL $subject = "Your Account Has Been Created"; $message = " <html> <head> <title> </title> </head> <body> <p>Thank you $f_name, </br></br> Body of email here.</p> </body> </html> "; send_email("info@website.com", "$email", $subject , $message); //ADMIN EMAIL $admin_subject = "A New Account Has Been Created"; $admin_message = " <html> <head> <title> </title> </head> <body> <p>Body of email here.</p> <table> <tr> <th>Name:</th> <td>$f_name $l_name</td> </tr> </table> </body> </html> "; send_email("info@website.com", "admin's email address", $admin_subject , $admin_message); ?>
×
×
  • 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.