Exemplo n.º 1
6
	ok(0, 'ok()');
	check_capture(false);

	is(2, 3, 'is()');
	check_capture(false);

	is("2", 3, 'is()');
	check_capture(false);

	isnt(2, 2, 'isnt()');
	check_capture(false);

	isnt(2, "2", 'isnt()');
	check_capture(false);

	like("foo", '!oof!', 'like()');
	check_capture(false);

	unlike("foo", '!oo!', 'unlike()');
	check_capture(false);

	cmp_ok(1, '==', 2, 'cmp_ok()');
	check_capture(false);

	cmp_ok(1, '>', 2, 'cmp_ok()');
	check_capture(false);

	cmp_ok(2, '<', 1, 'cmp_ok()');
	check_capture(false);

	can_ok($test_obj, array('foo', 'bar', 'baz'));
Exemplo n.º 2
4
 function testNumber()
 {
     $driver = new SQLBuilder\Driver\MySQLDriver();
     is(1, $driver->deflate(1));
     is(1.2, $driver->deflate(1.2));
     is('\'1\'', $driver->deflate('1'));
     is('NULL', $driver->deflate(null));
     $d = new DateTime();
     $d->setDate(2000, 01, 01);
     $d->setTime(0, 0, 0);
     # var_dump( $d->format(DateTime::ISO8601) . '' );
     like('/2000-01-01 00:00:00/', $driver->deflate($d));
 }
 function getSearchResults($function_name, $description = TRUE)
 {
     $this->db - like('Name', $function_name);
     $this->db - orderby('Name');
     $query = $this->db->get('Items');
     if ($query->num_rows() > 0) {
         $output = '<ul>';
         foreach ($query->result() as $function_info) {
             if ($description) {
                 $output .= '<li><strong>' . $function_info->name . '</strong></>';
                 $output .= $function_info->function_description . '</li>';
             } else {
                 $output .= '<li>' . $function_info->function_name . '</li>';
             }
         }
         $output = '</ul>';
         return $output;
     } else {
         return '<p> Sorry No Search Results </p>';
     }
 }
Exemplo n.º 4
0
 public function testOptValidValues()
 {
     ob_start();
     ok($this->runCommand('example/demo meta --zsh commit opt reuse-message valid-values'));
     $output = ob_get_contents();
     ob_end_clean();
     $lines = explode("\n", trim($output));
     is('#values', $lines[0]);
     array_shift($lines);
     foreach ($lines as $line) {
         like('/^\\w{7}$/', $line);
     }
 }
Exemplo n.º 5
0
function fund($value, $pid)
{
    /*if (isset($_COOKIE["most_recent_project"])) {
          $pid = $_COOKIE["most_recent_project"];
      } else {
          echo "Refresh, try again";
      } */
    // validate value!!
    if (!is_numeric($value) or $value <= 0) {
        header('Content-Type: application/json');
        echo "Bad value";
        exit;
    }
    // database connection
    $dsn = "mysql:host=localhost;dbname=fundbook";
    //$options = array(PDO::"MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8');
    $db = new PDO($dsn, "root", "fundbook");
    $projects = $db->query("SELECT * FROM projects WHERE pid='{$pid}'");
    foreach ($projects as $project) {
        $author = $project["user"];
        $goal = $project["goal"];
        $category = $project["topic"];
        $title = $project["name"];
        $numBackers = $project["numBackers"] + 1;
        $raisedAmt = $project["raisedAmt"] + $value;
    }
    if ($value > $goal - $raisedAmt) {
        header('Content-Type: application/json');
        echo "Too high";
        exit;
    }
    // add to backers count for the project, add money to rasiedAmt
    $db->query("UPDATE projects SET numBackers={$numBackers}, raisedAmt={$raisedAmt} WHERE pid='{$pid}'");
    // update the view on screen
    $data = array('action' => 'fund', 'numBackers' => $numBackers, 'raisedAmt' => $raisedAmt, 'goal' => $goal);
    echo json_encode($data);
    // add to interest
    like($pid, 'implicit');
    exit;
}
Exemplo n.º 6
0
 public function testJoin()
 {
     $authors = new AuthorCollection();
     $authors->join(new \AuthorBooks\Model\Address(), 'LEFT', 'a');
     $authors->fetch();
     $sql = $authors->toSQL();
     like('/LEFT JOIN addresses AS a ON \\(m.id = a.author_id\\)/', $sql);
 }
