????
Current Path : /home2/morganrand/backup.morganrand.com/design/ |
Current File : /home2/morganrand/backup.morganrand.com/design/switchup.php |
<?php if ( isset($_GET['do']) ) { if ( !is_numeric($_GET['do']) ) { $do = $_GET['do']; $widget = ''; $conn = null; // ** MySQL settings ** // require_once('conn.php'); $pompoms = '<a href="../pompoms.html" class="cta-btn">Let\'s Create</a>'; $store= '<a href="../store/" class="cta-btn">Shop Now</a>'; if ($do == 'store') { $param1 = $pompoms; $param2 = $store; } elseif ($do == 'pompoms') { $param1 = $store; $param2 = $pompoms; } $sql = "SELECT option_value FROM wp_options WHERE option_name='widget_text'"; $result = $conn->query($sql); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { $widgetArray = unserialize($row['option_value']); $widgetArray[2]['text'] = str_replace($param1, $param2, $widgetArray[2]['text']); $widget = addslashes(serialize($widgetArray)); } } else { echo "0 results"; exit; } $sql = "UPDATE wp_options SET option_value='" . $widget . "' WHERE option_name='widget_text'"; if ($conn->query($sql) === TRUE) { echo 'Set the side menu widget button to : ' . $do; } else { echo 'Error updating the side menu widget to : ' . $do . '<br>' . $conn->error; } $conn->close(); } }