Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-11-2012, 10:48 PM   PM User | #46
amcf1992
Regular Coder

 
Join Date: Jul 2011
Posts: 114
Thanks: 7
Thanked 0 Times in 0 Posts
amcf1992 is an unknown quantity at this point
My code as per your code fix: Still stuck at send.php


Code:

PHP Code:
<?php
$con 
mysql_connect("localhost","friendko_admin","Macbookpro17#");
 if (!
$con)
   {
   die(
'Could not connect: ' mysql_error());
   }
 
mysql_select_db("friendko_text"$con);
 
$to $row['cell'];
$carrier $row['carrier'];
$message stripslashes($_POST['message']);
$keycode $_POST['keycode'];
 
$query "SELECT id, email, keycode, carrier, cell FROM users WHERE keycode = '{$_POST['keycode']}'";
$result mysql_query($query) or die(mysql_error().'<br>'.$query);  
while(
$row mysql_fetch_array($resultMYSQL_ASSOC))  

$carrierto = array();
$carrierto['ATT'] = '@txt.att.net';
$carrierto['DT']  = '@tomomail.net';
$carrierto['S']   = '@messaging.sprintpcs.com';
$carrierto['VM']  = '@vmobl.com';
$cc $row['carrier']
if ( isset(
$carrierto[$cc]) )
{
   
$formatted_number $to $carrierto[$cc];
   
mail("$formatted_number""SMS""$message");
   
header ("Location: sms_success.php");
}
else
   die(
"Oh crap... I don't know who that is!<br>\n");  
 
?>
Quote:
Originally Posted by vroom View Post
Alright, before my head explodes... how about creating either a carrierto array or some other way of avoiding the big redirect list... I've taken the liberty of using stock symbols for the phone carriers:

PHP Code:
$carrierto = array();
$carrierto['ATT'] = '@txt.att.net';
$carrierto['DT']  = '@tomomail.net';
$carrierto['S']   = '@messaging.sprintpcs.com';
$carrierto['VM']  = '@vmobl.com';
 
$cc $row['carrier']
if ( isset(
$carrierto[$cc]) )
{
   
$formatted_number $to $carrierto[$cc];
   
mail("$formatted_number""SMS""$message");
   
header ("Location: sms_success.php");
}
else
   die(
"Oh crap... I don't know who that is!<br>\n"); 
P.S. Is this just a learning experience project?
amcf1992 is offline   Reply With Quote
Old 09-11-2012, 10:50 PM   PM User | #47
amcf1992
Regular Coder

 
Join Date: Jul 2011
Posts: 114
Thanks: 7
Thanked 0 Times in 0 Posts
amcf1992 is an unknown quantity at this point
Its part of several PHP projects im doing to be able to better understanding PHP
amcf1992 is offline   Reply With Quote
Old 09-12-2012, 09:02 PM   PM User | #48
amcf1992
Regular Coder

 
Join Date: Jul 2011
Posts: 114
Thanks: 7
Thanked 0 Times in 0 Posts
amcf1992 is an unknown quantity at this point
Any help is greatly appreciated.
amcf1992 is offline   Reply With Quote
Old 09-12-2012, 09:24 PM   PM User | #49
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Do you get an error or just no send on the mail?
Fou-Lu is offline   Reply With Quote
Users who have thanked Fou-Lu for this post:
amcf1992 (09-12-2012)
Old 09-12-2012, 10:52 PM   PM User | #50
amcf1992
Regular Coder

 
Join Date: Jul 2011
Posts: 114
Thanks: 7
Thanked 0 Times in 0 Posts
amcf1992 is an unknown quantity at this point
It stays stuckk on send.php, It may be something with array or the select statement.
Thanks
amcf1992 is offline   Reply With Quote
Old 09-12-2012, 11:11 PM   PM User | #51
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
I don't understand what you mean by stuck.
Syntactically there is no infinite loop here to jam it. It is logically incorrect since you are missing braces which means you'll only ever have the last $row record to work with.

The end result should either be an error message by the die calls, or a redirect to sms_success.php assuming that this page is not sms_success.php. If it is, it will attempt to redirect cyclically, but most modern browsers will detect this and issue a stop.
Fou-Lu is offline   Reply With Quote
Old 09-12-2012, 11:13 PM   PM User | #52
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
I'm not sure if you caught my previous post: who is the email From?
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
AndrewGSW is offline   Reply With Quote
Old 09-13-2012, 02:08 AM   PM User | #53
amcf1992
Regular Coder

 
Join Date: Jul 2011
Posts: 114
Thanks: 7
Thanked 0 Times in 0 Posts
amcf1992 is an unknown quantity at this point
Quote:
Originally Posted by AndrewGSW View Post
I'm not sure if you caught my previous post: who is the email From?
The server will send a text anonymously. There is to from, just a $to variable
amcf1992 is offline   Reply With Quote
Old 09-13-2012, 04:12 AM   PM User | #54
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Quote:
Originally Posted by amcf1992 View Post
The server will send a text anonymously. There is to from, just a $to variable
From is a required field to send email. If its not configured on the server end, you must provide a from header in the email.
Fou-Lu is offline   Reply With Quote
Reply

Bookmarks

Tags
error, mysql, php

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:03 AM.


Advertisement
Log in to turn off these ads.