Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,166 members, 7,815,063 topics. Date: Thursday, 02 May 2024 at 06:37 AM

Anyone Who Can Help Me Solve This Php Code Will Gets 1k Glo Airtime - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Anyone Who Can Help Me Solve This Php Code Will Gets 1k Glo Airtime (786 Views)

This Php Server Remote Addr Is Giving Me Different Device Ip Address / How To Break Down A Link In Php Code, & Call/include User Session Into The Link? / Php Code To Make A Forum Support Youtube Embed On A Post (2) (3) (4)

(1) (Reply) (Go Down)

Anyone Who Can Help Me Solve This Php Code Will Gets 1k Glo Airtime by fineboynl(m): 7:55pm On Aug 15, 2018
@LaiveNg:


<?php

require_once 'config.php';
require_once 'database.php';

function send_email($data) {
$to = $data['to'];
$sub = $data['sub'];
$msg = $data['msg'];
$message = get_email_msg($data);
$header = "From:info@unibit.com\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-type: text/html\r\n";
$retval = mail ($to,$sub,$message,$header);
}

function get_email_msg($data) {
$msg_text = "";

switch($data['msg']) {

case 'acc_open':
$msg_text = '';
break;

case 'otp':
$msg_text = sprintf("Your one time token code : %u", $data['token']);
break;

case 'change_pwd':
$msg_text = sprintf("Your password is successfully changed. New Password is : %s", $data['pwd']);
break;

case 'change_pin':
$msg_text = sprintf("Your PIN is successfully changed. New PIN is : %u", $data['pin']);
break;

case 'register':
$msg_text = $data['body'];
break;

}//switch
return $msg_text;
}

?>


then inside my php code area there is the function line area where a code is generated and send to email which work perfectly, it work fine to email in every other functions.



$token = rand(100000, 9999999);
$token = strlen($token) != 6 ? substr($token, 0, 6) : $token;
$_SESSION['otp_token'] = 859874;//$token;

//email it now.
$subject = "Token Code";
$to = $_SESSION['hlb_user']['email'];
$mail_data = array('to' => $to, 'sub' => $subject, 'msg' => 'otp', 'token' => $token);
send_email($mail_data);

header('Location: index.php?v=Token');
exit();


i'm trying to implement all the email message function to sms as well.



$token = rand(100000, 9999999);
$token = strlen($token) != 6 ? substr($token, 0, 6) : $token;
$_SESSION['otp_token'] = 135246;//$token;

//email it now.
$subject = "Token Code";
$to = $_SESSION['hlbank_user']['email'];
$mail_data = array('to' => $to, 'sub' => $subject, 'msg' => 'otp', 'token' => $token);
send_email($mail_data);

// send sms

// Account details
$username = urlencode('xxxx@Bleep.com');
$apiKey = urlencode('hfhhlkhglkjfhgfkjhg');

// Message details
$sender = urlencode('unibit');
$messagetext = urlencode ('token Code: $token');

$flash = urlencode('0');
$recipients = urlencode('$_SESSION['hlb_user']['phone'];');



// Prepare data for POST request
$data = 'username=' . $username . '&apikey=' . $apiKey . "&sender=" . $sender . "&messagetext=" . $messagetext . '&flash=' . $flash . '&recipients=' . $recipients;

// Send the GET request with cURL
$ch = curl_init('http://api.Bleep.com:8080/sendsms?' . $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

// Process your response here
echo $response;
header('Location: index.php?v=Token');
exit();


the bolded is where the problem is.
it doesn't query the session user number from sql table, and if i just place a number there it send the sms but the token is just "?token" it doesn't send the generated code. anyone who can help me out to solved this 1k glo card
Re: Anyone Who Can Help Me Solve This Php Code Will Gets 1k Glo Airtime by LaiveNg: 9:19pm On Aug 15, 2018
I think you should first change $messagetext = urlencode( 'token Code: $token' ) ;
To $messagetext = urlencode( "token Code: $token" ) ; Notice the double quotes. Let's Start here.
Re: Anyone Who Can Help Me Solve This Php Code Will Gets 1k Glo Airtime by LaiveNg: 9:31pm On Aug 15, 2018
And also check this place:

$mail_data = array('to' => $to, 'sub' => $subject, 'msg' => 'otp', 'token' => $token) ;

I think you should use the session array value instead of the $token. So I think your code should read thus in this section:

$mail_data = array( 'to' => $to, 'sub' => $subject, 'msg' => 'otp', 'token' => $_SESSION['otp_token']) ;
Re: Anyone Who Can Help Me Solve This Php Code Will Gets 1k Glo Airtime by LaiveNg: 11:19am On Aug 16, 2018
If it works, let me know. 1k glo airtime very important.
Re: Anyone Who Can Help Me Solve This Php Code Will Gets 1k Glo Airtime by yefufikay: 2:52pm On Aug 16, 2018
IT'S HOOOOOOT SEAT ON TONIGHT WITH THIS BEAUTIFUL LADY ON THE PLATFORM OF LOVE

Yes, she is beautiful, delectible, sassy, sexy, adorable, loveable, sensually appealing and amazing young woman who is READY FOR AND DESIRE TRUE LOVE!

Introducing B-L-E-S-S-I-N-G on the very HOT SEAT where she will be answering all General and Personal questions everyone would be throwing at her!

Every other day, we will be having beautiful ladies and handsome bobos on the HOT SEAT where you get to know and meet verified members on the Platform of Love

Want to participate? Sign Up for FREE

MEMBERSHIP, REGISTRATION AND JOINING are absolutely FREE!

(1) (Reply)

Can I Make Money With Adsense On Blogger-() / 46k Facebook Page Available For Sale / Naijachats.com Fast Growing Nigeria Discussions Forum

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 16
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.