• Questions That Don't Need Their Own Thread v3
    4,068 replies, posted
  • Avatar of xmariusx
  • I could need some help over here: [url]http://venator.zxq.net/[/url] I would like the boxes to stretch to the bottom. the min-height is set to 460px. height:100%; won't work. Also, under the What people say, and after pressed the button Comment yourself, the close button doesn't work. Ideas? (take a look at the source code) |-- [editline]lol[/editline] --| I have a problem where to navigation tiles randomly generates horizontaly or verticaly. |-- --------- --| Feedback at: [url]http://facepunch.com/threads/1152034?p=35345725&viewfull=1#post35345725[/url] :)
  • Avatar of -Kesil-
  • Cool stuff I found. [url]http://developer.mozilla.org/media/uploads/demos/s/p/spite/db3d291f0b75477af6eb7fe4c8f29520/css3d-clouds_1332707832_demo_package/index.html#[/url] Gonna start working on kinetic websites like this... but with purpose. It will be hard to find a good purpose. How am I defining kinetic? Sites with ambient motion.
  • Avatar of KmartSqrl
  • [QUOTE=-Kesil-;35344085][url]http://lesscss.org/[/url] ^why isn't CSS like this by default? Is it just because they didn't think of it? [IMG]http://i.imgur.com/s8NL0.png[/IMG][/QUOTE] SASS and SCSS are a little more powerful than LESS (or at least they were when I last checked the differences between them) check those out.
  • Avatar of Bambo.
  • Hey guys, quick noob PHP question. I'm handling registrations like this: [code] <?php $data = $data["data"]; Register( $data["title"], $data["tagline"], $data["password"], $data["email"], $data["twitter"], $data["linkedin"], $data["blogger"] ); function Register( $title, $tagline, $password, $email, $twitter, $linkedin, $blogger ) { $con = mysql_connect("localhost", "root", "root"); if(!$con) { die('Could not connect'); } mysql_select_db("SocialProject", $con); $password = mysql_real_escape_string(strip_tags($password)); $password = Crypter::encrypt($password); $title = mysql_real_escape_string(strip_tags($title)); $tagline = mysql_real_escape_string(strip_tags($tagline)); $email = mysql_real_escape_string(strip_tags($email)); $twitter = mysql_real_escape_string(strip_tags($twitter)); $linkedin = mysql_real_escape_string(strip_tags($linkedin)); $blogger = mysql_real_escape_string(strip_tags($blogger)); if( mysql_query("INSERT INTO users (title, tagline, password, email, twitter, linkedin, blogger) VALUES ('$title', '$tagline', '$password', '$email', '$twitter', '$linkedin', '$blogger');") ) { $id = getID( $password ); echo "<meta http-equiv='REFRESH' content='0;url=profile/$id'>"; } else { echo "Something has gone terribly wrong! please hang in there as we try to resolve this problem. Email us at admin@LOLLOL.com to inform us about this error."; } die( mysql_error() ); mysql_close($con); } function getID( $password ) { $con = mysql_connect("localhost","root","root"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("SocialProject", $con); $result = mysql_query("SELECT * FROM users WHERE password='$password'"); while($row = mysql_fetch_array($result)) { $id = $row['id']; } return $id; mysql_close($con); } ?> [/code] In my registrations there will be a lot more options added onto it ( facebook.etc ) and I'm wondering whether there is a better way to add them all without hard coding(?) then in. Also any suggestions to improve the code is appreciated.
  • Avatar of StinkyJoe
  • [QUOTE=Bambo.;35347283] In my registrations there will be a lot more options added onto it ( facebook.etc ) and I'm wondering whether there is a better way to add them all without hard coding(?) then in. Also any suggestions to improve the code is appreciated.[/QUOTE] Use a separate table for the different services. For example, represented as a pseudo-schema: &#9636; table [B]user[/B] : &#9568; id &#9568; name &#9568; password &#9568; password_schema &#9562; etc &#9636; table [B]services[/B] : &#9568; user_id &#9568; service_id &#9562; etc The service_id can also be used to join with a services table, or just a constant value that you use to identify the service. This isn't a 100% flexible solution as you'll still have to settle with a schema for how individual service data is stored, but it's a good middle-ground that doesn't go off into the more complex end of things.
  • Avatar of Ac!dL3ak
  • [QUOTE=Freze;35344052][php]// code snip[/php] This produces this: [img]http://puu.sh/mWBR[/img] Whereas it SHOULD be random pixels all over?[/QUOTE] both $x and $y should start at 0, and the loops should be until $y > $height or $x > $width why don't you pick three random numbers between 0 and 255 instead of picking random characters, though?
  • Avatar of Bambo.
  • [QUOTE=StinkyJoe;35347454]Use a separate table for the different services. For example, represented as a pseudo-schema: &#9636; table [B]user[/B] : &#9568; id &#9568; name &#9568; password &#9568; password_schema &#9562; etc &#9636; table [B]services[/B] : &#9568; user_id &#9568; service_id &#9562; etc The service_id can also be used to join with a services table, or just a constant value that you use to identify the service. This isn't a 100% flexible solution as you'll still have to settle with a schema for how individual service data is stored, but it's a good middle-ground that doesn't go off into the more complex end of things.[/QUOTE] Neat. Thanks!
  • Avatar of Snakess
  • [QUOTE=Miljaker;35345063]Maybe I should start learning something about server stuff... I have no idea what to do to make a VPS working and host websites on it with features I can't do with shared hosting. But I don't see any way of learning it without first renting one, and it feels kinda stupid to spend money on something alien to me.[/QUOTE] PM me if you like, I have a VPS I'm not using currently that you can have a play on if you like, I'll give you some help if you need any, not that I know loads about VPS' myself
  • Avatar of swift and shift
  • [QUOTE=Crhem van der B;35343195]I completely agree with you, it doesn't. Here it is: [code] ActiveRecord::Schema.define(:version => 20120321200514) do create_table "posts", :force => true do |t| t.string "title" t.text "description" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false t.string "user" t.integer "user_id" t.integer "time" end create_table "users", :force => true do |t| t.string "name" t.text "password" t.text "pin" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false t.text "salt" end end [/code] P.S.: Yeah, I know some fields in "posts" table are not necessary, but I'm still learning, so didn't knew about some stuff.[/QUOTE] A couple of hints here: the 'text' type is designed for storing data that's several kilobytes long, you probably shouldn't use it for the password, pin, or salt. It's fine to use it for the post description though. Secondly, (this is just stylistic though) you should prefer to use symbols rather than strings in migrations. Thirdly, why have you got a string column called 'user' in your posts table? Anyway, with regard to your actual problem, can you see if something like this works as expected: User.where("pin = ?", "753e345a113471a6775e242f444704fe")
  • Avatar of Gibo990
  • Probably a basic question but i've just started learning HTML and CSS. I want to have a background image similar to how [URL="http://www.ebuyer.com"]www.ebuyer.com[/URL] have theirs. I was just wondering how they went about doing that? Here's my CSS file: [CODE] * { padding: 0; margin: 0; } body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; } p { padding: 10px; } #wrapper { margin: 0 auto; width: 50%; } /* Content is where the main items go */ #content { float: left; color: #333; background: #FFFFFF; height: 1024px; width: 100%; display: inline; } /* Header is the top of the page banner (holds items in it below) */ #header { background: url(../images/headerBackground.png); width: 100%; float: left; background-position: top; height: 120px; } /* Items used in the HEADER */ #logo { margin-left: auto; margin-right: auto; } /* Facebook follow button */ #facebook { margin-left: auto; margin-right: auto; margin-top: 25px; } /*Twitter follow button */ #twitter { margin-left: auto; margin-right: auto; margin-top: 25px; } #footer { width: 100%; height: 100px; clear: both; color: #333; background: #FFA840; } #navigation { float: left; width: 100%; height: 25px; color: #333; background: #3C9DD0; } [/CODE] So I've changed the #wrapper width to 50% and it now looks like ebuyers where there is two gaps either side and a middle part where the content goes. I have a feeling I shouldn't be doing this so any help would be very appreciated. If it's right do I just use a background: url...... in the wrapper?
  • Avatar of jaybuz
  • Wrapper needs a set width of 980px and then the background needs to be attachment fixed. The background image itself is just a 1920x1080 graphic with a 1020px white section in the center.
  • Avatar of kragmars102
  • [QUOTE=Gibo990;35357065]Probably a basic question but i've just started learning HTML and CSS. I want to have a background image similar to how [URL="http://www.ebuyer.com"]www.ebuyer.com[/URL] have theirs. I was just wondering how they went about doing that? // code. So I've changed the #wrapper width to 50% and it now looks like ebuyers where there is two gaps either side and a middle part where the content goes. I have a feeling I shouldn't be doing this so any help would be very appreciated. If it's right do I just use a background: url...... in the wrapper?[/QUOTE] [url]http://ezyimg.info/v/2L43HBcPBev.jpg[/url] basic template that you can use, the white is where the content comes ( I'm guesing your content is 1000px in width ). To save filesize on the background you can delete the part of the image that the content is covering.
  • Avatar of CBastard
  • You could also add these so that the background dynamically re-sizes and maintains its aspect ratio: [CODE] -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; [/CODE]
  • Avatar of Crhem van der B
  • [QUOTE=swift and shift;35352946]A couple of hints here: the 'text' type is designed for storing data that's several kilobytes long, you probably shouldn't use it for the password, pin, or salt. It's fine to use it for the post description though. Secondly, (this is just stylistic though) you should prefer to use symbols rather than strings in migrations. Thirdly, why have you got a string column called 'user' in your posts table? Anyway, with regard to your actual problem, can you see if something like this works as expected: User.where("pin = ?", "753e345a113471a6775e242f444704fe")[/QUOTE] Thanks for the info regarding the table. And I have a user column because I forgot about user_id.. Anyhow, the method you posted doesn't seem to work as expected.. [code] def check_user user = User.where("pin = ?", "753e345a113471a6775e242f444704fe") if user.nil? 'nil' else 'not nil' end end [/code] returns "not nil", however if I do user.name, it returns just "User". And if I do user.pin, it throws an error: [code] undefined method `pin' for []:ActiveRecord::Relation [/code] Yeah... I don't know anymore..
  • [QUOTE=Miljaker;35345129]On my acer laptop that overheats when I start up windows media player?[/QUOTE] I think something like this would lend itself to a platform like the Raspberry Pi :v: You could easily install a Linux OS that supports ARM, and install a web server that supports ARM on it to just learn how to configure the servers. Then connect the Pi to your network and play around with web development.
  • [code] border-collapse: collapse [/code] Stick that in your CSS for the cells and see if it goes away. This is assuming it isn't there already seeing as you didn't give us any idea what the CSS is like currently.
  • Avatar of swift and shift
  • [QUOTE=Crhem van der B;35361421]Thanks for the info regarding the table. And I have a user column because I forgot about user_id.. Anyhow, the method you posted doesn't seem to work as expected.. [code] def check_user user = User.where("pin = ?", "753e345a113471a6775e242f444704fe") if user.nil? 'nil' else 'not nil' end end [/code] returns "not nil", however if I do user.name, it returns just "User". And if I do user.pin, it throws an error: [code] undefined method `pin' for []:ActiveRecord::Relation [/code] Yeah... I don't know anymore..[/QUOTE] If you like I can take a look over TeamViewer in about 6 hours for you. Add me on skype: turbeh
  • Avatar of Kopimi
  • [QUOTE=hexpunK;35365271][code] border-collapse: collapse [/code] Stick that in your CSS for the cells and see if it goes away. This is assuming it isn't there already seeing as you didn't give us any idea what the CSS is like currently.[/QUOTE] yeah sorry my post was utter shit and really not detailed enough to get any help for i'll make another post tomorrow with more details, thanks anyway
  • Avatar of twenty
  • [url]http://lolcode.com/[/url] [code] HAI CAN HAS STDIO? VISIBLE "HAI WORLD!" KTHXBYE[/code] God have mercy...
  • Avatar of marcin1337
  • hey guys, on my website login screen, user puts in his password and username, I then check in php ( sha1 + salt ) if it matches with the one with the MySQL server , if it does I do session_regenerate_id(); $_SESSION['valid']=1; $_SESSION['userid'] = $username; I then check on every other page if(isset($_SESSION['valid']) && $_SESSION['valid']) is this safe?
  • Avatar of jetboy
  • [QUOTE=marcin1337;35385970]hey guys, on my website login screen, user puts in his password and username, I then check in php ( sha1 + salt ) if it matches with the one with the MySQL server , if it does I do session_regenerate_id(); $_SESSION['valid']=1; $_SESSION['userid'] = $username; I then check on every other page if(isset($_SESSION['valid']) && $_SESSION['valid']) is this safe?[/QUOTE] It's definitely not the best solution, but it's not really [i]unsafe[/i] as long as you protect against session jacking.
  • Avatar of Spero78
  • [QUOTE=marcin1337;35385970]hey guys, on my website login screen, user puts in his password and username, I then check in php ( sha1 + salt ) if it matches with the one with the MySQL server , if it does I do session_regenerate_id(); $_SESSION['valid']=1; $_SESSION['userid'] = $username; I then check on every other page if(isset($_SESSION['valid']) && $_SESSION['valid']) is this safe?[/QUOTE] You can just do [php] $_SESSION['valid']=TRUE; if($_SESSION['valid']){ //Do Things } [/php] Pretty sure thats how most sites do it, Personally i store the users ID, a hashed password (hmac), expiry time and a cookie hash in a string in a cookie and use a Regular Expression to separate it into an array and validate the users password every time they visit the site. My system is quite hacked together because I was using a cookie generated by forum software so im not going to share it but the cookie works like this, [php] if (isset($_COOKIE['cookie_name']) && preg_match('%^(\d+)\|([0-9a-fA-F]+)\|(\d+)\|([0-9a-fA-F]+)$%', $_COOKIE['cookie_name'], $matches)) { $cookie = array( 'user_id' => intval($matches[1]), 'password_hash' => $matches[2], 'expiration_time' => intval($matches[3]), 'cookie_hash' => $matches[4], ); } [/php]
  • Avatar of swift and shift
  • no no no no just store the user's id and check if it's there or not sessions are completely 100% tamper proof
  • Avatar of Ac!dL3ak
  • [QUOTE=swift and shift;35389773]no no no no just store the user's id and check if it's there or not sessions are completely 100% tamper proof[/QUOTE] unless someone has direct access to your server but i mean if they do then you should be worried about something else other than sessions
  • Avatar of Shortyish
  • does anyone have any experience with the parallels plesk control panel? im trying to set up a website for the first time and i have no idea how to put my html in to actually make it show up.
  • Avatar of kragmars102
  • Just something that might come useful in the future to restrict content just do: [code]if(!isset($_SESSION['valid']) || !$_SESSION['valid']) { die(); }[/code]
  • Avatar of marcin1337
  • In PHP I have a class lets say ImgEntry within it I have variables for its source, text, title , etc, and some functions I need to put it on a website. I have a MySQL database full of these . What I'm asking is how do I get all of these in the MySQL db into the class?, do I create an instance for each member of the MySQL db? if so how?! do I create one instance of the class and modify the class so it accepts arrays
  • Avatar of StinkyJoe
  • [QUOTE=marcin1337;35396067]In PHP I have a class lets say ImgEntry within it I have variables for its source, text, title , etc, and some functions I need to put it on a website. I have a MySQL database full of these . What I'm asking is how do I get all of these in the MySQL db into the class?, do I create an instance for each member of the MySQL db? if so how?! do I create one instance of the class and modify the class so it accepts arrays[/QUOTE] You create a new instance for each row in your result set: Pseudo-something example: [php] class MyThing { private $data = array() public function __construct(array $data) { $this->data = $data } } $results = <mysql query> $results->each(function($row) { $row = new MyThing($row) }) [/php]