Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if ($_SERVER['REQUEST_METHOD']!='POST')
- {
- echo 'This script is not supposed to be viewed in a browser!';
- exit;
- }
- // Connecting to the database.
- // Change the parameter values to the actual ones
- $con = new mysql_connect('localhost','nrtx_sms','13101991as','nrtx_sms');
- $insert_sms_success = FALSE;
- if (mysql_connect_errno()==0)
- { // if successfully connected
- $sent_dt=$_POST['scts'];
- // important: escape string values
- $txt=mysql_real_escape_string($con, $_POST['text']);
- $snd=mysql_real_escape_string($con, $_POST['sender']);
- // creating an sql statement to insert the message into the SMS_IN table
- $sql="INSERT INTO SMS_IN(sms_text,sender_number,sent_dt) VALUES ('$txt','$snd','$sent_dt')";
- // executing the sql statement
- $insert_sms_success = mysql_query($con,$sql);
- // closing the connection
- mysqli_close($con);
- }
- if ($insert_sms_success)
- {
- // if we have succeeded to insert sms into the database
- }
- else
- {
- // if we have failed to insert sms into the database.
- // Here you can do something upon failure to insert sms into the database.
- // For example, let SMS Enabler know an error has occured
- http_response_code(500);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement