File size: 8.93Kb
<?php require_once('header.php'); ?>
<?php
if(isset($_POST['form1'])) {
$statement = $pdo->prepare("UPDATE nrd_social SET social_url=? WHERE social_name=?");
$statement->execute(array($_POST['facebook'],'Facebook'));
$statement = $pdo->prepare("UPDATE nrd_social SET social_url=? WHERE social_name=?");
$statement->execute(array($_POST['twitter'],'Twitter'));
$statement = $pdo->prepare("UPDATE nrd_social SET social_url=? WHERE social_name=?");
$statement->execute(array($_POST['linkedin'],'LinkedIn'));
$statement = $pdo->prepare("UPDATE nrd_social SET social_url=? WHERE social_name=?");
$statement->execute(array($_POST['googleplus'],'Google Plus'));
$statement = $pdo->prepare("UPDATE nrd_social SET social_url=? WHERE social_name=?");
$statement->execute(array($_POST['pinterest'],'Pinterest'));
$statement = $pdo->prepare("UPDATE nrd_social SET social_url=? WHERE social_name=?");
$statement->execute(array($_POST['youtube'],'YouTube'));
$statement = $pdo->prepare("UPDATE nrd_social SET social_url=? WHERE social_name=?");
$statement->execute(array($_POST['instagram'],'Instagram'));
$statement = $pdo->prepare("UPDATE nrd_social SET social_url=? WHERE social_name=?");
$statement->execute(array($_POST['tumblr'],'Tumblr'));
$statement = $pdo->prepare("UPDATE nrd_social SET social_url=? WHERE social_name=?");
$statement->execute(array($_POST['flickr'],'Flickr'));
$statement = $pdo->prepare("UPDATE nrd_social SET social_url=? WHERE social_name=?");
$statement->execute(array($_POST['reddit'],'Reddit'));
$statement = $pdo->prepare("UPDATE nrd_social SET social_url=? WHERE social_name=?");
$statement->execute(array($_POST['snapchat'],'Snapchat'));
$statement = $pdo->prepare("UPDATE nrd_social SET social_url=? WHERE social_name=?");
$statement->execute(array($_POST['whatsapp'],'WhatsApp'));
$statement = $pdo->prepare("UPDATE nrd_social SET social_url=? WHERE social_name=?");
$statement->execute(array($_POST['quora'],'Quora'));
$statement = $pdo->prepare("UPDATE nrd_social SET social_url=? WHERE social_name=?");
$statement->execute(array($_POST['stumbleupon'],'StumbleUpon'));
$statement = $pdo->prepare("UPDATE nrd_social SET social_url=? WHERE social_name=?");
$statement->execute(array($_POST['delicious'],'Delicious'));
$statement = $pdo->prepare("UPDATE nrd_social SET social_url=? WHERE social_name=?");
$statement->execute(array($_POST['digg'],'Digg'));
$success_message = 'Social Media URLs are updated successfully.';
}
?>
<section class="content-header">
<div class="content-header-left">
<h1>Социальные сети</h1>
</div>
</section>
<?php
$statement = $pdo->prepare("SELECT * FROM nrd_social");
$statement->execute();
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach ($result as $row) {
if($row['social_name'] == 'Facebook') {
$facebook = $row['social_url'];
}
if($row['social_name'] == 'Twitter') {
$twitter = $row['social_url'];
}
if($row['social_name'] == 'LinkedIn') {
$linkedin = $row['social_url'];
}
if($row['social_name'] == 'Google Plus') {
$googleplus = $row['social_url'];
}
if($row['social_name'] == 'Pinterest') {
$pinterest = $row['social_url'];
}
if($row['social_name'] == 'YouTube') {
$youtube = $row['social_url'];
}
if($row['social_name'] == 'Instagram') {
$instagram = $row['social_url'];
}
if($row['social_name'] == 'Tumblr') {
$tumblr = $row['social_url'];
}
if($row['social_name'] == 'Flickr') {
$flickr = $row['social_url'];
}
if($row['social_name'] == 'Reddit') {
$reddit = $row['social_url'];
}
if($row['social_name'] == 'Snapchat') {
$snapchat = $row['social_url'];
}
if($row['social_name'] == 'WhatsApp') {
$whatsapp = $row['social_url'];
}
if($row['social_name'] == 'Quora') {
$quora = $row['social_url'];
}
if($row['social_name'] == 'StumbleUpon') {
$stumbleupon = $row['social_url'];
}
if($row['social_name'] == 'Delicious') {
$delicious = $row['social_url'];
}
if($row['social_name'] == 'Digg') {
$digg = $row['social_url'];
}
}
?>
<section class="content">
<div class="row">
<div class="col-md-12">
<form class="form-horizontal" action="" method="post">
<div class="box box-info">
<div class="box-body">
<p style="padding-bottom: 20px;">Если вы не хотите отображать социальные сети на своей главной странице, просто оставьте поле ввода пустым.</p>
<div class="form-group">
<label for="" class="col-sm-2 control-label">Facebook </label>
<div class="col-sm-4">
<input type="text" class="form-control" name="facebook" value="<?php echo $facebook; ?>">
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">Twitter </label>
<div class="col-sm-4">
<input type="text" class="form-control" name="twitter" value="<?php echo $twitter; ?>">
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">LinkedIn </label>
<div class="col-sm-4">
<input type="text" class="form-control" name="linkedin" value="<?php echo $linkedin; ?>">
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">Google Plus </label>
<div class="col-sm-4">
<input type="text" class="form-control" name="googleplus" value="<?php echo $googleplus; ?>">
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">Pinterest </label>
<div class="col-sm-4">
<input type="text" class="form-control" name="pinterest" value="<?php echo $pinterest; ?>">
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">YouTube </label>
<div class="col-sm-4">
<input type="text" class="form-control" name="youtube" value="<?php echo $youtube; ?>">
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">Instagram </label>
<div class="col-sm-4">
<input type="text" class="form-control" name="instagram" value="<?php echo $instagram; ?>">
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">Tumblr </label>
<div class="col-sm-4">
<input type="text" class="form-control" name="tumblr" value="<?php echo $tumblr; ?>">
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">Flickr </label>
<div class="col-sm-4">
<input type="text" class="form-control" name="flickr" value="<?php echo $flickr; ?>">
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">Reddit </label>
<div class="col-sm-4">
<input type="text" class="form-control" name="reddit" value="<?php echo $reddit; ?>">
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">Snapchat </label>
<div class="col-sm-4">
<input type="text" class="form-control" name="snapchat" value="<?php echo $snapchat; ?>">
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">WhatsApp </label>
<div class="col-sm-4">
<input type="text" class="form-control" name="whatsapp" value="<?php echo $whatsapp; ?>">
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">Quora </label>
<div class="col-sm-4">
<input type="text" class="form-control" name="quora" value="<?php echo $quora; ?>">
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">StumbleUpon </label>
<div class="col-sm-4">
<input type="text" class="form-control" name="stumbleupon" value="<?php echo $stumbleupon; ?>">
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">Delicious </label>
<div class="col-sm-4">
<input type="text" class="form-control" name="delicious" value="<?php echo $delicious; ?>">
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label">Digg </label>
<div class="col-sm-4">
<input type="text" class="form-control" name="digg" value="<?php echo $digg; ?>">
</div>
</div>
<div class="form-group">
<label for="" class="col-sm-2 control-label"></label>
<div class="col-sm-6">
<button type="submit" class="btn btn-success pull-left" name="form1">Сохранить</button>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</section>
<?php require_once('footer.php'); ?>