PHP - Completely Ban Ie 7 And Below Users
Hi, I am having serious issues with compatibility with IE7 and below (and even 8 but they should be rectified). There is no way I can have these problems finished before the site is online, so I want to redirect users to a page apologizing and recommending alternative browsers.
Is this possible? *Please don't reply just to tell me that banning an entire browser is bad, I know it is - I plan to sort it out. But this is an extra curricular project and I'm halfway through my penultimate year of uni, so IE and it's utterly shambolic rendering of CSS is not my priority. Thankyou* Similar TutorialsHello
I am trying to work out how many regular users I have to my site and how long those users tend to be users..
So, I have a table that logs every time a user visits my site and logs in, it stores the date / time as a unix timestamp and it logs their user id.
I started by getting the id's of any user who logs in more than 5 times in a specified period, but now I want to extend that...
SELECT userID as user, count(userID) as logins FROM login_history where timestamp > UNIX_TIMESTAMP('2014-06-01 00:00:00') and timestamp < UNIX_TIMESTAMP('2014-07-01 00:00:00') group by user having logins > 5; I just discovered that I have a major security flaw with my website. Anyone who logs in to the website can easily access other users information as well as delete and edit other users information just by changing the ID variable in the address bar. I have user ID Session started on these pages but still people can do anything they like with other users information just by editing the address bar. For example if your logged in in the address bar of www.mywebsite.com/delete_mystuff.php?id=5 and change the "5" say to a "9" then you will have access to user#9 information. Every important page that I have has this code: Code: [Select] session_start(); if (!isset($_SESSION['user_id'])) { // Start defining the URL. $url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); // Check for a trailing slash. if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) { $url = substr ($url, 0, -1); // Chop off the slash. } // Add the page. $url .= '/index.php'; ob_end_clean(); // Delete the buffer. header("Location: $url"); exit(); // Quit the script. } else { //Else If Logged In Run The Script if((isset($_GET['id'])) && (is_numeric($_GET['id']))) { $id = (int) $_GET['id']; } elseif ((isset($_POST['id'])) && (is_numeric($_POST['id']))) { $id = (int) $_POST['id']; } else { echo ' No valid ID found, passed in url or form element'; exit(); } What am I doing wrong? Please help if you know how to correct this. Many thanks in advance. I'm brand new to PHP - trying to have a form that accepts a document attachment -
the top of my form has includes which a
include_once('/usr/bin/pear-stable/Mail.php'); Hello all, i'm attempting to implement i18n into my project. so I read some tutorials, copied some code and eventually made the following: Code: [Select] /** * applyMultiLingual uses the gettext module from PHP to support multilingual * @param Array $settings */ private static function applyMultiLingual($settings){ /* init global config */ bindtextdomain(self::$project_name,Config::path('i18n')); bind_textdomain_codeset(self::$project_name, 'UTF-8'); textdomain(self::$project_name); if(!array_key_exists('enabled', $settings) || $settings['enabled'] == false){ //initiate default (english) putenv("LC_MESSAGES=en_EN"); setlocale(LC_MESSAGES,'en_EN'); } else{ if(Session::language() === null){ //initiate custom if($settings['default'] == 'auto'){ locale::acceptFromHttp($header); } else{ putenv("LC_MESSAGES=".$settings['default']);setlocale(LC_MESSAGES,$settings['default']); } } else{ putenv("LC_MESSAGES=".Session::language()); setlocale(LC_MESSAGES,Session::language()); } } } The code is (imo) pretty readable, so it sets the textdomain to "project1", and the current language to en_EN. if should search for the translations in DOC_ROOT/i18n/ now, it returns the text between the _(); functions, but I get no translation files in said directory, and I also have no clue how to accomplish this. so what I want to accomplish is this: enable use of function _(), which saves all translations in a folder i18n, and subfolder LOCALE_CODE (ex. DOC_ROOT/i18n/en_EN/messages.po). what am I doing wrong, and how can I fix it? thanks to any who can help, and if more info is needed, ask and you shall receive. Hi all I'm building a script which reads a XML document, and so far so good... until now! the document uses '-' extensively all the way through it (not something that I would have chosen) so to combat this I've used {}. The part of the document I am working on now, this simply does not work, and I really cannot see why... XML Code: [Select] <plot> <name-number>87</name-number> <price>183000</price> <bedrooms>4</bedrooms> <status>available</status> <summary>With three double bedrooms, including one en suite and a further bedroom plus family bathroom to the first floor,&nbsp;separate lounge and&nbsp;dining room with kitchen&nbsp;and utility to the ground floor, the Otter is a modern home with a great deal to offer growing families.</summary> <feature>Separate lounge and dining room</feature> <feature>Kitchen with utility room</feature> <feature>Integral garage</feature> <feature>En suite to master bedroom</feature> <property-type>detached-house</property-type> <media> <caption> </caption> <type>image</type> <filename>1855_Otter-WhitehirstGrange.jpg</filename> <indexno>1</indexno> </media> <media> <caption> </caption> <type>floorplan</type> <filename>1386_Otter-WhitehirstGrange.pdf</filename> <indexno>2</indexno> </media> <media> <caption> </caption> <type>brochure</type> <filename>284_brochure.pdf</filename> <indexno>3</indexno> </media> <style-name>Otter</style-name> </plot> PHP Code: [Select] echo $plot->{name-number}; // echoes nothing, should echo 87 echo $plot->price; // echoes 183000 echo $plot->bedrooms // echoes 4 echo $plot->{style-name} // echoes nothing, should echo Otter This is frustrating the hell out of me, and I cannot see why this would work everywhere else in the XML document but not here. Any ideas or help would be received with gratitude! Hi there, I am hoping someone here can help me with my problem... I have created some php code that I thought would do what I require but it just will not work! What I require is to connect to my database and get information from one table to see if a video has been marked as featured, if so then get some more information from that table and then get the users "NickName" from another table to show with the video screenshot. I have tried playing around with the code to see if I can get it to work but I have not been able to. Here is my code so far: mysql_connect("localhost", "*****", "*****") or die(mysql_error()); mysql_select_db("*****") or die(mysql_error()); $dir = "*****/*****/*****/"; $sql = "SELECT RayVideoFiles.ID, RayVideoFiles.Owner, RayVideoFiles.Views, RayVideoFiles.Featured, RayVideoFiles.Uri, RayVideoFiles.Title, Profiles.ID, Profiles.NickName\n" . "FROM RayVideoFiles\n" . "INNER JOIN Profiles\n" . "ON RayVideoFiles.Owner=Profiles.ID\n" . "ORDER BY Profiles.ID LIMIT 0, 30 "; while($row = mysql_fetch_array($sql)) { echo '<!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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><style type="text/css">'; echo '.centering {display: block; margin-left: auto; margin-right: auto; margin-top:10px; }'; echo '</style></head><body>'; echo '<div style="margin-left:auto; margin-right:auto; width:170px; background-color:#fff; padding:10px;"><div class="boxContent"><div class="dbContent"> <a href="m/videos/view/'.$row[Uri].'"><img src="'.$dir.''.$row[ID].'.jpg" width="140px" height="110px" style="border:6px double #545565;"/></div></a><br /><p><div class="sys_file_search_title" style="margin-top:-15px;"><a href="m/videos/view/'.$row[Uri].'">'.$row[Title].'</a><br /></div><div class="sys_file_search_from" style="margin-top:0px;">From <a href="'.$row[NickName].'">'.$row[NickName].'</a><br /></div><div class="sys_file_search_when" style="margin-top:0px;">'.$row[Views].' Views</p></div></div></div>'; } I thank you in advance for any help that you can give me on this matter. Hello Guys.
I am having a trouble viewing a specific column content both in phpMyAdmin and console.It only shows a partial info about the contents inside that column.
I have attached a screenshot of this to give you a demonstration inside that link:
http://i59.tinypic.com/2n6ymqf.jpg
as you can see , the user picked hamburger ,steak and ground beef (and some more), but it seems that it stops showing it right in the middle of the word. Is there any limit for characters in this case?
What would be possible to figure that out please?
Thanks in advance..
Edited by osherdo, 17 December 2014 - 09:11 PM. Hello everybody.
I'm changing some php in one wordpress website.
What I'm trying to do is to pass some values from one website page to the other.
When I do it this way, everything works fine:
Example 1:
First php file: (the one sending the value)
$Variable1 ='Hello'; $_SESSION['kamail']=$Variable1; printf('<li> Variable value:'. $Variable1 .'</li>'); Second php file: (the one getting the value) $Variable2=($_SESSION['kamail']);In the previous "Example 1" I get the correct value in $Variable2 and the print_f also prints the correct value In the next "Example 2", it does print the correct value, but in the second file, $Variable2 gets a completely different value. Example 2: First php file: (the one sending the value) $Variable1 =($javo_directory_query->get('email')); $_SESSION['kamail']=$Variable1; printf('<li> Variable value:'. $Variable1 .'</li>'); Second php file: (the one getting the value) $Variable2=($_SESSION['kamail']);I guess that this haves something to do with pointers or something similar, but I'm a completely PHP beginner, so I'm stuck with this Francisco im new , and ... i hate tutorials .. books .. anything that does not make u part of the deal - .. thats why i started by creating something and learning from my mistakes at the same time .. i like this way of learning .. soo , while im building and trying things out .. i started thinking how the server know the person with this link is really U ? .. when u start just linking pages to each other its just a matter of finding out what is the link to do what ever u want with the users personal pages ! .. i know my questions r stupid but i just hate to go and write lessons without any effort im confused with the concept of SESSIONS and COOKIES , r they the unswer to this security problem ? how u can work with them .. ? im not asking for codes .. just general ideas about users and how they control their profiles and stuff with full security ? ill be very thankful if i get any answer ^^ Hi guys, I am trying to get a admin panel, which when the user is logged in, it will check if there user access is(say for this post) 9... If there access is 9 in the database then direct to admin panel if not return them home. Thanks guys how can I list a user from a table and show the results in a grid with different color eg frist in blue color second on white , 3rd on blue 4th in with etc
I do need to set select command and I have db name and ip on a file called dbconfig.php from wd calendar so I just need to read the info
ps: I cant post links so search for wd calendar and see the dbconfig.php in php folder
I would get the ip address of the user that is on the site. I used $ip = $_SERVER['REMOTE_ADDR']; and it doesn't show my actual ip. Is it because im using an apache server on my computer. Hi guys, im just trying to work out an app in my head and on paper. im just wondering.. when a user registers they can choose an Avatar 100px by 100px jpg, when they upload one would i then grab the file and store all Avatars in a avatar image folder and rename it to something like.. avatar[user_id].jpg and keep them all in the same folder. or would i crate a folder called users, each user gets their own folder with files like avatar.jpg and it finds the [user_id] folder and pulls the avatar out from that, or is there a more prefered method? cheers Hi. my browser ist telling me there are errors on line 3 and 4 for my code. It says summin like Notice: HTTP_CLIENT_IP and HTTP_X_FORWARDED_FOR are unidentified: below is the code see if you can spot anything btw i copied down the code from beginner php tutorial 66 if you type that into youtube . Code: [Select] <?php $http_client_ip = $_SERVER['HTTP_CLIENT_IP']; $http_x_forwarded_for = $_SERVER['HTTP_X_FORWARDED_FOR']; $remote_addr = $_SERVER['REMOTE_ADDR']; if (!empty($http_client_ip)){ $ip_addr = $http_client_ip; }else if(!empty($http_x_forwarded_for)){ $ip_addr = $http_x_forwarded_for; }else{ $ip_addr = $remote_addr; } echo $ip_addr; ?> Thanks MOD EDIT: code tags added. I have used
$sql = "SELECT id, username FROM $tbl_name ORDER BY username"; $result = $con->query($sql); while ($row = $result->fetch_assoc()) { echo "<a href='editUser.php?id={$row['id']}'>{$row['username']}</a><br><br>\n"; echo "<style>a {color: blue; text-decoration: none;} a:hover {color: #ff0000} body {background-color: #000;} </style>"; }in euser.php which echo's out all the users in the database via an anchor tag and includes their id in the url. but when i click on their name i want to have options like: - change password - ban user e.t.c and i have tried $sql = "SELECT id FROM $tbl_name"; $result = $con->query($sql); while ($row = $result->fetch_assoc()) { echo "<a href='editUser.php?id={$row['id']}'> Change Password </a>in my other page editUser.php it posts Change Password Change Password Change Password and each change password has the 3 ids of the users this is confusing me. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=350642.0 Hi guys I am new to PHP and need som help. I have set up a site that allows a user to log in through a simple form where the data is then send to checklogin.php. Here the data is checked up against my sql database and if the login is correct the user is transfered to the "secret" members only site. All this works fine. My question is then, how do I get the members site to greet the member with "Hello 'username'"; of course where the username changes depending on the login. This is the part where the username and password is checked: <?php $host="mydbb10.surftown.dk"; // Host name $username="****"; // Mysql username $password="****"; // Mysql password $db_name="****"; // Database name $tbl_name="members"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // username and password sent from form $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; // To protect MySQL injection (more detail about MySQL injection) $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "korrekt.php" session_register("myusername"); session_register("mypassword"); echo "Tak fordi du loggede ind<br>Redirecter..."; header("location: ../forhandlerservice.php"); } else { echo "Forkert brugernavn eller password"; header("location: ../loginfejl.html"); } ?> and this is the first line of code on the members site: <? session_start(); if(!session_is_registered(myusername)){ header("location:login.html"); } ?> Sorry if I provided to much code, just want to make sure that I don't forget anything. Any help is appreciated. Thank you I have a string which is a list of user id's like "44/5/6/67/7/88/56/76/9/90/65/74/8/68". I explode this string and put them into an array, but now I have a problem of getting the users first names from the database by using the id's and putting them in alphabetical order. How can I do this? Thanks Afternoon All. I wish to re-direct users to a 404 error page on my site if an article does not exist in my database. Here's my code: $SQL = "SELECT headline FROM news WHERE news_id=".mysql_real_escape_string($_GET['news_id']); $result = mysql_query($SQL) OR die(mysql_error()); $num = mysql_num_rows($result); //** Check that the entry exists otherwise send to error page if ($num > 0) { $row = mysql_fetch_array($result); $headline = $row['headline']; } else { echo "Why is this printed? - I should be leaving this page?"; header("Location: error.php"); exit; } Now the wierd thing is that when I enter a news_id for a value that does not exist it prints the message Why is this printed? - I should be leaving this page? so it's actually going to the ELSE statement which is good, but surely it should not do this as I ask the page to re-direct? Thank you What are the different ways you can keep a User "logged in"? From what I *vaguely* recall from a year or two ago when I read a whole hoard of PHP books, you commonly use cookies and sessions. But I'm asking this more from an OOP standpoint than a PHP standpoint. Let's say I have a User record in my database, and a User comes along and attempts to log in. In OOP terms, I would think you'd call some class to help log them in, and upon successfully logging in, you would "load" the User object into memory and set the "LoggedIn" field to "True". Then as long as that field was set in their object, they could surf all over the place and do things like change their account and buy things. Is that how you would do it in OOP? TomTees |