We have a site, mysite.com, which links to another site of ours, mydemo.com.
The link is https://demouser:password#subdomain.mydemo.com, and in iOS, when users click on the link, because of the username and password. Below is the image :
Is there some possibility to tell the iOS browser that this is not a phishing attempt?
Rather than a direct link, use a PHP file with a redirect like this one
<?php function redirect($url, $statusCode = 302)
{
header('Location: ' . $url, true, $statusCode);
die();
}
$url = 'https://demouser:password#subdomain.mydemo.com';
redirect($url); ?>
If you need a dynamic link (different users, different link) use a PHP file like this with a form leading to it.
demo.php:
<?php function redirect($url, $statusCode = 302)
{
header('Location: ' . $url, true, $statusCode);
die();
}
$url = 'https://' . $_POST['user'] . ':' . $_POST['password'] . '#subdomain.mydemo.com';
redirect($url); ?>
and
login.htm
<form action='demo.php' method='post'>
Username <input type='text' name='user'><br>
Password <input type='password' name='password'><br>
<input type='submit' value='login'>
</form>
Related
How can I send the lastInsertId again to another php document?
Explanation why:
After someone sends a form (form.html) to a database (send.php) he will get an ID for that form. This ID I show in the send.php to the person via PDO:
<p>Your ID:<?php echo $dbh->lastInsertId(); ?></p>
At this confirmation page I want give the person the possibility to print the data from his form as an pdf. So I wrote:
<form action="print.php" method="POST">
<input type="hidden" name="ID" value="<=htmlspecialchars($_POST['lastInsertId']);?>"/>
<input type="submit" name="Print" value="Print" >
</form>
But I he doesn't send the lastInsertId -> I guess the problem is here:
value="<?=htmlspecialchars($_POST['lastInsertId']);?>"
Can you help me to solve that problem?
Your code should be like this:
<form action="print.php" method="POST">
<input type="hidden" name="ID" value="<?php echo $dbh->lastInsertId(); ?>"/>
<input type="submit" name="Print" value="Print" >
</form>
Not sure if it's the best way, but I once needed the last ID of a person who registered.
I did the following after inserting the info into the DB (My table has Auto Increment Primairy Key ID):
$lastId = mysqli_insert_id($con);
You can store the ID anywhere you want. (In the URL or cookie)
Hope this helps (:
Thank you very much! That helped.
Is their an easy way that after he press print (now gets with the ID all the data from the database to show it at the site print.php - that part all works) and NOW DIRECTLY asks to save as pdf?
Can someone please help me with what I am doing wrong here. Quite a novice when it comes to PHP
Here is my code:
<?php echo $breadcrumb['text']; str_replace("<br />",""); ?>
I think the correct way of executing that is this.:
echo str_replace("<br />", "", $breadcrumb['text']);
In this case, you want to replace all br-tags with "" in the $breadcrumb['text'] variable.
Look at the documentation for that function here: http://php.net/manual/en/function.str-replace.php
If I understand:
<?php
$breadcrumb['text'] = "Something <br /> Next line but now on first <br />";
str_replace("<br />","", $breadcrumb['text']);
echo $bread;
?>
How can I get a part of a string from the specific starting position to end. Like for example I want to copy v=mQUr2RkjykU from the given url:
http://www.youtube.com/watch?v=mQUr2RkjykU
If url is writen into form, how can i copy and paste that part.
And write it mysite.com/watch?xxxxxxxxxxx in a link thats generated.
<input id="Form" name="Form" type="text" /><input id="Button" type="button" value="" />
Thank you
You can use substr() and strpos()
In your case , you can check the position of '?' in your URL>>
$oldUrl = 'http://www.youtube.com/watch?v=mQUr2RkjykU';
$newUrl = substr($oldUrl, 1, strpos($oldUrl, '?')-1);
$newUrl would be your answer,
anyway , try to search more before asking question here :)
I have a page where i need to send parameter (say param1) via post and site is running
over HTTPS, would it be secure can anyone hack this information, what is the correct
solution to send info over https ?
Below is the JSP page, indeed the info is send via HTTPS but user can see view source to
see value of param1 and param2, would we use some encryption standard or jsp taglib so
that user is not able to view source ass well as not able to read param1 and param2 values.
testPage.jsp
This is a parent page , in this a second jsp is included
<form id="myForm" target="iframe" method="post" action="http://www.abc.com/jsp/dGrid.jsp">
<input type="hidden" name="param1" value="77"/>
<input type="hidden" name="param2" value="SS"/>
</form>
<iframe name="iframe" width="1500px" scrolling="no" height="1170px" frameborder="0" allowtransparency="">
</iframe>
<script type="text/javascript">
document.getElementById('myForm').submit();
</script>
I know enough about the coding end of web design to be embarrassed by what I don't know. What I want to do is to have various print promotions in newspapers and what not along the lines of: for more information please visit www.mysite.com/2345.
If the visitor doesn't enter the entire url in the nav bar and ends up at the main index, I want to have a text field there so they can enter "2345", hit enter or submit, then be redirected to www.mysite.com/2345 wherein the folder's index page will load.
I usually search and find the coding info I'm looking for, but I can't figure out a concise way to search this particular problem. Can anyone help with this or point me in the right direction for help elsewhere?
Thanks.
Pretty simple with JavaScript, here's a working example:
<form onsubmit="location.href='http://www.mysite.com/' + document.getElementById('myInput').value; return false;">
<input type="text" id="myInput" />
<input type="submit" />
</form>
You can do it using javascript. Here's a terribly ugly example but should give you an idea.
<form>
<input type="text" id="number" name="number" />
<input type="submit" onclick="window.location = window.location + '/' + number.value; return false;"/>
</form>
Ideally you'd also handle it in whatever server side language you're using as well. Here's a PHP example:
<?
if(isset($_POST['number'])){
header('Location: http://www.yourdomain.tld/'.$_POST['number']);
exit;
}
?>
Very simple example with PHP, so that you can understand how it works. Very simple.
<?php
if (isset($_POST['bt']))
{
header("Location: http://localhost/" . $_POST['folder']);
}
?>
<html>
<form id="form1" name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="text" name="folder" id="folder" />
<input type="submit" name="bt" id="bt" value="Go To" />
</form>
</html>
This is you index.php File, in your htdocs/www folder.
The PHP notices when you click the button and it will redirect you to
http://www.yourdomain.com/what-you-have-writen-in-the-textfield
You can also do it with JavaScript, but with PHP it will work even if your visitor browser has JavaScript disabled.