Jump to content

Mudsaf

Members
  • Posts

    462
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Mudsaf

  1. Hello, im not sure should i add this to "SQL" category since this is bit more sql-related but any fix to this. I have timestamp field in my database and it has worder ORDER BY Desc so far from oldest to newest and now at 2013 it doesn't work like that.

    SELECT * FROM ms_news ORDER BY newsDate DESC LIMIT 0, 1

    Last 2 values Code displays this

    2013-01-03 01:48:05   

    Should display this

    2013-01-04 01:03:53 

    At year 2012 it worked from oldest to newest so im not sure does the 2013 year mess the desc somehow. Blargh fixed, had taken the value from Date and not Datetime :P

  2. Hi,I am currently working on my final project of my undergraduate study and the project is about type safety in PHP. One aspect of the project examines the opinion of the PHP community on this topic. I now need your help. I would be very glad, if you could take 5 – 20 minutes to fill in my online survey: http://www.q-set.co....de=PGSKQCJUWZVK I will publish the deliverables of my project under an open source license. Thus you contribute automatically to an open source project if you fill in the form :) Thanks for your helpRobert Stoll
    I would do the survey but it takes about 30s to load page after each question.
  3. Hello, Im just wondering does it strain website server if i check if port is open and server is running. So basically i have 1 php page that is has selection for example "Sitefriends" and then when user refreshes the webpage check if the website port is open and server is up (This is because my sitefriend server isn't on always) and im wondering does it make their server slower or something if test their port openings?

  4. OH CMON IE, now i added link there and the box goed like from [ ] to 50x that... SRSLY IE! Now having 2 problems with ie.1st as i mentioned on first post

    What it looks in IE (Only IE problem)HomeInfoForumsDownloads

    What it should look in IE (Only IE problem)

    Home Info Forums Downloads

    2nd IE messes the news box the width is about 100% for no reason (should be automated depending text length). Note: This works perfectly on Google Chrome browser. Problem fixed by hating ie

    <![if !IE]>//If browser is not IE//Script here<![endif]>

  5. Note: Position:relative kind of doesn't work + Ie adds random space after something so it will be like this

    HomeInfoGames

    In Google chrome

    Home Info Games

    So i want the "Home, Info & Games" to stay in their position when im revealing the code under it and remove the random enter space that internet explorer gives. Css file

    * {margin:0;}.info, .home, .games {text-decoration:none; margin:0; list-style-image:none; list-style:none; list-style-type:none; font-weight:bold; font-size:14px; display:block;}#naviCont {margin:0;padding:0;display:inline-block; }  .naviHome, .naviInfo, .naviGames {vertical-align:text-top;font-size:18px;font-weight:bold;display:inline-block;margin-top:0px; }

    Html code

    <div id="naviCont"><ul class="naviHome">Home<li class="home">This is not homepage</li><li class="home">Neither is this</li></ul></div> <div id="naviCont"><ul class="naviInfo">Info<li class="info">Introduce</li><li class="info">Server machine</li><li class="info">Sitefriends</li></ul></div><div id="naviCont"><ul class="naviGames">Games<li class="games">Top-Games</li><li class="games">Most-Views</li><li class="games">Search games</li><li class="games">Download games</li></ul></div>

    Fixed the positions by myself, but there is still space in IE.

  6. Hello, im wondering can i prevent brute-force attacks from my webpage example creating this. This should work if the user doesn't close and re-open the page after attempts are out, but i have no idea how brute-force does it. Login page

    <?php session_start();if(isset($_SESSION['login_attempt']) && $_SESSION['login_attempt']  < 6) {} else {//Form here}?>

    Login confirm page

    <?phpsession_start();if (isset($_SESSION['Rights']) && $_SESSION['login_attempt'] < 6) {header("Location: index.php");} elseif (isset($_POST['password']) && isset($_POST['username']) && $_SESSION['login_attempt'] < 6) {//LOGIN SCRIPT HERE} elseif ($rows > 0) {  //user has logged in correctly//FEW SESSIONS TO STORE DATA} else { if (!isset($_SESSION['login_attempt'])) {$_SESSION['login_attempt'] = 1;} else {$_SESSION['login_attempt'] = $_SESSION['login_attempt'] + 1;}if ($_SESSION['login_attempt'] < 6) {echo (5 - $_SESSION['login_attempt']) . " attempts left";}}}?>

    Read more about brute-force here

    http://en.wikipedia.org/wiki/Brute-force_attack

    Read more about SQL-injections here (This prevention is MUST-have to SQL-based webpage)

    http://en.wikipedia.org/wiki/SQL_injection

  7. Hello, i have problem with my website upload system. Example if i upload game through the php This game success

    http://www.mochimedia.com/games/play/boat-racing-challenge

    But this game fails

    http://www.mochimedia.com/games/play/magnet-ninja

    Here is my form code

      <p> 	<label>	  <input type="radio" name="Upload" value="radbo" checked="checked" id="Upload_0" />	  Upload files and do query (Not working untill beta 0.3)</label>	<br />	<label>	  <input type="radio" name="Upload" value="radqu" id="Upload_1" />	  Do query only (Not working untill beta 0.3)</label>	<br />	<label>	  <input type="radio" name="Upload" value="radup" id="Upload_2" />	  Upload files only (Not working untill beta 0.3)</label>	<br />  </p>

    if (isset($_POST["Upload"]) && $_POST["Upload"] == "radup") { $target_path_img = "../games/img/";$target_path_swf = "../games/swf/";$mysql_path_img = "img/" . $_FILES['imagefile']['name'];$mysql_path_swf = "swf/" . $_FILES['flashfile']['name'];if (!empty($_FILES["imagefile"]) && ($_FILES['imagefile']['error'] == 0) && !empty($_FILES["flashfile"]) && ($_FILES['flashfile']['error'] == 0)) {if ($_FILES["flashfile"]["size"] <= 5000000 && $_FILES["imagefile"]["size"] <= 3000000) {if ($_FILES["flashfile"]["type"] == 'application/x-shockwave-flash' && $_FILES["imagefile"]["type"] == 'image/jpeg') {if(move_uploaded_file($_FILES['imagefile']['tmp_name'], $target_path_img . $_FILES['imagefile']['name']) && move_uploaded_file($_FILES['flashfile']['tmp_name'], $target_path_swf . $_FILES['flashfile']['name'])) {echo "<p>You have sussefully uploaded the 2 files.</p>";} else{echo "There was an error uploading the files, please try again!";}} else {echo "<p>You tried to upload files with wrong fileformat, only (.JPG) allowed on image field and (.SWF) allowed on flash file field.</p>";}} else {echo "The filesize you tried to upload was too big";}} else {echo $_FILES['imagefile']['error'] . $_FILES['flashfile']['error'];}}  else { //This comes with MAGNET AND NOT WITH BOATecho "<p>No radio button selections detected, please go back and confirm that you have selected some radio button.</p>";echo $_POST["Upload"]; //This returns as empty}

    With boat racing the code success

  8. Example i have data in database, i just want to display value from JOB (Not the same value twice) ID | JOB | NAME 1 | Engineer | OH LONG JOHNSON2 | Engineer | Peter3 | Cleaner | Katy So how i do query that takes only 1 times same job example 1 | Engineer | OH LONG JOHNSON3 | Cleaner | Katy :ifyouknowwhatimean: PS: This example have nothing to do with my database.

  9. I'm getting this when check for a post when I submit the form to itself: So I think your code is okay. I don't know what the cause of it is, unfortunately. But here's my full code. Maybe it will help:
    <?phpif ($_POST) {    	echo "Image file format: " . $_FILES['imagefile']['type']; //PASTES image/jpeg	echo "<br>";	echo "Flash file format: " . $_FILES['flashfile']['type']; //DOESNT PASTE ANYTHING} ?><form action="self.php" method='post' enctype='multipart/form-data'>	<label for='imagefile'>Image (.JPG):</label>	<input id='form_addgame' type='file' name='imagefile' id='imagefile' /><input type="hidden" name="MAX_FILE_SIZE_IMG" value="3000000" /> <!-- 3000 KB -->	<label for='flashfile'>Flash (.SWF):</label>	<input id='form_addgame' type='file' name='flashfile' id='flashfile' /><input type="hidden" name="MAX_FILE_SIZE_SWF" value="5000000" /> <!-- 5000 KB --><input type="submit" /></form>

    Thanks for reply, copyed ur form code + removed the double ID what was added 2 times (form_addgame) and somehow now it works :)
  10. Hello everybody, i got form with 2x file upload fields.

    <form action='Proceed.php' method='post' enctype='multipart/form-data'>    <label for='imagefile'>Image (.JPG):</label>    <input id='form_addgame' type='file' name='imagefile' id='imagefile' /><input type="hidden" name="MAX_FILE_SIZE_IMG" value="3000000" /> <!-- 3000 KB -->    <label for='flashfile'>Flash (.SWF):</label>    <input id='form_addgame' type='file' name='flashfile' id='flashfile' /><input type="hidden" name="MAX_FILE_SIZE_SWF" value="5000000" /> <!-- 5000 KB --></form>

    When i proceed to confirmation page i get this error echo "Image file format: " . $_FILES['imagefile']['type']; //PASTES image/jpegecho "Flash file format: " . $_FILES['flashfile']['type']; //DOESNT PASTE ANYTHING Im not sure howto fix this problem O_o

  11. if ($_SESSION['loginattempt'] > 5 && $rows_check2 != 1){  echo "<p id='red'>Security code was invalid. Try <a href='login.php'>again</a>!</p>";}else{  //LOGIN SCRIPT HERE}

    Well ur right im kind a idiot, i can do the query if the loginattempt isnt even 5, fixed my problem xD
  12. What's wrong with something like
    if ($_SESSION['loginattempt'] > 5) { //[1] IF TRIES > 5 CHECKS SECURITY CODE//CHECK IF THE ROW2 IS CORRECT ELSE SAYS WRONG CODE   if ($rows_check2 != 1) { //[2] <-- CHECKS CODE	//[2] <-- CODE = WRONG	echo "<p id='red'>Security code was invalid. Try <a href='login.php'>again</a>!</p>";   } //[2] <-- CLOSES CODE CHECK} else { //[1] <-- SESSION Loginattempt <= 5 //LOGIN SCRIPT HERE --- } //[1] <-- CLOSES LOGIN SCRIPT

    Well the problem is there at } //[2] <-- CLOSES CODE CHECKsince if u close it completely it doesnt add the login scriptif ($_SESSION['loginattempt'] > 5) { <-- this goes to else --- and if security code == correct it just closes the script before the else.
×
×
  • Create New...