Loading...
More PHP Posts
<?php/** @param string $file Filepath* @param string $query Needed information (0 = width, 1 = height, 2 = mime-type)* @return string Fileinfo*/function getImageinfo($file, $query) {if (!realpath($file)) {$file = $_SERVER["DOCUMENT_ROOT"] . $file;}$image = getimagesize($file);return $image[$query];}?>
<?phpheader('Content-Type:text/html');$jsonData = json_decode(file_get_contents("names.json"));$namesArray = array();foreach($jsonData as $data) {$namesArray[] = $data;}for($i = 0; $i < 64000; $i++) {echo 'D.add_edge("'. $namesArray[array_rand($namesArray)] . '", "' . $namesArray[array_rand($namesArray)]. '")';echo "<br>";}?>
<?phpecho '<select id="modeEl" size="1"><option value="abap">ABAP</option><option value="abc">ABC</option><option value="actionscript">ActionScript</option><option value="ada">ADA</option><option value="alda">Alda</option><option value="apache_conf">Apache Conf</option><option value="apex">Apex</option><option value="aql">AQL</option><option value="asciidoc">AsciiDoc</option><option value="asl">ASL</option><option value="assembly_x86">Assembly x86</option><option value="autohotkey">AutoHotkey / AutoIt</option><option value="batchfile">BatchFile</option><option value="c_cpp">C and C++</option><option value="c9search">C9Search</option><option value="cirru">Cirru</option><option value="clojure">Clojure</option><option value="cobol">Cobol</option><option value="coffee">CoffeeScript</option><option value="coldfusion">ColdFusion</option><option value="crystal">Crystal</option><option value="csharp">C#</option><option value="csound_document">Csound Document</option><option value="csound_orchestra">Csound</option><option value="csound_score">Csound Score</option><option value="css">CSS</option><option value="curly">Curly</option><option value="d">D</option><option value="dart">Dart</option><option value="diff">Diff</option><option value="dockerfile">Dockerfile</option><option value="dot">Dot</option><option value="drools">Drools</option><option value="edifact">Edifact</option><option value="eiffel">Eiffel</option><option value="ejs">EJS</option><option value="elixir">Elixir</option><option value="elm">Elm</option><option value="erlang">Erlang</option><option value="forth">Forth</option><option value="fortran">Fortran</option><option value="fsharp">FSharp</option><option value="fsl">FSL</option><option value="ftl">FreeMarker</option><option value="gcode">Gcode</option><option value="gherkin">Gherkin</option><option value="gitignore">Gitignore</option><option value="glsl">Glsl</option><option value="gobstones">Gobstones</option><option value="golang">Go</option><option value="graphqlschema">GraphQLSchema</option><option value="groovy">Groovy</option><option value="haml">HAML</option><option value="handlebars">Handlebars</option><option value="haskell">Haskell</option><option value="haskell_cabal">Haskell Cabal</option><option value="haxe">haXe</option><option value="hjson">Hjson</option><option value="html">HTML</option><option value="html_elixir">HTML (Elixir)</option><option value="html_ruby">HTML (Ruby)</option><option value="ini">INI</option><option value="io">Io</option><option value="jack">Jack</option><option value="jade">Jade</option><option value="java">Java</option><option value="javascript">JavaScript</option><option value="json">JSON</option><option value="json5">JSON5</option><option value="jsoniq">JSONiq</option><option value="jsp">JSP</option><option value="jssm">JSSM</option><option value="jsx">JSX</option><option value="julia">Julia</option><option value="kotlin">Kotlin</option><option value="latex">LaTeX</option><option value="latte">Latte</option><option value="less">LESS</option><option value="liquid">Liquid</option><option value="lisp">Lisp</option><option value="livescript">LiveScript</option><option value="logiql">LogiQL</option><option value="lsl">LSL</option><option value="lua">Lua</option><option value="luapage">LuaPage</option><option value="lucene">Lucene</option><option value="makefile">Makefile</option><option value="markdown">Markdown</option><option value="mask">Mask</option><option value="matlab">MATLAB</option><option value="maze">Maze</option><option value="mediawiki">MediaWiki</option><option value="mel">MEL</option><option value="mips">MIPS</option><option value="mixal">MIXAL</option><option value="mushcode">MUSHCode</option><option value="mysql">MySQL</option><option value="nginx">Nginx</option><option value="nim">Nim</option><option value="nix">Nix</option><option value="nsis">NSIS</option><option value="nunjucks">Nunjucks</option><option value="objectivec">Objective-C</option><option value="ocaml">OCaml</option><option value="pascal">Pascal</option><option value="perl">Perl</option><option value="pgsql">pgSQL</option><option value="php">PHP</option><option value="php_laravel_blade">PHP (Blade Template)</option><option value="pig">Pig</option><option value="powershell">Powershell</option><option value="praat">Praat</option><option value="prisma">Prisma</option><option value="prolog">Prolog</option><option value="properties">Properties</option><option value="protobuf">Protobuf</option><option value="puppet">Puppet</option><option value="python">Python</option><option value="qml">QML</option><option value="r">R</option><option value="raku">Raku</option><option value="razor">Razor</option><option value="rdoc">RDoc</option><option value="red">Red</option><option value="rhtml">RHTML</option><option value="rst">RST</option><option value="ruby">Ruby</option><option value="rust">Rust</option><option value="sass">SASS</option><option value="scad">SCAD</option><option value="scala">Scala</option><option value="scheme">Scheme</option><option value="scss">SCSS</option><option value="sh">SH</option><option value="sjs">SJS</option><option value="slim">Slim</option><option value="smarty">Smarty</option><option value="smithy">Smithy</option><option value="snippets">snippets</option><option value="soy_template">Soy Template</option><option value="space">Space</option><option value="sql">SQL</option><option value="sqlserver">SQLServer</option><option value="stylus">Stylus</option><option value="svg">SVG</option><option value="swift">Swift</option><option value="tcl">Tcl</option><option value="terraform">Terraform</option><option value="tex">Tex</option><option value="text">Text</option><option value="textile">Textile</option><option value="toml">Toml</option><option value="tsx">TSX</option><option value="twig">Twig</option><option value="typescript">Typescript</option><option value="vala">Vala</option><option value="vbscript">VBScript</option><option value="velocity">Velocity</option><option value="verilog">Verilog</option><option value="vhdl">VHDL</option><option value="visualforce">Visualforce</option><option value="wollok">Wollok</option><option value="xml">XML</option><option value="xquery">XQuery</option><option value="yaml">YAML</option><option value="zeek">Zeek</option><option value="django">Django</option></select>';?>
<?phpfunction getFileExtension($file) {return end(explode(".", $file));}?>
<?phpsession_start();if(isset($_POST['search-submit'])) {$currentFilter;if(isset($_POST['search-filter']) && $_POST['search-filter'] == "search-all") {$currentFilter = "All";} else if(isset($_POST['search-filter']) && $_POST['search-filter'] == "search-by-title") {$currentFilter = "Title";} else if(isset($_POST['search-filter']) && $_POST['search-filter'] == "search-by-language") {$currentFilter = "Language";} else {$currentFilter = "Username";}}if(isset($_POST['search-submit']) && $_POST['search'] !== "") {require_once 'includes/config.php';$searchQuery = '%' . htmlspecialchars($_POST['search']) . '%';$statement;if(htmlspecialchars($_POST['search-filter']) == "search-all") {$statement = $conn->prepare("SELECT * FROM user_posts WHERE privacy = 0 AND title LIKE ? OR username LIKE ? OR language LIKE ?");$statement->bind_param("sss", $searchQuery, $searchQuery, $searchQuery);} else if(htmlspecialchars($_POST['search-filter']) == "search-by-title") {$statement = $conn->prepare("SELECT * FROM user_posts WHERE privacy = 0 AND title LIKE ?");$statement->bind_param("s", $searchQuery);} else if(htmlspecialchars($_POST['search-filter']) == "search-by-language") {$statement = $conn->prepare("SELECT * FROM user_posts WHERE privacy = 0 AND language LIKE ?");$statement->bind_param("s", $searchQuery);} else {$statement = $conn->prepare("SELECT * FROM user_posts WHERE privacy = 0 AND username LIKE ?");$statement->bind_param("s", $searchQuery);}$statement->execute();$result = $statement->get_result();}?><?phpif(isset($_POST['search-submit']) && $_POST['search'] !== "") {if($result->num_rows > 0) {$i = 1;echo '<ul class="list-group mt-5">';while($row = $result->fetch_assoc()) {$linkName = "post.php?postID=" . $row['postID'];$privacy = ($row['privacy'] == 0) ? "Public" : "Private";if($privacy == "Public" || ($privacy == "Private" && (isset($_SESSION['username']) && ($row['username'] == $_SESSION["username"])))) {echo '<a class="post-box-link" href="' . $linkName . '"><li class="list-group-item mb-2 border rounded post-box"><h4><span style="color: #007bff;">' . $row['title'] . '</span> | ' . $row['language'] . '</h4><h5>' . $row['username'] . ' - ' . '<small>' . $row['uploadDate'] . '</small></h5></li></a>';$i++;}}echo '</ul>';}}?>
<?php$array = array('fruit1' => 'apple','fruit2' => 'orange','fruit3' => 'grape','fruit4' => 'apple','fruit5' => 'apple');// this cycle echoes all associative array// key where value equals "apple"while ($fruit_name = current($array)) {if ($fruit_name == 'apple') {echo key($array), "\n";}next($array);}?>