- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
$__sys=array();
{//bd
$__sys['bd']=array(
'c'=>new PDO('mysql:host=host;dbname=dbname;charset=utf8', 'username', 'pass'),
'd_new'=>array(),
//'d_bd'=>array(),
'execute'=>'',
);
function bd_get_arrays($what='*',$table,$where=false,$where2=false,$order_by=false,$start=false,$limit=false){
$s_act=false;
if($what=='-only_ids'){$s_act='only_ids';$what='*';}
$q=is_object($where)?$where:$GLOBALS['__sys']['bd']['c']->prepare('SELECT '.$what.' FROM '.$table.' WHERE '.($where?$where:'1').
($order_by?' order by '.$order_by:'').($start?' limit '.$start.($limit?', '.$limit:''):''));
$q->execute($where2&&is_array($where2)?$where2:null);
$w=$q->fetchAll();
if($what=='*'){
$I=count($w);
if(!isset($GLOBALS['__sys']['bd']['d_new'][$table]))$GLOBALS['__sys']['bd']['d_new'][$table]=array();
//if(!isset($GLOBALS['__sys']['bd']['d_new'][$table]))$GLOBALS['__sys']['bd']['d_bd'][$table]=array();
for($i=0;$i<$I;$i++){
$GLOBALS['__sys']['bd']['d_new'][$table][$w[$i]['id']]=$w[$i];
//$GLOBALS['__sys']['bd']['d_bd'][$table][$w[$i]['id']]=$w[$i];
}
}
if($s_act=='only_ids'){
$r=array();
$I=count($w);
for($i=0;$i<$I;$i++){
$r[]=$w[$i]['id'];
//$GLOBALS['__sys']['bd']['d_bd'][$table][$w[$i]['id']]=$w[$i];
}
}
return $w;
}
function bd_get_array($what='*',$table,$where=false,$where2=false,$order_by=false){
if(is_numeric($where)){
if(isset($GLOBALS['__sys']['bd']['d_new'][$table],$GLOBALS['__sys']['bd']['d_new'][$table][$where]))
return $GLOBALS['__sys']['bd']['d_new'][$table][$where]; else $where='id='.$where;
}
$q=bd_get_arrays($what='*',$table,$where,$where2,$order_by,1);
return isset($q[0])?$q[0]:false;
}
function bd_set_array($table,$set=false,$where=false,$where2=false,$order_by=false,$start=false,$limit=false){
if(!$set&&is_array($set)&&!empty($set))return;
if(!isset($GLOBALS['__sys']['bd']['d_new'][$table])&&$where)
bd_get_arrays('*',$table,$where,$where2,$order_by,$start,$limit);
if($where){bd_get_arrays('-only_ids',$table,$where,$where2);
}else{$w=array_keys($GLOBALS['__sys']['bd']['d_new'][$table]);$I=count($w);}
$GLOBALS['__sys']['bd']['execute'].='UPDATE `game_marsgame_users` SET ';
for($i=0;$i<$I;$i++){
$r=array_keys($set);
$R=count($r);
for($ri=0;$ri<$R;$ri++){
$GLOBALS['__sys']['bd']['d_new'][$table][$w[$i]][$r[$ri]]=$set[$r[$ri]];
$GLOBALS['__sys']['bd']['execute'].=$r[$ri].'="'.addslashes($set[$r[$ri]]).'"';
}
}
$GLOBALS['__sys']['bd']['execute'].=' WHERE id in('.implode(',',$w).');';
return;
}
function bd_query($sql){
$GLOBALS['__sys']['bd']['c']->query($sql);
}
function bd_close(){
$GLOBALS['__sys']['bd']['c']->query($GLOBALS['__sys']['bd']['execute']);
}
}
barop 11.09.2016 00:32 # −66
guest 12.09.2016 23:07 # 0
Milonov 13.09.2016 00:14 # 0
MAKAKA 25.06.2024 02:15 # 0
guest6 25.06.2024 12:48 # 0
MAKAKA 25.06.2024 02:15 # 0
kissarat 11.09.2016 15:42 # −1
Horse3 13.09.2016 00:18 # 0
https://pbs.twimg.com/media/CqApLcjWcAAXUKu.jpg
bormand 14.09.2016 18:33 # 0
(Ну а через libusb/winusb давным-давно можно было).
XEP 14.09.2016 18:43 # 0
ждём твоего поста!!!
bormand 14.09.2016 18:44 # 0
XEP 14.09.2016 18:51 # 0
inkanus-gray 14.09.2016 19:33 # 0
http://govnokod.ru/14175#comment203408
bormand 14.09.2016 19:16 # +1
З.Ы. Но я не люблю PHP, поэтому даже не уговаривайте...
XEP 14.09.2016 19:21 # +3
Ждём твоего поста, bormand, ну или кто-нибудь ещё