Hot to pass $_SESSION to my not secure log in to my hash login PHP

i have a little problem i have two login first it s not secure login build to md5('$password') second login with hash algoritm password i post both . I want pass the variable about the $_SESSION but i can't to build it . I post what i want to not secure login

I want this

if(is_array($row) && !empty($row))
{
 $validuser = $row['email'];
 $_SESSION['name_session'] = $validuser;
 $_SESSION['nome'] = $row['nome'];
 $_SESSION['id'] = $row['id'];
}

and this

if(isset($_SESSION['name_session']))
{
echo "CODE";
header('Location: FOLDER/FILE.php');
}

Post not secure login

<?php include'header.php'; ?>
<?php session_start(); ?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../../../favicon.ico">

<title>Signin Template for Bootstrap</title>

</head>

<div class="container">
<div class="row">
<div class="col-md-3"></div>
<div style="text-align: center;" class="col-md-6">
<?php
include("connessione.php");
if(isset($_POST['submit']))
{
$email = mysqli_real_escape_string($connessione, $_POST['email']);
$password = mysqli_real_escape_string($connessione, $_POST['password']);

if(
$email == "" ||
$password == "")
{
    echo "CAMPI VUOTI.";
    echo "<br/>";
    echo "<a href='User/index.php'>Go back</a>";
} else {

$result = mysqli_query($connessione, "SELECT * FROM utenti WHERE email='$email' AND
password=md5('$password')")
 or die("Could not execute the select query.");

$row = mysqli_fetch_assoc($result);
if(is_array($row) && !empty($row))
{
      $validuser = $row['email'];
      $_SESSION['sessione_valida'] = $validuser;
      $_SESSION['nome'] = $row['nome'];
      $_SESSION['id'] = $row['id'];
} else

{
      echo "EMAIL O PASSWORD ERRATI.";
      echo "<br/>";
      echo "<a href='accesso.php'>Go back</a>";
}

if(isset($_SESSION['sessione_valida']))
{
  echo "<div style='text-align:center;' class='col-md-12'>
<h3>Accesso effettuato correttamente</h3>
</div>
<div style='text-align:center;' class='col-md-12'>
<a href='User/index.php'><input class='btn btn-primary btn-lg btn-block' type='submit' name='submit' value='Accedi'></a>
</div>";
  header('Location: User/index.php');
} }
} else {
?>
<form name="form1" method="post" class="form-signin">
<img class="mb-4" src="https://getbootstrap.com/assets/brand/bootstrap-solid.svg" alt="" width="72" height="72">
<h1 class="h3 mb-3 font-weight-normal">Please sign in</h1>
<label for="inputEmail" class="sr-only">Email address</label>
<input type="email" name="email" id="inputEmail" class="form-control" placeholder="Email address" required autofocus>
<label for="inputPassword" class="sr-only">Password</label>
<input type="password" name="password" id="inputPassword" class="form-control" placeholder="Password" required>
<div class="checkbox mb-3">

      </div>
<input class="btn btn-primary btn-lg btn-block" type="submit" name="submit" value="Accedi">
      <p class="mt-5 mb-3 text-muted">&copy; 2017-2018</p>
    </form>
    <?php
} ?>
</div>
<div class="col-md-3"></div>
</div>
</div>
</html>

And i want implement two if in my new hash algoritm password

<?php include'header.php'; ?>
<?php session_start(); ?>
<?php
$msg = "";

if (isset($_POST['submit'])) {
include 'connessione.php';

$email = $connessione->real_escape_string($_POST['email']);
$password = $connessione->real_escape_string($_POST['password']);

$sql = $connessione->query("SELECT id, password FROM titolare_azienda WHERE email='$email'");

if ($sql->num_rows > 0) {
$data = $sql->fetch_array();

if (password_verify($password, $data['password'])) {
$msg = "You have been logged IN! <a href='User/index.php'>vai</a>";
}

else
$msg = "Please check your inputs!";

} else
$msg = "Please check your inputs!";

}

?>

<?php if ($msg != "") echo $msg . "<br><br>"; ?>

<form method="post" action="accesso.php">
<input class="form-control" name="email" type="email" placeholder="Email..."><br>
<input class="form-control" minlength="5" name="password" type="password" placeholder="Password..."><br>
<input class="btn btn-primary" name="submit" type="submit" value="Log In"><br>
</form>
  • update query dosen't work
    SELECT codefard,ave,class,
          IF(ave=@_last_ave,@curRank:=@curRank,@curRank:=@_sequence) AS rank,
           @_sequence:=@_sequence+1,@_last_ave:=ave
        FROM grade, (SELECT @curRank := 1, @_sequence:=1, @_last_ave:=0) r
        ORDER BY  ave DESC
    

    this query is works correctly but when i update this answer into table doesn't work.

    UPDATE grade JOIN (SELECT codefard,ave,class,
       IF(ave=@_last_ave,@curRank:=@curRank,@curRank:=@_sequence) AS rank,
                  @_sequence:=@_sequence+1,@_last_ave:=ave
        FROM grade, (SELECT @curRank := 1, @_sequence:=1, @_last_ave:=0) r
        ORDER BY  ave DESC)as d ON grade.codefard = d.codefard SET grade.allrank=d.rank
    
  • Hibernate: could not extract ResultSet; SQL [n/a]

    I have that nativeQuery Query in my Repository.

        @Query(value = Constant.QUERRY_FIND_GUIDE, nativeQuery=true)
    List<Guide> findGuide(String locationName, String gender, String type, String language);
    

    and Constant.QUERRY_FIND_GUIDE is

    public static final String QUERRY_FIND_GUIDE = "SELECT g.id FROM Guide g " + 
            " LEFT JOIN g.user u  " + 
            " LEFT JOIN g.locations l " + 
            " LEFT JOIN g.languages lang "+
            "WHERE (UPPER(?1)=UPPER('NULL') OR ?1 IS NULL OR ?1 ='' OR l.locationName = ?1) "
            + " AND (UPPER(?2)=UPPER('NULL') OR ?2 IS NULL OR ?2 ='' OR g.gender =?2) "
            + " AND (?3 IS NULL OR ?3 ='' OR "
            + " (CASE WHEN UPPER(?3)=UPPER('NULL') THEN g.cardnumber IS NULL ELSE g.cardnumber IS NOT NULL END) )"
            + " AND (UPPER(?4)=UPPER('NULL') OR ?4 IS NULL OR ?4='' OR lang.language = ?4)";
    

    when i run the Page I have that error: 2018-04-24 03:05:32.198 WARN 1340 --- [nio-8080-exec-4] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 1064, SQLState: 42000 2018-04-24 03:05:32.198 ERROR 1340 --- [nio-8080-exec-4] o.h.engine.jdbc.spi.SqlExceptionHelper : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE (UPPER('Hà Nội')=UPPER('NULL') OR 'Hà Nội' IS NULL OR 'Hà Nội' ='' at line 1 2018-04-24 03:05:32.208 ERROR 1340 --- [nio-8080-exec-4] c.w.tgo.controller.OperatorController : error search: org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet i try all solution on google but can't fix it. Can somehone hlp me please!!!!

  • Unhandled rejection SequelizeConnectionRefusedError: connect ECONNREFUSED

    I keep getting this error when I run my server with mysql and nodemon. I understand that part of the solution is that my database server is not running, but I do not know how to get it back up and running. I have my root, host, password, database etc., all set up, and the server use to work before, but I have no idea why it would not be working now. Can anyone help me?

    Thank you.

  • Microsoft HoloLens: Mixed Reality 250 - No session available for one HoloLens to join with another HoloLens hosting it

    This morning, I was working through the Mixed Reality 250 tutorial. I'm stuck with having one HoloLens join the session that the other HoloLens is currently hosting, because the selectable widget in the UIContainer prefab that should have the information on the hosted session is missing.

    I followed all of the necessary steps there. It does deploy successfully through USB.

    As someone in a post on the Windows Mixed Reality Developers Forum wrote, it doesn't matter how the software itself is deployed; it's the software itself that determines how two or more HoloLens headsets will share holograms among one another.

    They are both connected to the same network on Wi-Fi. On One HoloLens, upon deployment by USB and starting it up [by selecting Start without Debugging in the Debug menu on Visual Studio 2017], I gaze over to the Start button, then I do an air tap gesture on it to start the session. As expected, the demo hologram does show up in front of me, and when I do an air tap with the cursor on it, I am able to move it around with my gaze and see the spatial mapping triangles.

    On the other HoloLens, I deploy it by USB and start it up by clicking on [Start without Debugging]. The app does load, except I don't see an option for the hosted session the other HoloLens is running in the Available Sessions list. Even the Join button underneath it has the text completely gray.

    I don't understand why I can't join a session on the client HoloLens even if it's on the same network. My two workmates told me that it may have to do with the network itself, but I'm not exactly sure because there may be something that has to do with the HoloLens headsets themselves, or my laptop I'm trying to deploy the solution from. Someone told me further on that I may need a router, but I am not exactly sure on that.

    I followed the steps of the setup as is.

    Versions of Windows Holographic on both HoloLens headsets are 10.0.14393.2007 and 10.0.14393.448. I don't know if updating the versions would make a difference.

    The end goal here is to see if following Mixed Reality 250 can be useful for a project under an NDA where we wanted to deploy it to the HoloLens and enable Spectator View.

    I am a university student, and this is my last week of an internship I'm completing.

  • Python - How to create post requests with multiple sessions to a single website simultaneously?

    For example let's say I want to create 5 logged in sessions to a single website and then make a post request to each session all simultaneously?

    What's the most practical way to achieve this... if possible.

    Thanks.

  • Access Woocommerce Session data

    I'm trying to access a value in the Woocommerce Session Object , without any result.

    Having this session in WC:

    WC_Session_Handler Object
    (
        [_cookie:protected] => wp_woocommerce_session_b520c2589cabce0f648a4494ecfed80e
        [_session_expiring:protected] => 1524665732
        [_session_expiration:protected] => 1524669332
        [_has_cookie:protected] => 1
        [_table:protected] => wp_woocommerce_sessions
        [_customer_id:protected] => 5449e37e9213b75fddd980f24c9b93d3
        [_data:protected] => Array
            (
                [cart] => a:0:{}
                [cart_totals] => a:15:{s:8:"subtotal";i:0;s:12:"subtotal_tax";i:0;s:14:"shipping_total";i:0;s:12:"shipping_tax";i:0;s:14:"shipping_taxes";a:0:{}s:14:"discount_total";i:0;s:12:"discount_tax";i:0;s:19:"cart_contents_total";i:0;s:17:"cart_contents_tax";i:0;s:19:"cart_contents_taxes";a:0:{}s:9:"fee_total";i:0;s:7:"fee_tax";i:0;s:9:"fee_taxes";a:0:{}s:5:"total";i:0;s:9:"total_tax";i:0;}
                [applied_coupons] => a:0:{}
                [coupon_discount_totals] => a:0:{}
                [coupon_discount_tax_totals] => a:0:{}
                [removed_cart_contents] => a:1:{s:32:"ee0d6c58f0f8345eefda7e85c449b783";a:10:{s:3:"key";s:32:"ee0d6c58f0f8345eefda7e85c449b783";s:10:"product_id";i:10758;s:12:"variation_id";i:0;s:9:"variation";a:0:{}s:8:"quantity";s:1:"1";s:13:"line_tax_data";a:2:{s:8:"subtotal";a:1:{i:13;d:7.1229508196721322832445366657339036464691162109375;}s:5:"total";a:1:{i:13;d:7.1229508196721322832445366657339036464691162109375;}}s:13:"line_subtotal";d:32.37704918032786594039862393401563167572021484375;s:17:"line_subtotal_tax";d:7.12000000000000010658141036401502788066864013671875;s:10:"line_total";d:32.37704918032786594039862393401563167572021484375;s:8:"line_tax";d:7.12000000000000010658141036401502788066864013671875;}}
                [customer] => a:26:{s:2:"id";s:1:"0";s:13:"date_modified";s:0:"";s:8:"postcode";s:0:"";s:4:"city";s:0:"";s:9:"address_1";s:0:"";s:7:"address";s:0:"";s:9:"address_2";s:0:"";s:5:"state";s:2:"BO";s:7:"country";s:2:"IT";s:17:"shipping_postcode";s:0:"";s:13:"shipping_city";s:0:"";s:18:"shipping_address_1";s:0:"";s:16:"shipping_address";s:0:"";s:18:"shipping_address_2";s:0:"";s:14:"shipping_state";s:2:"BO";s:16:"shipping_country";s:2:"IT";s:13:"is_vat_exempt";s:0:"";s:19:"calculated_shipping";s:1:"1";s:10:"first_name";s:0:"";s:9:"last_name";s:0:"";s:7:"company";s:0:"";s:5:"phone";s:0:"";s:5:"email";s:0:"";s:19:"shipping_first_name";s:0:"";s:18:"shipping_last_name";s:0:"";s:16:"shipping_company";s:0:"";}
                [wc_notices] => 
                [shipping_for_package_0] => a:2:{s:12:"package_hash";s:40:"wc_ship_99615497844192df6a7ff67c2bfcf000";s:5:"rates";a:1:{s:51:"tree_table_rate:e1027cf7_spedizione_standard_italia";O:16:"WC_Shipping_Rate":2:{s:7:"*data";a:6:{s:2:"id";s:51:"tree_table_rate:e1027cf7_spedizione_standard_italia";s:9:"method_id";s:15:"tree_table_rate";s:11:"instance_id";i:0;s:5:"label";s:26:"Spedizione standard Italia";s:4:"cost";s:5:"11.89";s:5:"taxes";a:1:{i:13;d:2.61580000000000012505552149377763271331787109375;}}s:12:"*meta_data";a:0:{}}}}
                [previous_shipping_methods] => a:1:{i:0;a:1:{i:0;s:51:"tree_table_rate:e1027cf7_spedizione_standard_italia";}}
                [shipping_method_counts] => a:1:{i:0;i:1;}
                [chosen_shipping_methods] => 
            )
    
        [_dirty:protected] => 1
    )
    

    I need to get this value:

    is_vat_exempt
    

    Consulting the documentation I've found the function:

    get( $key, $default = null ) 
    

    What I'm doing wrong? I will appreciate any help.

    Thank you

  • Excel formula with loop and if condition

    We have a laundry machine in the company with a maximum capacity = 100kg. Now, the target is to put always 100kg of clothes in order to effectively use the washing products (shampoo, etc.). The amount being put there differentiate around 100kg more/less. Laundry machine has several different regimes of washing. Now, I need to figure out a formula that would tell me (automatically) whether a certain regime of washing has more/less then 100kg.

    I could easily tell, if an "x" result equals 90 kg (90-100kg gives me the result). Now, the problem is, that I get several results per day and sometimes the capacity used is 110, 90, 110,90 etc. Now, when I sum all the numbers up - I would get 400 (110+90+110+90) and by deduction from 400 -> I would get "0" and that would mean, that everything is OK, which is not.

    Could anybody advise me?

    I hope you get the point.

    Thakns!

  • Python Pandas conditional flagging

    Working with python pandas dataframe df:

    product_id |transaction_id | category | color
    234          54              A           black
    349          54              B           silver
    213          46              A           silver
    490          46              A           black
    245          87              A           black
    249          87              B           black
    294          87              A           silver
    

    I want to flag transaction_IDs that have category of A and B with the same color. So in the scenario above transaction 87 has a product A black and a product B black.

    Desired output:

    product_id |transaction_id | category | color  | flag
    234          54              A           black
    349          54              B           silver
    213          46              A           silver
    490          46              A           black
    245          87              A           black    X
    249          87              B           black    X
    294          87              A           silver   X
    

    I was trying to create a unique key between category and color and then groupby, but it got messy and I still have to go manually through it. There must be a simpler way.

    df['key']=df['category']&df['color']
    
    df['transaction_analysis']= df.groupby('transaction_id').key.transform(lambda x : '&'.join(set(x)))
    
  • Creating a function that can assess a column and give an output in a new column

    This is my first question, so I will attempt to give as much detail as possible.

    I am attempting to create a function in which I can produce a new column containing "1" or "0" as my output based on whether or not the original column had a date listed or it had no value. Below is a small example of what I am trying to achieve:

                Column 1      New Column
        Obs.1   4/23/2012          1
        Obs.2                      0
        Obs.3   1/23/2016          1
    

    I am not sure on how to go about doing this. I have attempted to use tapply() and ifelse() in conjunction, but have not had any workable code. This is sort of what I am going for:

        TextToNumb <- function(df$column){
        Ifelse(df$column > 0, 1, 0)
        return(df$newcolumn
        }
    

    I would appreciate any help, thanks!