Jump to content

lockdownd7

Members
  • Posts

    22
  • Joined

  • Last visited

    Never

Everything posted by lockdownd7

  1. Sorry for the confusion. I should have mentioned earlier that the main point is that I want to mask the link. I've got so much crap I'm working on right now I can't keep it all straight. I'm sorry. *Slams head against wall* Anyway, yes, the html output is being generated with php. But if I just straight link then the destination url will be visible. I'd like to redirect with meta refresh so I can rel nofollow the redirect page and keep serp. However what I'm trying to avoid is having a separate file on the server for each link. Yet in order to make sure the link ultimately goes to the right place I need a way to track where it came from. Also, http_referer won't really work in this case because there are many links on each page. This is a bitch, I know.
  2. Yes, and I know javascript is what would be best for this task but I didn't think it would be a good idea to rely on JS because users can disable it. I guess I worded it very poorly before. I'm trying to make a redirection script that dynamically selects the destination based on the source. In other words, if the link meets certain parameters, it links to one place, if it meets other parameters, it link somewhere else, etc. Preferrably using php because: a) I want it to work for all users b) I have other php scripts I would like it to work with
  3. Hi, I want to use php to do something similar to javascripts onclick function. Basically I don't want to generate the link until a user clicks on it, and depending on what they clicked is what the url will be. My first thought was to have all links go to something like redirect.php, and use a session variable to track which link they had clicked then use metarefresh.... but that won't work unless there's a way to uniquely identify each link.... and I couldn't come up with anything. So if anyone has any suggestions, I'd be very grateful.
  4. I need the scandir() function to return an array that includes actual directory names, instead of something like '.' or '..' . What would be the best way to do that?
  5. You may could use output buffering...
  6. Yep, that was it. Just shows how little I know about SQL.
  7. My apologies. Here is the full error: Fatal error: Query failed: 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 't you always thought about hitting upon a hot page about [Keyword]? Are you into' at line 1 in C:\xampp\htdocs\test2.php on line 32
  8. Here's what the relevant section of code looks like: mysql_connect($hostname,$username,$password) or die(mysql_error()); mysql_select_db($database) or die(mysql_error()); $file = date("m.d.y") . ".txt"; if (file_exists($file)) { $fh = fopen($file, 'r'); $string = fread($fh, filesize($file)); fclose($fh); mysql_query("INSERT INTO table (field1) VALUES('$string') ") or die(mysql_error()); } James, I tried your code and still got the following error: Fatal error: Query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
  9. Yes, I initially used single quotes, but either way I still get an error. I should probably mention that these strings are unrelated to the database... i.e., I didn't use any mysql query to retrieve them.
  10. I'm trying to write string variables into a table. Something like this: $string = "random string"; $anotherstring = "random string"; mysql_query("INSERT INTO table (field1, field2) VALUES("$string", "$anotherstring") ") or die(mysql_error()); What am I missing? When I run the code, I get an error about MySQL syntax being incorrect.
  11. Exactly what I needed! Thank you very much!
  12. I've got an array of file names like: $array[0] = blah.html $array[1] = blah.jpg $array[2] = blah.txt $array[3] = blah2.txt How would I count the number of times a particular file type appears; i.e. in the above example if I counted the number of .txt files, I'd get two.
  13. The string I'm replacing is a variable itself... how would I represent that with a regex?
  14. I need a function that works like str_replace, but lets me replace each instance of the string I'm finding with a different value. Something like this: str_replace($stringtobereplaced , $array[] , $filebeingsearched); Where the first instance would be replaced by $array[0], the second instance by $array[1], etc. Any ideas?
  15. You can do that and show it to them; but it would be easier if you ran the genetic calculations first and then converted them to a format you want users to see. My point was just that it will be easier if you don't try to compare string values like that to make the actual decisions.
  16. Newline character.... I would have never thought of that! Tyvm, I really do appreciate it.
  17. Well after looking at your code, I made some real changes: $template = "template1.txt"; $fh = fopen($template, 'r') or die("can't open file"); $templatetext = fread($fh, filesize($template)); $words = explode("|", $templatetext); $lastitem = end($words); foreach ($words as &$value) { if (strstr($value, "{") == "$value"){ $value = ltrim($value, "{"); } elseif($lastitem == $value){ $value = rtrim($value, "}"); } } But for some reason, while it does trim the "{" it won't trim the "}" . And I honestly can't figure it out. The elseif executes at the right time, but it's like it's ignoring the statement.
  18. Is there a reason you formatted the genes like this: aaB_C_D_E_ If the user won't see the genes you're using then, you can format them in a lot easier way to process. I'm guessing capital letters are dominant genes? If that's the case you could put each rabbit's genes in an array; assign each gene an integer value depending on how dominant you wanted it. Then compare the parents values in whatever way you want to determine the offspring's array values.
  19. I'll try to keep it simple. I'm trying to parse something of this syntax into an array: {one|two|three|four} One, two, three, etc. are just examples; the idea is that I could put any words in those brackets, and send them to an array. BTW, the above string is stored in "template1.txt". Here's what I've got: $template = "template1.txt"; $fh = fopen($template, 'r') or die("can't open file"); $templatetext = fread($fh, filesize($template)); while($offset = strpos($templatetext, "|", $offset + 1)){ $locations[] = $offset; } for ($i = 0; $i < count($locations); $i++) { $locationsaddone = $locations[i] + 1; $countlessone = count($locations) - 1; $beginning = $locationsaddone; if ($i === $countlessone) { $end = strpos($templatetext, "}"); } /*IF I HAD TO GUESS, I'D SAY THE ERROR IS HERE */ else { $end = $locations[$i+1]; } fseek($fh, $locationsaddone); $total = $end - $beginning; $word[$i] = fread($fh, $total); /* OR HERE */ } I'm open to any and all suggestions... even if you can't figure out what's wrong, if you can suggest an alternative solution.... I'd really appreciate it. Thanks.
  20. I've got a wordpress blog set up, everything's great, however, now that I have more than 10 blog posts, it obviously adds the "next page" link at the bottom so users can go back and look at older entries. However, when you click this link, although it goes to page 2, it simply repeats the most recent 10 posts, which is obviously redundant and wrong. I would really appreciate any help anyone can provide. Even if you don't know what the problem is, if you can recommend a workaround for it in the meantime, that would be fine. Here is the code from the index.php file. I'm not sure that this is where the error is, so if you need to see other code, let me know.
×
×
  • 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.