-
Posts
178 -
Joined
-
Last visited
Everything posted by Pain
-
hiding .php (or any other) extension with .htaccess
Pain replied to Pain's topic in Apache HTTP Server
I will not create yet another topic and ask this in here. I've got this url: http://kingstonuni.atspace.co.uk/social/user_profile.php?id=14 which i want to convert to: http://kingstonuni.atspace.co.uk/social/14 or: http://kingstonuni.atspace.co.uk/social/user_profile/14 what extra line of code should i add? Thank you very much for your kind help. -
hiding .php (or any other) extension with .htaccess
Pain replied to Pain's topic in Apache HTTP Server
That you for your help guys. I found a solution. I've added one line at the top: RewriteBase / So full code would be; RewriteBase / RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php -
hiding .php (or any other) extension with .htaccess
Pain replied to Pain's topic in Apache HTTP Server
I saw some other examples of mod rewriting and i figured that i have o do something with the last line RewriteRule ^(.*)$ $1.php So if i want make it from myFile3.php to myFile then i should write something in that 4th line? -
hiding .php (or any other) extension with .htaccess
Pain replied to Pain's topic in Apache HTTP Server
Still not working for some reason -
Hello again. I've been trying to hide my url extension lately. If it is yourdomain.com/management.php then i wan to make it yourdomain.com/management After exploring various tutorials i've found out that writing the following code in the .htaccess file would help. RewriteEngine On RewriteCond %{REQUEST_URI} !-d RewriteCond %{REQUEST_URI} !-f RewriteCond %{REQUEST_URI} !\.php$ RewriteRule ^(.*)$ /$1.php [L] Also i've changed all internal links in my website (eg. from <a href="management.php">Link</a> to <a href="/management">Link</a> ) However it still does not work :s Is there something wrong with the code?
-
Hi there. I want to make a sliding div which is hidden. Lets say there is a document and a button within a document. A new div slides down as soon as the button is clicked. I've tried using css visibility: hidden and then jquery: $(document).ready(function(){ $(".in_line2").click(function(){ $(".message_box").css("visibility", "visible"); $(".message_box").slideDown("slow"); }); }); however what happens is the box appears instantly and that's it, no sliding effect.
-
Hi. I ran into this function called file_get_contents() However it is not clear to me when is the best moment to use it. I mean if you want to open a text file you can always use fopen.
-
is it even possible to do it the way i want?
-
Hi again. Sorry for taking so long to reply. I have this messages table. If a user sends a message to another user then the following will happen: User's username, receiver's username and the message will all be inserted into messages table. After that, the user's image will be displayed in the message list so that the receiver could open it up and read the message. However if the user sends more than one message, then more than one picture will be displayed in the messages list. Here is an example: http://imageshack.us/photo/my-images/528/messp.jpg/ I just want one picture displayed in the messages list page, no matter the amount of messages.
-
<?php $submit_line = $_POST['submit_line']; if (isset($submit_line)) { if ($points >= 50) { if (!empty($_POST['line']) && strlen($_POST['line']) >= 3) { if (strlen($_POST['line']) <= 50) { mysql_query("INSERT INTO line VALUES ('', '$usr', '$_POST[line]', '$name')"); mysql_query("UPDATE members SET points = points - 50"); } else { ?> <script type="text/javascript"> window.alert("Simboliu skaicius negali virsyti 50"); </script> <?php } } else { ?> <script type="text/javascript"> window.alert("Turite ivesti bent 3 simbolius"); </script> <?php } } else { ?> <script type="text/javascript"> window.alert("Neuztenka tasku"); </script> <?php } } ?>
-
Thank you for your reply. I am using php_self, so the code that processes the form is in the same page. I've tried: <div id="hot_line"><form method="post" action="main.php#line1"> <input type="text" name="line" placeholder="Karstoji linija (-50 tasku)" id="input" /> <input type="submit" name="submit_line" value="Siusti" id="button"/> </form></div> Is this what you meant? Didn't work for me.
-
Hello there. I was wondering how do people redirect users to a particular div after a submit button is clicked. Say i want to redirect someone to a div with an id of "line1". So normally user should click on a link of some sort: <a href='#line_1'>Click here</a> How do i do something like this without clicking any links, but rather after submitting information to the server. Can i do it by sending headers?
-
Not sure how to structure it... ?
-
Hi. I am trying to make a code which displays a picture of a user who just sent you a message. However if i have two messages from the same user then i also get two pictures of the user. What do i need to change in this code to make the picture display itself only once per user? <?php $query = mysql_query("SELECT * FROM message WHERE receiver = '$usr' ORDER BY date DESC"); while ($row = mysql_fetch_assoc($query)) { $message = $row['message']; $from = $row['sender']; $id = $row['id']; $date = $row['date']; $sender_image = $row['profile_picture']; $new = $row['new']; $name = $row['from_name']; ?> <div class="featured"> <a href="read.php?id=<?php echo $id; ?>"><img src="<?php echo $sender_image; ?>" class="borders" /><div class="borders3"><div class="borders_text"><?php echo $name; ?></div></div></a></div> <?php } ?>
-
Hi there. I am trying to put a "user is online" icon on top of a picture. What i've got so far is: html/php <div class="featured"><a href="user_profile.php?id=<?php echo $id2[1]; ?>"><img src="<?php echo $profile_picture2[1]; ?>" class="borders" /></a></div> css .featured { width: 136px; height: 136px; background-image: url('img/featured.jpg'); float: left; margin: 2px; } .borders { border: 4px solid #D8D8D8; height: 128px; width: 128px; } .on { width: 80px; height: 80px; background-image: url('img/on.png'); } I want to put class "on" on top of the image. I've tried many things, but just keep getting nothing or distorted layout. Any help pls:) Thanks!
-
Ok, got it. However my code doesn't work. If i have a div with a class "featured" and i want to apply a "borders2" class when hovered then should this code work? $(".featured").mouseover(function(){ $(this).addClass('borders2'); }).mouseout(function(){ $(this).addClass('borders'); });
-
Hello there. Was wondering if there is such a thing as addClass or something else which would be similar to .addClass For instance i have this code: $("#featured").mouseover(function(){ $(this).addClass('borders2'); }).mouseout(function(){ $(this).addClass('borders'); }); Can you help me out with this? Thank you:)!
-
Hello guys. I am building a 'sudoku' game and i want to load a puzzle (which is actually a text string consisting of 81 digits). I have succeeded in loading just one puzzle, however i want to make it possible to load a different puzzle when the user clicks on a button. Also the old puzzle should be removed. Here is my sudoku board: <div class="group"> <div class="cell"><input type="text" name="8_0" onfocus="{onFocusY=8;onFocusZ=0;}"></div> <div class="cell"><input type="text" name="8_1" onfocus="{onFocusY=8;onFocusZ=1;}"></div> <div class="cell"><input type="text" name="8_2" onfocus="{onFocusY=8;onFocusZ=2;}"></div> <div class="cell"><input type="text" name="8_3" onfocus="{onFocusY=8;onFocusZ=3;}"></div> <div class="cell"><input type="text" name="8_4" onfocus="{onFocusY=8;onFocusZ=4;}"></div> <div class="cell"><input type="text" name="8_5" onfocus="{onFocusY=8;onFocusZ=5;}"></div> <div class="cell"><input type="text" name="8_6" onfocus="{onFocusY=8;onFocusZ=6;}"></div> <div class="cell"><input type="text" name="8_7" onfocus="{onFocusY=8;onFocusZ=7;}"></div> <div class="cell"><input type="text" name="8_8" onfocus="{onFocusY=8;onFocusZ=8;}"></div> </div> <textarea id="puzzle">306500090200400851100780060009368500628000349005924100040097002863001005070003408</textarea> Actually there are nine of them, but there's no point in copying them all, they are pretty much the same. To load the puzzle i've used the following javascript: function ReloadingBoard(){ var puzzle = new String(document.getElementById('puzzle').value); var pos; var ch; var cell; var r; var c; pos = 0; for(c=0;c<=8;c++) { for(r=0;r<=8;r++) { cell = GetCellFromRowcolumn(r,c); ch = puzzle.substr(pos,1); switch(ch){ case '0': cell.value = ''; break; default: cell.value = ch; break; } pos++; } } } and function loadingBoard(){ document.onkeyup = KeyPressed; ReloadingBoard(); } So how do i make the board load a different puzzle when i click the button? Any ideas? Thanks:)
-
Ammm ok i tried this, but simply nothing happens. I've included the jquery function and also added a class to the selection. <html> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> function loadXML() { var xmlhttp; if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest; } xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { document.getElementById("search").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","search.php",true); xmlhttp.send(); } $(".list").change(function(){ loadXML(); }); </script> </head> <body> <form method="POST"> <p><select name="how_old" class="list"></p> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> </select> <p><select name="how_old2" class="list"></p> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> </select> <input type="submit" name="submit"/> </form> </body> </html>
-
Hey there. I have this drop down list on main.php <form method="POST"> <p><select name="how_old"></p> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> </select> <p><select name="how_old2"></p> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> </select> <input type="submit" name="submit" onsubmit="loadXML"/> </form> When i pick an option, i want search.php to be loaded with ajax. <?php session_start(); require("functions.php"); // mysql query $query2 = mysql_query("SELECT * FROM members ORDER BY date_joined DESC LIMIT 8"); $how_old = $_POST['how_old']; $how_old2 = $_POST['how_old2']; ?> <?php $query = mysql_query("SELECT * FROM members WHERE age >= '$how_old' AND age <= '$how_old2'"); while ($row = mysql_fetch_assoc($query)) { $username = $row['username']; $age = $row['age']; $profile_picture = $row['image']; $id = $row['id']; echo "<p><a href='user_profile.php?id=$id'><img src='$profile_picture' style='border:1px solid black' height='45' width='45' /></a></p>"; echo '<p>' . $username . '</p>'; echo '<p>' . $age . '</p><br />'; } ?> </body> </html> Usually i use action in my form and process all the code in another page. However i am not sure how to do it with ajax...
-
Hi there. How can i set up a maximum width and height of a picture? For example: the limit is 400x400. So if the photo is 200x200 then it stays that way, however if a photo is 550x550 then it gets resized to 400x400.
-
Hi there. How can i set up a maximum width and height of a picture? For example: the limit is 400x400. So if the photo is 200x200 then it stays that way, however if a photo is 550x550 then it gets resized to 400x400.
-
Oh forgot to ask one thing. If i were to refresh the page every second instead of ten seconds, would there be a downside to it?
-
Omg never imagined this would be so easy! Thanks! God i'm SO making a donation to phpfreaks after i fully master ajax!
-
Hi there. Im pretty new in AJAX and i've learned some basics from w3schools so i can now confidently load info from the database to the web page without actually reloading it. What i want to learn is how to load info from the database while refreshing it every ten seconds or so. Now i know there are plenty of examples of how to do this, but they all seem different and it really confuses a newbie like me. Here is my basic AJAX script: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Home</title> <script type="text/javascript"> function loadXML() { var xmlhttp; if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest; } xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","users.php",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv">Get the info!</div> <button type="button" onClick="loadXML()">Greet</button> </body> </html> If somebody could guide me all the way... it would be fantastic! I don't want to just copy a line or two but I rather want to understand it. So far i figured that i'd have to use a timer for this matter..?