CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Tips & Solutions

 PHP Encrypt URL & Bootstrap Launch Modal Window With Session Var

Print topic Send  topic

Author Message
MichaelMcDonald

Posts: 640
Posted: 02/03/2015, 6:37 PM

The encryption here is more about looks than security.
It masks the true id of the iduser record, that's all it does.
You can however now user a session variable to update user records.

How To...

In your grid, add a hidden field attached to iduser field (example called "iduser")

In your grid Link Before Show:

// Comment userPage = your gridnamePage

CODE

$userpage = CCGetFromGet("userPage");
$key = "D1Be1056x93o5aM7";
$url = $user->iduser->GetValue();
$encrypted = CCEncryptString($url, $key);
$user->Link1->SetLink("users.php?iduser=" . $encrypted . "&userPage=" .$userpage);

In Page Before Initialize Event:

$key = "D1Be1056x93o5aM7";
$iduser = CCGetFromGet("iduser");
$iduser = CCDecryptString($iduser, $key);
CCSetSession("iduser",$iduser);

Also, in grid I have an Add New link with parameters:

expression
1
newuser


In Before Show Of Any Form On The Page:

Place a hidden field in a form example called "iduser" on the page (this is to launch the Bootstrap Modal Window using a session variable)

$iduser = CCGetSession("iduser");
$userSearch->iduser->SetValue($iduser);

This launches Bootstrap Modal (in your .html)

<script type="text/javascript">
$(window).load(function(openmodal){

function GetURLParameter(sParam){
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++)
{
var sParameterName = sURLVariables.split('=');
if (sParameterName[0] == sParam)
{ return sParameterName[1];
}
}
};
var iduser = $('#userSearchiduser').val();

var newuser = GetURLParameter('newuser');

if((iduser > 0) || ( newuser == 1)) {

$('#myModal').modal('show');}
});


</script>

In the form that gets carried in the modal window have links with Expression parameters to close the modal window

0
iduser

0
newuser
_________________
Central Coast, NSW, Australia.

View profile  Send private message
eratech


Posts: 513
Posted: 02/03/2015, 8:32 PM

Further to the other forum question - Yes, CCSEncrypt() is fine there.

It makes it not-obvious what is being stored but if someone cracks it, it won't open the database if they change it.

E
_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia
View profile  Send private message
MichaelMcDonald

Posts: 640
Posted: 02/03/2015, 10:12 PM






_________________
Central Coast, NSW, Australia.

View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.