Jump to content

per1os

New Members
  • Posts

    3,095
  • Joined

  • Last visited

Everything posted by per1os

  1. What do you mean, that statement just confused me? <?php $x = "test test '" . $b . "' test test"; //is the same as $x = 'test test "' . $b . '" test test'; ?> --FrosT
  2. I am not sure, it is worth a shot? How I see it is for some reason the nl2br is throwing off because it just does a newline, where as the post is returning a carriage return (\r) with a new line (\n) So in theory, converting \r\n to <br/> should produce the desired results...in theory. --FrosT
  3. Try this: $form_array = array('title', 'entry', 'comment', 'rating'); foreach ($form_array as $cs) { $query = mysql_query("SELECT value FROM prefix_config WHERE name = '".$cs."'"); $test = mysql_fetch_array($query); $cs = $test['value']; } MySQL only supports Single-quotes in it's queries. And to debug I would do this: $form_array = array('title', 'entry', 'comment', 'rating'); foreach ($form_array as $cs) { $query = mysql_query("SELECT value FROM prefix_config WHERE name = '".$cs."'") or DIE(mysql_error()); $test = mysql_fetch_array($query); $cs = $test['value']; } --FrosT
  4. I don't think this is the correct place to request this. --FrosT
  5. Sometimes includes are weird. I would try the file_get_contents with the whole location to the file in the string. If it is in '/home/public_html/includes/languages/conditions.html' use that. See what that produces. --FrosT
  6. How about this? <?php $Post = $_POST['Message']; if($Post == "") { $Post = "[No Message]"; } $Post = ereg_replace("\r\n", "<br />", $Post); ?> --FrosT
  7. Yea, I found that out the hard way. Oh well all that Java knowledge down the tube =) PHP 5 may support overloading, I am not sure. --FrosT
  8. <?php mysql_select_db(***); $div = mysql_real_escape_string($_GET['div']); $sql = "SELECT div, division, gameid, date, time, home, h_score, visitor, v_score, field, field_no FROM s2007schedules WHERE div='$div'"; $result = mysql_query($sql) or die(mysql_error()); $i = 0; ?> See where that gets ya. What is throwing you off are the single quotes in the $div portion. --FrosT
  9. I am not sure if we are just missing code, but I do not really see where the done part is set. <input type="hidden" value="ok" name="done" /> Probably should be somewhere I hope. If not your data is never entering into that first if statement. --FrosT
  10. Try this: <?php $Post = $_POST['Message']; if($Post == "") { $Post = "[No Message]"; } $Post=htmlspecialchars(nl2br($Post)); $Time = date("F j, Y, g:i a"); $query = mysql_query("Insert into Posts (Post,Poster,Time,TID,FID) values ('$Post','$getuser3[username]','$Time','$TID','$FID')") or die(mysql_error()); $query = mysql_query("SELECT * FROM Posts where Poster = '$getuser3[username]' order by ID desc limit 1") or die(mysql_error()); $row = mysql_fetch_array( $query ); $Today=date("U"); $UUT="update trainers set LPostTime='$Today' where Username='$getuser3[username]' LIMIT 1"; mysql_query($UUT) or die(mysql_error()); $nFID = $row["TID"]; $pstamp = date("U")-0; $query = mysql_query("update Threads set OS = '$pstamp' where ID = '$TID'") or die(mysql_error()); print "Reply Posted Sucessfully. You Are Now Being Redirected To The Topic."; print "<meta http-equiv=refresh content='2; URL=index.php?function=ViewThread&TID=$nFID'>"; ?> --FrosT
  11. Ah, its all good =) Either way there is never 1 right answer to any question in coding. There are always 10 different ones =) --FrosT
  12. Well you need to make sure you have the path specified too. If that file is not contained within the directory you are running the script the path needs to be specified. IE: script.php is located in /home/public_html/includes conditions.html is located in /home/public_html/includes/languages In order for script.php to read from conditions.html you need to do this: $replace = file_get_contents('/languages/conditions.html'); OR $replace = file_get_contents('/home/public_html/includes/languages/conditions.html'); --FrosT
  13. Everything is possible in its own work around. Here is an example of overloading a function in PHP <?php class a { function a() { // constructor $this->b = new b(); } function overLoad() { // extra data here return $this->b->overLoad() "!!!"; } } class b { function b() { // constructor } function overLoad() { // extra data here return "The cat is fat"; } } ?> Another alternative might be this (I have not tested this) <?php class a extends b { function a() { // constructor } function overLoad() { // extra data here return b::overLoad() . "!!!"; } } class b { function b() { // constructor } function overLoad() { // extra data here return "The cat is fat"; } } ?> Now as for processing time for the first one, it should not be too bad for 1 class etc. But if you have 5 classes you are trying to do that to, your processing time increases dramatically. I am not sure what the second one result is. Either way if you test it out let us know what you find. --FrosT
  14. <?php function send(){ $time = time(); $sql = "INSERT INTO mail(from, userTo, subject, message, sent) VALUES($this->from, $this->to, '$this->subject', '$this->message', $time)"; return dbExecute($sql); } ?> Try that maybe that should work. Replace $this->$to with $this->to --FrosT
  15. <?php $replace = file_get_contents('conditions.html'); define('TEXT_INFORMATION', $replace); ?> Note you can use fopen + fread etc. Basically you do not want to include the file, just read the contents and put them into a string. This should do just that. --FrosT
  16. My bad man, on my half-assed way, I messed up on the "in_array" function, this is out it should be. <?php $comids=array(); while (odbc_fetch_row($res)) { if (!in_array($comid, $comids)) { $composer=odbc_result($res,"ARTIST"); $comid=odbc_result($res,"ORDER"); $comids[]=$comid; echo '<option value="' .$comid. '">' .$composer. '</option>'; } } ?> --FrosT
  17. Theres more than one way to skin a cat =) --FrosT
  18. Damn dude talk about a hard way of doing stuff. Maybe this will help. <?php echo createInput('tricepsSkinfold1'); function createInput($name) { $return = '<input name="'.$name.'" type="text" size="10" maxlength="2"'; if (isset($_SESSION['bValidated'][$name]['value'])) { $return .= 'value="'.$_SESSION['bValidated'][$name]['value'] . '" '; }else { $return .= 'value="" '; } if (isset($_SESSION['bValidated'][$name]['valid']) && $_SESSION['bValidated'][$name]['valid'] == -1) { $return .= 'style="background: #FFFF00" ' . $_SESSION['errors'][$name]; } return $return . ' />'; } ?> Then if you have an array of the names, just loop them with that function. Simple as that. --FrosT
  19. // === Display the lat/lon and a google maps link echo $latlon["lat"] . ", " . $latlon["lon"]; echo " <a href="http://blog.tooleshed.com/%5C%22http://maps.google.com/maps?f=q&hl=en&q=%22">Google Map</a>"; should be // === Display the lat/lon and a google maps link echo $latlon["lat"] . ", " . $latlon["lon"]; echo " <a href=\"http://blog.tooleshed.com/%5C%22http://maps.google.com/maps?f=q&hl=en&q=%22\">Google Map</a>"; Those double quotes need to be escaped. --FrosT
  20. The [ code ] and [ /code ] tags are your friend. What was wrong was you added an extra while loop. Here is how it should look. <?php //select statement example ok all book entry's lol. $sql = "SELECT * FROM shops"; $data = mysql_query($sql); while($record = mysql_fetch_assoc($data)) { $id = $record['id']; $name = $record['name']; $picture = $record['picture']; $rating = $record['rating']; $sdesc = $record['sdesc']; // echo book information ok title price and a link to see that book information. echo $id . $name . "<a href=read_more.php?id=".$id.">More Info[/url]"; } ?>
  21. craygo would be the one to go with. Like I said mine was half-assed, craygo's is the correct way to go about it. --FrosT
  22. <input type="text" size="40" name="address" value="<? $_REQUEST["address"] ?>"> should be <input type="text" size="40" name="address" value="<?=$_REQUEST["address"]; ?>"> --FrosT
  23. No problem, maybe once you figure it out post that code, I would be interested to see what you came up with. --FrosT
  24. Mail headers are always good to include especially if you want to define reply-to etc. I simply posted a solution to the reason why the username and password were not showing up. But redarrow is right, for this to be done the best way possible, mail headers are a must. Some example headers for ya: <?php $mail_headers = "From: Your Mailer <[email protected]>\r\n"; $mail_headers .= "Reply-To: You at No Reply <[email protected]>\r\n"; $mail_headers .= "MIME-Version: 1.0\r\n"; $mail_headers .= "Content-type: text/plain; charset=utf-8\r\n"; $mail_headers .= "X-Mailer: Your Mailer"; mail($to, $subject, $body, $mail_headers, "-f" . "From: Your Mailer <[email protected]>\r\n"); ?> Anyhow hope the helps. --FrosT
  25. Probably better to do it this way: <?php $query = "SELECT username,password FROM tblNamesMain WHERE Email='$to'"; $result = mysql_query($query, $link) or DIE(mysql_error()); $uData = mysql_fetch_assoc($result); $username = $uData['username']; $password = $uData['password']; $body = "Here is your user Athletic Endurance account information that you requested.\n\nUsername: ".$username."\nPassword: " .$password." "; mysql_close($conn); if (mail($to, $subject, $body)) { echo("<p>Message successfully sent!</p>"); ?> --FrosT
×
×
  • 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.