Jump to content

Fabis94

Members
  • Posts

    87
  • Joined

  • Last visited

    Never

Everything posted by Fabis94

  1. Okay so my sites template is saved as template.php and i need to edit .htaccess somehow so people can't view the file in their browsers. How do i do that?
  2. But if it doesn't create it, then how does it log in and use the cookies? :/
  3. I'm testing this on my windows computer (with xampp) by the way. And well the cookies.txt file isn't read only.
  4. Well ok thanks that works. I still don't understand why it didn't even create a tmp/cookies.txt file :/
  5. Oh well now the problem with the redirect is that it redirects the browser to http://my.ign.com (obviously because its the home page), but i need it to LOAD my.ign.com with the new cookies inside my script. So i think that after doing the logging in, i need to use curl again, but to load the main page with the cookies it created while running curl the first time (with CURLOPT_POSTFIELDS as the user details) and all of this needs to be in the same script. So do i just create a new instance of curl_init() or what? If i do it like this, then again it loads the page like if i hadn't logged in (and no cookies were created): <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://my.ign.com/user/ign-login'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $cookiefile = "cookies.txt"; curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefile); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile); curl_setopt($ch, CURLOPT_POSTFIELDS, 'email=sss&r=http://my.ign.com/home&password=sss'); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); $outz = curl_exec($ch); /// $chz = curl_init(); curl_setopt($chz, CURLOPT_URL, 'http://my.ign.com/home'); curl_setopt($chz, CURLOPT_POST, 1); curl_setopt($chz, CURLOPT_RETURNTRANSFER, 1); $cookiefile = "cookies.txt"; curl_setopt($chz, CURLOPT_COOKIEJAR, $cookiefile); curl_setopt($chz, CURLOPT_COOKIEFILE, $cookiefile); curl_setopt($chz, CURLOPT_FOLLOWLOCATION, TRUE); $out = curl_exec($chz); echo $out; ?> (The CURLOPT_POSTFIELDS part isn't the cause, cuz in my script i use the real details) EDIT: Wait never mind it seems it does log in...but well the problem now is that each time i use the script it logs in and then reads the site. I want to get the cookies, save them in a text file and then change the script so it doesnt need to log in each time the script is ran, but the thing is that the cookies.txt file is empty. If the logged in page does load then it must have loaded the cookies, but they aren't in the file
  6. Okay well this is what i have: <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://my.ign.com/home'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $cookiefile = "cookie.txt"; curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefile); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile); $out = curl_exec($ch); echo $out; ?> Well it loads the page like if i wasn't logged in (and i am logged in, with my cookies) so what. Maybe i need to make it actually make NEW cookies and log in? Well for that i tried to make this: <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://my.ign.com/user/ign-login'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $cookiefile = "cookies.txt"; curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefile); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile); curl_setopt($ch, CURLOPT_POSTFIELDS, 'email=sss&r=http://my.ign.com/home&password=sss'); $out = curl_exec($ch); echo $out; ?> (i changed the user details of course) The thing is it just loads the login script and stays at it, while if you log in manually, it redirects back afterwards. How do i make it load the main page after doing this login_script and use the new cookies it made from logging in?
  7. Ok then what syntax would be correct for the cookie file?
  8. Well okay, but then can i use the file that i posted in my first post? (The one with the .ea.com cookies) And do i have to do something like this: $c = curl_setopt($ch, CURLOPT_COOKIE, 'cookie.txt'); $cookie = curl_setopt($ch, COOKIE_FILE, $c);
  9. 1. I want cURL to use cookies from my browser (i use firefox). So i have the cookies.sqlite file. I'm guessing i can't use that so i used the cookies export extension and now i've got a file like this: .ea.com TRUE / FALSE 1294567511 __utmz 103303007.1278799512.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none) .ea.com TRUE / FALSE 1341871511 __utma 103303007.1717195267.1278799512.1278799512.1278799512.1 .ea.com TRUE / FALSE 1281477904 displayCountrySelector true Can the cookie file read a file like this? Or does it need a different syntax? 2. How can i make cURL read those cookies? P.S. What i want to do is access a site with cURL, but make it read cookies from a file that contains cookies exported from my browser.
  10. Actually the version of GD on the server is 2.0.34. AND this is really strange, but without changing anything it magically started working...so err...i guess solved?
  11. Ok i'm trying to make a layout in which there is a content <div> that sticks to the left (and thats where all the text and everything is) and to the right of it there's a sidebar. Now i used float:right; to make the sidebar stick to right, but the problem is, if i fill it full of text, it does this: http://i31.tinypic.com/24y62dj.png (the "GARG" part i used for testing, goes out of the page and continues there) I want it to make the page longer, not break it and go out of it. Here's the main <div>: <div class="page"> <div class="page_left"> Y harro </div> <div class="sidebar"> GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br> GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br> GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br> GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br> GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br> GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br> GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br> GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br>GARG <br> </div> </div> The class "page" is the white part. Actually here's the CSS aswell: .sidebar { margin: 20px; position: relative; height: auto; width: 300px; border-left: thin solid #000000; margin-bottom: 10px; top: 0px; right: 0px; float: right; } .page_left { margin: 20px; float:left; min-height: 200px; border-bottom: thin solid #000000; width: 600px; } .page { background-color: #FFFFFF; margin-bottom: 10px; border: 1px solid #000000; min-height: 700px; padding-bottom: 10px; }
  12. I found out that the versions are different. So how do i adjust the code to output the picture as it does on my computer? (my computer has a newer version). Ok and here's the code: header("Content-type: image/png"); $font = 'digitalix.ttf'; $textfont = 'lsans.ttf'; $fontsize = 8; $image = imagecreatetruecolor(350, 170); imageantialias($image, false); $base_img = imagecreatefrompng('base.PNG'); imagecopy($image, $base_img, 0, 0, 0, 0, 350, 170); $white = imagecolorallocate($image, 255, 255, 255); $black = imagecolorallocate($image, 0, 0, 0); (...) imagettftext($image, $fontsize, 0, 71, $y, $white, $font, $text); //One of the functions, no point of posting them all addBorder($image, 0, 0, 0); imagepng($image); imagedestroy($image);
  13. Yeah i found that, and i found out that quality isn't the problem. Look at my post before yours:
  14. I have uploaded EVERYTHING. Which means that everything that i have on my PC is on the server (including the font). The text uses the font on the server, it's just that it's messed up. Here's how it looks on my PC: http://i26.tinypic.com/dvaer.png And here's how it looks on the server (remember, that all the files are uploaded): http://i26.tinypic.com/xdi7ft.png What i noticed is that the filesize is different aswell. So wtf
  15. What do you mean? I don't see an argument for changing the quality :/ EDIT: Nvm found it, but it requires you to save the file. I don't need to save the file. Also on my own computer (when i run stuff on localhost) everything looks fine, but when i transfer it to another server the text looks completely different. What's wrong?
  16. I'm making a hiscore reader that outputs the scores in an image. Everything is working fine except that the text is ugly and pixelated no matter what size i use. I use GD with PHP. What could be the problem?
  17. Ok thanks a lot i finished my script
  18. Ok and how do i get the number out of the get() function?
  19. Ok so i'm trying to write a Greasemonkey script to change all the hrefs on a single page. The href by default looks like this: <a href="javascript:get('246154895')" class="postid">ID</a> What i'm trying to do is make the number from get() appear in stead of "ID". How should i get this done? I started up with this: var posts = document.getElementsByClassname('postid'); for (i=0; i<posts.length; i++) { //Replacing } But i doubt it will work, since there are other items with the class "postid" that aren't related to these tags i'm trying to change. P.S. I'm new to JS so yeah
  20. Ok i did it with PHP (imagecopy() function). Thanks for help everyone
  21. It would work for me, but the image will be used as a link, so i need the whole area (150x150) to be clickable as the link. If i use your way, only when you click on the image you will be lead to the links destination, not the whole 150x150 area. Also i don't quite understand how imagecopymerge() works (i checked the docs).
  22. Ok so i use this function to create thumbnails: function createthumb($name,$filename,$new_w,$new_h) { $system=explode('.',$name); $src_img=imagecreatefrompng($name); $old_x=imageSX($src_img); $old_y=imageSY($src_img); if ($old_x > $old_y) { $thumb_w=$new_w; $thumb_h=$old_y*($new_h/$old_x); } if ($old_x < $old_y) { $thumb_w=$old_x*($new_w/$old_y); $thumb_h=$new_h; } if ($old_x == $old_y) { $thumb_w=$new_w; $thumb_h=$new_h; } $dst_img=ImageCreateTrueColor($thumb_w,$thumb_h); imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y); if (preg_match("/png/",$system[1])) { imagepng($dst_img,$filename); } else { imagejpeg($dst_img,$filename); } imagedestroy($dst_img); imagedestroy($src_img); } It works and all, but the problem is that for my gallery i need all the pictures to be exactly 150x150, but i also need the images to keep their aspect ratio (so they don't look ugly) so i was thinking i could add like borders that would fill up the space. Ok imagine the function resizes the image to 100x150 so i make the image centered and add 50px wide white black borders on each side of the picture, so it isn't stretched out (keeps it's ratio) and is also 150x150. The question is, how do i do this?
  23. Fabis94

    

    I use Dreamweaver and occasionally PHP Expert Editor.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.