Jump to content

schilly

Members
  • Posts

    870
  • Joined

  • Last visited

    Never

Everything posted by schilly

  1. Ya just post that code in your email script. <?php //get email address $email = $_GET['Email']; if($_POST){ $to = 'becca@windfallstudio.com'; $subject = "WHAT SHOULD THIS BE"; $message = "Date: $date\n\r". ............. Because you have no url set for the action of your form this will work. The other option is to assign it to a hidden variable in your form. <input type='hidden' name='var_name' value='<?=$_GET['email']?>'> then you can access it through the POST vars. $_POST['var_name'];
  2. Oh I see what you're doing now. echo '<a href="http://emailScript.php?email=' . $row['Email'] . '">'.$row['Email'].'</a>'; That will pass the email through to $_GET['email']
  3. link to your email script and pass in the id from the row. ie. echo '<a href="http://emailScript.php?id=$rowid">'.$row['Email'].'</a>'; then grab the data from the db in the email script for that row id and add it into your email form.
  4. is your php script returning a value? success: function(response){ alert( response); }
  5. Hey, I'm running into some weird issues doing cross server ajax calls with http://valums.com/ajax-upload/. The request works fine and the file uploads and saves properly but for some reason the xhr response is invalid so I get an error every time even though the json success message is returned. PHP Request Processor: <?php //check for cross server access check if($_SERVER['REQUEST_METHOD'] == 'OPTIONS' && $_SERVER['HTTP_ORIGIN'] == 'http://domain1'){ header('Access-Control-Allow-Origin: http://domain1'); header('Access-Control-Allow-Methods: POST, GET'); header('Access-Control-Allow-Headers: X-Requested-With,X-File-Name'); header('Access-Control-Allow-Credentials: true'); header('Access-Control-Max-Age: 1728000'); header("Content-Length: 0"); header("Content-Type: text/plain"); exit(); } else { //return success message echo htmlspecialchars(json_encode(array('success'=>true)), ENT_NOQUOTES); exit(); } ?> Request Headers: Yet when I look at the xhr response, the readyState is 4 meaning it's done but the status is 0 and there is no responseText. Anyone have any ideas what I can try? The response works fine if I do it on the same server. I'm guessing it has something to do with the headers but I'm really not sure. It seems like everything other than the xhr readyState is null. Anyone have anything I could try? Thanks.
  6. Ya I've lowered that to 5mins from 10mins. But how to do these connections just get left open sleeping?
  7. Where do these come from and how do they happen? Every now and then I seem to get a ton to the point where the db sometimes hits max connections. Any reasons for this? Thanks.
  8. I'm getting a ton of sleeping apache threads for httpd to the point where I get "[error] server reached MaxClients setting, consider raising the MaxClients setting" in the error log. It's causing our site to go down. The access_logs seem ok. What are the reasons for this happening? Anyone know? Thanks.
  9. What are you trying to do? I don't think you're using preg_replace properly. Is this what you want? $txt = "Bla bla bla bla bla [gls]12[/gls] bla bla bla"; $txt = preg_match("/.*\[gls\]([\d]*)\[\/gls\].*/",$txt, $matches); $content = file_get_contents('shipping_cost_u.php?id=' . $matches[1]);
  10. This pattern worked for me when I tested: /.*\[gls\]([\d]*)\[\/gls\].*/ Remember you need to escape [, ], and /
  11. Put the add rows in the person's session then read off that.
  12. Ok I switched back to my original method. Here it is: on domain2 in my header/connect file //***already called session_start() if(!isset($_SESSION['session_check_flag'])){ // // Check for GET sid Var if (isset($_GET['sid'])) { $curr_sid = session_id(); $url_sid = $_GET['sid']; //access the other session session_destroy(); session_id($url_sid); session_start(); #echo "<br>" . print_r($_SESSION, true) . "<br>"; $session_ip = $_SESSION['account']['ip']; $curr_ip = $_SERVER['REMOTE_ADDR']; #echo "<br>curr sid = $curr_sid and get sid = $url_sid<br>"; if($session_ip != $curr_ip){ //create new session and delete old one $_SESSION = array(); session_destroy(); session_start(); echo "<br>IP Mismatch - Reset Session<br>"; } else { echo "<br>IP Match - Keep Current Session<br>"; } } #echo "<br>" . print_r($_SESSION, true) . "<br>"; // Set cross domain check flag $_SESSION['session_check_flag'] = 1; } it just needs some final testing. this will only work if your domain are on the same server as the session info lies in the same area on the web server so you can access it without external calls (curl/file_get_contents).
  13. Ok I tried something similar. I'm having issues with session_id($_GET['session_id']); // load the session in my verification script from the curl or file_get_contents call. Whenever I try to set the session id the curl call times out. Not sure what the deal is. I tried setting a cookie for the curl call as well. If I load the verification URL in my browser it works fine. Pulling out hairs here.
  14. Nice. good tip. I always used mktime().
  15. Thanks Micah. I'm looking at something very similar. My domains are on the same server so I can access all the sessions from domain2 without contacting domain1 if I know the session id. I think I'm going to try out an IP verification between sessions so people can't send links to other people and grant them access.
  16. do you have any articles detailing this? i'd like to know what kind of overhead there is. Because really if you have a form with a lot of fields, some of which are allowed be empty, are you really going to add code to check all these fields for empty then assign a value to them before you assign them to a variable? Aside from any overhead that may or may not exist and may or may not be "significant", ignoring notices is a BAD idea. Retrieving a value from a variable that does not exist is, in my book, an ERROR. Taking your example: "if you have a form with a lot of fields, some of which are allowed be empty, are you really going to add code to check all these fields for empty": YES, I am going to check every field. If you do not check every field and you ignore notices, what happens when you misspell or mis-capitalize one of the field (or array element) names. You have notices turned off so the script goes on its merry way, and you do NOT get the correct results. Then you spend hours searching though the logic looking for a flaw when the problem would have been easily spotted if you had displayed AND read the errors (notices). As to assigning a value to the fields that are allowed to be empty, I don't recommend that. I use the ternary operator: $wholesale = (isset($_POST['wholesale']) ? $_POST['wholesale'] : ''); Your method makes more sense using the ternary operator but for any field I'm going to test whether it works or not regardless of whether the value is set. I've never had an issue with this breaking my scripts. I'd be more interested to know if there is significant overhead.
  17. I use to think that until I found out about the MySQL Date Time Functions: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html
  18. Why would you use PHP to do date conversion when MySQL can do it for you?
  19. why are you using sprintf without inserting any values into it?
  20. do you have any articles detailing this? i'd like to know what kind of overhead there is. Because really if you have a form with a lot of fields, some of which are allowed be empty, are you really going to add code to check all these fields for empty then assign a value to them before you assign them to a variable?
  21. turn down your error reporting. it just means there is nothing in that variable. doesn't effect your script at all. in most regular builds of php "Notice" errors aren't shown.
×
×
  • 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.