Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in /home/jopp289/domains/progmans.net/public_html/engine/classes/mysqli.class.php on line 162 Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jopp289/domains/progmans.net/public_html/engine/modules/show.short.php on line 160 Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jopp289/domains/progmans.net/public_html/engine/modules/show.short.php on line 160 Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jopp289/domains/progmans.net/public_html/engine/modules/show.short.php on line 160 Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jopp289/domains/progmans.net/public_html/engine/modules/show.short.php on line 160 Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jopp289/domains/progmans.net/public_html/engine/modules/show.short.php on line 160 Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jopp289/domains/progmans.net/public_html/engine/modules/show.short.php on line 160 WEB
Заголовок



import React, { useState, useEffect } from 'react';
import RecipeList from './components/RecipeList

function App() {
  const url = useState(`https://api.myjson.com/bins/t7szj`)
  const [recipes, setRecipes] = useState([])
  const fetchRecipe = async () => {
    const recipeData = await fetch(url)
    const { recipes } = await recipeData.json()
    setRecipes(recipes)
  }

  useEffect(() => {
    fetchRecipe()
  })

  return (
    <div className="App">
      <RecipeList recipes={recipes}>
    </div>
  );
}

 

https://medium.com/better-programming/lets-learn-react-hooks-and-context-api-by-building-a-recipe-search-app-63be9d9e1801

Теги:



import React, { Component } from 'react'
import RecipeList from './components/RecipeList
export default class test extends Component {
  constructor(props) {
    super(props)
    this.state = {
      apiResponse: [],
    }
  }
  componentDidMount() {
    fetch(`https://api.myjson.com/bins/t7szj`)
      .then(data => data.json)
      .then(apiResponse => this.setState({ apiResponse }))
  }
  render() {
    return (
      <div>
          <RecipeList recipes={this.state.recipes}>
      </div>
    )
  }
}

 

https://medium.com/better-programming/lets-learn-react-hooks-and-context-api-by-building-a-recipe-search-app-63be9d9e1801

Теги:









php текстовое поле, поле ввода

<input type="text" name="имя" size="размер" maxlength="длина" value="значение">


--------------------------------------------------------------------------------------------------------

php текстовая область

<textarea name="имя" cols="ширина" rows="высота" wrap="тип">

Это текст, отображаемый по умолчанию.

</textarea>


--------------------------------------------------------------------------------------------------------

php флаг флажок

<input type="checkbox" name="имя" value="значение" checked="checked">


--------------------------------------------------------------------------------------------------------

php переключатель

8.00-12.00<input type="radio" name="time" value="1">

12.00-16.00<input type="radio" name="time" value="2" checked="checked">

16.00-20.00<input type="radio" name="time" value="3">


--------------------------------------------------------------------------------------------------------

php скрытое поле

echo '<input type="hidden" name="submitted" value="yes">'


… и проверка    if (isset($_POST['submitted']))

{...


--------------------------------------------------------------------------------------------------------

php выпадающий список drop down

Овощи <select name="veg" size="1">

<option value="Горох">Горох</option>

<option value="Фасоль">Фасоль</option>

<option value="Морковь">Морковь</option>

<option value="Капуста">Капуста</option>

<option value="Брокколи">Брокколи</option>

</select>


--------------------------------------------------------------------------------------------------------

php label выбор элемента формы щелчком на связанном с ним тексте

<label>8.00-12.00<input type="radio" name="time" value="1"></label>




php избежать внедрения sql-кода, безопасность

mysql_real_escape_string


Указатели места заполнения

PREPARE statement FROM "INSERT INTO classics VALUES(?,?,?,?,?)";

SET @author = "Emily Brontл",

@title = "Wuthering Heights",

@category = "Classic Fiction",

@year = "1847",

@isbn = "9780553212587";

EXECUTE statement USING @author,@title,@category,@year,@isbn;

DEALLOCATE PREPARE statement;


--------------------------------------------------------------------------------------------------------

php избежать внедрения html-кода, безопасность

htmlentities

 

--------------------------------------------------------------------------------------------------------

php обезвреживание безопасность

<?php

function sanitizeString($var)

{

$var = stripslashes($var);

$var = htmlentities($var);

$var = strip_tags($var);

return $var;

}


function sanitizeMySQL($connection, $var)

{ // Использование расширения mysqli

$var = $connection->real_escape_string($var);

$var = sanitizeString($var);

return $var;

}

?>


$var = sanitizeString($_POST['user_input']);

$var = sanitizeMySQL($connection, $_POST['user_input']);

назад 1 2 3 4 далее