Example #1
1
function multiexplode($delimiters, $string)
{
    $ary = explode($delimiters[0], $string);
    array_shift($delimiters);
    if ($delimiters != NULL) {
        foreach ($ary as $key => $val) {
            $ary[$key] = multiexplode($delimiters, $val);
        }
    }
    return $ary;
}
Example #2
0
function validate($text)
{
    $z = array_filter(multiexplode($text), function ($i) {
        return filter_var($i, FILTER_VALIDATE_EMAIL);
    });
    return $z;
}
Example #3
0
 function tgl_jam_indo($tgl_jam)
 {
     $rubah = gmdate($tgl_jam);
     $cacah = multiexplode(array("-", " ", ":"), $rubah);
     $tanggal = $cacah[2];
     $bulan = bulan($cacah[1]);
     $tahun = $cacah[0];
     $jam = $cacah[3];
     $menit = $cacah[4];
     $detik = $cacah[5];
     return $tanggal . ' ' . $bulan . ' ' . $tahun . ' ' . $jam . ':' . $menit . ':' . $detik;
 }
function spamcheck($field)
{
    $addresses = multiexplode(array(",", ";"), $field);
    for ($i = 0; $i < count($addresses); $i++) {
        //filter_var() sanitizes the e-mail
        //address using FILTER_SANITIZE_EMAIL
        $addresses[$i] = filter_var($addresses[$i], FILTER_SANITIZE_EMAIL);
        //filter_var() validates the e-mail
        //address using FILTER_VALIDATE_EMAIL
        if (!filter_var($addresses[$i], FILTER_VALIDATE_EMAIL)) {
            return FALSE;
        }
    }
    return TRUE;
}
Example #5
0
function decimal_lat_long($gps)
{
    $position = multiexplode(array(' ', '\'', '"', ','), $gps);
    $degree_lat = doubleval($position[0]);
    $min_lat = doubleval($position[2]);
    $sec_lat = doubleval($position[4]);
    $decimal_lat = $degree_lat + $min_lat / 60 + $sec_lat / 3600;
    $decimal_lat = round($decimal_lat, 6);
    if ($position[6] == "S") {
        $decimal_lat *= -1;
    }
    $degree_long = doubleval($position[8]);
    $min_long = doubleval($position[10]);
    $sec_long = doubleval($position[12]);
    $decimal_long = $degree_long + $min_long / 60 + $sec_long / 3600;
    $decimal_long = round($decimal_long, 6);
    if ($position[14] == "W") {
        $decimal_long *= -1;
    }
    return array($decimal_lat, $decimal_long);
}
 */
require_once 'logic.php';
function multiexplode($delimiters, $string)
{
    $ready = str_replace($delimiters, $delimiters[0], $string);
    $launch = explode($delimiters[0], $ready);
    return $launch;
}
//get input from index.php
if (isset($_POST['input'])) {
    $input = $_POST['input'];
}
echo $input;
//Parse $input
$numbers = multiexplode(array("(", ")", "+", "-", "*", "/", "sqrt2", "sqrt3", "pow"), $input);
$operations = multiexplode(array("1", "2", "3", "4", "5", "6", "7", "8", "9", "0", " "), $input);
$i = 0;
foreach ($operations as $a) {
    if ($a == "") {
        unset($operations[$i]);
        array_values($operations);
    }
    if ($a == ".") {
        unset($operations[$i]);
        array_values($operations);
    }
    $i++;
}
//Reorder arrays. why? Because i can.
$numbers = array_values($numbers);
$operations = array_values($operations);
Example #7
0
<?php

