Jump to content

XeroXer

Members
  • Posts

    80
  • Joined

  • Last visited

Everything posted by XeroXer

  1. Hi there! Made a little script to extract all the links from a site. Works like a charm as it is now but I need it to be able to search a file like http://www.google.com/search?q=xeroxer but then I get an error saying: Warning: file(http://www.google.com/search?q=xeroxer) [function.file]: failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden in /customers/_/_/httpd.www/-/index.php on line 2 <?php $innehall = file('http://www.google.se/'); foreach($innehall as $enrad) { $slicerad = strstr($enrad, 'http://'); $slicerad = strrev($slicerad); $slicerad = strrchr($slicerad, '"'); $slicerad = strrev($slicerad); $slicerad = rtrim($slicerad, '"'); if($slicerad != "") { echo $slicerad; echo "<br>\n"; } else { echo ""; } } ?> So I was wondering if someone had any idea on how to make it work. And if someone has any idea on making the code better (though it works) you are welcome to post to.
  2. Well the problem is that I want to replace the number in the URL if it's already there. And if it's not I want to add a & and then enter the new. If none of them exists I want to add a ? and then the code. If a user goes to http://www.test.com/mysite/ and they click a link to my gallery. The URL then goes to http://www.test.com/mysite/?m=2 that is my gallery. They then select a subcategory in my gallery to my vacation pictures. The URL then goes to http://www.test.com/mysite/?m=2&p=1 that is my gallery with the subcategory vacation. In that gallery they select the folder Ibiza2006 and the URL goes to http://www.test.com/mysite/?m=2&p=1&f=Ibiza2006 If they now select a different gallery say London2003 the URL becomes http://www.test.com/mysite/?m=2&p=1&f=Ibiza2006&f=London2003 And it doesn't work. I can also select main section such as my guestbook and the URL goes to this: http://www.test.com/mysite/?m=2&p=1&f=Ibiza2006&f=London2003?m=3 * note the ? and not & * All this is because I use REQUEST_URI and just add the ?m=1, &p=2 or &f=folder. Can I somehow search the REQUEST_URI for m=, p= and f= ? And if the one I am trying to enter exists it replaces that number and if none of them exists it adds a ? in the start. And if another one exists but not the one I am trying to enter it adds a &. ( I know that this can be hard to understand but I so need your help. )
  3. Hi there! I am making my whole menusystem with ?m=1&p=2&f=folder I am doing this with linking to $_SERVER['REQUEST_URI']. The problem is that if m=1 is in the URL and I click a link with m=2 it is also entered into the URL. So I have both 1 and 2 and the site doesn't work. Or the problem that if m=2 and I press a link that goes to p=3 it has to add the & between them. Can I check if the URL contains a m=, p= or f= and depending on what link is pressed replace the number/text or append it with a & at the end of the URL. Hope that someone understands my problem...
  4. Thanks all! I used a edited version of ProjectFear's idea. At the top of the page I set $count to 0 <?php $count = "0"; ?> At the start of my foreach I check the $count and if it is 3 I enter the <tr> <?php foreach ($bilder as $bilderna) { if($count == 3){ $count = 0; echo "</tr><tr>"; echo "\n"; } else { echo ""; } ?> After the image code is entered I increse the $count by 1. <?php echo "<td><a href='$sokvag' target='_blank'><img src='$thumbsokvag' border='0' alt='$bilderna / $filstorlek bytes'></a><br>"; echo $bilderna . " - " . $filstorlek . " bytes</td>"; $count++; ?> And after the whole foreach section I make an echo out </tr> because that will always be needed because the other </tr> adding is at the beginning of the foreach. <?php echo "</tr>"; ?>
  5. Hi! I am using a foreach command to list my image gallery. The problem is I want the images in a table but don't know how to make it enter a new <tr>. Can I do so that after three images in my foreach it echos </tr><tr>?
  6. I am making my own simple gallery where I am just suppose to be able to upload a folder and the server fixes the rest. I have gotten it so everything is scanned and entered into my fields correct. I have made it so a copy of the original image is placed in a thumbs folder. But here is where I need help. Can I do it so that after the copy is done it also resizes the image so I have to do nothing on my own. [code]<?php mkdir($bildmapp . "/thumbs"); if (!copy($sokvag, $thumbsokvag)) { echo "copy file failed."; } ?>[/code]
  7. If I have an array and one of the array lines/entrys is really long. Can I make it so that the really long line somewhere splits itself into a new line/entry in the array? If I have this: [code]Array (   [a] => 123563573476   [b] => 22323213<>2474361414   [c] => 3432563246324 )[/code] Can I with any array command make that into this: [code]Array (   [a] => 123563573476   [b] => 22323213<   [c] => >2474361414   [d] => 3432563246324 )[/code] It must continue to be a array and not split into a string.
  8. If I have an array and one of the array lines/entrys is really long. Can I make it so that the really long line somewhere splits itself into a new line/entry in the array? If I have this: [code]Array (   [a] => 123563573476   [b] => 22323213<>2474361414   [c] => 3432563246324 )[/code] Can I with any array command make that into this: [code]Array (   [a] => 123563573476   [b] => 22323213<   [c] => >2474361414   [d] => 3432563246324 )[/code]
  9. then I have to do everything in another way because foreach won't work with a string.
  10. Well installed php and all on my laptop and the script kinda works. [code]<?php         $sokstrang = file("http://images.google.com/images?svnum=10&hl=en&lr=&btnG=Search&q=".$_POST['search']);         foreach($sokstrang as $htmlrader => $enrad) {                 $expett = explode(":http://", $enrad);                 $exptva = explode("\" height=", $expett[1]);                 $bildlank = "http://".$exptva[0];                 if($bildlank == "http://") { echo ""; }                 else { echo $bildlank."<br>"; }         } ?>[/code] The problem is that google doesn't make every link on one row so the script just lists one row that is mixed up. Can I somehow before I print the info out make every image link on one row?
  11. I get an error message. As I can see this means that my webhost does not support other sites through the file command. I also tried file_get_content but the same error there. Can I make it work anyhow or do I have to host the php files myself? [b]Warning:[/b] file(http://images.google.com/images?hl=en&q=gothicmadness) [[color=blue]function.file[/color]]: failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden in [b]/customers/xeroxer.com/xeroxer.com/httpd.www/gimg/gimg.php[/b] on line [b]2[/b]
  12. How do I combine all this with a search function? :) Need all the help I can get. Have done community sites and such but never searched through another site and list the result.
  13. Well google automaticly creates a direct link to the images in it's own top border when you click the thumbnails. Shouldn't I somehow be able to get the direct link from there? Also there check so the images exists so I don't link to a bunch of non existant images.
  14. Hi there! I am making a search script for personal use. I am expanding my wallpaper database and feel that searching every name on google, then clicking two links per image and then maybe downloading it takes a lot of time. So what I want the script to do is: * lista a empty textbox where I enter the imagename I want to find. * search images.google.com for that name. * On the scriptsite list all the images in their original size. (*) If more then 50 results list them as text links or thumbnails instead. Anyone feels like helping me with this?
  15. thank you... thank you... thank you... thank you... thank you... thank you... :)
  16. changed that row to: [code]<?php mysql_query("INSERT INTO support_questions (username, email, question, qdate, show) VALUES ('$name', '$email', '$message', '$thetime', '0')") or die ('Error in query: ' . mysql_error()); ?>[/code] but then I get the error: [code]You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'show) VALUES ('XeroXer', 'test@test.com', 'hello', '2007-01-0[/code]
  17. Start with the problem stuff: [b]database[/b] [code]CREATE TABLE `support_questions` ( `id` tinyint(9) NOT NULL auto_increment, `username` varchar(99) NOT NULL default '', `email` varchar(99) NOT NULL default '', `question` longtext NOT NULL, `qdate` varchar(99) NOT NULL default '', `answer` longtext NOT NULL, `adate` varchar(99) NOT NULL default '', `ausername` varchar(99) NOT NULL default '', `show` varchar(99) NOT NULL default '', PRIMARY KEY  (`id`) ) TYPE=MyISAM ;[/code] [b]form[/b] [code]<?php echo "<table width='50%' aling='left' valign='top'><tr><td>"; echo "<form id='login' name='login' method='post' action='index.php?p=ask'>"; echo "<input type='text' name='user' value='username' onFocus='formrule(this);'><br>"; echo "<input type='text' name='email' value='e-mail' onFocus='formrule(this);'><br>"; echo "<textarea name='quest' onFocus='formrule(this);'>question</textarea><br>"; echo "<input type='submit' name='ask' value='ask'>"; echo "</form>"; echo "</td></tr></table>"; ?>[/code] [b]code[/b] [code]<?php include("database.php"); $con = mysql_connect("$mysqlhost","$mysqlusr","$mysqlpass") or die('Could not connect: ' . mysql_error()); mysql_select_db($db_name, $con) or die(mysql_error()); mysql_query("INSERT INTO support_questions (username, email, question, show) VALUES ('$name', '$email', '$message', '$thetime', '0')"); echo "<table width='50%' aling='left' valign='top'><tr><td>"; echo "Question has been asked. Answer will be updated by an admin."; echo "<br><br><u>Save this information to get your answer later.</u>"; echo "<br><b>Name:</b> "; echo $name; echo "<br><b>E-mail:</b> "; echo $email; echo "<br><b>Question:</b> <table><tr><td>"; echo $message; echo "</td></tr></table></td></tr></table>"; mysql_close($con); ?>[/code] [hr] I have been sitting with this code on the side all day. Checking it a few times and it just won't work. Probebly I have just missed a variable like the last time. Please help... [i]The part I find strange is that i copied the code from my other site where it works. So I can't find the problem...[/i]
  18. Hi there! For my test community site I use sessions to set if user is logged in and so on. Is this a secure way or can one somehow change the session settings or maybe check what they are set to? By using sessions my users get logged out every time they close the webbrowser. Can I somehow set a cookie without storing any "unsafe" info in it so that the user can stay loggd in. I was thinking sopmething like if they check the box "Remember me" I set a cookie containng the userid and the md5 password. And when they later return without the session info set the scripts searches for the cookie and if it is found it checks it with the mysql server and if correct the sessions are set again. Is this a secure and good way to do it?
  19. Hi again all I have been having some php problems with my site. Yesterday I created a simple forum and user profiles. The thing is that if someone goes into a userid that doesn't exists I want to show an error. Now it only shows a blank page. My code is like this: [code]<?php echo "<table border='1' cellspacing='2' cellpadding='2'><tr><td><strong>Topic</strong></td><td><strong>Date</strong></td><td><strong>User</strong></td></tr>"; $threads = $_GET['t']; include("config/database.php"); $con = mysql_connect("$mysqlhost","$mysqlusr","$mysqlpass") or die('Could not connect: ' . mysql_error()); mysql_select_db($db_name, $con) or die(mysql_error()); $results = mysql_query("SELECT * FROM v2_forum_threads WHERE catid = '$threads' ORDER BY id") or die(mysql_error()); while($row = mysql_fetch_array($results)) { echo "<tr><td><a href='forum_thread.php?t="; echo $row['id']; echo "'>"; echo $row['topic']; echo "</a></td><td>"; echo $row['date']; echo "</td><td>"; echo "<a href='profile.php?u="; echo $row['userid']; echo "'>"; $userid = $row['userid']; $results = mysql_query("SELECT * FROM v2_users WHERE id = '$userid'") or die(mysql_error()); while($rows = mysql_fetch_array($results)) { echo $rows['name']; } echo "</a></td></tr>"; } mysql_close($con); echo "</table>"; echo "<br><p align='right'><a href='forum_post.php?t="; echo $threads; echo "'>Post thread</a></p>"; ?>[/code] I want that if no catid that is the same as $threads it should show a simple message to the user.
  20. thx a lot bljepp69. That was the miss and now it works...
  21. Why would it fail? I use the same connect info to insert user info into the user table and that works. But printing out doesn't work..
  22. Still the same error. Doesn't my webserver support the mysql_fetch_array command?
  23. I am creating a small simple forum and this confuses me. This I do: [code]<?php include("config/database.php"); $con = mysql_connect("$mysqlhost","$mysqlusr","$mysqlpass") or die('Could not connect: ' . mysql_error()); mysql_select_db($db_name, $con); $results = mysql_query("SELECT * FROM v2_forum_cat ORDER BY id"); while($row = mysql_fetch_array($result)) { echo "<table border='0' cellspacing='0' cellpadding='0'>"; echo "<tr><td>"; echo $row['name']; echo "</td></tr>"; echo "<tr><td><span class='smalltxt'>"; echo $row['descr']; echo "</span></td></tr>"; echo "</table>"; } mysql_close($con); ?>[/code] This output I get: [list] [*][b]Warning:[/b] mysql_fetch_array(): supplied argument is not a valid MySQL result resource in [b]/customers/xeroxer.com/xeroxer.com/httpd.www/v2/forum.php[/b] on line [b]16[/b] [/list]
  24. OMG you rock. That was the best solution I have ever seen... :) It worked and it's just what I wanted. Thanks a lot...
×
×
  • 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.