<?php | |
function tiny($url){ | |
$tiny = file_get_contents("http://tinyurl.com/api-create.php?url=$url"); | |
return $tiny; | |
} | |
?> | |
<!DOCTYPE HTML> | |
<html> | |
<!--<img src="http://tinyurl.com/y8zsvy3u" alt="img"> http://tinyurl.com/api-create.php?url=--> | |
<title>Generate QRCode in php - HackerRahul</title> | |
<head> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> | |
</head> | |
<div class="w3-container w3-center w3-blue"> | |
<h1>Generate QRCode- HackerRahul</h1> | |
</div><br> | |
<center> | |
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> | |
<ins class="adsbygoogle" | |
style="display:block" | |
data-ad-client="ca-pub-3641343196914554" | |
data-ad-slot="5783482020" | |
data-ad-format="auto"></ins> | |
<script> | |
(adsbygoogle = window.adsbygoogle || []).push({}); | |
</script> | |
</center> | |
<br> | |
<div class="w3-content"> | |
<h1>What you want to create?</h1><hr> | |
<form method="post" action="index.php"> | |
<div class="w3-row"> | |
<a href="javascript:void(0)" onclick="openCity(event, 'text');"> | |
<div class="w3-third tablink w3-bottombar w3-hover-light-grey w3-padding">Text</div> | |
</a> | |
<a href="javascript:void(0)" onclick="openCity(event, 'url');"> | |
<div class="w3-third tablink w3-bottombar w3-hover-light-grey w3-padding">URL</div> | |
</a> | |
<a href="javascript:void(0)" onclick="openCity(event, 'sms');"> | |
<div class="w3-third tablink w3-bottombar w3-hover-light-grey w3-padding">SMS</div> | |
</a> | |
</div> | |
<?php | |
if (isset($_POST['submit_text'])) { | |
$text = urlencode($_POST['text']); | |
$create_qr_txt = tiny("https://chart.googleapis.com/chart?cht=qr&chs=250x250&chl=$text"); | |
echo "<img src='$create_qr_txt'>"; | |
}elseif (isset($_POST['submit_url'])) { | |
$url = $_POST['url']; | |
$create_qr_url = tiny("https://chart.googleapis.com/chart?cht=qr&chs=250x250&chl=$url"); | |
echo "<img src='$create_qr_url'>"; | |
}elseif (isset($_POST['submit_sms'])) { | |
$number = $_POST['phone_number']; | |
$sms_body = urlencode($_POST['sms']); | |
$create_qr_txt = tiny("https://chart.googleapis.com/chart?cht=qr&chs=250x250&chl=SMSTO:$number:$sms_body"); | |
echo "<img src='$create_qr_txt'>"; | |
} | |
?> | |
<div id="text" class="w3-container city" style="display:none"> | |
<br><h2>Text</h2><br> | |
<input type="text" name="text" class="w3-input" placeholder="Write Something!" required><br> | |
<input type="submit" name="submit_text" class="w3-blue w3-btn w3-hover-blue w3-round" value="submit"> | |
</div> | |
<div id="url" class="w3-container city" style="display:none"> | |
<br><h2>URL</h2><br> | |
<input type="text" name="url" class="w3-input" placeholder="Start with http://" required><br> | |
<input type="submit" name="submit_url" class="w3-blue w3-btn w3-hover-blue w3-round" value="submit"> | |
</div> | |
<div id="sms" class="w3-container city" style="display:none"> | |
<br><h2>SMS</h2><br> | |
<input type="number" name="phone_number" class="w3-input" placeholder="Phone Number" required><br> | |
<textarea name="sms" class="w3-input" placeholder="SMS Body" required></textarea><br> | |
<input type="submit" name="submit_sms" class="w3-blue w3-btn w3-hover-blue w3-round" value="submit"> | |
</div> | |
</div> | |
</form> | |
<center> | |
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> | |
<ins class="adsbygoogle" | |
style="display:block" | |
data-ad-client="ca-pub-3641343196914554" | |
data-ad-slot="5783482020" | |
data-ad-format="auto"></ins> | |
<script> | |
(adsbygoogle = window.adsbygoogle || []).push({}); | |
</script> | |
</center> | |
</div> | |
<script> | |
function openCity(evt, cityName) { | |
var i, x, tablinks; | |
x = document.getElementsByClassName("city"); | |
for (i = 0; i < x.length; i++) { | |
x[i].style.display = "none"; | |
} | |
tablinks = document.getElementsByClassName("tablink"); | |
for (i = 0; i < x.length; i++) { | |
tablinks[i].className = tablinks[i].className.replace(" w3-border-blue", ""); | |
} | |
document.getElementById(cityName).style.display = "block"; | |
evt.currentTarget.firstElementChild.className += " w3-border-blue"; | |
} | |
</script> | |
<div class="w3-footer w3-center w3-blue w3-bottom"> | |
<h4>A HackerRahul Production</h4> | |
</div> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment