UBB.Dev
Posted By: Gregori Sending SMS between users! - 02/21/2005 6:14 PM
Hi all,

One of my forum categories is dedicated to personals (SWF seeks...). I have set up my Threads 6.5.1 with special templates (postlist.tmpl, showflat.tmpl, showthreaded.tmpl) for these forums.

What I want to do is this:

First of all, I want to add another field to the user profile: an optional field for the users cell phone number.

This field is not to be shown in public.

Lets say the user Grunt (with Threads user number 11111) enters his cell phone number and then posts an ad in the personals. When this ad is viewed by someone, Threads will notice the phone number and then publish the users usernumber (NOT the cell phone number) just like Grunts Location is published like "Loc: Las Vegas".

Only this time the sentence would be "To send SMS to Grunt: send an SMS starting with PERSONAL REPLY 11111 followed by your reply to number 77777"

How do I do this?

Second, and this is the tricky part I guess, I want another server to communicate with Threads using HTTP GET and POST requests.

This server, the SMS-server, will authenticate itself to Threads and then send Grunt´s usernumber to Threads. The response from Threads will be to send Grunt´s cell phone number to the SMS-server.

Has anyone done anything like this before with Threads?

The $1 000 000 question is of course: how???
Posted By: Gregori Re: Sending SMS between users! - 02/23/2005 7:19 PM
So far I have managed to get the front end to work. If there is a phone number, the SMS info text will show. If not, nothing will be displayed.

Does this look ok? It seems to work on my dev site.

Code
  <br /><br /><br />##############<br />showflat.php<br />##############<br />##############<br />find:<br />##############<br /><br /><br />	$postrow[$i]['Username'] = $Username;<br />	$postrow[$i]['Title']    = $Title;<br /><br />	if ( ($config['showip'] == 1) && $IP) {<br />		$postrow[$i]['IP'] = "($IP)";<br />	}<br /><br /><br />##############<br />replace with:<br />##############<br /><br />	$postrow[$i]['Username'] = $Username;<br />	$postrow[$i]['usernumber'] = $usernumber;<br />	$postrow[$i]['Extra3'] = $Extra3;<br />	$postrow[$i]['Title']    = $Title;<br /><br />	if ( ($config['showip'] == 1) && $IP) {<br />		$postrow[$i]['IP'] = "($IP)";<br />	}<br /><br /><br /><br /><br /><br /><br /><br />$userob = new user;<br />$user = $userob -> authenticate("U_Display, U_Groups, U_PostsPer, U_PicturePosts, U_FlatPosts, U_TimeOffset,U_ShowSigs,U_TimeFormat,U_Ignored,U_SearchSession,U_Preview,U_TextCols,U_TextRows");<br />isset($user['U_Username']) && $Username = $user['U_Username'];<br /><br /><br /><br /><br />##############<br />replace with:<br />##############<br /><br /><br />$userob = new user;<br />$user = $userob -> authenticate("U_Extra3, U_Display, U_Groups, U_PostsPer, U_PicturePosts, U_FlatPosts, U_TimeOffset,U_ShowSigs,U_TimeFormat,U_Ignored,U_SearchSession,U_Preview,U_TextCols,U_TextRows");<br />isset($user['U_Username']) && $Username = $user['U_Username'];<br />isset($user['U_Extra3']) && $Extra3 = $user['U_Extra3'];<br /><br /><br /><br /><br />##############<br />find:<br />##############<br /><br /><br />	// -----------------------------------------------------------<br />	// If this thread has been moved we need to send them properly<br />	if ($Open == "M") {<br />		@list($NewBoard,$NewNumber,$Body) = split("-ML-",$Body);<br />		$Body = "<a href=\"{$config['phpurl']}/showflat.php{$var_start}Cat{$var_eq}$Cat{$var_sep}Number{$var_eq}$NewNumber\">{$ubbt_lang['POINTER']}</a>$Body";<br />	}<br /><br />##############<br />replace with:<br />##############<br /><br /><br />   // SMS yes or no<br />	if ($user['U_Extra3'] != "") {<br />		$SMS = "on";<br />	}<br /><br /><br />	// -----------------------------------------------------------<br />	// If this thread has been moved we need to send them properly<br />	if ($Open == "M") {<br />		@list($NewBoard,$NewNumber,$Body) = split("-ML-",$Body);<br />		$Body = "<a href=\"{$config['phpurl']}/showflat.php{$var_start}Cat{$var_eq}$Cat{$var_sep}Number{$var_eq}$NewNumber\">{$ubbt_lang['POINTER']}</a>$Body";<br />	}<br /><br /><br /><br />##############<br />find:<br />##############<br /><br /><br />// Edit Button?<br />	$postrow[$i]['editlinkstart'] = "";<br />	$postrow[$i]['editlinkstop'] = "";<br />	$postrow[$i]['editdisplay'] = "";<br />	if ($edit == "on") {<br />		$postrow[$i]['editlinkstart'] = "<a href=\"{$config['phpurl']}/editpost.php?Cat=$Cat&amp;Board=$Board&amp;Number=$Number&amp;page=$page&amp;what=showflat&amp;vc=1\">";<br />		$postrow[$i]['editlinkstop'] = "</a>";<br />	}<br />	else {<br />		$postrow[$i]['editdisplay'] = "style=\"display: none;\"";<br />	}<br /><br /><br />##############<br />replace with:<br />##############<br /><br /><br />	// Cell Phone SMS code<br />	$postrow[$i]['SMScodestart'] = "";<br />	$postrow[$i]['SMScodestop'] = "";<br />	$postrow[$i]['SMScodedisplay'] = "";<br />	if ($SMS == "on") {<br />		$postrow[$i]['SMScodestart'] = "Send SMS: <B>REPLY $usernumber 'YOUR TEXT'";<br />		$postrow[$i]['SMScodestop'] = "</B> to number 777777";<br />	}<br />	else {<br />		$postrow[$i]['SMScodedisplay'] = "style=\"display: none;\"";<br />	}<br /><br />         <br />// Edit Button?<br />	$postrow[$i]['editlinkstart'] = "";<br />	$postrow[$i]['editlinkstop'] = "";<br />	$postrow[$i]['editdisplay'] = "";<br />	if ($edit == "on") {<br />		$postrow[$i]['editlinkstart'] = "<a href=\"{$config['phpurl']}/editpost.php?Cat=$Cat&amp;Board=$Board&amp;Number=$Number&amp;page=$page&amp;what=showflat&amp;vc=1\">";<br />		$postrow[$i]['editlinkstop'] = "</a>";<br />	}<br />	else {<br />		$postrow[$i]['editdisplay'] = "style=\"display: none;\"";<br />	}<br /><br /><br /><br /><br /><br /><br /><br />##############<br />showflat.tmpl<br />##############<br />##############<br />find:<br />##############<br /><br /><br /><br />{$postrow[$i]['Location']}<br /><br />##############<br />replace with:<br />##############<br /><br /><br />{$postrow[$i]['Location']}<br /><br /><br />{$postrow[$i]['SMScodestart']}<br />{$postrow[$i]['SMScodestop']}<br /><br />
© UBB.Developers