-
Notifications
You must be signed in to change notification settings - Fork 2
/
edit-social-id.php
104 lines (83 loc) · 3.26 KB
/
edit-social-id.php
1
2
3
4
5
6
7
8
9
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
include('include/config.php');
if(!isset($_SESSION['id'])) header('Location: index.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Modifica il codice cancella personaggio • <?=$config['site_name'];?></title>
<? include('include/meta-tags.php');?>
</head>
<body>
<div class="container">
<div class="row">
<div class="span3">
<? include('include/menu.php');?>
</div>
<div class="span9">
<?php
if(isset($_POST['edit-go']))
{
mysql_select_db('account', $conn);
$socialid = mysql_real_escape_string($_POST['socialid']);
$username = $_SESSION['login'];
$id = $_SESSION['id'];
$error = array();
if(strlen($socialid)!=7)
{
$error[0] = 'Il codice per cancellare il personaggio deve essere lungo 7 caratteri.';
}
if($socialid == 1234567)
{
$error[1] = 'Non puoi utilizzare come codice per cancellare il personaggio 1234567 perché non è sicuro, scegline un altro.';
}
elseif($socialid == '0000000')
{
$error[1] = 'Non puoi utilizzare come codice per cancellare il personaggio 0000000 perché non è sicuro, scegline un altro.';
}
if(count($error) == 0)
{
$sql = "UPDATE account SET social_id = '$socialid' WHERE login = '$username' and id = $id ";
if($ris = mysql_query($sql))
{
echo'<div class="alert alert-success">Codice elimina personaggio modificato con successo.</div>';
$_SESSION['social_id'] = $socialid;
}
else
{
echo '<div class="alert alert-error">Non è possibile effettuare la modifica per problemi interni al sito web.</div>';
}
}
else
{
echo '<div class="alert alert-error">';
foreach($error as $value) : echo '<p>'.$value .'</p>'; endforeach;
echo '</div>';
}
}
?>
<form class="form-horizontal" action='edit-social-id.php' method='POST'>
<fieldset>
<legend>Codice cancella personaggio</legend>
<div class="control-group <? if(isset($error[0])) echo 'error';?>">
<label class="control-label" for="input01">Codice elimina personaggio</label>
<div class="controls">
<input type="text" class="input-xlarge" name="socialid" maxlength="7" value="<?=$_SESSION['social_id'];?>">
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary" name="edit-go"><i class="icon-ok icon-white"></i> Cambia </button>
<button type="reset" class="btn"><i class="icon-remove"></i> Cancella</button>
</div>
</fieldset>
</form>
</div>
</div>
<div class="row">
<div class="span12" style="margin-top:20px; text-align:center;">
<p><?=base64_decode($config['activaction_key']);?></p>
</div>
</div>
</div>
</body>
</html>