Jump to content

jazzman1

Staff Alumni
  • Posts

    2,713
  • Joined

  • Last visited

  • Days Won

    12

Everything posted by jazzman1

  1. you are using an absolute path to "/TZ", but actually this directory is a part of "/home/*REMOVED*/public_html/". Use a relative or an absolute path like - "/home/*REMOVED*/public_html/TZ/v3/includes/db.php"
  2. Can you use the forum code tags next time when providing code? So, correct me if I'm wrong, but you want to use a remote database resource using your local server or ....?
  3. I amended a little jcbones's script. <?php ini_set('display_errors',1); error_reporting(-1); if(isset($_POST['email'])) { // EDIT THE 2 LINES BELOW AS REQUIRED $email_to = "mail@gmail.com"; $email_subject = "Your email subject line"; function died($error) { // your error code can go here echo "We are very sorry, but there were error(s) found with the form you submitted. "; echo "These errors appear below.<br /><br />"; echo $error."<br /><br />"; echo "Please go back and fix these errors.<br /><br />"; die(); } // validation expected data exists if((!isset($_POST['first_name']) || $_POST['first_name'] == '') || (!isset($_POST['email']) || $_POST['email'] == '')) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } $first_name = $_POST['first_name']; // required $email_from = $_POST['email']; // required $error_message = ""; $email_exp = '~^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,4})$~'; if(!preg_match($email_exp,$email_from)) { $error_message .= 'The Email Address you entered does not appear to be valid.<br />'; } $string_exp = "/^[A-Za-z .'-]+$/"; if(!preg_match($string_exp,$first_name)) { $error_message .= 'The First Name you entered does not appear to be valid.<br />'; } $email_message = "Form details below.\n\n"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_message .= "First Name: ".clean_string($first_name)."\n"; $email_message .= "Email: ".clean_string($email_from)."\n"; // create email headers $headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); if(!$error_message){ if(mail($email_to, $email_subject, $email_message, $headers)) { echo "Thank you for contacting us. We will be in touch with you very soon."; } else { echo "ERROR: Message failed."; } } else { echo $error_message; exit; } }
  4. Cpanel running by a regular user ( by default ) gets effected only onto the user/public_html home directory not to entire system. You need to go there to check, what happens.The easiest way for you is just to create a file for instance - phpinfo.php with phpinfo() function in it, open it up in your browser and check what version you're using to this particular directory. They probably change (handle) their installed versions of php using the apache "addhandler" directive, so check for .htaccess file in the same directory. And post out the result if you don't understand something.
  5. Unfortunately, Jacques is right. We're all under massively surveillance these days by our ISPs, telecommunications companies and the government. This article talks about Canadian surveillance, but it would be apply to Americans and Europeans as well.
  6. Move my code down on your script: <?php session_start(); error_reporting(E_ALL); ini_set('display_errors', '1'); require( 'database.php' ); include('includes/overall/header.php'); $username = $_SESSION['loggedinuser']; if(isset($_POST['username'], $_POST['email'], $_POST['fishtype'], $_POST['speciesCommon'], $_POST['speciesScientific'], $_POST['speciesSynonym'], $_POST['origin'], $_POST['size'], $_POST['environment'], $_POST['waterChemistry'], $_POST['temperature'], $_POST['temperature1'], $_POST['feeding'], $_POST['sexing'], $_POST['compatability'], $_POST['temperament'], $_POST['breeding'], $_POST['comments'], $_POST['reward'])) { echo '<pre>'.print_r($_POST,true).'</pre>'; // here No need to include your database credentials twice, only once on the top of the file is enough!
  7. delete the exit command from the last example and try again!
  8. Then, open up "submitCareGuideCheck.php " file and add the following line as in the example below, submit the form with all data you want to be submitted and post out the result: <?php session_start(); error_reporting(E_ALL); ini_set('display_errors', '1'); echo '<pre>'.print_r($_POST,true).'</pre>'; exit; // this line require( 'database.php' ); EDIT: Make sure this is the right file with insertion data!
  9. Make sure that the url of the action attribute of your submitting form points to this file. I'm guessing you're not submitting the data to this script at all. I completely missed that
  10. Let me see the html posting form.
  11. At first glance I don't see nothing wrong. Are you sure you're calling your code inside the else block? So, do an echo command as in the example below, and tell me what you get: else { echo 'call'; exit; require( 'database.php' ); ............................................
  12. Take a look at this presentation, in case you prefer to use json as your inserting database format. MySQL (MariaDB) should be a version 5.3 or up!
  13. Json as far as I know is supported in MySQL, but in the newer versions.I was using json to insert data by Javascript only once to one noSQL database - MongoDB, not too much experience with it. What MySQL version does the host provide you?
  14. Hm....not able to attach the file as a edit option to my previous post. Attach the file here
  15. A silly mistake, when I'm in a hurry. Deleted the first line and work like a charm.
  16. Guys, I recently came across this about using a tor socks proxy as a default proxy server in my local home network. So, to my centos-box, I've set the service up with a default soks-port 9050 and the local ip address of this machine is 10.10.1.5. Here's a part of the tor's config file: Now, I'm completely able to use that socks proxy from the centos-box with my default browser / curl or whatever you want to be, but if I go to my laptop and set the proxy-socket up to its browser, I've got a message of "TOR is not an HTTP proxy" and half or more ( not all of them ) of my bookmarks web-sites don't work. However, a message when I'm running this service says: Ideas?
  17. This version of php is not compiled with mysqli support, but you've got a better one - pdo. Use pdo as your default database library.
  18. Take mine and use code tags when providing code the next time. <?php ini_set('display_startup_errors',1); ini_set('display_errors',1); error_reporting(-1); // create both cURL resources $ch1 = curl_init(); $ch2 = curl_init(); // set URL and other appropriate options curl_setopt($ch1, CURLOPT_URL, "http://www.mobile.ir/phones/prices.aspx?sort=date&dir=desc&brandid=0&terms=&duration=14&pagesize=50&price_from=-1&price_to=-1&provinceid=0&shopid=0&page=2"); curl_setopt($ch1, CURLOPT_HEADER, 0); curl_setopt($ch2, CURLOPT_URL, "http://www.php.net/"); curl_setopt($ch2, CURLOPT_HEADER, 0); //create the multiple cURL handle $mh = curl_multi_init(); //add the two handles curl_multi_add_handle($mh,$ch1); curl_multi_add_handle($mh,$ch2); $active = null; //execute the handles do { $mrc = curl_multi_exec($mh, $active); } while ($mrc == CURLM_CALL_MULTI_PERFORM); while ($active && $mrc == CURLM_OK) { if (curl_multi_select($mh) != -1) { do { $mrc = curl_multi_exec($mh, $active); } while ($mrc == CURLM_CALL_MULTI_PERFORM); } } $dom = new DOMDocument('1.0', 'utf-8'); libxml_use_internal_errors(true); $dom->loadHTML($mrc); libxml_clear_errors(); $xpath = new DOMXpath($dom); $data = array(); $table_rows = $xpath->query('//table[@id="price_table"]/tbody/tr'); // target the row (the browser rendered <tbody>, but actually it really doesnt have one) if ($table_rows->length <= 0) { // exit if not found echo 'no table rows found'; exit; } $s = "st\xECna"; foreach ($table_rows as $tr) { // foreach row $row = $tr->childNodes; if ($row->item(0)->tagName != '<tr class="carHeader"> <td>نام کارخانه </td> <td>نام خودرو </td> <td>قیمت نمایندگی (ریال) </td> <td>قیمت بازار (ریال) </td> </tr>') { // avoid headers $data[] = array( 'Name' => trim($row->item(2)->nodeValue), 'Price' => trim($row->item(4)->nodeValue), ); } } echo '<pre>'; print_r($data);
  19. welcome to the club, mate
  20. Usually, I am using my centos machine and firefox through a tor proxy server with German exit nodes, these replies were wrote from my daughter's fedora laptop. It's nice to hear, that there are more Canadians around me
  21. Ah...I see, you've got an redesigned database.I don't know how to help you...b/s a lot of queries should be fixed, I think.
  22. so you don't specify on which exactly duplicated key you want to update points column.
  23. It's huge I am not able to help without copying/past the script onto my IDE. So, I need to see what result you've got below. Instead yours, $r = mysql_query("insert into points values ('${v[0]}', ${v[1]}, '$At') on duplicate key update Points = Points + ${v[1]}"); // do this $query = "insert into points values ('{$v[0]}',{$v[1]},'$At') on duplicate key update Points = Points + $v[1]"; echo $query; exit; $r = mysql_query($query) or die(mysql_error());
  24. According your html input field, your user select list could be something like: <select name="user_list"> <option value="<?php echo $firstname ?>"><?php echo $firstname; ?></option> </select>
  25. as for the first question we need to see what value is assigned to $v[1] variable, I'm guessing it's zero or null. as for the second one, you should show us some part of your script.
×
×
  • 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.