echo "equation: {$_POST['input']} <br>";
$string = $_POST['input'];
$num = preg_replace("/[^0-9]*/s", " ", $string);
function multiexplode($delimiters, $string)
{
    $ready = str_replace($delimiters, $delimiters[0], $string);
    $launch = explode($delimiters[0], $ready);
    return $launch;
}
$num = multiexplode(array("+", "-", "/", "*"), $string);
$j = 0;
for ($i = 0; $i < strlen($string); $i++) {
    if ($string[$i] == '+') {
        $num[$j + 1] = $num[$j] + $num[$j + 1];
        $j++;
    } else {
        if ($string[$i] == '-') {
            $num[$j + 1] = $num[$j] - $num[$j + 1];
            $j++;
        } else {
            if ($string[$i] == '*') {
                $num[$j + 1] = $num[$j] * $num[$j + 1];
                $j++;
            } else {
                if ($string[$i] == '/') {
                    $num[$j + 1] = $num[$j] / $num[$j + 1];
                    $j++;
                } else {
                    continue;
function profanity_counter($textarea, $dirt = array())
{
    $counter = 0;
    $textArray = array();
    //multi explode all the text to array
    $textarea = multiexplode(array("|", " ", "//"), $textarea);
    //create the loop to check
    foreach ($textarea as $string) {
        if (preg_match_all("/(" . implode('|', $dirt) . ")/", $string, $matches)) {
            $counter += 1;
        }
    }
    return (int) $counter;
}
Example #9
0
        $total = "http://www.youtube.com/embed/" . $Parse;
    }
    //create new login and profile if form success
    if ($postsuccess) {
        notifiy_friends($conn);
        //echo "Link created!";
        $err_post = "Submitted!";
        //sql login
        $sql_addpost = "INSERT INTO posts (User_ID, type, info)\n\t\tVALUES ({$_SESSION['SESS_LOGIN_ID']}, 'video', '{$total}')";
        check_sql($sql_addpost, $conn);
        $last_post = $conn->insert_id;
        //check for tags------------------------------------------------------
        if (isset($_POST['tags_video'])) {
            $tlist = "video, " . $_POST['tags_video'];
            $tag_list = test_input($tlist);
            $exploded = multiexplode(array(",", " "), $tag_list);
            foreach ($exploded as $tag_element) {
                if ($tag_element != NULL) {
                    $sql_addpost2 = "INSERT INTO tags (Post_ID, Tag_label)\n\t\t\t\t\t\t\tVALUES ({$last_post}, '{$tag_element}')";
                    check_sql($sql_addpost2, $conn);
                }
            }
        }
        header("Location:index.php");
    }
}
?>

</body>
</html>
Example #10
0
        $date4 = sanitize($_POST["date4"]);
        $reason = sanitize($_POST["request_reason"]);
        $sql_date2 = $sql_date3 = $sql_date4 = "1969-01-01";
        // Convert from MM-DD-YYYY to YYYY-MM-DD to follow the MySQL Date Format
        $dateInput1 = multiexplode(array("-", "/"), $date1);
        $sql_date1 = $dateInput1[2] . "-" . $dateInput1[0] . "-" . $dateInput1[1];
        if (!empty($_POST["date2"])) {
            $dateInput2 = multiexplode(array("-", "/"), $date2);
            $sql_date2 = $dateInput2[2] . "-" . $dateInput2[0] . "-" . $dateInput2[1];
        }
        if (!empty($_POST["date3"])) {
            $dateInput3 = multiexplode(array("-", "/"), $date3);
            $sql_date3 = $dateInput3[2] . "-" . $dateInput3[0] . "-" . $dateInput3[1];
        }
        if (!empty($_POST["date4"])) {
            $dateInput4 = multiexplode(array("-", "/"), $date4);
            $sql_date4 = $dateInput4[2] . "-" . $dateInput4[0] . "-" . $dateInput4[1];
        }
        // echo "CALL insert_request('$first_name', '$last_name', '$sql_date1', '$sql_date2', '$sql_date3', '$sql_date4', '$reason')";
        mysqli_query($link, "CALL insert_request('{$first_name}', '{$last_name}', '{$sql_date1}', '{$sql_date2}', '{$sql_date3}', '{$sql_date4}', '{$reason}')");
        echo "<h3>The Day Off Request was sent successfully!</h3>";
        die;
    }
}
?>
                    <h1>Day Off Request</h1>

                    <p>The Day Off Request Form is to fill out the information for specific day you want to take a break.  Once you submit the form, you will receive an e-mail from the one of the manager that determines if they accept or reject your request.</p>

                    <form class="form-horizontal day_request" method="POST">
                        <div class="form-group form-group-default">
Example #11
0
// counter
$url = "http://open.live.bbc.co.uk/weather/feeds/en/" . $weatherval . "/observations.rss";
// url to parse
$rss = simplexml_load_file($url);
// XML parser
function multiexplode($delimiters, $string)
{
    $ready = str_replace($delimiters, $delimiters[0], $string);
    $launch = explode($delimiters[0], $ready);
    return $launch;
}
$exploded = "";
foreach ($rss->channel->item as $item) {
    if ($i < 1) {
        // parse only 10 items
        $exploded = multiexplode(array(",", ".", "|", ":"), $item->title);
        //echo $exploded[3];
        //$wethval2 = explode(':', $wethval2[1],-1);
        // echo preg_replace('/[^a-zA-Z0-9_%\[().\]\\/-]/s', '', $exploded[3]);
        //
        // = preg_replace('/[^a-zA-Z0-9_%\[().\]\\/-]/s', '', $wethval2[5]);
    }
    $i++;
}
$exploded[3] = preg_replace('/[^a-zA-Z0-9_%\\[().\\]\\/-]/s', '', $exploded[3]);
$exploded[2] = trim($exploded[2]);
// end getting weather
// getting value passed by the arduino
$val = htmlspecialchars($_GET["num"]);
// end getting value
// reading file from storage
Example #12
0
 public function update_subjects()
 {
     $this->load->library("form_validation");
     $this->load->helper("string");
     if ($this->session->userdata("update-subjects")) {
         $rules = array();
         foreach ($this->session->userdata("update-classes") as $i) {
             foreach ($this->session->userdata("update-subjects")[$i] as $j) {
                 $rules[] = array("field" => "credits[{$i}][{$j}]", "label" => "Credits for Class {$i} and Subject {$j}", "rules" => "required|decimal");
                 $rules[] = array("field" => "exams[{$i}][{$j}]", "label" => "Exams for Class {$i} and Subject {$j}", "rules" => "required|valid_exams");
             }
         }
         $this->form_validation->set_rules($rules);
         if ($this->form_validation->run()) {
             $subjects = array();
             foreach ($this->session->userdata("update-classes") as $i) {
                 foreach ($this->session->userdata("update-subjects")[$i] as $j) {
                     $subjects[$i][$j]["credits"] = $this->input->post("credits")[$i][$j];
                 }
             }
             $this->session->set_userdata("subjects-update-data", $subjects);
             $exams = array();
             foreach ($this->session->userdata("update-classes") as $i) {
                 foreach ($this->session->userdata("update-subjects")[$i] as $j) {
                     $exams[$i][$j] = multiexplode(array(',', ' '), $this->input->post("exams")[$i][$j]);
                 }
             }
             $this->session->set_userdata("update-exams", $exams);
             $this->session->set_flashdata("success", true);
             $this->session->set_flashdata("messages", "Your subjects have been updated successfully!");
             redirect("grade/show_update_grades_form");
         } else {
             $this->session->set_flashdata("errors", true);
             $this->session->set_flashdata("messages", validation_errors());
             redirect("subject/show_update_subjects_form/{$id}");
         }
     } else {
         $this->session->set_flashdata("errors", true);
         $this->session->set_flashdata("messages", "You need to update classes first!");
         redirect("classcontroller/show_update_classes_form");
     }
 }
Example #13
0
    $msj = check_action($service, $client, $action);
}
// Print Document Headers
doc_header($msj);
// Get service status
$service_status = get_service_status($service, $status_opts);
// Get playback status
$playback_status = get_playback_status();
print "<strong>now playing:</strong>";
print '<div style="width:50%;"><marquee behavior="scroll" direction="left"><pre>' . $playback_status . '</pre></marquee></div>';
print '<hr align="center" width="80%" noshade="noshade" />';
// Separate each instance
$delimiters = array("\n");
$result = multiexplode($delimiters, $service_status);
// Process each instance
foreach ($result as $pre_status) {
    // Separate name and process status
    $delimiters = array(" ");
    $info = multiexplode($delimiters, $pre_status);
    // Get usefull data
    $replace = array("(", ")");
    $name = str_replace($replace, " ", "{$info['0']}");
    $status = $info[1];
    // Print dynamic content
    if ($name != "" && $status != "") {
        $content = display_status($status, $name);
        print $content;
    }
}
// Print document footer
doc_footer();
Example #14
0
 public function update_classes()
 {
     $this->load->library('form_validation');
     $this->load->helper("string");
     $this->load->model(array("subjectmodel", "grademodel"));
     if ($this->session->userdata('update-classes')) {
         $id = $this->session->userdata("branch-update-id");
         $rules = array();
         foreach ($this->session->userdata("update-classes") as $i) {
             $rules[] = array("field" => "sections[{$i}]", "label" => "Sections for Class {$i}", "rules" => "required|valid_sections");
             $rules[] = array("field" => "subjects[{$i}]", "label" => "Subjects for Class {$i}", "rules" => "required|valid_subjects");
             $rules[] = array("field" => "terms[{$i}]", "label" => "Terms for Class {$i}", "rules" => "required|valid_terms");
             $rules[] = array("field" => "grades[{$i}]", "label" => "Grades for Class {$i}", "rules" => "required|valid_grades");
         }
         $this->form_validation->set_rules($rules);
         if ($this->form_validation->run()) {
             $subjects = array();
             $grades = array();
             foreach ($this->session->userdata("update-classes") as $i) {
                 $subjects[$i] = multiexplode(array(',', ' '), $this->input->post("subjects")[$i]);
                 $grades[$i] = multiexplode(array(',', ' '), $this->input->post("grades")[$i]);
             }
             $this->session->set_userdata("update-subjects", $subjects);
             $this->session->set_userdata("update-grades", $grades);
             $classes = array();
             foreach ($this->session->userdata("update-classes") as $i) {
                 $classes[$i] = array("sections" => multiexplode(array(' ', ','), $this->input->post("sections")[$i]), "terms" => multiexplode(array(' ', ','), $this->input->post("terms")[$i]));
             }
             $this->session->set_userdata("classes-update-data", $classes);
             $this->session->set_flashdata('success', true);
             $this->session->set_flashdata('messages', 'Classes have been updates successfully!');
             redirect("subject/show_update_subjects_form");
         } else {
             $this->session->set_flashdata('errors', true);
             $this->session->set_flashdata('messages', validation_errors());
             redirect('classcontroller/show_update_classes_form');
         }
     } else {
         $this->session->set_flashdata('errors', true);
         $this->session->set_flashdata('messages', "You need update branch first!");
         redirect('branch/show_update_branch_list');
     }
 }
