Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How you make the remote view secrity
Message
From
06/10/2006 16:29:58
 
 
To
06/10/2006 15:50:40
Michale Chen
Shijiazhuang ZhiYuan Crop.
Shijiazhuang, China
General information
Forum:
Visual FoxPro
Category:
Client/server
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01160213
Message ID:
01160227
Views:
14
>Hello everyone:
>
> Could you give me some advice on how to create remote view secritily, so user can not modify the data in remote view and found the password in connection of dbc files. I think first can create a database and then delete the database afer application close maybe a solution, did you have any suggest? Thank you.

Hi
Initially the connection string in your database does not contain the values of essentual parameters like SERVER, UID, PWD. Then with SetConnString (UDF) you set those values, then you actually connect, then blank the values.
=SetConnString('Connect1', 'SERVER='+cSQLServer_na ;
	,'uid='+a_UserInfo[4], 'pwd='+a_UserInfo[5])
h_Connect1=SQLCONNECT('Connect1', .t.)
=SetConnString('Connect1', 'SERVER=','uid=','pwd=')

******************
FUNCTION SetConnString
LPARAMETERS c_Conn_na, c_Parm1, c_Parm2, c_Parm3, c_Parm4, c_Parm5 ;
	, c_Parm6, c_Parm7, c_Parm8
*c_Conn_na the name of the connection whose string to set
*Connection strings parameters to set, eg 'UID=Kamil'
* Example of calling this function
* SetConnString('Connect1','uid='+a_UserInfo[4],'pwd='+a_UserInfo[5])
* Example of a connect string
* DRIVER=SQL Server;Server=OvspsPipe;uid=kamil;
* pwd=KamilPwd;APP=Microsoft® Visual FoxPro®;WSID=KAMIL;
* DATABASE=PL;Network=DBMSSOCN;Address=ovsps,1433

PRIVATE n_Count, c_ConnString, c_BeforeMatch ;
	, c_MatchAfter, n_Pointer, x_R1, c_R2, c_Parm
l_Result=.T.				&& Return value
c_ConnString=.F.			&& Connection String
c_ConnString=DBGETPROP(c_Conn_na,'Connection','ConnectString')
IF VARTYPE(c_ConnString)='L'		&& if still logical
	RETURN .F.
ENDIF
FOR n_Count = 1 TO 8
	c_Parm=EVALUATE('c_Parm'+TRANSFORM(n_Count))
	IF VARTYPE(c_Parm)='L' OR EMPTY(c_Parm)
		LOOP
	ENDIF
	c_Parm=ALLTRIM(c_Parm)
	n_Pointer=ATC('=',c_Parm)
	IF n_Pointer<1
		l_Result=.F.
		LOOP
	ENDIF
	x_R1=LEFT(c_Parm,n_Pointer)				&& eg UID=
	c_R2=SUBSTR(c_Parm,n_Pointer+1)		&& eg KAMIL
* setting the connection string parameter
	n_Pointer=ATC(x_R1,c_ConnString)
	IF n_Pointer<1
		l_Result=.F.
		LOOP
	ENDIF
	c_BeforeMatch=LEFT(c_ConnString,n_Pointer-1)
	c_MatchAfter=SUBSTR(c_ConnString,n_Pointer)
	c_ConnString=c_BeforeMatch+c_Parm
	n_Pointer=ATC(';',c_MatchAfter)
	IF n_Pointer>0
		c_MatchAfter=SUBSTR(c_MatchAfter,n_Pointer)
		c_ConnString=c_ConnString+c_MatchAfter
	ENDIF
ENDFOR
IF NOT l_Result
	WAIT 'Not able to form a connection string' WINDOW
ENDIF
IF APPLICATION.STARTMODE>0		&& Design mode=0
	DBSETPROP(c_Conn_na,'Connection','DispLogin',3)		&& no login dialog
ENDIF
RETURN DBSETPROP(c_Conn_na,'Connection','ConnectString',c_ConnString) AND l_Result
************************************
If the user doesn't know the password, he can't connect to the database, hence he can not use the RV to modify the data.
Kamil
A moment of silence is our cosmic reset button.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform