link){ - $sth = $this->link->prepare($sql); - $sth->execute(); - $result = $sth->fetch(PDO::FETCH_ASSOC); + $data = $this->dbqueryall($sql); + + if ($data){ + return $data[0]; } return $result; } diff --git a/lib/processdata.php b/lib/processdata.php index 01c2a5c..458f55c 100644 --- a/lib/processdata.php +++ b/lib/processdata.php @@ -1,5 +1,5 @@ secvalue($email); $akey = $db->secvalue($akey); - $hasuser = $db->dbquery("select * from users where useremail='".$email."' and activationkey='".$akey."'"); - if (count($hasuser) > 0){ - $hasuser = $db->dbquery("select * from users where useremail='".$email."' and activationkey='".$akey."'"); + $sql = "select count(*) as cnt from users where useremail='".$email."' and activationkey='".$akey."'"; + $hasuser = $db->dbquery($sql); + if ($hasuser["cnt"] > 0){ + //$hasuser = $db->dbquery("select * from users where useremail='".$email."' and activationkey='".$akey."'"); $db->dbexec("update users set activationkey=null where useremail='".$email."' and activationkey='".$akey."'"); $msg = '
le compte a été activé!
'; $p = 'profile'; @@ -120,7 +116,7 @@ $tmpuser = $db->dbquery($sql); if (count($tmpuser) > 0){ $newpasswd = randomPassword(10,'lower_case,upper_case,numbers,special_symbols'); - $sql2 = "UPDATE users SET md5pwd='md5(".$newpasswd.")' WHERE useremail='".$email."';"; + $sql2 = "UPDATE users SET md5pwd=md5('".$newpasswd."') WHERE useremail='".$email."';"; $db->dbexec($sql2); $send = sendemail('user_forgotpasswd',array("email" => $email, "newpassword" => $newpasswd,"id" => $tmpuser["id"])); if ($send == 0){ @@ -131,29 +127,40 @@ } } - function checklogin($user,$passwd){ - global $db; - $sql = "select * from users where useremail='".$db->secvalue($user)."' and md5pwd=md5('".$db->secvalue($passwd)."');"; - - $user = $db->dbquery($sql); - + function checklogin($username,$passwd){ + global $db,$msg; + $sql = "select count(*) as cnt,id from users where useremail='".$db->secvalue($username)."' and md5pwd=md5('".$db->secvalue($passwd)."');"; + + $luser = $db->dbquery($sql); $sid = null; - if (count($user) > 0){ + $retuser=null; + echo "
$sql
".$luser["cnt"]."
"; + if ($luser["cnt"] == 1){ $sid = generateRandomString(); - $sql = "INSERT INTO usersession (sessionid, id_user, lastlogin, useragent, remoteaddr) - VALUES('".$sid."', ".$user['id'].", CURRENT_TIMESTAMP, '".$_SERVER['HTTP_USER_AGENT']."', '".$_SERVER['REMOTE_ADDR']."');"; + $sql = "INSERT INTO usersession (sessionid, id_user, lastlogin, useragent, remoteaddr) + VALUES('".$sid."', ".$luser['id'].", CURRENT_TIMESTAMP, '".$_SERVER['HTTP_USER_AGENT']."', '".$_SERVER['REMOTE_ADDR']."');"; $db->dbexec($sql); setcookie("juridig",$sid); + $retuser = getsessiondata($sid); + + //$p='profile'; + }else { + setcookie("juridig",""); + $msg='
'.$sql.'
Utilisateur et/ou mot de passe non connu!
'; + //$p='/home'; } - return $user; + return $retuser; } function process_getdata($gdt){ - global $baseurl,$p; + global $baseurl,$p,$db,$user; $action = $gdt["action"]; if ($action == "logout"){ + $db->dbexec("delete from usersession where sessionid='".$user["sessionid"]."';"); + $user=array(); setcookie("juridig",""); - header("location:".$_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['HTTP_HOST'].$baseurl.'/'.$p); + $p='home'; + #header("location:".$_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['HTTP_HOST'].$baseurl.'/'.$p); } else if ($action == "edit") { } else if ($action == "delete") { @@ -163,8 +170,9 @@ function getsessiondata($sessid){ global $db; - $user = $db->dbquery("SELECT us.* from usersession ses LEFT JOIN users us on (ses.id_user=us.id) where ses.sessionid='".$sessid."';"); - return $user; + $sql = "SELECT us.*,ses.sessionid from usersession ses LEFT JOIN users us on (ses.id_user=us.id) where ses.sessionid='".$sessid."';"; + $sesuser = $db->dbquery($sql); + return $sesuser; } function generateRandomString($length = 40) { @@ -185,8 +193,8 @@ $symbols["lower_case"] = 'abcdefghijklmnopqrstuvwxyz'; $symbols["upper_case"] = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $symbols["numbers"] = '1234567890'; - $symbols["special_symbols"] = '!?~@#-_+<>[]{}'; - + $symbols["special_symbols"] = '!?@#-_+*&='; + $characters = explode(",",$characters); foreach ($characters as $key=>$value) { $used_symbols .= $symbols[$value]; diff --git a/lib/sendemail.php b/lib/sendemail.php index 18b5721..40c077f 100644 --- a/lib/sendemail.php +++ b/lib/sendemail.php @@ -6,7 +6,8 @@ $subject = ""; $maildata = array(); $tmpl = $db->dbquery("select * from emailtemplates where ident='".$template."';"); - //print_r($tmpl); if (count($tmpl) > 0){ + //print_r($tmpl); + // if (count($tmpl) > 0){ $datasql = $tmpl['emaildatasql']; foreach ($data as $key => $value){ $datasql = str_replace('%%'.$key.'%%',$value,$datasql); diff --git a/site.js b/site.js index be3de39..01b6e30 100644 --- a/site.js +++ b/site.js @@ -18,26 +18,62 @@ $( document ).ready(function() { initdata(); - - - }); -function readUrl(input) { +// function readUrl(input) { - if (input.files && input.files[0]) { - let reader = new FileReader(); - reader.onload = (e) => { - let imgData = e.target.result; - let imgName = input.files[0].name; - input.setAttribute("data-title", imgName); - //console.log(e.target.result); +// if (input.files && input.files[0]) { +// let reader = new FileReader(); +// reader.onload = (e) => { +// let imgData = e.target.result; +// let imgName = input.files[0].name; +// input.setAttribute("data-title", imgName); +// //console.log(e.target.result); +// } +// reader.readAsDataURL(input.files[0]); +// } + +// } + +function handleFileSelect(evt) { + var files = evt.target.files; // FileList object + //if (!$("#userphoto")){ + $("form#dksrdv_userprofile").prepend(''); + //} + // Loop through the FileList and render image files as thumbnails. + for (var i = 0, f; f = files[i]; i++) { + + // Only process image files. + if (!f.type.match('image.*')) { + continue; } - reader.readAsDataURL(input.files[0]); + + var reader = new FileReader(); + + // Closure to capture the file information. + reader.onload = (function(theFile) { + return function(e) { + $("#preview").attr("src",e.target.result); + $("#userphoto").val(e.target.result); + console.log($("#userphoto")); + }; + })(f); + + // Read in the image file as a data URL. + reader.readAsDataURL(f); } + +} +function removephoto(){ + $("#preview").attr("src",defaultphoto); + if (!$("#userphoto")){ + $("form#dksrdv_userprofile").prepend(''); + } } +document.getElementById('files').addEventListener('change', handleFileSelect, false); + function initstandard(){ var forms = document.querySelectorAll('form.dks'); if (forms.length > 0){ diff --git a/style.css b/style.css index 53cac4c..6fbb1de 100644 --- a/style.css +++ b/style.css @@ -44,33 +44,33 @@ header.masterhead > h1 { } -.inputDnD .form-control-file { - position: relative; - width: 100%; - height: 100%; - min-height: 6em; - outline: none; - visibility: hidden; - cursor: pointer; - /* background-color: #c61c23; */ - /* box-shadow: 0 0 5px solid currentColor; */ -} -.inputDnD .form-control-file:before { - content: attr(data-title); - position: absolute; - top: 0.5em; - left: 0; - width: 100%; - min-height: 6em; - line-height: 2em; - padding-top: 1.5em; - opacity: 1; - visibility: visible; - text-align: center; - border:1px solid currentColor; - /* transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); */ - /* overflow: hidden; */ -} +// .inputDnD .form-control-file { +// position: relative; +// width: 100%; +// height: 100%; +// min-height: 6em; +// outline: none; +// visibility: hidden; +// cursor: pointer; +// /* background-color: #c61c23; */ +// /* box-shadow: 0 0 5px solid currentColor; */ +// } +// .inputDnD .form-control-file:before { +// content: attr(data-title); +// position: absolute; +// top: 0.5em; +// left: 0; +// width: 100%; +// min-height: 6em; +// line-height: 2em; +// padding-top: 1.5em; +// opacity: 1; +// visibility: visible; +// text-align: center; +// border:1px solid currentColor; +// /* transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); */ +// /* overflow: hidden; */ +// } /* .inputDnD .form-control-file:hover:before { border-style: solid; box-shadow: inset 0px 0px 0px 0.25em currentColor; diff --git a/tmpl/pages/avocats.php b/tmpl/pages/avocats.php index c27447a..88d3727 100644 --- a/tmpl/pages/avocats.php +++ b/tmpl/pages/avocats.php @@ -26,7 +26,7 @@ foreach ($avocats as $avo) {
- picture + picture

Addresse

@@ -56,10 +56,8 @@ foreach ($avocats as $avo) {

'.(($avo['userdescription'] != "")?$avo['userdescription']:'').'

'; - if (strpos($avo['services'],'rendezvous') >= 0 ){ - - - echo '
+ if (strpos($avo['services'],'rendezvous') >= -1 ){ + echo ''; } diff --git a/tmpl/pages/profile/profile.php b/tmpl/pages/profile/profile.php index 6d329be..17403a9 100644 --- a/tmpl/pages/profile/profile.php +++ b/tmpl/pages/profile/profile.php @@ -7,7 +7,7 @@ } } $activatedapps = array(); - if ($user['usergroup'] != 'client'){ + if (($user['usergroup'] != 'client') && ($user['services'] != "")){ $activatedapps = explode(',',$user['services']); } ?> @@ -51,9 +51,9 @@ if ($user['usergroup'] == 'administrator'){ ?> - Email Templates + Users - Pages + @@ -111,6 +111,29 @@ ?>
Descriptions
+
+
+ + +
+ " style="width: 150px; max-width: 150px; max-height: 150px;" id="preview"/> +
+
+
+
+ Photo +
+
+ + +
+
+ + +  supprimer la photo +
+
+
@@ -159,20 +182,7 @@
-
-
-
- -
-
- -
- - -
-
-
-
+