Search the Community
Showing results for tags 'post'.
-
I am using the service from bitping.net which uses a HTTP POST to send event data to my php script on my site. When an event is posted the data is inserted into a database and then triggers a SMS via the twilio script. For some reason my test event would run the script fine; insert the data and return info via SMS. but the actual event does not trigger the SMS! After a ton of debugging I tracked down the point where it stops working I have it broken into 3 parts. Data.php the main file Addresscheck.php Requiredebug.php I can only run two of these at a time. Data.php and require ("addresscheck.php"); or data.php and require ("requireDebug.php"); Both do work independently if I comment out the other include. I tried having one database, tried breaking it into two. (The way it is now) I keep thinking it must be a problem with the site bitping.net But every time data is passed into the database. Test/or real event. It is the twillio that is failing to trigger. It seems insane to me the Test event HTTP POST would be any different from the real event. I’ve been pounding my head with craziness; any pointers would be greatly appreciated. <?php //Call the 2 databases $conn = new mysqli('localhost', 'Admin', 'XXXXXXXX','MDHoldings'); //debug PASS //bitping HTTP post, but should work for Pubnub $to_address = $_POST["to_address"]; $amount = $_POST["amount"]; $btc = $_POST["btc_amount"]; $confirmations = $_POST["confirmations"]; $txhash = $_POST["txhash"]; $block = $_POST["block"]; $sig = $_POST["signature"]; $mysig = sha1( $address . $amount . $confirmations . $txhash . $block . "f632c83ad0f5a44d9a169902ff18b3ed" ); if ($mysig === $sig) { //check if number of confirmations is ok //update order/send user notification } else { //log all post data, send warning email to administrator } //get data //require ("requireDebug.php"); //store DATA $sql = "INSERT INTO `transactions` (`to_address`, `txhash`, `USD`, `amount`, `block`) VALUES ('$to_address', '$txhash', '$USD','$amount','$block')"; //KEEP TRACK OF IF's if ($conn->query($sql) === TRUE) { echo 'users entry saved successfully'; } else { echo 'Error: '. $conn->error; } //Debug PASS require ("addresscheck.php"); //debug 2 //require ("requireDebug.php"); //********** WHY CAN I ONLY Use 1?! If I only select one at a time, not both!? $cell = XXXXXXXXXX; //$Data = test; /* Send an SMS using Twilio. You can run this file 3 different ways: * * - Save it as sendnotifications.php and at the command line, run * php sendnotifications.php * * - Upload it to a web host and load mywebhost.com/sendnotifications.php * in a web browser. * - Download a local server like WAMP, MAMP or XAMPP. Point the web root * directory to the folder containing this file, and load * localhost:8888/sendnotifications.php in a web browser. */ // Step 1: Download the Twilio-PHP library from twilio.com/docs/libraries, // and move it into the folder containing this file. require "Services/Twilio.php"; // Step 2: set our AccountSid and AuthToken from www.twilio.com/user/account $AccountSid = "XXXXXXXXXXXXXXXXXXXXXXXXXX"; $AuthToken = "XXXXXXXXXXXXXXXXXXXXXXXXX"; // Step 3: instantiate a new Twilio Rest Client $client = new Services_Twilio($AccountSid, $AuthToken); // Step 4: make an array of people we know, to send them a message. // Feel free to change/add your own phone number and name here. $people = array( "$cell" => "$user", ); // Step 5: Loop over all our friends. $number is a phone number above, and // $name is the name next to it foreach ($people as $number => $name) { $sms = $client->account->sms_messages->create( // Step 6: Change the 'From' number below to be a valid Twilio number // that you've purchased, or the (deprecated) Sandbox number "XXXXXXXXXXXXX", // the number we are sending to - Any phone number $number, // the sms body " $test $name, There has been a deposit to $Account : $baddress you have $USD$ of new funds in your account. Recipt $txhash " ); // Display a confirmation message on the screen echo "Sent message to $name $amount"; } $conn->close(); ?> requireDebug.php <?php $conn = new mysqli('localhost', 'worker', 'XXXXXXX','test'); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } // sql query for INSERT INTO users (two rows) // SELECT sql query $sql = "SELECT `id`, Price FROM `Intake` ORDER BY id DESC LIMIT 1"; // perform the query and store the result $result = $conn->query($sql); // if the $result contains at least one row if ($result->num_rows > 0) { // output data of each row from $result while($row = $result->fetch_assoc()) { $rate = $row['Price']; } } else { echo '0 results'; } //$Data = $row['Price']; echo ($rate); $conn->close(); $USD = ($amount * $rate)/100000000; ?> addresscheck.php <?php // CONNECT TO THE DATABASE $conn = new mysqli('localhost', 'Admin', 'XXXXXXX','MDHoldings'); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } // sql query for INSERT INTO users (two rows) // SELECT sql query $sql2 = "SELECT * FROM Accounts WHERE Address = '$to_address'"; // perform the query and store the result $result2 = $conn->query($sql2); // if the $result contains at least one row if ($result2->num_rows > 0) { // output data of each row from $result while($row2 = $result2->fetch_assoc()) { $Account = $row2['Account']; } } else { echo '0 results'; } //echo ($test); //echo ($Account); //echo ($user_email); //echo ($Balance); $conn->close(); ?>
-
hello guys i have been tryning this code for quite sum time now. it sends sms but i want the server response to display without refreshing the page, i have use cURL extension and cant seem to get it working. the script run smooth but it return the url as the response and it does not execute the url here is the code <?php class send { public $username; public $password; public $destination; public $sender; public $msg; public $type; public $dlr; public $url; function __construct() { } function send_sms(){ $posturl = 'http://121.241.242.114:8080/bulksms/bulksms?'; $number = $this->destination; $number = urlencode($number); $msg = urlencode($this->msg); $type='0'; $dlr='0'; $url=''; $posturl = $posturl."source=".$this->sender."&username=".$this->username."&password=".$this->password."&type=".$type."&dlr=".$dlr."&destination=".$number."&message=".$msg; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $posturl); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); return $posturl; } } ?> i have no idea wat am i doing wrong. the results are getting captured by javasript from the original page but only display the url and does not execute it
-
My plugin is a custom export/update plugin that lets the user export his products, update the price grids, and upload the csv to change the data quicker than using the visual editor. The price grids are stored as a serialized array in the post's meta (_cp_array). To test my plugin, I uploaded a csv with data identical to that which was already in the DB. The function below informed that the Table Rates had not changed (because they hadn't!). Next, I changed ONE value in ONE row of the csv. Tested again. This time, the function informed that for the product I changed, the post meta had been updated. However, the meta is never actually updated. Looking in the DB for the meta (_cp_array), the serialized string stays the same after running my upload function multiple times, with update_post_meta returning true each time, and echoing the "updated" message. For debugging purposes, I used var_export($unserialized) to see what it outputted, and also var_export(serialize($unserialized)) to see what the data should look like when writing the serialized array/string to the DB. The var_export (serialized and not) on my plugin screen always displays the new, changed data from the csv. It gets even stranger...next I tried adding new metadata to a product that didn't have anything for that specific metadata (it was empty and the meta key didn't exist for that product). The function displays that it updated the metadata for that product. However, looking in the DB reveals that the serialized value for that product's meta (_cp_array) was very different from the data I entered! The var_export displays the correct array and serialized string, but the DB had very different keys and values! All relevant examples/info: http://pastebin.com/jYjuzg6G Why is the plugin not changing the metadata, even though the function returns true? And why, when it added new metadata, did it add incorrect metadata, even though the serialized array was correct when outputted to the screen? The below code is responsible for updating the product's _cp_array: if(update_post_meta($id, '_cp_array', $unserialized)) echo 'Table Rate Prices Updated.<br />'; else echo 'No Table Rate Change.'; var_export($unserialized); echo '<br />'; var_export(serialize($unserialized));
-
This one is a doozy for me. My brain is fried after spending a couple days trying to figure this out. None of my formulas have seemed to work out enough. So I'm waiving my white flag and asking for some help. Below is a simplified version of my code. The purpose of this page is an estimate calculator. It is for a window cleaning service, and they have pricing for doing the insides of windows and the outsides. Each style of window has different pricing for each inside and outside. What is supposed to happen in the form is this: If they want an estimate for say basic window cleaning for both inside and outside, they will check the chechboxes for both inside and outside. Then enter a number for the amount of windows to clean. The formula for this would look something like this: Amount = Inside Price x Outside Price (if inside price and outside price checkboxes are ticked). And for each entry, it needs to add up the total. But none of the foreach or while loops i try to create seem to do the trick. Basic Form Setup: $query = "SELECT * FROM estimates WHERE 1 ORDER BY id ASC"; $result = mysql_query($query); while ($estimates = mysql_fetch_object($result)) { $style = $estimates->style; $insidePrice = $estimates->price; $outsidePrice = $estimates->out; echo $style.' <input type="checkbox" name="insidePrice[]" value ="'.$insidePrice,'" /> $'.$insidePrice.' <input type="checkbox" name="outsidePrice[]" value ="'.$outsidePrice,'" /> $'.$outsidePrice.' <input type="text" name="amount[]" />'; } And an idea of how i want this to work: foreach ($_POST['amount'] as $key => $a){ if ($a != "" or $a !="0"){ //Now to llustrate what Im trying to do, I know this is wrong though foreach ($_POST['insideAmount'] as $i){ $i = $i*$a; } foreach ($_POST['outsideAmount'] as $o){ $o = $o*$a; } $a = $i+$o; } //Trying to add each row as they build to make the estimate total $prev = $a[$key-1]; $a = $a+$prev; $total = $a; } echo "$total";
-
Hi there mates, I've got a question from a friend of mine. And I could not solve it and I am ashamed of myself haha . The code is not yet complete, but what it has to do, is post the array, whick contains the names of the files uploaded ( pictures in this case ) The first post works, but thats it, it doesnt show the array on the last past it only shows "array". Please help me fix problem, I translated a bit of the code from dutch to english, so it's a bit more clear Thanks in advance David fotoinvoerpagina2.php
-
Pass Parameters From Index.php Tag To Header.php Meta
donrobertito posted a topic in PHP Coding Help
Hello there! I'm such a beginner in php coding, i don't know the trick yet. My question is: I have a site, the main files are header.php; index.php; footer.php. I include header and footer in index php The index.php contains the articles, with tags. I want to pass the tags form articles to header.php as meta information. I get the tags from a database query. How can i do this method? Thanks: Robert -
I have a question about passing a variable from php to html and back again Ideally i'd like to pass a customers name inputted into php file using a form out into the form submission page as a hidden form input and then use this value in a new php file when a button is pressed to send them back to the home page. the aim is to show the users name once they have completed the form. I've had a look around and many people suggest using code similar to this: value="<?php echo htmlspecialchars($name); ?>" but if i include this in my html form do I not have to save the html document as php? I hope someone can help, thanks in advance!
-
Preface: I again apologize in advance earlier to the people who thought I was writing a Scam PHP page. I should have informed it was a teacher written assignment. Hi guys so Im writing these two php webpages : one is a signup page which is a mock 'dating site' : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>NerdLuv</title> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <link href="heart.gif" type="image/gif" rel="shortcut icon" /> <link href="nerdluv.css" type="text/css" rel="stylesheet" /> </head> <body> <div id="main"> <div id="bannerarea"> <img src="nerdluv.png" alt="banner logo" /> <br /> where meek geeks meet </div> <div id="matches"> <h1>Matches for User Name</h1> <div class="match"> <p class="name"> <img src="images/ada_lovelace.jpg" alt="Ada Lovelace" /> Ada Lovelace </p> <p class="info"> <strong>gender:</strong> F <br /> <strong>age:</strong> 96 <br /> <strong>type:</strong> ISTJ <br /> <strong>OS:</strong> Linux <br /> <strong>rating:</strong> 4 </p> </div> <!--End of first match case ada lovelace --> <div class="match"> <p class="name"> <img src="images/grace_hopper.jpg" alt="Grace Hopper" /> Grace Hopper </p> <p class="info"> <strong>gender:</strong> F <br /> <strong>age:</strong> 87 <br /> <strong>type:</strong> ISFP <br /> <strong>OS:</strong> Windows <br /> <strong>rating:</strong> 4 </p> </div> <!-- end of second match case --> </div> <!-- Div id matches--> <!--This reads the singles text file and prints them to the results page --> <!--<?php include("singles.txt"); ?> --> <p> </p> <div id="w3c"> <a href="http://validator.w3.org/check/referer"> <img src="http://www.w3.org/Icons/valid-xhtml11" alt="Valid XHTML 1.1" /></a> <a href="http://jigsaw.w3.org/css-validator/check/referer"> <img src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS" /></a> </div> </body> </html> the other is a results page which will display the appropriate match according to user input : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR...D/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>NerdLuv</title> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <link href="heart.gif" type="image/gif" rel="shortcut icon" /> <link href="nerdluv.css" type="text/css" rel="stylesheet" /> </head> <body> <div id="main"> <div id="bannerarea"> <img src="nerdluv.png" alt="banner logo" /> <br /> where meek geeks meet </div> <div id="matches"> <h1>Matches for User Name</h1> <div class="match"> <p class="name"> <img src="images/ada_lovelace.jpg" alt="Ada Lovelace" /> Ada Lovelace </p> <p class="info"> <strong>gender:</strong> F <br /> <strong>age:</strong> 96 <br /> <strong>type:</strong> ISTJ <br /> <strong>OS:</strong> Linux <br /> <strong>rating:</strong> 4 </p> </div> <!--End of first match case ada lovelace --> <div class="match"> <p class="name"> <img src="images/grace_hopper.jpg" alt="Grace Hopper" /> Grace Hopper </p> <p class="info"> <strong>gender:</strong> F <br /> <strong>age:</strong> 87 <br /> <strong>type:</strong> ISFP <br /> <strong>OS:</strong> Windows <br /> <strong>rating:</strong> 4 </p> </div> <!-- end of second match case --> </div> <!-- Div id matches--> <!--This reads the singles text file and prints them to the results page --> <!--<?php include("singles.txt"); ?> --> <p> </p> <div id="w3c"> <a href="http://validator.w3....check/referer"> <img src="http://www.w3.org/Ic.../valid-xhtml11" alt="Valid XHTML 1.1" /></a> <a href="http://jigsaw.w3.org...check/referer"> <img src="http://jigsaw.w3.org...or/images/vcss" alt="Valid CSS" /></a> </div> </body> </html> I was thinking ultimately to implement POST methods with a function to retrieve the data and POST but at this point Im totally lost...... If I just implement a form action post it will obviously need something on the other php page to recieve it . But thats not how its setup, ill need a way to send the user data have it check the data in a textfile(which is what results.php displays from, and also write the user data in the same file ) then once results.php processes it shows the "suitable" matches according to user input ..Im coming short in development time so any help would be great.. Thanks
- 2 replies
-
- file write
- get
-
(and 2 more)
Tagged with:
-
Hey there! I've been working on a Calculator with button in PHP and im having some trouble connecting the buttons to my php code. For an example: If i press the first button ("1") Then it's suppose to show up the number "1" on the screen. Mabye it's abit hard to explain but i hope you understand what i mean here. So i would be delight if someone could throw an eye on my code and tell me and explain what i have too do too fix this! Here is my code: http://pastebin.com/FF3NBACa (sorry if im posting this at the wrong place, im new to this forum ! ) Mvh Griser
- 2 replies
-
- calc
- caluclator
-
(and 3 more)
Tagged with:
-
I ran through all the possibilities of strings , paranthesis , basically the syntax issues but can seem to figure out whats throwing a fit. It seems lines 15, 16 , 17 are giving problems . <!DOCTYPE html > <html> <head> <title>Buy Your Way to a Better Education!</title> <link href="http://www.cs.washington.edu/education/courses/cse190m/09sp/labs/4-buyagrade/buyagrade.css" type="text/css" rel="stylesheet" /> </head> <body> <h1>Thanks, sucker!</h1> <p>Your information has been recorded.</p> <?php $name = $_POST['name']; $ccNo = $_POST['ccNo']; $ccType = $_POST['ccType']; echo "Your name ". $name . " " . "<br/>"; echo "Credit Card Type:" . $ccType . "<br />"; echo "Credit Card No: " . $ccNo; ?> </body> </html>
-
Hi, I am new in php and trying to build a database driven web site. In every step I deal with a new problem . In the image I attached I have a diagram of how the website looks. As you can see I have a side bar with two dropdown menus and on the right is the main content of the page. The procedure goes like this: When I select a value from the drop down menu and click the button, a request is sent through Ajax to the database (I use the $.ajax function). All the php code is written in a different file which I define in the url of ajax method. That way my page is not refreshed every time that I click the button. But the problem is that the results are not appearing where I want. As you can see in the diagram(attached) I want them to be in the main content of the page (1) but they appear on the sidebar (2). This must be really easy question but as I said I started learning only some time ago. Any suggestions? Thanks Dimitris
-
Hi everyone, I hope cyberRobot or Guru is reading this thread. I am trying to create a vertical table data in php from method of GET and POST. Is it possible? I succeed created the vertical table data from database (MySQL). I created the vertical table data on php that inside the form thathas method of GET or POST, that should allow any value in php go to another page by method of GET, but seem it doesn't work. Maybe I miss something in code? Help will be very appreciate. I am still learning, ready to get in interaction in php. Here my code: <!doctype html> <html> <head> <title>Test array attendence</title> </head> <body> <table> <?php $columns = 2; if(isset($_GET['member'])) { $display = $_GET['member']; $num_row = $display; $rows = ceil($num_row / $columns); <-- It is causing an error in code, line 14. while ($row = $display) { $data[] = $row; } echo "<table border='1'>"; for($i = 0; $i < $rows; $i++) { echo "<tr>"; for($j = 0; $j < $columns; $j++) { if(isset($data[$i + ($j * $row)])) { echo "<td>".$data[$i + ($j * $row)]."</td>"; $count = $count+1; } } echo "</tr>"; } } ?> </table> <table><tr><td><?php echo $count." are attending this meeting tonight." ?></td></tr></table> </body> </html> I get an error message - Fatal error: Unsupported operand types in /srv/disk10/1141650/www/sigmahokies.biz.ht/testarray3.php on line 14
- 9 replies
-
- vertical data
- php
-
(and 3 more)
Tagged with: