Variable accessible de n'importe que autre page Web
Bonjour à tous,
Je suis débutant et j'essaye de faire en sorte que les données du membre soient accessibles de n'importe quelle page Web.
Je recherche à avoir des variables accessibles de n'importe que autre page Web.
Voici mon code.
Auth.html
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
|
<html>
<head>
<title>app test2</title>
<meta charset="UTF-8">
<!--<script type="text/javascript" src="api/bower_components/jquery/dist/jquery.js"></script>-->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!--
<script type="text/javascript" src="api/bower_components/bootstrap/dist/js/bootstrap.js"></script>
<link rel="stylesheet" type="text/css" href="api/bower_components/bootstrap/dist/css/bootstrap.css">
-->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script>
<!-- mes code source perso -->
<script type="text/javascript" src="./app.js"></script>
<!--<script type="text/javascript" src="./service/ServiceInscription.js"></script>-->
<script type="text/javascript" src="./service/ServiceAuth.js"></script>
<script type="text/javascript" src="./controller/CtrlAuth.js"></script>
</head>
<body ng-app="app">
<div ng-controller="CtrlAuth">
<a href="testA.html?aaa=f">test z</a>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-10">
<h3>Authentification Membres </h3>
<p>
<!-- {{User}}-->
<!--{{membreDonnees.Nom}}-->
------------------------{{$rootScope.bebeTest}}
</p>
<br><br>
<br><br><br>
<p> </p>
<!--
<p class="text-success" ng-show="authMembre.$submitted" >
OK
</p>
-->
</div>
</div>
<form class="form-horizontal" name="authMembre" id="authMembre" ng-submit="authentificationMembre(identifiant, motDePasse)" notvalidate >
<div class="form-group" ng-class="{ 'has-error': authMembre.identifiant.$invalid && !authMembre.identifiant.$error.required }">
<label class="col-sm-4 control-label">Identifiant </label>
<div class="col-sm-3">
<input type="text" name="identifiant" class="form-control" id="identifiant" ng-model="identifiant" placeholder="Identifiant" required />
</div>
<span ng-show="authMembre.identifiant.$dirty && authMembre.identifiant.$error.required" style="color:red">le champ ne dois pas être vide.</span>
<!--
<p ng-show="newMembre.identifiant.$error.pattern" class="help-block" style="color:red">caractères spéciaux interdits!</p>
<p ng-show="newMembre.identifiant.$error.UserHexistance" class="help-block" style="color:red">veuillez choisirs un autre identifiant ! Merci!</p>
<p ng-show="newMembre.identifiant.$error.minlength" class="help-block" style="color:red">il faut au minimum 8 caractères.</p>
<p ng-show="newMembre.identifiant.$error.maxlength" style="color:red" class="help-block">Limitée a 15 caractères</p>
<span ng-show="authMembre.identifiant.$dirty && authMembre.identifiant.$error.required" style="color:red">le champ ne dois pas être vide.</span>
-->
</div>
<div class="form-group" >
<label class="col-sm-4 control-label">Mot de Passe</label>
<div class="col-sm-3">
<input type="text" name="motDePasse" class="form-control" id="motDePasse" ng-model="motDePasse" placeholder="mot de passe" required>
</div>
<span ng-show=" authMembre.motDePasse.$dirty && authMembre.motDePasse.$error.required" style="color:red">le champ ne dois pas être vide.</span>
<!-- <span ng-show="authMembre.motDePasse.$dirty && authMembre.motDePasse.$error.required" style="color:red">le champ ne dois pas être vide.</span>
-->
<!--
<p ng-show="newMembre.motDePasse.$error.pattern" class="help-block" style="color:red">caractères interdits.</p>
<p ng-show="newMembre.motDePasse.$error.minlength" class="help-block" style="color:red">il faut au minimum 8 caractères.</p>
<p ng-show="newMembre.motDePasse.$error.maxlength" style="color:red" class="help-block">Limitée a 15 caractères</p>
<span ng-show="newMembre.motDePasse.$dirty && newMembre.motDePasse.$error.required" style="color:red">le champ ne dois pas être vide.</span>
-->
</div>
<div class="form-group">
<div class="col-sm-offset-4 col-sm-10">
<button type="submit" class="btn btn-default" >Connexion</button><br><br>
<br>
<hr>
<br><br><br>
</div>
</div>
</div>
</form>
</body>
</html> |
testA.html
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
<html>
<head>
<title>app teddfdfdst2</title>
<meta charset="UTF-8">
<script type="text/javascript" src="api/bower_components/jquery/dist/jquery.js"></script>
<!--
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
-->
<!--
<script type="text/javascript" src="api/bower_components/bootstrap/dist/js/bootstrap.js"></script>
<link rel="stylesheet" type="text/css" href="api/bower_components/bootstrap/dist/css/bootstrap.css">
-->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script>
<!-- mes code source perso -->
<script type="text/javascript" src="./app.js"></script>
<script type="text/javascript" src="./service/ServiceAuth.js"></script>
<script type="text/javascript" src="./controller/CtrlAuth2.js"></script>
<!-- Include Bootstrap Datepicker -->
<!--Ceci permet de mettre un menu pour le input de la date de naissance -->
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/css/datepicker.min.css" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/css/datepicker3.min.css" />
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/js/bootstrap-datepicker.min.js"></script>
<script type="text/javascript">
</script>
</head>
<body ng-app="app">
<script type="text/javascript">
</script>
<div ng-controller="CtrlAuth2">
<!--{{sik}}-->
{{membreVerif}}
</div>
</body>
</html> |
CtrlAuth.js
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
'use strict';
app.controller ('CtrlAuth', function ($rootScope, $http, $scope, ServiceAuth){
$scope.authentificationMembre = function (NewUser, NewPasse){
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$http.get ("./serveur/mysql/VerifMembre.php", {
params: { leUser: NewUser,
lePasse: NewPasse}
})
.success(function(data, status) {
$rootScope.membreVerif = data;
if ($rootScope.membreVerif == "oui"){
$rootScope.Usera = {statut:"true", id:NewUser, password:NewPasse};
$scope.RecupeDonneesMembre (NewUser, NewPasse);
}
else {
// $rootScope.membreIdentification = false;
// $rootScope.membreEtat = {};
$rootScope.Usera = {statut:"false", id:"RIEN", "password":"RIENddddddddddddddd"};
}
//console.log (">>>>"+$rootScope.membreIdentification);
}).
error(function(data, status) {
alert ("erreur lors de lappel du json");
});
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$scope.RecupeDonneesMembre = function (LeUser, LePasse){ // methode pour recuperer les donnees du membre.
$http.get ("./serveur/mysql/InfosMembre.php", {
params: { leUser: LeUser,
lePasse: LePasse}
})
.success(function(data, status) {
$scope.membreDonnees = data;
window.test98 = data;
ServiceAuth.SetMember(data);
console.log ("!!!!!!!!!!!!!!!!!!!!!!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"+ServiceAuth.GetMember().Nom);
$rootScope.ttta = ServiceAuth.GetMember().Nom;
$rootScope.MyUseraaa = "test var global";
window.Letesta = data;
$rootScope.bebeTest = data;
console.log ("<<<<<<<<<<<<<<<<<<<<<<<<<"+window.Letesta.Nom);
//$rootScope.membreDonnees = ServiceAuth.GetMember (LeUser, LePasse);
}).
error(function(data, status) {
alert ("erreur lors de lappel du json");
});
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}); |
ServiceAuth.js
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
'use strict';
app.service ('ServiceAuth', ['$http', function ($http){
//this.mavar = "NULL NULL";
this.SetMember = function (mavara){
this.mavar = mavara;
};
this.GetMember = function (){
return this.mavar;
};
///////////////////
this.GetMemberInit = function (NewUser, NewPasse){
$http.get ("./serveur/mysql/InfosMembre.php", {
params: { leUser: NewUser,
lePasse: NewPasse}
})
.success(function(data, status) {
}).
error(function(data, status) {
alert ("erreur lors de lappel du json");
});
};
///////////////////////////////////////////////////////
}]); |
Merci d'avance de votre aide.