Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. and of course, update the loop to while ($row = mysql_fetch_assoc($result)) { echo $row["date"]."<br>"; echo $row["content"]."<br><br>"; } also check your data, manually run the query SELECT * FROM recent_news WHERE status = 1 LIMIT 2 to check you have data
  2. 500 emails per hour.. more than that and your probably be blacklisted anyway, the mail() function isn't designed for mass mailing, I believe all good shared hosts would limit their mails (if not then their probably already blacklisted) I find it interesting that you say and then maybe look at PHPList
  3. The problem is this given this date 07-03-08, what is the month ? or making it easier 2007-03-08.. but still what's the month ? the only option i can think of is <?php function ConvertDate($OldDate) { return date("Y-m-d",strtotime($OldDate)); } ?> which will return 2007-03-08 from my impossible example. but 23.12.2006 would return 2006-12-23 so you MAY be fine..
  4. I think it maybe an idea to move to a database driven site (example at the bottom), Keeping with the current theme, if you want different sidebars then i think it maybe an idea to create a sidebar with a name close to the page its used on, for example "howtouse" side bar would be "howtouse-side" then we can replace the whole sidebar and if statement with <?php /*Probably want to secure this a little better first*/ $sidebar = $_GET['page']."-side.php"; if(file_exists($sidebar)) { include $sidebar; } ?> Database driven Have 2 tables Pages & Sidebars Pages will have the following fields uID - auto number field Name - page name (ie howtouse) Contents or Filename - HTML contents SidebarID - the ID of the sidebar 0=no sidebar Sidebars will have the following fields uID - auto number field (also used by SidebarID in Pages) Contents or Filename Now you can use a Query to check for contents and sidebar ie (you could use a JOIN but i am trying to keep it simple $SQL = sprintf("SELECT * FROM Contents WHERE Name = '%s' LIMIT 1;",mysql_real_escape_string($_GET['nosb'])); $result = mysql_query($SQL); $num_rows = mysql_num_rows($result); if($num_rows>0) { $row = mysql_fetch_assoc($result); echo $rows['Contents']; }else{ echo "Not found"; } //sidebar if($rows['SidebarID'] >0 ) { $SQL = sprintf("SELECT * FROM Contents WHERE Name = '%d' LIMIT 1;",$rows['SidebarID']) $result = mysql_query($SQL); $srow = mysql_fetch_assoc($result); echo $srow['Contents']; }
  5. if your going to catch hell then try this $LoginPassword = md5($_POST['Password']); $LoginPassword = substr($LoginPassword, 0, 15); this should work but only keep it like that until everyone has reset their passwords EDIT: also read up on sql injection and then look at this part of your code Username = '$_POST[username]' I'm sure someone will explain why its bad.. but its 7:30am here and i need sleep!
  6. tested here and its doing exactly what it is supposed to do, However I don't know what your expecting it to do! okay for text alignment see CSS/HTML align attribute.
  7. What do you mean by alignment? what are you trying to do?
  8. What's "not right" about echo number_format ($sub_attributes_level_id , 2 , "." , ",");
  9. Your not sending a HTML or attaching the file.. maybe try http://sourceforge.net/projects/phpmailer/ instead
  10. No that's an SQL statement that gets the titel field from kunden table, your need to find where you echo it with the anchor tag, ie echo "<a href=\"something\">".$row['Kunden']."</a>"; then update it to something like <script language="javascript" type="text/javascript"> <!-- function popitup(url) { newwindow=window.open(url,'name','height=500,width=500'); if (window.focus) {newwindow.focus()} return false; } // --> </script> <?php echo "<a href=\"something\" onclick=\"return popitup('something');\">".$row['Kunden']."</a>"; ?>
  11. Make sure the code that has the DELETE from runs BEFORE the code that has the SELECT for example if you pull from the database then delete from it, the pull will have the data you deleted, so put the PHP code you post at the top (before the select)
  12. WOW i'm kinda shocked i forgot to add EXTR_SKIP
  13. Well as `mg_id` int(10) is an auto_increment so you don't need to manually set them.. so i removed them (you could just sent them to null) OR you could set auto number to start at 5 then set 1-4
  14. Well personally I do it the hard way.. and rarely use extract. I find i either use $_POST[First_Name'] or I filter it before setting it to a variable.
  15. Okay this is a MYSQL and PHP question Here a basic script to start with <?php //Database host / ssername /password $conn = mysql_connect("localhost", "mysql_user", "mysql_password"); //check connection if (!$conn) { echo "Unable to connect to DB: " . mysql_error(); exit; } //database name if (!mysql_select_db("mydbname")) { echo "Unable to select mydbname: " . mysql_error(); exit; } //SQL Query $sql = "$sql = "SELECT * FROM sometable WHERE userstatus = 1 LIMIT 5";"; $result = mysql_query($sql); if (!$result) { echo "Could not successfully run query ($sql) from DB: " . mysql_error(); exit; } if (mysql_num_rows($result) == 0) { echo "No rows found, nothing to print so am exiting"; exit; } // While a row of data exists, put that row in $row as an associative array // Note: If you're expecting just one row, no need to use a loop // Note: If you put extract($row); inside the following loop, you'll // then create $userid, $fullname, and $userstatus while ($row = mysql_fetch_assoc($result)) { echo $row["userid"]; echo $row["fullname"]; echo $row["userstatus"]; } mysql_free_result($result); ?> Take note of the 1. $sql = "SELECT * FROM sometable WHERE userstatus = 1 LIMIT 5"; and 2. while ($row = mysql_fetch_assoc($result)) { echo $row["userid"]; echo $row["fullname"]; echo $row["userstatus"]; } Now 1. finds every field in sometable WHERE the field userstatus = 1 and only finds up to 5 results 2. fetches that data and puts it into $row and continues until no more records are found (as the QUERY only finds up to 5 it will only loop a maximum of 5 times and it echos the fields userid, fullname and userstatus Play with that and see what you get and if yo get stuck just post back
  16. try $addperm = " INSERT INTO `permissions` (`mg_name`, `editprofile`, `viewprofile`, `admin`, `moderate`) VALUES ('user', 1, 1, 0, 0), ('admin', 1, 1, 1, 1), ('guest', 0, 0, 0, 0), ('mod', 1, 1, 0, 1); ";
  17. You could use extract() ie extract($_POST); echo $First_Name;
  18. whats with $$options = $groupName; EDIT: you found it I marked it as solved (bottom left)
  19. change <textarea cols="1" rows="1"></textarea> to <textarea name="Message" cols="1" rows="1"></textarea>
  20. Kool Can you click topic solved bottom left
  21. Well you have changed quite a few other things try this <?php $q= $_GET["q"]; include("goatlogin.inc"); $sql="SELECT * FROM bookmakers WHERE bookmaker = '$q' "; //UPDATED you had missed quotes and an or die ? /*I assume you don't mean mysqli ad their is no mysqli_query() function, $cxn isn't set and even if it was you had it in the wrong place*/ $result = mysql_query($sql) or die ("Can't execute \$result!"); //// THIS IS WHAT IS SHOWN AS THE OUTPUT //// /*again i assume mysql_fetch_array instead of mysqli_fetch_array*/ while($row = mysql_fetch_array($result)) { echo $row['details']; } ?>
  22. change echo $details; to echo $row['FieldNames']; replace FieldNames with names of fields from the table also remove echo $q;
  23. Sorry I'm not great at explaining things at the best of times. the side bar never gets processed which means it doesn't exist when $hidesidebar is not empty ($hidesidebar = true;) When you open the page and theirs an if statement if the condition is false the code skips what's in the block ie if(false) { //this is skipped } the only difference in your code is you have HTML but the same logic applies <?php if(false) { ?> //this is skipped <?php } ?> Now ANYTHING in the files in the INC folder will be placed in side the <div id="content"> Now if you want different side bars for different pages we can work to that .. what's your ideal set-up ? you final goal / requirements ?
  24. What happens when you open getoption.php?q=TEST you SHOULD get a page that says TEST also <option value='$value' name='$value' onClick='showUser(this.name)'>$value</option>"; surely should be <option value='$value' name='$value' onClick='showUser(this.value)'>$value</option>";
  25. Some info (may help) The code you added to the index file, created an IF block around the sidebar HTML code, if the condition of that if statement is true then it processes what's in the block (as theirs only HTML in it it displays it) The condition empty($hidesidebar) checks to see if $hidesidebar is empty (blank/false/unset/0 etc) if $hidesidebar is empty then it will display the HTML but when you set $hidesidebar = true; the IF condition is false (not empty) thus doesn't display the HTML, Remember if you DON'T set $hidesidebar its classed as empty Now that's fine but how does index know a value from another file ? the code at the start builds an array for all files in the INC folder called $pages then about half way down your see that the code checks to see if value of $_GET['page'] is in the $pages array.. if it is then it include the file note: $_GET['page'] is the part of the URL ?page=whatever NOW this is important the file is included BEFORE the sidebar thus $hidesidebar is also included before the if statement If this is solved please click the topic solved button bottom left
×
×
  • 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.