Example #15
0
        }
        $i++;
    }
    $tab_mot[] = $mot;
    $tab_occurence[] = 1;
}
// $RSSLink="http://feeds.gawker.com/deadspin/full";
$content = file_get_contents($RSSLink);
$x = new SimpleXmlElement($content);
$tab_mot = array();
$tab_occurence = array();
foreach ($x->channel->item as $entry) {
    $html = str_get_html($entry->description . "");
    foreach ($html->find('p[class=first-text]') as $p) {
        $p_without_tags = strip_tags($p);
        $words = multiexplode(array('"', ' ', '.', '|', ',', '?', '!', '—', '“'), $p_without_tags);
        foreach ($words as $mot) {
            if (strlen($mot) >= 5) {
                occurence($mot, $tab_mot, $tab_occurence);
            }
        }
    }
}
function permute(&$val1, &$val2)
{
    $inter = $val1;
    $val1 = $val2;
    $val2 = $inter;
}
function sort_array(&$array1, &$array2)
{
Example #16
0
                                $combinedVoteCount = $voteCount + $adminVote;
                                echo "Current likes: ";
                                echo $combinedVoteCount;
                                ?>


            <h2>Tags</h2>
            <ul class="list-unstyled">
                <?php 
                                $tagsStmt = new mysqli_stmt($mysqli, "SELECT keywords FROM adventures WHERE id = ?");
                                $tagsStmt->bind_param("i", $adv_id);
                                $tagsStmt->execute();
                                $tagsResult = $tagsStmt->get_result();
                                $tagsTemp = $tagsResult->fetch_array();
                                $tagString = $tagsTemp['keywords'];
                                $tags = multiexplode(array(";", ","), $tagsTemp['keywords']);
                                foreach ($tags as $tag) {
                                    echo "<li>" . $tag . "</li>";
                                }
                                ?>
            </ul>
        </div>
    </div>

    <div class="row">
        <div
            class="col-md-5 col-md-offset-1 comments-section">
            <h2>Comments <br></h2>
        </div
    </div
Example #17
0
    echo $i;
    ?>
_title"><div class="playlist_title"><?php 
    echo html($table_track['title']);
    ?>
</div>
		<div class="playlist_title_album"><?php 
    echo $image_id['album'];
    ?>
</div>
	</a></td>
	
	<td class="time">
	<?php 
    $artist = '';
    $exploded = multiexplode($cfg['artist_separator'], $table_track['track_artist']);
    $l = count($exploded);
    if ($l > 1) {
        for ($j = 0; $j < $l; $j++) {
            $artist = $artist . '<a href="index.php?action=view2&amp;artist=' . rawurlencode($exploded[$j]) . '">' . html($exploded[$j]) . '</a>';
            if ($j != $l - 1) {
                $artist = $artist . '<a href="index.php?action=view2&amp;artist=' . rawurlencode($table_track['track_artist']) . '&amp;order=year"><span class="artist_all">&</span></a>';
            }
        }
        echo $artist;
    } else {
        echo '<a href="index.php?action=view2&amp;artist=' . rawurlencode($table_track['track_artist']) . '&amp;order=year">' . html($table_track['track_artist']) . '</a>';
    }
    ?>
	</td>
Example #18
0
    #print_r($pieces);
    echo "</br>pp" . $string . "pp</br>";
    echo "yy" . $line . "zz";
    if (ctype_digit($string)) {
        break;
    }
    $line = $line . "\n" . $file[$i];
}
echo $line;
echo "</br>";
$vars = "";
$file = file("{$dir}/out1.txt");
$file = array_reverse($file);
foreach ($file as $f) {
    //echo $f."<br />";
    $pieces = multiexplode(array(" ", "\t"), $f);
    $string = str_replace(' ', '', $pieces[0]);
    $string = preg_replace('/\\s+/', '', $string);
    print_r($pieces);
    echo "xx" . $string . "xx" . "</br>";
    if (ctype_digit($string) || strpos($string, '0x') !== false) {
        break;
    }
    $vars = $vars . "\n" . $f;
}
echo $vars;
$pos = $_SESSION['pos'];
fwrite($fhis, "{$pos}    =>  \t" . $line);
fwrite($fhis, "\n------------------------------------------\n");
fclose($fhis);
fwrite($fhis1, "{$pos}    =>  \t" . $vars);
Example #19
0
            }
            if (empty($_POST['txtDetail'])) {
                $errorDetail = "<span class='error'>Please enter detail</span>";
            }
            if ($errorTitle == "" && $errorStartDate == "" && $errorEndDate == "" && $errorStartTime == "" && $errorEndTime == "" && $errorLocation == "" && $errorDetail == "") {
                $title = $_POST['txtTitle'];
                $detail = $_POST['txtDetail'];
                $startDate = $_POST['txtStartDate'];
                $endDate = $_POST['txtEndDate'];
                $startTime = $_POST['txtStartTime'];
                $endTime = $_POST['txtEndTime'];
                $location = $_POST['txtLocation'];
                $event_id = $_GET["event_id"];
                $endDateFormat = multiexplode(array("-", "/"), $endDate);
                $end_date = $endDateFormat[2] . "-" . $endDateFormat[0] . "-" . $endDateFormat[1];
                $startDateFormat = multiexplode(array("-", "/"), $startDate);
                $start_date = $startDateFormat[2] . "-" . $startDateFormat[0] . "-" . $startDateFormat[1];
                //$startdate = $year . "-" . $month . "-" . $day;
                mysqli_query($link, "CALL update_event('{$title}', '{$detail}', '{$event_id}', '{$start_date}', '{$end_date}', '{$startTime}', '{$endTime}', '{$location}')");
                //echo "UPDATE request_calendar SET title = '" . $title . "', detail = '" . $detail . "' WHERE event_date = '" . $eventdate . "'";
                echo "<br/><br/><h2>Event was successfully Edited<h2>";
                die;
            }
        }
    }
}
?>
    <table border="1" id='eventTable'>
        <tr class="eventRow">
            <td class="eventData"><input type="button" value='<' name='previousbutton' onclick="goLastMonth(<?php 
