Enjoy an ad free experience by logging in. Not a member yet?
Register .
09-11-2012, 10:48 PM
PM User |
#46
Regular Coder
Join Date: Jul 2011
Posts: 114
Thanks: 7
Thanked 0 Times in 0 Posts
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 ( $result , MYSQL_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
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?
09-11-2012, 10:50 PM
PM User |
#47
Regular Coder
Join Date: Jul 2011
Posts: 114
Thanks: 7
Thanked 0 Times in 0 Posts
Its part of several PHP projects im doing to be able to better understanding PHP
09-12-2012, 09:02 PM
PM User |
#48
Regular Coder
Join Date: Jul 2011
Posts: 114
Thanks: 7
Thanked 0 Times in 0 Posts
Any help is greatly appreciated.
09-12-2012, 09:24 PM
PM User |
#49
God Emperor
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Do you get an error or just no send on the mail?
Users who have thanked Fou-Lu for this post:
09-12-2012, 10:52 PM
PM User |
#50
Regular Coder
Join Date: Jul 2011
Posts: 114
Thanks: 7
Thanked 0 Times in 0 Posts
It stays stuckk on send.php, It may be something with array or the select statement.
Thanks
09-12-2012, 11:11 PM
PM User |
#51
God Emperor
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
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.
09-12-2012, 11:13 PM
PM User |
#52
Senior Coder
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
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
09-13-2012, 02:08 AM
PM User |
#53
Regular Coder
Join Date: Jul 2011
Posts: 114
Thanks: 7
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by
AndrewGSW
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
09-13-2012, 04:12 AM
PM User |
#54
God Emperor
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Quote:
Originally Posted by
amcf1992
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.
Jump To Top of Thread
Thread Tools
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
HTML code is Off
All times are GMT +1. The time now is 09:03 AM .
Advertisement
Log in to turn off these ads.