SMS API HELP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
php_new_guy_09
Forum Newbie
Posts: 12
Joined: Fri Sep 04, 2009 3:21 pm

SMS API HELP

Post by php_new_guy_09 »

A
Last edited by php_new_guy_09 on Wed Sep 16, 2009 7:31 pm, edited 1 time in total.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: SMS API HELP

Post by requinix »

So what's the problem? What's your question?
php_new_guy_09
Forum Newbie
Posts: 12
Joined: Fri Sep 04, 2009 3:21 pm

Re: SMS API HELP PLEASE............................

Post by php_new_guy_09 »

b
Last edited by php_new_guy_09 on Wed Sep 16, 2009 7:33 pm, edited 3 times in total.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: SMS API HELP

Post by John Cartwright »

We're not here to do the work for you. Again, what specifically are you having trouble with?
php_new_guy_09
Forum Newbie
Posts: 12
Joined: Fri Sep 04, 2009 3:21 pm

Re: SMS API HELP

Post by php_new_guy_09 »

I do not have any knowledge of php or mysql, I have a little knowledge of sql in ms access, and a little experience of programming in vb, so im pretty useless, I downloaded xampp on a laptop yesterday however incurred problems, i would just like to know if the code i posted will work and if not, where have i made mistakes.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: SMS API HELP

Post by requinix »

php_new_guy_09 wrote:i would just like to know if the code i posted will work and if not, where have i made mistakes.
Well, no, it won't work.

Code: Select all

<?php
 
$uname = "youremailaddress";
$pword = "yourpassword";
$database="my database";
$sender = $_REQUEST['sender'];
$content = $_REQUEST['content'];
$from = " php_new_guy_09";
$selectednums = $sender;
$message = AUTOREPLY CONTENT;
$message = urlencode($message);
 
mysql_connect(localhost,$username,$password); // localhost is not a constant. where's $username? $password?
mysql_select_db($database);
INSERT INTO  log (sender,content) VALUES ('$sender','$content'); // not php code
$query="SELECT $sender, $content FROM log "; // horrible, horrible idea - see below
$result=mysql_query($query);
 
$content ^ sunrise // not a php statement. what is this supposed to be?
SELECT '$content', FROM autoreplymsg WHERE content ='sunrise'
ORDER BY RAND()
LIMIT 1 // not php code, invalid sql
 
$data = "uname=".$uname."&pword=".$pword."&message=".$message."&from=". $from."&selectednums=".$selectednums."&info=".$info."&test=".$test; 
 
$ch = curl_init('http://www.txtlocal.com/sendsmspost.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch); 
curl_close($ch);
 
mysql_close();
 
?>
I would like to draw attention to

Code: Select all

$query="SELECT $sender, $content FROM log ";
$sender and $content are coming from user input. You are letting them put whatever they want into your SQL query. I don't have to explain why that's bad, right?
php_new_guy_09
Forum Newbie
Posts: 12
Joined: Fri Sep 04, 2009 3:21 pm

Re: SMS API HELP

Post by php_new_guy_09 »

Line 13: Wouldn’t my hostname need to replace ‘localhost’

Line 13: is suppose to read ‘$uname’ and ‘$pword’

Line 19: is suppose to mean where the string $content matches the keyword sunrise

Line 22: is suppose to mean select only one result

Line 19/22: I’m not sure where I got that from, I will find out the correct code for that.

Thanks a lot, you have put me on the right tracks, I am now going to make some corrections and look into Line 16.

THANKS A LOT AGAIN
Post Reply