Jump to content

NL_Rosko

Members
  • Posts

    24
  • Joined

  • Last visited

    Never

Everything posted by NL_Rosko

  1. could be code issue, opened connections need to be closed once the request is done. Then too many connections open maybe.
  2. $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); valid hostnames can be in an array, from outside then not accessible. maybe better, not sure what is better <?PHP echo GetHostByName($_SERVER['REMOTE_ADDR']); echo "<br />"; echo $_SERVER['X_HTTP_FORWARDED_FOR']; echo "<br />"; echo $_SERVER['REMOTE_ADDR']; ?>
  3. maybe its better to save the results in an csv file which can be easily opened in excel. there are tons of examples on this subject csv files gives you more flexibility but here is an example $query = "SELECT * FRoM TABLE"; $result = mysql_query($query) or die('Error, query failed'); $tsv = array(); $html = array(); while($row = mysql_fetch_array($result, MYSQL_NUM)) { $tsv[] = implode("\t", $row); $html[] = "<tr><td>" .implode("</td><td>", $row) . "</td></tr>"; } $tsv = implode("\r\n", $tsv); $html = "<table>" . implode("\r\n", $html) . "</table>"; $fileName = 'somefile.xls'; header("Content-type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename=$fileName"); echo $tsv;
  4. the internet is full of information of this subject start here http://www.w3schools.com/php/default.asp
  5. so giving it an long Unique identifier only makes sure that no spam content gets into the hidden field ? what could be the use of that for spammers or hackers ?
  6. did you try reading the log files, any errors there ? possible one or more tables are corupted and need repair
  7. depending on where the site is hosted you could use separate domains or virtual hosts 1 is accessible only from intranet and the other from internet then separate the code depending on the url request just an idea out of the top of my head
  8. i have seen several sites where the hidden input field in an form is encrypted. can someone explain what the specific use of that is ? i'm not quit sure what the meaning is and/or it is usefull for security. if this improves overall form security i think i will use but only if meaningfull
  9. when using left join u will see all the coloms of the left from the join even if there is right now relation the group by function is this case will not give the required result. use inner join, when a number in table a is found in table b it is joined. test youre query by using 1 id, and then continue the build. this is basic sql
  10. i am using an odbc connection to mssql with PHP and that works like a dream. Very fast. use the sql tools to make your query, create an SP and then run the SP from your PHP code. i have some examples if your interested. the query indeed needs to be tuned to speed it up, not using tablenames for instance but aliases. tbldata t1 etc.
  11. have a look at he my.cnf file, this can be editted. (mysql\bin\ folder) change the data folder to suite your needs. haven't tested is myself but should work apache has it's own config file, also edit his (apache\conf) _*** i cant find my.cnf file in the folders. but i have found something else and that is 'winmysqladmin.exe' i did see 'my.ini' there but still cant figure out how to move my database from "C:\xampp\mysql\data\mysite" to "C:\mysite\data". please help.... ??? btw, im using xampp v1.6.3a.... help....??? in the folder i mentioned should be an MY file (in my case it looks like an speeddial file) open it with editor of choice. It looks like this: i've recplaced the data dir with another data dir and copied the files over. It worked. # The following options will be passed to all MySQL clients [client] # password = your_password port = 3306 socket = mysql # Here follows entries for some specific programs # The MySQL server [mysqld] basedir="D:/xampp/mysql" tmpdir="D:/xampp/tmp" #datadir="D:/xampp/mysql/data" datadir="D:/data"
  12. i think i would rewrite it like so: in a nutshell <?php $connection = mysql_connect($database,$username,$password); mysql_select_db($db, $connection) or die( "Unable to select database"); //first check if user exists $searchtable = "SELECT user, status FROM resident_name WHERE name='$name'"; $result = mysql_query($searchtable); if ($result) { //user exists and has probably status while row etc... $user = $row[] $status = $row[] if $status == "complete { exit } else { update } else { insert } mysql_close(); ?>
  13. have a look at he my.cnf file, this can be editted. (mysql\bin\ folder) change the data folder to suite your needs. haven't tested is myself but should work apache has it's own config file, also edit his (apache\conf)
  14. did you read your own query ? there is an ascii sign in the join sfk._file_ID WHERE
  15. first pull out the status of the select while row etc. $status = $row[status]; if ($status == "complete" || $status != "") continue else ... like so..
  16. It all depends on how secure you want the applicatin to be. For instance, if you have a system where an administrator can disable access to a user and that change needs to take place "immediateky" then you need to check the user's credentials on every page load. However, if those changes only need to be checked at the start of each session, then you can refer to the session value. In any case, the method of checking for logged in or rights just needs to be written once and included on every page. That is the reason it should be a separate file. That way you can modify that method for the entire site in one fell swoop. It has to be secure, sessions should not be hijjacked for instance. after that level security is enough. Is this ok in the PHP world ? or does this need an different approach ? index.php?id=1&mod=reg switch id case 1 //main pages include break etc. switch mod //submenu pages case reg include break etc.
  17. persoanlly I use a single script/page to check the user's login/rights and call that at the beginning of every applicable page. You use an login.php for example, set an variable or session, include it at every page that needs an valid login. ? does it slow down the response. How would you accomplish this then ?
  18. no run the php code (script), but echo the query as an string as output into your browser. this will show the values that stand for your variables. under your statement echo/print the complete statement. echo mysql_query("update ...);
  19. i think the problem is in the values, your statement looks ok try to echo the sql in your code like this $sql = ""; $res = mysql_query($sql); echo $sql; past in an sql window if available and run, often gives better error handling post output complete
  20. yes, bit strange question what i meant was if i would use separate pages for home, registration etc. how do i check if an valid user is logged in. but you said GET is the better option than this is not as issue. problem is i have multiple different submenus depending on the main menu, like an actual application so the option will be then index.php?id=1 (home), =2 (registration) (will use htaccess to clean this up) then use switch to load the content and submenu ? is that the best way to do this then ?
  21. UPDATE tbl_name SET temphealth = CASE WHEN temphealth + $hp_increase <= maxhp THEN temphealth + $hp_increase ELSE maxhp END CASE WHERE temphealth < maxhp
  22. did you try basic troubleshooting ? Is case supported under mysql 5.0 ? where does the value maxhp come from, what is the table layout (int, varchar etc..) try pasting the sql in phpmyadmin sql window and test/try with fixed values. echo sql to see the values and paste in sql window
  23. i've been searching for an good tutorial on howto implement proper menu navigation and switching content. that's way i'm posting here, could not find it. i have a menu structure and submenu structure. depending on the choice of the menu it should show content and of course the submenu. i can programm it easily with switch or if statements etc. Smarty is very easy to use for this purpose, but now i want to know if i should use seperate php files for each section in the menu so i can load the submenu but then how do i deal with the user that has logged in securely (sessions or define constants) or switch the content depending on the url ? so two questions: - how to proper set up navigational structure - if separate files with seperate templates then use session to check if user is logged in i hope someone can push me in the right direction here. I guess this question is the fundament of php website programming and need to understand it completely. thanks.
  24. i guess the statement is missing the END... http://dev.mysql.com/doc/refman/5.0/en/case-statement.html
×
×
  • 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.