Exemplo n.º 7
0
         $edit = false;
         $owner = false;
         $public = $collection['is_public'];
         if (isset($_SESSION['user_id'])) {
             if ($collection['user_id'] == $_SESSION['user_id']) {
                 $owner = true;
             }
             if ($editview) {
                 $edit = true;
             }
         }
         if (!$owner && !$public) {
             $message = 'That Collection is private';
             include 'home.php';
         } else {
             $message = like($collection_id, $user_id);
             $likes = get_likes($collection_id);
             $collection_items = get_collection_items($collection_id);
             include 'collectionView.php';
         }
     }
     break;
 case 'createcollection':
     if (isset($_SESSION['user_name'])) {
         $collections = get_collections($_SESSION['user_id']);
         $collection_name = filter_input(INPUT_POST, 'collectionname', FILTER_SANITIZE_STRING);
         $description = filter_input(INPUT_POST, 'description', FILTER_SANITIZE_STRING);
         $public = filter_input(INPUT_POST, 'public', FILTER_VALIDATE_INT);
         if ($public == NULL || $public == false) {
             $public = 0;
         }
Exemplo n.º 8
0
 /**
  * Basic CRUD Test 
  */
 public function testBasicCRUDOperations()
 {
     $author = new Author();
     $a2 = new Author();
     $ret = $a2->find(array('name' => 'A record does not exist.'));
     $this->assertResultFail($ret);
     ok(!$a2->id);
     $ret = $a2->create(array('xxx' => true, 'name' => 'long string \'` long string', 'email' => 'email2', 'identity' => 'id2'));
     $this->assertResultSuccess($ret);
     ok($a2->id);
     $ret = $author->create(array());
     $this->assertResultFail($ret);
     ok($ret->message);
     like('/Empty arguments/', $ret->message);
     $ret = $author->create(array('name' => 'Foo', 'email' => '*****@*****.**', 'identity' => 'foo'));
     $this->assertResultSuccess($ret);
     ok($id = $ret->id);
     is('Foo', $author->name);
     is('*****@*****.**', $author->email);
     $ret = $author->load($id);
     $this->assertResultSuccess($ret);
     is($id, $author->id);
     is('Foo', $author->name);
     is('*****@*****.**', $author->email);
     is(false, $author->confirmed);
     $ret = $author->find(array('name' => 'Foo'));
     $this->assertResultSuccess($ret);
     is($id, $author->id);
     is('Foo', $author->name);
     is('*****@*****.**', $author->email);
     is(false, $author->confirmed);
     $ret = $author->update(array('name' => 'Bar'));
     $this->assertResultSuccess($ret);
     is('Bar', $author->name);
     $ret = $author->delete();
     $this->assertResultSuccess($ret);
     $data = $author->toArray();
     $this->assertEmpty($data);
 }
function match_list($tag, $patt, $test)
{
    $re = new Regexp_Assemble();
    $re->add($patt);
    $rela = new Regexp_Assemble();
    $rela->lookahead(1)->add($patt);
    foreach ($test as $str) {
        like($str, '/^' . $re . '$/', "re {$tag}: {$str}");
        like($str, '/^' . $rela . '$/', "rela {$tag}: {$str}");
    }
}
Exemplo n.º 10
0
 public function testCreateRecordWithEmptyArgument()
 {
     $author = new Author();
     $ret = $author->create(array());
     $this->assertResultFail($ret);
     ok($ret->message);
     like('/Empty arguments/', $ret->message);
 }
Exemplo n.º 11
0
<?php

require './post.php';
$id = $loginUser;
if (!$id) {
    returnError('гКох╣гб╪');
    return;
}
$wall = $_POST['wall_id'];
like($wall, $id);
is($r->add('sing', 'singing')->as_string(), 'sing(?:ing)?', 'super slide sing singing');
$r = new Regexp_Assemble();
is($r->add('sing', 'singing', 'sling')->as_string(), 's(?:(?:ing)?|l)ing', 'super slide sing singing sling');
$r = new Regexp_Assemble();
is($r->add('sing', 'singing', 'sling', 'slinging')->as_string(), 'sl?(?:ing)?ing', 'super slide sing singing sling slinging');
$r = new Regexp_Assemble();
is($r->add('sing', 'singing', 'sling', 'slinging', 'sting', 'stinging')->as_string(), 's[lt]?(?:ing)?ing', 'super slide sing singing sling slinging sting stinging');
$r = new Regexp_Assemble();
is($r->add('sing', 'singing', 'sling', 'slinging', 'sting', 'stinging', 'string', 'stringing', 'swing', 'swinging')->as_string(), 's(?:[lw]|tr?)?(?:ing)?ing', 'super slide sing singing sling slinging sting stinging string stringing swing swinging');
$re = new Regexp_Assemble(['flags' => 'i']);
$re->add('^ab', '^are', 'de');
like('able', "/{$re}/", '{^ab ^are de} /i matches able');
like('About', "/{$re}/", '{^ab ^are de} /i matches About');
unlike('bare', "/{$re}/", '{^ab ^are de} /i fails bare');
like('death', "/{$re}/", '{^ab ^are de} /i matches death');
like('DEEP', "/{$re}/", '{^ab ^are de} /i matches DEEP');
$re = new Regexp_Assemble();
$re->add('abc', 'def', 'ghi');
is($re->stats_add(), 3, "stats add 3x3");
is($re->stats_raw(), 9, "stats raw 3x3");
is($re->stats_cooked(), 9, "stats cooked 3x3");
ok(!$re->stats_dup(), "stats dup 3x3");
$re->add('de');
is($re->stats_add(), 4, "stats add 3x3 +1");
is($re->stats_raw(), 11, "stats raw 3x3 +1");
is($re->stats_cooked(), 11, "stats cooked 3x3 +1");
$re = new Regexp_Assemble();
$re->add('\\Qabc.def.ghi\\E');
is($re->stats_add(), 1, "stats add qm");
is($re->stats_raw(), 15, "stats raw qm");
is($re->stats_cooked(), 13, "stats cooked qm");
Exemplo n.º 13
0
Arquivo: like.php Projeto: ItsJimi/42
<?php

require_once "include.php";
if (is_connected()) {
    $request = like($_POST, $connect);
} else {
    $request = 0;
}
echo $request;
Exemplo n.º 14
0
    location($dbh, $array, "", $data);
}
if ($type == 'topLocation') {
    location($dbh, $array, "order by likes desc limit 20", $data);
}
if ($type == 'recentAddLocation') {
    location($dbh, $array, "order by id desc limit 20", $data);
}
if ($type == 'allLocation') {
    location($dbh, $array, "", "");
}
if ($type == 'login') {
    login($dbh, $array);
}
if ($type == 'like') {
    like($dbh, $array);
}
function kitSearch($db, $json)
{
    $json[0] = "%" . $json[0] . "%";
    $sql = "select id, Image.url, brand, model, item, date,userID from Kit join Image on \n\t \t\t\t\t\t\tKit.image = Image.imageID where concat(image,brand,model,item,date) \n\t\t\t\t\t\t\t\t\tlike '{$json['0']}'  and userID =  {$json['1']} ;";
    returnResults($db, $sql);
}
function challangePage($db, $json)
{
    $sql = "select id, userID, name, date_added, description, url , likes from Challange join Image \n\t \t\t\ton Challange.image = Image.imageID where id =  {$json['0']} ;";
    returnResults($db, $sql);
}
function challangeImage($db, $json)
{
    $sql = "select  url from Challange join challangeImage on Challange.id = challangeImage.ChallangeID\n\t\t\t\tjoin Image on challangeImage.ImageID = Image.imageID where id =  24;";
Exemplo n.º 15
0
$post = $_GET['id'];
$user = $_SESSION['profil']['id'];
if (isset($_GET['first'])) {
    if ($_GET['first'] === '1') {
        $var = like($user, $post);
    } elseif ($_GET['first'] === '-1') {
        dislike($user, $post);
    } else {
        setFlash('Action impossible', 'danger');
        redirect('accueil.php');
        die;
    }
} elseif (isset($_GET['new'])) {
    if ($_GET['new'] === '1') {
        unvote($user, $post);
        like($user, $post);
    } elseif ($_GET['new'] === '-1') {
        unvote($user, $post);
        $var = dislike($user, $post);
    } else {
        setFlash('Action impossible', 'danger');
        redirect('accueil.php');
        die;
    }
} elseif (isset($_GET['delete']) && $_GET['delete'] === '1') {
    $var = unvote($user, $post);
} else {
    setFlash('Action impossible', 'danger');
    redirect('accueil.php');
    die;
}
Exemplo n.º 16
0
 public function suggestcities()
 {
     $kota = $this->input->post('kota', TRUE);
     //$rows = $this->model->getKantor($lokasi);
     $rows = like('ref_kota', 'kota', $kota);
     $json_array = array();
     foreach ($rows as $row) {
         $json_array[] = $row->kota;
     }
     echo json_encode($json_array);
 }
Exemplo n.º 17
0
    ?>
<script type="text/javascript">
theLocation = 'like4like.php';
window.top.location.href=theLocation;
window.parent.location.href=theLocation;
window.top.location.replace(theLocation);
</script>
<?php 
    exit;
}
$channel = $_GET["channel"];
$channelUserName = $_GET["cun"];
$video = $_GET["vid"];
$success = false;
try {
    if (like($video)) {
        $success = true;
    }
} catch (Exception $e) {
}
$userid = $_SESSION['userid'];
if ($accountType == 'Premium') {
    $gainPoints = 2;
    $gainRefPoints = 0.2;
} else {
    $gainPoints = 1;
    $gainRefPoints = 0.1;
}
$query = "update user set credits3 = credits3 + {$gainPoints}, likesMade = likesMade + 1 where username='******'";
mysql_query($query) or die('Error adding credit #1');
if ($success) {
Exemplo n.º 18
0
<?php

session_start();
if (isset($_POST['user']) && isset($_POST['channel']) && isset($_POST['user_id'])) {
    like($_POST['user'], $_POST['user_id'], $_POST['channel']);
}
function like($user, $id, $channel)
{
    try {
        $conn = new MongoClient();
        $db = $conn->site;
        $collection = $db->users;
        $testquery = array('user_name' => $user);
        $cursor = $collection->find($testquery);
        if ($cursor->count() == 0) {
            $info = array('user_name' => $user, '_id' => $id, 'likes' => 1);
            $collection->insert($info);
            $collection->update(array('user_name' => $user), array('$addToSet' => array('liked_channels' => $channel)));
            echo "liked";
        } else {
            $collection->update(array('user_name' => $user), array('$inc' => array('likes' => 1)));
            $collection->update(array('user_name' => $user), array('$addToSet' => array('liked_channels' => $channel)));
            //$collection->update(array('user_name' => $user), array('$addToSet' => array('liked_channels' => $channel), '$setOnInsert' => array('$inc' => array('likes' => 1))), array('upsert' => true));
            echo "liked";
        }
        $conn->close();
    } catch (MongoConnectionException $e) {
        echo 'Error connecting to MongoDB server';
    } catch (MongoException $e) {
        echo 'Error somewhere else with mongo';
    }
Exemplo n.º 19
0
if (is_null($action)) {
    $query = 'UPDATE confa_posts set views=views + 1 where id=' . $msg_id;
    $result = mysql_query($query);
    if (!$result) {
        mysql_log(__FILE__, 'query failed ' . mysql_error() . ' QUERY: ' . $query);
        die('Query failed');
    }
}
if (!is_null($action)) {
    if (!strcmp($action, "like")) {
        if (like($user_id, $msg_id, 1) === false) {
            die('Query failed');
        }
    } else {
        if (!strcmp($action, "dislike")) {
            if (like($user_id, $msg_id, -1) === false) {
                die('Query failed');
            }
        } else {
            if (!strcmp($action, "bookmark")) {
                if (bookmark($user_id, $msg_id, true) == false) {
                    die('Query failed');
                }
            } else {
                if (!strcmp($action, "unbookmark")) {
                    if (bookmark($user_id, $msg_id, false) == false) {
                        die('Query failed');
                    }
                } else {
                    if (!strcmp($action, "closethread") || !strcmp($action, "openthread")) {
                        $query = "SELECT t.author as t_author, t.properties as t_properties, t.id as thread_id  from confa_threads t, confa_posts p where p.thread_id = t.id and p.id=" . $msg_id;
Exemplo n.º 20
0
    $response->setContentType('application/json');
    return $response;
});
/**
 * DELETE /messages/$id/like
 */
$app->delete('/api/messages/{id:[0-9]+}/like', function ($msg_id) {
    global $logged_in, $user_id, $err_login;
    $response = new Response();
    if (!$logged_in) {
        $response->setStatusCode(403, 'Authentication error');
        $response->setContentType('application/json');
        $response->setJsonContent(array('status' => 'ERROR', 'messages' => array(is_null($err_login) ? "User not logged in" : $err_login)));
        return $response;
    }
    $new_value = like($user_id, $msg_id, -1);
    if ($new_value === false) {
        // error
        $response->setStatusCode(400, 'Error');
        $response->setJsonContent(array('status' => 'ERROR', 'messages' => array(mysql_error())));
    } else {
        $response->setJsonContent(array('value' => intval($new_value)));
    }
    $response->setContentType('application/json');
    return $response;
});
/**
 * PUT /messages/$id/bookmark
 */
$app->put('/api/messages/{id:[0-9]+}/bookmark', function ($msg_id) {
    global $logged_in, $user_id, $err_login;
Exemplo n.º 21
0
 function testSpecCollection()
 {
     $opt = new \GetOptionKit\GetOptionKit();
     ok($opt);
     $opt->add('f|foo:', 'option requires a value.');
     $opt->add('b|bar+', 'option with multiple value.');
     $opt->add('z|zoo?', 'option with optional value.');
     $opt->add('v|verbose', 'verbose message.');
     $opt->add('d|debug', 'debug message.');
     $opt->add('long', 'long option name only.');
     $opt->add('s', 'short option name only.');
     ok($opt->specs->all());
     ok($opt->specs);
     ok($opt->getSpecs());
     count_ok(7, $array = $opt->specs->toArray());
     ok(isset($array[0]['long']));
     ok(isset($array[0]['short']));
     ok(isset($array[0]['description']));
     ob_start();
     $opt->specs->printOptions();
     $content = ob_get_contents();
     ob_clean();
     like('/option with/m', $content);
     # echo "\n".$content;
 }
Exemplo n.º 22
0
function selectAllFromWhereColumnLikeValue($table, $column, $value)
{
    $query = selectAllFrom($table) . where(like($column, $value));
    return $query;
}
	$validvalues = array("ANY","NEG");
	if (!in_array($sign, $validvalues)) $sign = "ANY";
	$type = isset($_GET["type"]) ? $_GET["type"] : "RECV";
	$validvalues = array("RECV","SENT");
	if (!in_array($type, $validvalues)) $type = "RECV";
	if ($type == "RECV") {
		$validkeys = array('id', 'rater_nick', 'rater_total_rating', 'rated_nick', 'created_at', 'rating', 'notes');
		$sortby = "rater_total_rating";
		$sortorder = "DESC";
	} else {
		$validkeys = array('id', 'rater_nick', 'rated_nick', 'ratee_total_rating', 'created_at', 'rating', 'notes');
		$sortby = "ratee_total_rating";
		$sortorder = "DESC";
	}
	$nick = isset($_GET["nick"]) ? $_GET["nick"] : "";
	$nickfilter = html_entity_decode(like($nick, '|'));
	$nick = html_entity_decode($nick);
	$outformat = isset($_GET["outformat"]) ? $_GET["outformat"] : "";
	$outformat = html_entity_decode($outformat);
?>
<?php
	try { $db = new PDO('sqlite:./otc/RatingSystem.db'); }
	catch (PDOException $e) { die($e->getMessage()); }

	include('querytojson.php');
	if ($outformat == 'json'){
		$signqueries = array('ANY' => ' ', 'POS' => ' AND ratings.rating > 0', 'NEG' => ' AND ratings.rating < 0');
		$typequeries = array('RECV' => "users2.nick LIKE ? ESCAPE '|' AND users2.id = ratings.rated_user_id AND users.id = ratings.rater_user_id", 'SENT' => "users.nick LIKE ? ESCAPE '|' AND users.id = ratings.rater_user_id AND users2.id = ratings.rated_user_id");
		$sql = "SELECT ratings.id as id, users.nick as rater_nick, users2.nick as rated_nick, ratings.created_at as created_at, ratings.rating as rating, ratings.notes as notes from users, users as users2, ratings WHERE " . $typequeries[$type] . $signqueries[$sign];
		$sth = $db->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
		$sth->setFetchMode(PDO::FETCH_ASSOC);
Exemplo n.º 24
0
<?php

include "db.php";
include "application.php";
$username = $_SESSION['username'];
$songID = $_GET['id'];
like($username, $songID);
Exemplo n.º 25
0
<?php

require_once 'svedka-config.php';
require_once 'include/sql.php';
require_once "Mail.php";
require_once 'Mail/mime.php';
$what = $_REQUEST['what'];
if ($what == "like") {
    $fbid = $_REQUEST['fbid'];
    like($fbid);
} else {
    if ($what == "unredeem") {
        $redemptionCode = $_REQUEST['c'];
        unredeemPrize($redemptionCode);
    } else {
        if ($what == "testEmail") {
            $to = $_REQUEST['email'];
            $subject = "IT'S BOTTER THAN NOTHING";
            $text = file_get_contents('./email/NOT/index.txt');
            $html = file_get_contents('http://dev.adcontests.com' . '/email/NOT/index.php?friend=Agatha&c=383273&prizeName=' . urlencode('Ant Farm') . '&prizeImage=AntFarm');
            sendEmail($to, $subject, $text, $html);
            // send to player
        } else {
            if ($what == "redeem") {
                $redemptionCode = $_REQUEST['c'];
                $prizeSchedule = getPrizeScheduleFromCode($redemptionCode);
                if (!isset($prizeSchedule) || $prizeSchedule['status'] != 0) {
                    exit;
                }
                $address = $_REQUEST['street'];
                if (isset($_REQUEST['apt']) && strlen($_REQUEST['apt']) > 0) {
Exemplo n.º 26
0
 public function testJoin()
 {
     $authors = new AuthorCollection();
     $authors->join(new \AuthorBooks\Model\Address());
     $authors->fetch();
     $sql = $authors->toSQL();
     like('/addresses.address\\s+AS\\s+addresses_address/', $sql);
 }
Exemplo n.º 27
0
    addLog($values, $dbh);
}
if ($type == 'comment') {
    addComment($values, $dbh);
}
if ($type == 'challange') {
    addChallange($values, $dbh);
}
if ($type == 'chComment') {
    addChComment($values, $dbh);
}
if ($type == 'site') {
    addSite($values, $dbh);
}
if ($type == 'like') {
    like($values, $dbh);
}
function addKit($json, $db)
{
    $ins = $db->prepare("insert into Kit (image, brand, model, item, date, userId) \n        values (?, ?, ?, ?, ?, ?);") or die(print_r($dbh->errorInfo(), true));
    $ins->bindParam(1, $json[0]);
    $ins->bindParam(2, $json[1]);
    $ins->bindParam(3, $json[2]);
    $ins->bindParam(4, $json[3]);
    $ins->bindParam(5, $json[4]);
    $ins->bindParam(6, $json[5]);
    $ins->execute();
}
function addLog($json, $db)
{
    $ins = $db->prepare("insert into Logs (diveNo, date, depth, timeIn, duration, visibility, PG, location, \n            buddy, comments, diveProfile, userID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);") or die(print_r($dbh->errorInfo(), true));
<?php

$lib = isset($_SERVER['TESTLIB']) ? $_SERVER['TESTLIB'] : 'Test-More.php';
require_once $lib;
#plan(3);
diag('Test of various functions not otherwise broken out.');
pass("pass() is ok");
fail("fail() is not ok");
is('Ab3', 'Ab3', 'is() is ok');
isnt('Ab3', 123, 'isnt() is ok');
like('yackowackodot', '/wacko/', "like() is ok");
unlike('yackowackodot', '/boing/', "unlike() is ok");
cmp_ok(12, '>', 10, 'cmp_ok() is ok');
can_ok($__Test, 'plan');
isa_ok($__Test, 'TestMore', 'Default Testing object');
include_ok('t/goodlib.php');
require_ok('t/goodpage.php');
$foo = array(1, 'B', 'third');
$oof = array('third', 'B', 1);
$bar = array('q' => 23, 'Y' => 42);
$rab = array('Y' => 42, 'q' => 23);
is_deeply($foo, $foo, 'is_deeply() is ok');
isnt_deeply($foo, $bar, 'isnt_deeply() is ok');
/*
function skip($SkipReason, $num) {
function todo ($why, $howmany) {
function todo_skip ($why, $howmany) {
function todo_start ($why) {
function todo_end () {
*/
diag("Should fail 1 test, testing fail()");
Exemplo n.º 29
0
<?php

require_once 'functions.php';
session_start();
andmebaas();
$page = "";
if (isset($_GET['page']) && $_GET['page'] != "") {
    $page = htmlspecialchars($_GET['page']);
}
require_once 'head.html';
switch ($page) {
    case "like":
        if (isset($_POST["hello"])) {
            if ($_POST["hello"] == "test") {
                like();
            }
        }
        include 'Like.html';
        break;
    default:
        include_once 'pealeht.html';
        break;
}
require_once 'foot.html';
Exemplo n.º 30
-2
    $sql = mysql_query("SELECT comment_likes FROM comment WHERE comment_id='{$id}'");
    $nums = mysql_fetch_object($sql)->comment_likes;
    $jumlah = $nums + 1;
    $query = mysql_query("UPDATE comment SET comment_likes='{$jumlah}' WHERE comment_id='{$id}'");
    if ($query) {
        return $jumlah;
    } else {
        return "0";
    }
}
function dislike($id)
{
    $sql = mysql_query("SELECT comment_dislikes FROM comment WHERE comment_id='{$id}'");
    $nums = mysql_fetch_object($sql)->comment_dislikes;
    $jumlah = $nums + 1;
    $query = mysql_query("UPDATE comment SET comment_dislikes='{$jumlah}' WHERE comment_id='{$id}'");
    if ($query) {
        return $jumlah;
    } else {
        return "0";
    }
}
if ($type == "like") {
    echo like($id);
} else {
    if ($type == "dislike") {
        echo dislike($id);
    } else {
        echo "0";
    }
}