PHP - Lets Play Noobs Lofl
I thought to relax a bit and while i saw something and an idea came to my mind, lets play noobs, it will be fun... we ask noob questions here lolzzz
so my question is
Hello,
I have seen that there are always 3 users /* I know these are bots */ Google, Yahoo and Bing always online and we cannot see their profiles. They must be very professional hackers who have known how to hide their identities.. right??
Similar TutorialsI've been using procedural code since I started learning PHP. I hear good thinks about OOP but it looks scary. Does OOP function somehow like CSS? If you have experience with OOP, please share an example for us noobs, where you effectively use it. I have a search that the user can use and pulls up the records from the database. I made it to where you can click on an image and it will let you edit that record, problem is, it won't let me edit the 1st record that is populated, the rest work fine. Can you find what I am doing wrong? while ($row = mysql_fetch_array($result)) { $rid=$row['timeslip_id']; $rint=$row['Initials']; $rident=$row['Identifier']; $rtype=$row['Type']; $rterms=$row['Terms']; $rmemo=$row['Memo']; $rdate=$row['Date']; $rcost=$row['Cost']; ?> <tr> <td valign="top"></td> <td valign="top"> <form action="editslip.php" name="<?=$rid?>" method="post"> <input type="hidden" name="edata" value="<?=$rid?>"> </form> <a href="#" onclick="document['<?=$rid?>'].submit()"><img src="images/pencil.png" height="24px" width="24px"/></a></td> <td valign="top" align="left"><?=$rint?></td> <td valign="top" align="left"><?=$rident?></td> <td valign="top" align="left"><?=$rtype?></td> <td valign="top" align="left"><?=$rterms?></td> <td valign="top" align="left"> <?php $convdate = date('m/d/Y', strtotime($rdate));?> <?=$convdate?></td> <td valign="top"><?=$rcost?></td> <td valign="top"> <?php echo substr($rmemo,0,100);?></td> <td align="center"><input type="checkbox" name="del[]" id="del" value="<?=$row['timeslip_id']?>"></td> </tr> I have two scripts. One uses a drop down list to populate a forum while the other makes you enter in a value and populates the forum below with all the data in that table where the input matches the requested number. So lets get down to it shall we? 1st up we have a movies list. <?php include('CheckLogin.php'); include ('databaseconfig.php'); $query = mysql_query("select title from movies"); if (isset($_POST['submitSearch'])) { $query2 = mysql_query("select * from movies where title = ". $_POST['list']); } ?> <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Home </title> <script type="text/javascript" src="javaScript/jquery-min.js"></script> <script type="text/javascript" src="javaScript/corners.js"></script> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <link href="style.css" rel="stylesheet" type="text/css"> </head> <body> <div id="wrapper"> <header> <div id="header"> <h1 id="logo">RAY AND CARLS </h1> <p class="description"><?php echo check();?><br/> </p> </div> </header> <nav> <ul id="nav"> <li> <a href="index.php">Home </a> </li> <li> <a href="#">Customer Registration </a> </li> <li> <a href="#">View Movies </a> </li> <li> <a href="#">View Games </a> </li> <li> <a href="#">Rent </a> </li> <li> <a href="#">Login </a> </li> <li> <a href="#">Admin </a> </li> </ul> </nav> <article> <section> <div class="cornerBox cBox3"> <div class="cornerBox-content"> <div class="List"> <form class="cmxform" id="commentForm" action="action" method="post"> <p> <select name="list"> <?php while ($row = mysql_fetch_array($query)) { echo "<option>$row[title]</option>\n"; } ?> </select> </p> <p><input name="submitSearch" type="button" value="submit"></p> </form> <p> </p> <form class="cmxform" id="commentForm" action="action" method="post"> <h2>The Movie Selected </h2> <p> <?php while ($row2 = mysql_fetch_array($query2)){?> <label for="cname">Movie ID: </label> <em>* </em> <input id="cname" name="movieid" size="4" class="required" minlength="2" value="<?php echo $row2[0];?>"> </p> <p> <label for="cemail">Rented <em> 0 for n, 1 for y</em> </label> <em>* </em> <input id="cemail" name="rented" size="2" class="required email" value="<?php echo $row2[1];?>"> </p> <p> <label for="curl">Title </label> <em>* </em> <input id="curl" name="title" size="30" class="url" value="<?php echo $row2[2];?>"> </p> <p> <label for="curl">Category </label> <em>* </em> <input id="curl" name="category" size="15" class="url" value="<?php echo $row2[3];?>"> </p> <p> <label for="curl">Director </label> <em>* </em> <input id="curl" name="director" size="15" class="url" value="<?php echo $row2[4];?>"> </p> <p> <label for="curl">Leading Actors </label> <em>* </em> <input id="curl" name="leadingactors" size="50" class="url" value="<?php echo $row2[5];?>"> </p> <p> <label for="curl">Supporting Actors </label> <em>* </em> <input id="curl" name="supportingactors" size="50" class="url" value="<?php echo $row2[6];?>"> </p> <p> <label for="curl">Run Time <em>in minutes</em> </label> <em>* </em> <input id="curl" name="runtime" size="4" class="url" value=""><?php echo $row2[7];?></input> </p> <p> <label for="curl">Rating </label> <em>* </em> <input id="curl" name="rating" size="6" class="url" value="<?php echo $row2[8];?>"> </p> <p> <label for="curl">Release Date </label> <em>* </em> <input id="curl" name="releasedate" size="10" class="url" value="<?php echo $row2[9];?>"> <?php } ?> </form> </div> </div> </div> </section> </article> <footer> <div id="footer"> <div class="footer1"> <h2> About </h2> <p> Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. </p> </div> <div class="footer2"> <h2>Other places </h2> <p> <ul> <li> <a href="#">Link 1 </a> </li> <li> <a href="#">Link 2 </a> </li> <li> <a href="#">Link 3 </a> </li> <li> <a href="#">Link 4 </a> </li> </ul> </p> </div> <div class="footer3"> <h2> Other information </h2> <p> Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. </p> </div> <p class="credits">© <a href="http://bwshome.byethost5.com/blogs">Adam Balan - BLACKANDWHITE </a> <span>• </span> Powered by <a href="http://bwshome.byethost5.com/blogs">BLACKANDWHITE </a> <span>• </span> </div> </footer> </div> </body> </html>] This script populates a list with movie names with the select statement of select * from movies; What I want to do is select a movie from this list and have the page refresh with a forum full of the details based on the movie title, hence the select * from movies where title = title statement. What it currently does is populates a drop down list with titles of movies in the data base but not the forum.... 2nd up we have the customer details The second script is similar but now we want to populate a forum based on user input of a customer id. So lets say we have an ID of 10, we enter 10 hit enter and the forum bellow should populate with all the customer info based on that id allowing me to edit and update (I haven't got to the update part yet, still trying to populate a forum) <?php session_start(); include('CheckLogin.php'); include('databaseconfig.php'); if (isset($_POST['searchSubmit'])) { $query = mysql_query("select * from customer where customer_id =".$_POST['cust_id']); } ?> <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Home </title> <script type="text/javascript" src="javaScript/jquery-min.js"></script> <script type="text/javascript" src="javaScript/corners.js"></script> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> </script> <link href="style.css" rel="stylesheet" type="text/css"> </head> <body> <div id="wrapper"> <header> <div id="header"> <h1 id="logo">RAY AND CARLS </h1> <p class="description"> <?php echo checkAdmin();?> <br/> </p> </div> </header> <nav> <ul id="nav"> <li> <a href="index.php">Home </a> </li> <li> <a href="#">Customer Registration </a> </li> <li> <a href="#">View Movies </a> </li> <li> <a href="#">View Games </a> </li> <li> <a href="#">Rent </a> </li> <li> <a href="#">Login </a> </li> <li> <a href="#">Admin </a> </li> </ul> </nav> <article> <section> <div class="cornerBox cBox3"> <div class="cornerBox-content"> <p>All updates to the Data base can be done here. Keeping in mind specific relationships with The back end data bases. </p> <p>Some common tasks are below. This page allows you to add, edit and delete customers/movies and games. </p> <div class="cornerBox2 cBox3"> <div class="cornerBox-content"> <h1>Menu </h1> <ul> <h2>Customers </h2> <li> <a href="#">edit </a> </li> <li> <a href="#">Add New </a> </li> <h2>Movies </h2> <li> <a href="#">edit </a> </li> <li> <a href="#">Add New </a> </li> <h2>Games </h2> <li> <a href="#">edit </a> </li> <li> <a href="#">Add New </a> </li> </ul> </div> </div> <div class="Forum"> <h2>Search</h2> <form class="cmxform" id="commentForm" method="post" action=""> <p> <label for="cname">Customer ID: </label> <em>* id's must be > 0 </em> <input id="cname" name="cust_id" size="25" class="required" minlength="2" /> </p> <p> <input class="submit" type="submit" value="Submit" name="searchSubmit"/> </p> </form> <h2>Edit Customer </h2> <?php $resualt = mysql_query($query); while($row = mysql_fetch_array($resualt)) { ?> <form class="cmxform" id="commentForm" method="post" action=""> <p> <label for="cname">Customer ID: </label> <em>* </em> <input id="cname" name="cust_id" size="25" class="required" minlength="2" value="<?php $row[0]?>"/> </p> <p> <label for="cemail">First Name </label> <em>* </em> <input id="cemail" name="fname" size="25" class="required email" value="<?php $row[1]?>"/> </p> <p> <label for="curl">Last Name </label> <em>* </em> <input id="curl" name="lastname" size="25" class="url" value="<?php $row[2]?>"/> </p> <p> <label for="curl">Address </label> <em>* </em> <input id="curl" name="address" size="25" class="url" value="<?php $row[3]?>"/> </p> <p> <label for="curl">Postal Code </label> <em>* </em> <input id="curl" name="postalcode" size="7" class="url" value="<?php $row[4]?>"/> </p> <p> <label for="curl">Phone Number </label> <em>* </em> <input id="curl" name="phonenumber" size="11" class="url" value="<?php $row[5]?>""/> </p> <p> <input class="submit" type="submit" value="Submit" name="submit"/> </p> </form> <?php } ?> <?php if (!mysql_query($query)) { echo("<h1>Possible Errors </h1>"); //Echo errors echo mysql_error(); echo ("<p>"); } else { echo("<h2>Customer was added</h1>"); } ?> </div> </div> </div> </section> </article> <footer> <div id="footer"> <div class="footer1"> <h2> About </h2> <p> Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. </p> </div> <div class="footer2"> <h2>Other places </h2> <p> <ul> <li> <a href="#">Link 1 </a> </li> <li> <a href="#">Link 2 </a> </li> <li> <a href="#">Link 3 </a> </li> <li> <a href="#">Link 4 </a> </li> </ul> </p> </div> <div class="footer3"> <h2> Other information </h2> <p> Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. </p> </div> <p class="credits">© <a href="http://bwshome.byethost5.com/blogs">Adam Balan - BLACKANDWHITE </a> <span>• </span> Powered by <a href="http://bwshome.byethost5.com/blogs">BLACKANDWHITE </a> <span>• </span> </div> </footer> </div> </body> </html> Now when I enter 10 into the search I get an error of: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Resource id #5' at line 1" I was told to make another thread for my question(s) and since these are in relation to each other (populating a forum and all) I thought it best to combine two into one. Hiya! Is it possible to play an avi or mpg video file with php? If not is there any other recommeded scripts out there be it jquery, ajax, js ect that will do this? Many thanks, James. Hi guys, My first post here. I would like to seek you guys help about playing video from mysql. I wanted to upload video to database and also play it inside my webpage using the media player format. Thank in advance Hi, tried google'ing for an answer but found very little help, so decided to post here. I need a way to play a 2 second wav or mp3 file in a shell script. Is there any way to do this? I was hoping for something as simple as this if possible if ($GetHit == 'true') { $PlaySound; echo "Sound Played\n\n"; } Thanks How can i play with these role in my database table as you can see here //I have a database table CREATE TABLE users ( id int(10) NOT NULL PRIMARY KEY AUTO_INCREMENT, urole varchar(10) ); in the role column, I have 2 roles first role is only used once but the sound one can be assigned to more than one user, now I want to check my table if the first role is already registered, then we can't register user with that role, also the second role can exist two or more times //check role, a variable user role has been defined as $urole = $_POST['urole']; $check = $connect -> prepare('SELECT * FROM users WHERE urole = ?'); $check -> execute([$urole]); $checkfetch = $check -> fetch(); //I'm stacking here, I want to put $checkfetch['urole'] in rowCount() to be counted but I think this is not a correct way of using rowCount() if(($checkfetch['urole'] == 'MainAdmin') && ($checkfetch ->rowCount() == 1)) { echo 'This role can be used by only once!'; } //another role if(($checkfetch['urole'] == 'NormalAdmin') && ($checkfetch ->rowCount() < 4)) { echo 'This role can be used 4 times only!'; }
Hi, How to play any website's video using php.I searched many website.All are mention code for play video using a particular website like youtube only or VEOH only or Vimo only and etc. I need play video using any website's URL when we give input as valid url.Send me reply quick please......... This topic has been moved to Other. http://www.phpfreaks.com/forums/index.php?topic=320387.0 This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=327233.0 Here's my script: <?php $ch=curl_init('http://www.pictureinthesky.net/bltest/method1.php'); curl_setopt($ch,CURLOPT_COOKIEJAR,'cookie.txt'); curl_setopt($ch,CURLOPT_COOKIEFILE,'cookie.txt'); curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); curl_setopt($ch,CURLOPT_HEADER,false); curl_setopt($ch,CURLOPT_FOLLOWLOCATION,true); curl_setopt($ch,CURLOPT_POST,true); curl_setopt($ch,CURLOPT_POSTFIELDS,'crime=1&vercode=ABC'); $page=curl_exec($ch); if (curl_errno($ch)) { echo 'ERROR'; } curl_close($ch); echo $page; ?> I'm trying to get that to call the URL in the script to check the anti XSS code in my other script is working but all it does is read the page in without submitting the form -I should get an error message! I've checked and the cookie.txt file is being created and contains: Code: [Select] # Netscape HTTP Cookie File # http://curl.haxx.se/rfc/cookie_spec.html # This file was generated by libcurl! Edit at your own risk. www.pictureinthesky.net FALSE / FALSE 0 PHPSESSID 7268ef0b4b6adae605156ac177bdd43e EDIT: The above script can be tried: http://www.pictureinthesky.net/curl/readpage.php I think it might be failing because cURL hasn't been told the name of the submit button and in my code I'm checking for it by name. This topic has been moved to Other. http://www.phpfreaks.com/forums/index.php?topic=307175.0 Ok say i have a database with users who have a video url field for them to enter a video url to be submitted to the database, im trying to create a page where the videos will be displayed one at a time for example ' 1st video plays then it switches to the next random video from the database and so on' i want only to play so many seconds of the video before it switches as they will be presentations so i dont want viewers to watch them all in full, could anyone help me out with some code or feedback on this please? |