echo $month . ", " . $year;
Example #20
0
function playlistTrack()
{
    global $cfg, $db;
    authenticate('access_playlist', false, false, true);
    $track_id = get('track_id');
    $query = mysql_query('SELECT track.artist, album.artist AS album_artist, title, featuring, miliseconds, relative_file, album, album.image_id, album.album_id, track.genre, track.audio_bitrate, track.audio_dataformat, track.audio_bits_per_sample, track.audio_sample_rate, album.genre_id, track.audio_profile, track.track_artist, album.year as year, track.number, track.comment, track.track_id, track.year as trackYear, track.dr, album.album_dr
		FROM track, album 
		WHERE track.album_id = album.album_id
		AND track_id = "' . mysql_real_escape_string($track_id) . '"');
    $track = mysql_fetch_assoc($query);
    $query = mysql_query('SELECT image_front FROM bitmap WHERE image_id="' . mysql_real_escape_string($track['image_id']) . '"');
    $bitmap = mysql_fetch_assoc($query);
    $title = $track['title'];
    /* $query_ = mysql_query('SELECT title FROM track
    		WHERE DIFFERENCE(SOUNDEX(title), SOUNDEX("' . (mysql_real_escape_like($title)) . '")) > 0');
    	$query_ = mysql_query('SELECT SOUNDEX(title) FROM track');
    	 */
    /* $title = strtolower($title);
    	$separator = $cfg['separator'];
    	$count = count($separator);
    	$i=0;
    	
    	for ($i=0; $i<$count; $i++) {
    		$pos = strpos($title,strtolower($separator[$i]));
    		if ($pos !== false) {
    			$title = trim(substr($title, 0 , $pos));
    			//break;
    		}
    	}  */
    $other_track_version = false;
    if ($cfg['enable_core_track_search'] === TRUE) {
        $title = findCoreTrackTitle($title);
        $title = mysql_real_escape_like($title);
        $separator = $cfg['separator'];
        $count = count($separator);
        $query_string = '';
        $i = 0;
        for ($i = 0; $i < $count; $i++) {
            $query_string = $query_string . ' OR LOWER(title) LIKE "' . $title . $separator[$i] . '%"';
        }
        $filter_query = 'WHERE (LOWER(title) = "' . $title . '" ' . $query_string . ')';
        $query = mysql_query('SELECT title FROM track ' . $filter_query);
        if (strlen($title) > 0) {
            $num_rows = mysql_num_rows($query);
            if ($num_rows > 1) {
                $other_track_version = true;
            }
        }
    }
    $exploded = multiexplode($cfg['artist_separator'], $track['track_artist']);
    $inFavorite = false;
    if (isset($cfg['favorite_id'])) {
        $query = mysql_query("SELECT track_id FROM favoriteitem WHERE track_id = '" . $track_id . "' AND favorite_id = '" . $cfg['favorite_id'] . "' LIMIT 1");
        if (mysql_num_rows($query) > 0) {
            $inFavorite = true;
        }
    }
    $data = array();
    $data['album_artist'] = (string) ($track['album_artist'] == "Various Artists") ? rawurlencode($track['track_artist']) : rawurlencode($track['album_artist']);
    $data['track_artist'] = $exploded;
    $data['track_artist_url'] = $exploded;
    $data['track_artist_url_all'] = (string) rawurlencode($track['track_artist']);
    $data['title'] = (string) (trim($track['title']) !== '') ? $track['title'] : basename($track['relative_file']);
    $data['album'] = (string) (trim($track['album']) !== '') ? $track['album'] : basename(dirname($track['relative_file']));
    //$data['album']		= (string) $title;
    $data['by'] = (string) $by;
    $data['image_id'] = (string) $track['image_id'];
    $data['album_id'] = (string) $track['album_id'];
    $data['year'] = is_null($track['year']) ? (string) $track['trackYear'] : (string) $track['year'];
    $data['genre'] = (string) $track['genre'];
    $data['audio_dataformat'] = (string) strtoupper($track['audio_dataformat']);
    $data['audio_bits_per_sample'] = (string) $track['audio_bits_per_sample'];
    $data['audio_sample_rate'] = (string) $track['audio_sample_rate'];
    $data['genre_id'] = (string) $track['genre_id'];
    if ($track['audio_profile'] == 'Lossless compression') {
        $data['audio_profile'] = (string) floor($track['audio_bitrate'] / 1000) . ' kbps';
    } else {
        $data['audio_profile'] = (string) $track['audio_profile'];
    }
    $data['number'] = (string) $track['number'] . '. ';
    $data['miliseconds'] = (string) $track['miliseconds'];
    $data['other_track_version'] = (bool) $other_track_version;
    $data['comment'] = (string) $track['comment'];
    $data['track_id'] = (string) $track['track_id'];
    $data['relative_file'] = (string) $track['relative_file'];
    $data['inFavorite'] = (bool) $inFavorite;
    $data['dr'] = (string) $track['dr'];
    $data['album_dr'] = (string) $track['album_dr'];
    $data['title_core'] = $title;
    echo safe_json_encode($data);
}
Example #21
0
<?php 
$servername = "localhost";
$username = "******";
$password = "";
$dbname = "test";
$conn = new mysqli($servername, $username, $password, $dbname);
mysqli_query($conn, "SET NAMES utf8");
function multiexplode($delimiters, $string)
{
    $ready = str_replace($delimiters, $delimiters[0], $string);
    $launch = explode($delimiters[0], $ready);
    return $launch;
}
$text = 'چکیده';
$text = str_replace(array("\n", "\n", "'", "\"", "«", "ـ", "»", "،", "/", "[", "{", "]", "}", ",", ".", "|", ":", "؛", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "٠", "١", "٢", "٣", "۴", "۵", "۶", "٧", "٨", "٩", "٠", "١", "۱", "٢", "٣", "٤", "٥", "٦", "٧", "٨", "٩", ")", "(", "-", "!", "؟", "‌"), ' ', $text);
$exploded = multiexplode(array(" ", ".", "|", ":"), $text);
foreach ($exploded as $a) {
    if (trim($a) != '') {
        $sql = "INSERT INTO dic set word='" . trim($a) . "'";
        $conn->query($sql);
    }
}
echo 'OK';
//var_dump($exploded);
Example #22
0
#!/usr/bin/php
<?php 
function multiexplode($delimiters, $string)
{
    $ready = str_replace($delimiters, $delimiters[0], $string);
    $launch = explode($delimiters[0], $ready);
    return $launch;
}
if ($argc == 2) {
    $split = multiexplode(array('/', '*', '+', '-', '%'), $argv[1]);
    if (count($split) == 2) {
        $nb1 = trim($split[0]);
        $nb2 = trim($split[1]);
        if (ctype_digit($nb1) && ctype_digit($nb2)) {
            if (strstr($argv[1], '+')) {
                print $nb1 + $nb2;
            } else {
                if (strstr($argv[1], '-')) {
                    print $nb1 - $nb2;
                } else {
                    if (strstr($argv[1], '/') && $nb2 != 0) {
                        print $nb1 / $nb2;
                    } else {
                        if (strstr($argv[1], '%') && $nb2 != 0) {
                            print $nb1 % $nb2;
                        } else {
                            if (strstr($argv[1], '*')) {
                                print $nb1 * $nb2;
                            }
                        }
                    }
Example #23
0
                         $cc = $headers[$qq]['value'];
                         $temp = multiexplode(array("<", ">", "\"", ","), $cc);
                         foreach ($temp as $te) {
                             //echo "BCC===>".$bcc.'<br/>';
                             if (!(strpos($te, "@") === false)) {
                                 $te = strtolower($te);
                                 //echo $te.'<br/>';
                                 $ar[$cnt] = $te;
                                 $cnt++;
                             }
                         }
                     } else {
                         if ($headers[$qq]['name'] == "Bcc") {
                             $bcc = $headers[$q]['value'];
                             //echo "BCC===>".$bcc.'<br/>';
                             $temp = multiexplode(array("<", ">", "\"", ","), $bcc);
                             foreach ($temp as $te) {
                                 if (!(strpos($te, "@") === false)) {
                                     $te = strtolower($te);
                                     //echo $te.'<br/>';
                                     $ar[$cnt] = $te;
                                     $cnt++;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Example #24
0
<?php

header("Content-Type:text/html;charset=utf-8");
require 'lunar.php';
$LIUREN = ["大安", "留连", "速喜", "赤口", "小吉", "空亡"];
$user_time = $_POST["user_time"];
$msg = $user_time . "<br/>";
function multiexplode($delimiters, $string)
{
    $ready = str_replace($delimiters, $delimiters[0], $string);
    $launch = explode($delimiters[0], $ready);
    return $launch;
}
$timeArray = multiexplode(array("-", "T", ":", "+", " "), $user_time);
$lunar = new Lunar();
$lunarDate = $lunar->convertSolarToLunar($timeArray[0], $timeArray[1], $timeArray[2]);
if ($lunarDate[7] > 0) {
    if ($lunarDate[4] > $lunarDate[7]) {
        $lunarDate[4] = $lunarDate[4] - 1;
    }
}
$msg = $msg . $lunarDate[1] . $lunarDate[2] . "<br/>";
//echo "<br/>".$lunarDate[4].$lunarDate[5]."<br/>";
$mm = (int) $lunarDate[4];
if ($mm > 6) {
    $mmi = ($mm - 1) % 6;
} else {
    $mmi = $mm - 1;
}
//echo $mmi.":".$LIUREN[$mmi]."月<br/>";
$dd = (int) $lunarDate[5];
Example #25
0
<?php

$title = "Registration";
include "assets/inc/header.inc.php";
$errorId = "";
if (isset($_POST["submit"])) {
    if (!empty($_POST["ssn_digits"]) && !empty($_POST["dob"])) {
        $ssn = sanitize($_POST["ssn_digits"]);
        $dob = sanitize($_POST["dob"]);
        $dobInput = multiexplode(array("-", "/"), $dob);
        $date_of_birth = $dobInput[2] . "-" . $dobInput[0] . "-" . $dobInput[1];
        echo $ssn;
        echo $date_of_birth;
    }
    if (empty($_POST["ssn_digits"]) || empty($_POST["dob"])) {
        $errorId = "<span class='error'>Please enter your SSN and Date of Birth</span>";
    } else {
        if (register_verify_exists($ssn, $date_of_birth) == false) {
            $errorId = "<span class='error'>Wrong SSN or date of birth.  Please try again.</span>";
        } else {
            if (empty($_POST["username"])) {
                $errorId = "<span class='error'>Please enter username</span>";
            } else {
                if (user_exists($_POST["username"]) === true) {
                    $errorId = "<span class='error'>Sorry, the username \"" . $_POST["username"] . "\" is already taken.</span>";
                } else {
                    if (preg_match("/\\s/", $_POST["username"]) == true) {
                        // $regular_expression = preg_match("/\\s/", $_POST["username"]);
                        // var_dump($regular_expression);
                        $errorId = "<span class='error'>Your username must not contain any spaces.</span>";
                    } else {
Example #26
0
 function getTags($filter = "")
 {
     # Filter is an SQL where statement
     # tag sizes 0 ~ 4
     $TAGS = array();
     $maxTAG = 1;
     $mod = $this->parent->loaded($this->moduleRelation);
     $sql = "SELECT " . $mod->name . ".tags FROM " . $mod->dbname . " as " . $mod->name . " WHERE " . $mod->name . ".tags<>''" . ($filter != "" ? " AND " . $filter : "");
     $this->parent->dbo->query($sql, $r, $n);
     for ($c = 0; $c < $n; $c++) {
         list($ttags) = $this->parent->dbo->fetch_row($r);
         $ttags = multiexplode(array(" ", ',', ';'), strtolower($ttags));
         foreach ($ttags as $tag) {
             if (strlen($tag) >= $this->ignoreTagsSmallerThen) {
                 if (isset($TAGS[$tag])) {
                     $TAGS[$tag]++;
                 } else {
                     $TAGS[$tag] = 1;
                 }
                 if ($TAGS[$tag] > $maxTAG) {
                     $maxTAG = $TAGS[$tag];
                 }
             }
         }
     }
     foreach ($TAGS as $tag => $count) {
         $TAGS[$tag] = $count < $maxTAG / 5 ? 0 : ($count < 2 * $maxTAG / 5 ? 1 : ($count < 3 * $maxTAG / 5 ? 2 : ($count < 4 * $maxTAG / 5 ? 3 : 4)));
     }
     return $TAGS;
 }
Example #27
0
    $sal;
    if (strlen($a) > strlen($b) || strlen($a) === strlen($b) && $a <= $b) {
        $sal = -1;
    } else {
        $sal = 1;
    }
    return $sal;
}
if (!isset($_POST['botonenvio'])) {
    header('Location: http://localhost:8000');
}
$texto = $_POST['texto'];
$arraySalida = [];
//Primero separamos las palabras
$separadores = [",", " ", "\n", "\t", ".", ",", ";", ":"];
$palabras = multiexplode($separadores, $texto);
foreach ($palabras as $valor) {
    if (verMayusculas($valor) && cuentaLetras($valor) && cuentaVocales($valor) && finalEro($valor)) {
        if (!array_key_exists($valor, $arraySalida)) {
            $arraySalida[$valor] = 1;
        } else {
            $arraySalida[$valor]++;
        }
    }
}
$arrayAux = [];
foreach ($arraySalida as $key => $valor) {
    $arrayAux[] = $key;
}
usort($arrayAux, "cmp");
$imprime = implode('-', $arrayAux);
 $destino = '../../txt/';
 move_uploaded_file($_FILES['file2']['tmp_name'], $destino . '/' . $nombre_archivo);
 $archivo = "../../txt/" . $nombre_archivo;
 function multiexplode($delimiters, $string)
 {
     $ready = str_replace($delimiters, $delimiters[0], $string);
     $launch = explode($delimiters[0], $ready);
     return $launch;
 }
 $file = new SplFileObject($archivo);
 $i = 0;
 // Loop until we reach the end of the file.
 while (!$file->eof()) {
     // Echo one line from the file.
     $linea = $file->fgets();
     $partes = multiexplode(array(",", "."), $linea);
     $aux = explode("-", $partes[0]);
     if (isset($aux[0]) and isset($aux[1]) and isset($aux[2])) {
         $fecha = $aux[2] . "-" . $aux[1] . "-" . $aux[0];
     }
     if (isset($fecha) and isset($partes[1]) and isset($partes[2]) and isset($partes[38])) {
         $query = "INSERT INTO estacion (fecha, hora, estacion, temp, humedad, pRocio, vPromedio, vRafaga, direcViento, precActual, precHoy, presion, precTotal, tempInterior, humInterior, uViento, senTermica, indHumidex, uvIndex, rSolar, evotrans, evotransAnual, tAparente, rSolarMax, hSol_hoy, dVientoActual) VALUES\n\t\t\t\t('" . $fecha . "','" . $partes[1] . "','" . $estacion . "','" . $partes[2] . "." . $partes[3] . "','" . $partes[4] . "','" . $partes[5] . "." . $partes[6] . "','" . $partes[7] . "." . $partes[8] . "','" . $partes[9] . "." . $partes[10] . "','" . $partes[11] . "','" . $partes[12] . "." . $partes[13] . "','" . $partes[14] . "." . $partes[15] . "','" . $partes[16] . "." . $partes[17] . "','" . $partes[18] . "." . $partes[19] . "','" . $partes[20] . "." . $partes[21] . "','" . $partes[22] . "','" . $partes[23] . "." . $partes[24] . "','" . $partes[25] . "." . $partes[26] . "','" . $partes[27] . "." . $partes[28] . "','" . $partes[29] . "." . $partes[30] . "','" . $partes[31] . "','" . $partes[32] . "." . $partes[33] . "','" . $partes[34] . "." . $partes[35] . "','" . $partes[36] . "." . $partes[37] . "','" . $partes[38] . "','" . $partes[36] . "." . $partes[37] . "','" . $partes[38] . "')";
         // -- fecha -----,-- hora---------,----estacion----,----------- temp--------------,----humedad------,------------pRocio------------,-------vPromedio---------------,------vRafaga------------------,---direcViento----,---------precActual--------------,----------.-----precHoy----------,------------presion--------------,-------------precTotal-----------,------------tempInterior---------,---humInterior---,--------uViento------------------,-----------senTermica------------,-----------indhumidex------------,-----------uvIndex---------------,------rSolar-----,----------evotrans---------------,-------evotranAnual--------------,--------tAparente----------------,----rSolarMax----,----------hSol_hoy---------------,--dViento-Actual
     }
     if ($con->query($query) == TRUE) {
         $i++;
         echo "New record created successfully<br>";
     } else {
         echo "Error: " . $query . " <br> -- <br>" . $con->error . "<br>";
     }
 }
Example #29
0
 /**
  * GenerateDynamicPagesURLs
  *
  */
 public function GenerateDynamicPagesURLs(&$curfilename, &$pageCateBrand, &$pageYMM, &$hasmore = false)
 {
     $filesize = 50000;
     $pagesize = 1;
     $totalsize = $filesize * $pagesize;
     $filePrefix = 'dynamic-pages';
     //$categoryBrandURLs = $this->GetCategoryBrandURLs();
     $categoryURLs = $this->GetCategoryURLS();
     $brandURLs = $this->GetBrandURLS();
     $categoryBrandURLs = array_merge(array_keys($categoryURLs), array_keys($brandURLs));
     $urlCount = 1;
     $countName = 'Cake' . $urlCount;
     ${$countName} = array();
     $countCateBrand = count($categoryBrandURLs);
     $countFlag = true;
     for ($cc = $pageCateBrand; $cc < $countCateBrand; $cc++) {
         /*
         				reset($ymmURLs);
         				while(next($ymmURLs)){
         					current($ymmURLs);
         				}*/
         if (isset($categoryURLs[$categoryBrandURLs[$cc]])) {
             $ymmURLs = $this->_generalYMM($categoryURLs[$categoryBrandURLs[$cc]]);
         } else {
             $ymmURLs = $this->_generalYMM($brandURLs[$categoryBrandURLs[$cc]]);
         }
         $countYMM = count($ymmURLs);
         $pageYMM = $countFlag ? $pageYMM : 0;
         for ($yy = $pageYMM; $yy < $countYMM; $yy++) {
             if (count(${$countName}) < $filesize) {
                 array_push(${$countName}, $categoryBrandURLs[$cc] . $ymmURLs[$yy]);
             } else {
                 if ($urlCount < $pagesize - 1) {
                     $urlCount++;
                     $countName = 'Cake' . $urlCount;
                     ${$countName} = array();
                     array_push(${$countName}, $categoryBrandURLs[$cc] . $ymmURLs[$yy]);
                 } else {
                     $pageCateBrand = $cc;
                     $pageYMM = $yy;
                     $hasmore = true;
                     break;
                 }
             }
         }
         $countFlag = false;
         if ($hasmore) {
             break;
         }
     }
     if ($pageCateBrand == 0 && $pageYMM == 0 && !$hasmore) {
         $this->SaveAsXML(array($filePrefix => ${$countName}));
     } else {
         for ($ii = 1; $ii <= $urlCount; $ii++) {
             $countName = 'Cake' . $ii;
             $countArr = ${$countName};
             if ($GLOBALS['EnableSEOUrls'] == 1) {
                 $nameArr = explode('/', $countArr[0]);
                 for ($i = 4; $i < count($nameArr); $i += 2) {
                     $newArr[$nameArr[$i]] = $nameArr[$i + 1];
                 }
             } else {
                 $delimiters = array("?", "&", "=");
                 $res = multiexplode($delimiters, $countArr[0]);
                 foreach ($res[1] as $value) {
                     $newArr[$value[0]] = $value[1];
                 }
             }
             if (isset($newArr['series'])) {
                 $suffixName = $newArr['series'];
             } else {
                 if (isset($newArr['brand'])) {
                     $suffixName = $newArr['brand'];
                 } else {
                     if (isset($newArr['subcategory'])) {
                         $suffixName = $newArr['subcategory'];
                     } else {
                         if ($GLOBALS['EnableSEOUrls'] == 1) {
                             $suffixName = $nameArr[3];
                         } else {
                             $suffixName = $newArr['search_query'];
                         }
                     }
                 }
             }
             $filename = $filePrefix . '-' . $this->GenerateFilename($filePrefix, $this->MakeFileNameSafe(MakeURLNormal($suffixName)));
             $curfilename = $filename;
             $this->SaveAsXML(array($filename => $countArr));
         }
     }
     return true;
 }
function main()
{
    $form_valid = validate_form_input();
    if ($form_valid !== TRUE) {
        echo $form_valid;
    } else {
        $params = $GLOBALS["params"];
        $headers = $GLOBALS["headers"];
        if (mail($params["to"], $params["subject"], $params["message"], $headers)) {
            echo "Your important message was sent to the following email addresses:\n\n";
            $addresses = multiexplode(array(",", ";"), $params["to"]);
            foreach ($addresses as $address) {
                echo $address . "\n";
            }
            echo "Thank you for using our mail form. Have a nice day. HORRIE!!!\n\n";
            //echo "HEADERS: " . $headers . "\n";
        } else {
            echo "Sorry, an error occurred and your mail was not sent. HORRIE!!!";
        }
    }
}