Url got replaced to a symbol - php

i've been working on reset password url, let me get straight to the point.
Here's my sample code that i'm working on. I believe it's working fine on apache. But i'm currently working on IIS Server.
$resl_url = base_url() . $this->controller . "/reset_by_link?reset_code=" . $random . "&u=" . $baris->usr_id . "&e=" . $enc_username;
$mail_data['reset_link'] = $resl_url;
it produce this url:
https://hris-id.tmf-group.com/ess_lenovo/login/auth/reset_by_link?reset_co=e=5T/BX1GRDU&u=2&e=lffdmdnhkjjogdmkkmkpibjbkefnjgbc
and this is the url that i expected to appear:
https://hris-id.tmf-group.com/ess_lenovo/login/auth/reset_by_link?reset_code=5T/BX1GRDU&u=2&e=lffdmdnhkjjogdmkkmkpibjbkefnjgbc
Note: this url is being sent by email.
Will appreciate any help.
Thank you in advance.

Related

How do I log visitors from my HTML-page via PHP, with code separation?

I have a website where I want to log visitor's IP-address, browser and date/time to a txt-file, with help of a PHP-script. I have a PHP-script now that does what I want, it logs this information, but only if I visit the PHP-file. So when I visit my HTML, nothing adds to the txt-file.
I have tried both changing the HTML and the PHP, with for example require('home.html'); or $html = file_gets_contents("home.html"); in the PHP-file. But I'm very new to this language so I have no idea what I'm doing in this case.
And also, this is a school assignment, and I can't use PHP-language in the HTML-file and vice versa, so it needs to be separated. But it's ok to change the HTML-file as well, or both. Hope anyone can help me!
$handle = fopen('visitors.txt', 'a');
$data = "\nDate and time: " . date("Y.m.d, H:i:s") . "\nBrowser: " . $_SERVER['HTTP_USER_AGENT'] . "\nIP-address: " . $_SERVER['REMOTE_ADDR'] . "\n";
fwrite($handle, $data);
fclose($handle);
echo file_get_contents('visitors.txt');
This is the code that works, but only for PHP visits, not visits for my website. (I know there is no code for that yet)

QR code for calendar event in php

I have used the code found on this page to generate QR codes.
I want to generate a QR code for calendar event. I tried using this function:
function calendar_event($summary, $dtstart, $dtend){
$this->data = "BEGIN:VEVENT:SUMMARY:" . $summary . ";dtstart:" . $dtstart . ";dtend:" . $dtend . ";END:VEVENT;";
}
But it doesn't seem to work. Could anyone help me?
I think you are missing the \n. And you should not use ;, but : in terms of a key-value pair.
This is working for me: BEGIN:VCALENDAR\nBEGIN:VEVENT\nDTSTART:20110422\nDTEND:20110422\nSUMMARY:Karfreitag\nEND:VEVENT\nEND:VCALENDAR
Complete code can be
BEGIN:VEVENT\nSUMMARY:My+Event\nDESCRIPTION:Description\nLOCATION:Location\nDTSTART:20200225T114509Z\nDTEND:20210225T114509Z\nEND:VEVENT

Fan-Gate using FB SDK 4

I'm trying to connect an app to a facebook page ... up till that it's fine as it displays in the tabs. Also a simple echo works fine.
I'm using this guide to get it working: https://www.webniraj.com/2014/06/11/facebook-api-creating-page-apps-using-facebook-php-sdk-4-0-x/
I have tried to set some echos so I'd know where it's getting stuck and from what I have it seems it's getting stuck in the
$pageHelper = new FacebookPageTabHelper();
The code works fine on the server where it is uploaded
Any help would be appreciated,
Thanks :)
That tutorial is aweful. All those require calls when you could just use the existing autoloader.php instead. FacebookPageTabHelper extends FacebookCanvasLoginHelper, so you don´t have to add it separately.
Try this one instead: http://www.devils-heaven.com/facebook-php-sdk-4-0-tutorial/
See "Using the Page Tab Helper" in the article:
require 'phpsdk4/autoload.php';
use Facebook\Helpers\FacebookPageTabHelper;
FacebookSession::setDefaultApplication('APP-ID', 'APP-SECRET');
$helper = new FacebookPageTabHelper();
echo '<p>page id: ' . $helper->getPageId() . '</p>';
echo '<p>liked: ' . $helper->isLiked() . '</p>';
echo '<p>admin: ' . $helper->isAdmin() . '</p>';
Important: You need PHP 5.4+ to use the new PHP SDK. - If the code does not work, it´s most likely a problem with the server.

extracting links as clickable links from sql table

Been at this for a while and cant figure it out so i thought id come to the ppl who know.
my php / sql is so-so but.....this is what im trying to do / figure out..
i have a database setup to take in messages (of any sort) and works fine. The user enters data in a field, hits send, and the message gets logged.
But when a user puts in a link for example " http://www.google.com "
its stored in the DB just fine but when its printed back onto the page, it comes back as plain
text, what i want is that when the page throws back the message with the link in it, that the link is live and clickable.
Ive googled my a$# off but im guessing im searching for the wrong thing (or im missing something unbeknownst to me. )
Any tips/*direction* etc, ill gladly accept. also, I dont mind doing the work/research so if you have links only ill take those too.
Thanks in advanced.
You need to parse messages plain text in order to find links. Then, change link texts by adding an anchor tag (<a>).
This link should help you.
you need regular expressions to detect links and convert them to ...
see the answer here:
PHP validation/regex for URL
<?php echo "your_field"; ?>
Something like this should work (I took this from some code I wrote for a client):
$query = mysql_query("SELECT * FROM wcordersinfo WHERE dealer_id = '" . $dealer_id . "' && drawing_num = " . $_GET['reference_id'] . "");
while ($orders = mysql_fetch_array($query)) {
if ($orders['drawing_num'] != '') {
$link_open = '<a href="http://www.example.com/dealers/order-details.php?reference_id=' . $orders['drawing_num'] . '">';
$link_close = '</a>';
} else {
$link_open = $link_close = '';
}
and then where you want to display the content:
<?php echo "<li>' . $link_start . $orders['carrier'] . $link_end . '</li>"; ?>
You may want to check out http://www.php.net/manual/en/function.preg-replace.php for replacing regular expressions with something.
There you want to replace every website with a typical html link syntax like ...

How to share link via twitter from another site?

Is there any way to share link of specific website through my twitter account with PHP? Instead of going to that website and clicking share and authenticating and posting, can i do all this with PHP? If yes, how? Meanwhile, I've managed to get the desired format for posting:
$tweeter_link = "https://twitter.com/share?original_referer=" . $link . "&related=&source=tweetbutton&text=" . $title . "&url=" . $link . "&via=SomeThing";
But I can't process it properly with curl.

Categories