Advertisement
Guest User

Untitled

a guest
Apr 7th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. <?php
  2. include('../accesodatos/consultas.php');
  3. session_start();
  4. error_reporting(E_ALL & ~E_NOTICE);
  5. ini_set('display_errors', 1);
  6.  
  7. if($_SESSION['autenticado'])
  8. {
  9. $usuario = $_SESSION['usuario'];
  10. $usuarios = datosUsuarios($usuario);
  11. if($usuarios != null)
  12. {
  13. $categoria = $usuarios['cat_id_category_1'];
  14. $categoria2 = $usuarios['cat_id_category_2'];
  15. if($categoria2 == 'CON' OR $categoria == 'ADM')
  16. {
  17. ...
  18. }else{
  19. Header("location:index.php");
  20. }
  21. }
  22. }else{
  23. Header("location:login/index.php");
  24. }
  25.  
  26.  
  27. $idDeposito=$_GET['idDeposito'];
  28. $idArticulo=$_GET['idArticulo'];
  29. $aut = $_GET['aut'];
  30. echo $aut;
  31. if($aut != null){
  32. $passwordAdmin = $_POST['passAdmin'];
  33. $passUser = $_POST['txtPass'];
  34. if($passUser == $passwordAdmin){
  35. //echo 'asaj';
  36. $autoriz = true;
  37. }
  38. }
  39.  
  40.  
  41. if(($categoria == 'ADM' || $autoriz == true)){
  42. if(deleteDepositoDetalle($idDeposito,$idArticulo))
  43. {
  44. Header('Location:../depositoDetalleFA.php?idDeposito='.$idDeposito.'');
  45. }
  46. else
  47. {
  48. Header('Location:../depositoPF.php');
  49. }
  50. }elseif($autoriz == false && $autorize != null){
  51. echo "<script>alert('Las contraseñas no coinciden. Favor de intentarlo otra vez.');
  52. window.history.back();
  53. </script>";
  54. }
  55. else{
  56. $pass = randomPassword();
  57. //echo 'ehh';
  58. include('emailAutorizacionEliminarDetalleFactura.php');
  59. //echo 'ehh';
  60.  
  61. echo '<form name="frmIns" method="post" action = "delDepositoDetalle.php?idDeposito='.$idDeposito.'&idArticulo='.$idArticulo.'&aut=true">
  62. <input type="hidden" name = "passAdmin" value = "'.$pass.'"/>
  63. <label for="txtPass">Para hacer este movimiento se necesita la autorización del administrador. Por favor introduzca la contraseña asignada para continuar: </label>
  64. <input type="password" name = "txtPass"/>
  65. <input type="submit" name="Aceptar" value = "Aceptar"/>
  66. </form>';
  67.  
  68. }
  69.  
  70. function randomPassword() {
  71. $alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
  72. $pass = array(); //remember to declare $pass as an array
  73. $alphaLength = strlen($alphabet) - 1; //put the length -1 in cache
  74. for ($i = 0; $i < 8; $i++) {
  75. $n = rand(0, $alphaLength);
  76. $pass[] = $alphabet[$n];
  77. }
  78. return implode($pass); //turn the array into a string
  79. }
  80. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement