Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
в каком случае? веб, десктоп, консоль? распишите детально, что и как в С#, что и как в пхп, что кого вызывает и каким образомПодскажите, как это можно сделать?
$result = mysql_query("SELECT * FROM users WHERE login = '$login' AND password = '$pass'") or die(mysql_error());
$row = mysql_fetch_array($result);
$id = $row['id'];
$pc = $row['pc'];
using xNet.Net;
using xNet.Collections;
Form2 form2 = new Form2();
private void button1_Click(object sender, EventArgs e)
{
HttpRequest req = new HttpRequest();
HttpResponse resp;
req.Cookies = new CookieDictionary();
var urlParams = new RequestParams();
urlParams["login"] = textBox1.Text;
urlParams["pass"] = textBox2.Text;
resp = req.Get("http://test/script.php", urlParams);
form2.label2.Text = resp.ToString();
form2.ShowDialog();
}
echo $pc;
echo $id;
<?php
$arr = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5);
echo json_encode($arr);
?>
$arr = array('id' => $id, 'pc' => $pc);
echo json_encode($arr);
using xNet.Net;
using xNet.Collections;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
Form2 form2 = new Form2();
private void button1_Click(object sender, EventArgs e)
{
try
{
HttpRequest req = new HttpRequest();
HttpResponse resp;
req.Cookies = new CookieDictionary();
var urlParams = new RequestParams();
urlParams["login"] = textBox1.Text;
urlParams["pass"] = textBox2.Text;
resp = req.Get("http://test/script.php", urlParams);
string json = resp.ToString();
try
{
JObject data = JObject.Parse(json);
int dataId = (int)data["id"];
string dataPc = (string)data["pc"];
form2.label1.Text = dataPc;
form2.label2.Text = dataId.ToString();
if (dataId > 0)
{
form2.ShowDialog();
}
}
catch (Exception ex)
{
MessageBox.Show("Ошибка авторизации", "Error");
}
}
catch (Exception ex)
{
MessageBox.Show("Нет соединения с сервером ", "Error");
}
}
mysql_query("SET NAMES 'cp1251'");
mysql_query("SET CHARACTER SET 'cp1251'");
$arr = array('id' => $id, 'surname' => $surname, 'name' => $name, 'patronymic' => $patronymic, 'pc' => $pc);
echo json_encode($arr, JSON_UNESCAPED_UNICODE);
Надо будет обновить.The use of this solution worked for me with the Latin and the Cyrillic alphabet, with PHP 5.5
mysql_query("SET NAMES 'cp1251'");
mysql_query("SET CHARACTER SET 'cp1251'");