Example #1
0
<?php

//this is where you can update a contact. puts in current info.
$fullinfo = getcontactinfo(filter_input(INPUT_POST, "update"));
include './pages/header.php';
?>
<hmtl>
    <form method="post" class="loginform" enctype="multipart/form-data">
        <input type="text" name="fname" class="form-control" value="<?php 
echo $fullinfo[0]["fullname"];
?>
" placeholder="Name"/><br/>
        <input type="email" name="email" class="form-control" value="<?php 
echo $fullinfo[0]["email"];
?>
" placeholder="Email"/><br/>
        <input type="text" name="addr" class="form-control" value="<?php 
echo (int) $fullinfo[0]["address"];
?>
" placeholder="Address"/><br/>
        <input type="number" max="9999999999" min="1000000000" name="tel" class="form-control" value="<?php 
echo $fullinfo[0]["phone"];
?>
" placeholder="Phone"/><br/>
        <input type="text" name="url" class="form-control" value="<?php 
echo $fullinfo[0]["website"];
?>
" placeholder="Website"/><br/>
        <input type="date" name="month" class="form-control" value="<?php 
echo date("Y-m-d", strtotime($fullinfo[0]["birthday"]));
?>
Example #2
0
<?php

//this page will get all the data with that for that address_id and displays it. it uses magic.
$fullinfo = getcontactinfo(filter_input(INPUT_POST, "view"));
?>
<html>
    <?php 
if ($fullinfo[0]["image"] != null) {
    ?>
<div class="viewpic">
        <img src="./images/<?php 
    echo $fullinfo[0]["image"];
    ?>
" class="img-circle"></div>
    <?php 
}
?>
    <h1><?php 
echo $fullinfo[0]["fullname"];
?>
</h1>
    <p><a href="mailto:<?php 
echo $fullinfo[0]["email"];
?>
"><?php 
echo $fullinfo[0]["email"];
?>
</a></p>
    <p><a target="_blank" href="https://www.google.com/maps?q=<?php 
echo $fullinfo[0]["address"];
?>
<?php 
$vtype = $_POST['type'];
$vfunction = $_POST['function'];
$vsorttype = $_POST['sorttype'];
//$vtype='Dancehall, Pop, R&B';
$arr = array();
if ($vfunction == "contact_info") {
    $arr = getcontactinfo($vtype, $vsorttype);
} else {
    $arr = getsociallinks($vtype);
}
echo json_encode($arr);
function getcontactinfo($type, $sorttype)
{
    $con = mysql_connect("localhost", "root", "");
    $valid = false;
    $arr = array();
    if (!$con) {
        die('Could not connect: ' . mysql_error());
    }
    mysql_select_db("wmldatabase", $con);
    if ($type == "RnB") {
        $type = "R&B";
    }
    if ($type == "wms") {
        $result = mysql_query("SELECT * FROM contact_info  order by " . $sorttype . " ASC");
    } else {
        if ($type == "Music" || $type == "Entertainment" || $type == "Music/Entertainment") {
            $result = mysql_query("SELECT * FROM contact_info where Category like '%" . $type . "%'  order by " . $sorttype . " ASC");
        } else {
<?php

//makes sure you wanted to delete.
$fullinfo = getcontactinfo(filter_input(INPUT_POST, "deleteconfirm"));
include './pages/header.php';
?>
<h1><?php 
echo $fullinfo[0]["fullname"];
?>
 Deleted</h1>
<form method="post">
    <div class="btn-group" role="group">
        <button class="btn btn-default btn-lg" type="submit" name="delete" value="<?php 
echo $fullinfo[0]["address_id"];
?>
">Ok</button>
        <button class="btn btn-default btn-lg" type="submit" name="page" value="usermain">Undo</button>
    </div>
</form>