Jump to content

per1os

Newly Registered
  • Posts

    3,095
  • Joined

  • Last visited

Everything posted by per1os

  1. Nothing compares to what you learn on the job. School does not teach you anything, most people know this but still a degree is good. Whether the degree is programming or not, I would suggest you go for a bachelors. It will take you farther than anything. Programming classes suck, they are too easy and a waste of time. As far as knowing, make sure you know databases hands down. MySQL is probably the best/free route to go. But really knowing how to program is the key and being an exceptional learner and easy to teach. I knew a job where if you seemed like you were not teachable they canned ya. Always be open. I've coded in PHP, C#, C++, MySQL, SQL Server, ASP and VB .NET all in one job and it usually varied from day to day what I would code in. Anyhow good luck in the future, I plan on getting an outside job, sitting inside behind a computer 24/7 really does suck, at least to me.
  2. Good luck. I bet you are SOL (Shit out of Luck)
  3. mysql. Faster, better, more efficient and can handle much more data. Text files are never a good solution for massive data storage.
  4. How about you show us the page you are including and the page you want it to be included in's code. remember to use [ code ] tags (without spaces)
  5. www.php.net/mail Look into mail headers.
  6. It is not required, but it is alright if you do it. The reason I would include them is incase someone wanders your site and finds filename.php, whoops all of your code is visible to everyone. The <?php and ?> will hide that code incase someone accidentally finds that page. Edit: Just re-read the question and found it confusing. The filename.php file should have the <?php tags. However to include a file inside a php file already, if you are working within the tags you do not need them again and it will throw a syntax error: //included.php <?php echo 'here'; ?> //wheretoinclude.php <?php echo 'Welcome we are '; include('included.php'); echo '!!!'; ?> The example above is how it should be done.
  7. Buy more memory and allocate more memory?
  8. What FTP program are you using? Some FTP programs do not show "hidden" directories in linux. You also have to check if you need to use PASV mode or not. Need more information bud.
  9. Try it and find out, as long as the syntax is right and it has ; after each statement it should be fine.
  10. www.php.net/file_get_contents ???
  11. Its funny that people worry about that. I say screw them if they are not allowing cookies, they should not be on my site. Also if that is your only true validation on each page "$_SESSION['loggedin']" wow, easy for session hijacking and being a "Valid" user. But yea I think you have to instantiate the old session id from the previous form using either GET or POST, not sure I remember this issue back in the day. It would be like $_POST['PHPSESSID'] or $_GET['PHPSESSID'] and you would use www.php.net/session_id to set it I believe.
  12. there's an IF before the ELSE though. Please point out where that is. <?php checkUser('3'); if (isset($_GET['step'])){ echo " <tr> <td class=\"header\" colspan=\"2\"> <span class=\"header\">Add upcoming match</span> </td> </tr> <form action=\"index.php?content=admin&view=add_upcoming_match\" method=\"post\"> <tr> <td class=\"list\"> <span class=\"list\">Opponent : </span> </td> <td class=\"listed\"> <input type=\"text\" name=\"add_up_match_opponent\" class=\"text\"> </td> </tr> <tr> <td class=\"list\"> <span class=\"list\">Map : </span> </td> <td class=\"listed\"> <input type=\"text\" name=\"add_up_match_map\" class=\"text\"> </td> </tr> <tr> <td class=\"list\"> <span class=\"list\">HLTV : </span> </td> <td class=\"listed\"> <input type=\"text\" name=\"add_up_match_hltv\" class=\"text\"> </td> </tr> <tr> <td class=\"list\"> <span class=\"list\">Division : </span> </td> <td class=\"listed\"> <select name=\"add_up_match_division\"> <option value=\"\"></option> "; $add_up_match_divisions_sql = mysql_query("SELECT * FROM ".$table_suffixe."divisions ORDER BY game_name ASC"); while($add_up_match_division_row = mysql_fetch_array($add_up_match_divisions_sql)){ echo " <option value=\"$add_up_match_division_row[division_id]\">$add_up_match_division_row[game_name]</option> "; } echo " </select> </td> </tr> <tr> <td class=\"list\"> <span class=\"list\">Competition : </span> </td> <td class=\"listed\"> <select name=\"add_up_match_competition\"> <option value=\"\"></option> "; $competitions_sql = mysql_query("SELECT * FROM ".$table_suffixe."competitions ORDER BY name ASC"); while($competition_row = mysql_fetch_array($competitions_sql)){ echo " <option value=\"$competition_row[competition_id]\">$competition_row[name]</option> "; } echo " </select> </td> </tr> <tr> <td class=\"list\"> <span class=\"list\">Date : </span> </td> <td class=\"listed\"> <select name=\"add_up_match_date_day\"> <option value=\"\">Day</option> "; for($rr=1;$rr<=31;$rr++){ echo " <option value=\"$rr\">$rr</option> "; } echo " </select> / "; $months[1] = 'January'; $months[2] = 'February'; $months[3] = 'March'; $months[4] = 'April'; $months[5] = 'May'; $months[6] = 'June'; $months[7] = 'July'; $months[8] = 'August'; $months[9] = 'September'; $months[10] = 'October'; $months[11] = 'November'; $months[12] = 'December'; echo " <select name=\"add_up_match_date_month\"> <option value=\"\">Month</option> "; for($rmo=1;$rmo<=12;$rmo++){ echo " <option value=\"$rmo\">$months[$rmo]</option> "; } echo " </select> / <select name=\"add_up_match_date_year\"> <option value=\"\">Year</option> "; for($rmy=date("Y",time());$rmy<=(date("Y",time())+1);$rmy++){ echo " <option value=\"$rmy\">$rmy</option> "; } echo " </select> </td> </tr> <tr> <td class=\"list\"> <span class=\"list\">Time : </span> </td> <td class=\"listed\"> <select name=\"add_up_match_date_hour\"> <option value=\"\">Hour</option> "; for($rh=1;$rh<=24;$rh++){ echo " <option value=\"$rh\">$rh</option> "; } echo " </select> : <select name=\"add_up_match_date_minutes\"> <option value=\"\">Minutes</option> "; for($rm = 1;$rm <= 59; $rm++){ if($rm%15==0){ echo " <option value=\"$rm\">$rm</option> "; } } echo " </select> </td> </tr> <tr> <td class=\"list\"> <span class=\"list\">Comments : </span> </td> <td class=\"listed\"> <textarea name=\"add_up_match_comments\" class=\"textarea\" rows=\"10\"></textarea> </td> </tr> <tr> <td colspan=\"2\" class=\"submit\"> <input type=\"hidden\" value=\"true\" name=\"add_verify\"> <input type=\"submit\" value=\"Submit\" class=\"submit\"> </td> </tr> "; } else { $add_up_match_final_date = mktime($_POST['add_up_match_date_hour'], $_POST['add_up_match_date_minutes'], 0, $_POST['add_up_match_date_month'], $_POST['add_up_match_date_day'], $_POST['add_up_match_date_year']); $add_up_match_comments_good = addslashes(nl2br($_POST['add_up_match_comments'])); mysql_query("INSERT INTO ".$table_suffixe."upcoming_matches (opponent, date, map, competition_id, division_id, comments, hltv) VALUES ('$_POST[add_up_match_opponent]', $add_up_match_final_date, '$_POST[add_up_match_map]', $_POST[add_up_match_competition], $_POST[add_up_match_division], '$add_up_match_comments_good', '$_POST[add_up_match_hltv]')"); echo " <tr> <td style=\"padding:5px;\"> Your match has been added. You will now be redirected to your administration panel. <meta http-equiv=\"refresh\" content=\"2;url=index.php?content=admin&view=panel\"> </td> </tr> "; } echo " <tr> <td colspan=\"2\" class=\"page_footer\"> </td> </tr> "; ?> I bet the code above will not give you a parse error, because wow there is an if before the else after I modified it. Why exactly where you using the switch statement with only "1" default case and no others?
  13. Your using else with a switch statement. It doesn't work like that. If/Else Switch/Case
  14. Why do you think that, it is not true btw. The issue is arising in that there is something going wrong with the select statement, as fert pointed use that to generate the error. My bet is that either the table is misspelled, or the session variables contain improperly formed data. Can tid or cid be anything but a number? If not than no need to use single quotes around them. Also try adding back ticks around the table name and cid and tid (backticks are ` by the 1 key). Another tip, on the MySQL_Query portion you are using the error suppressor, this should not be used unless by some weird circumstance your php data always throws an error on the mysql_query function. It is a result of bad programming as code should work without having to surpress errors. Report back with what fert suggest to try and what the error is. Note this may be helpful to try too: $result_send = mysql_query($query_send, $connection) or die("SQL WAS:" . $query_send . "<Br />Error Was:" . mysql_error());
  15. http://www.w3schools.com/htmldom/met_doc_getelementbyid.asp <?php $display_block .= "var x = document.getElementById('memberName');\n"; $display_block .= "alert(x.innerHTML);\n"; Should work.
  16. So the file is uploading? Well a half-assed way to remove the error message is to use the @ suppressor sign. if (@move_uploaded_file(...etc)) That will get rid of the error message.
  17. Why not use absolute paths. $_SERVER['DOCUMENT_ROOT'] should assist you in dynamically creating it, not sure if this will work. The goal is to have the file moved to /the/actual/path/to/upload
  18. www.php.net/substr www.php.net/explode
  19. Using $_FILES is fine, what is the problem you are having, you never stated and/or restated the problem.
  20. <?php echo ($_GET['iframe'] ? $_GET['iframe'] : '/home.php'); ?> The ? and : is caled the ternary operator. It is just a shortened if else. If $_GET['iframe'] is true than echo $_GET['iframe'] else echo '/home.php' EDIT::: The second portion the issue is: "<iframe src=\'".$iframe."'\" Should be "<iframe src='".$iframe."' Single quotes do not need escaped when inside double quotes and you cannot mix and match meaning a single quote must be closed by a single quote and not a double.
  21. $_POST['submit'] Add quotes to array indexes or else they are considered constants.
  22. www.php.net/fopen www.php.net/fwrite www.php.net/fclose
  23. Because not having single quotes around indexes in an array causes a notice error, which in return will "slow down the site" as it sees id as being an undefined constant. Just not good practice. Nope, but good luck. This is HELP not code for me. Makes more sense.
  24. if (is_file($_SERVER['DOCUMENT_ROOT'] . "/stuff/images/resizedimage.jpg")) I think you need that extra slash in there, I am not sure (You have it in the echo statement)
  25. Wow very inefficient EDIT::: Fixed a syntax error in the mysql_num_rows check. <?php (connect stuff is here)-technex if (isset($_POST['username']) AND isset($_POST['password'])) { if(empty($_POST['username'])) { $errorusernamenull=1; echo 'Bad username'; }else { $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string($_POST['password']); $db_password = hash('sha512',$password); $check = mysql_query("SELECT * FROM users WHERE username = '" . $username . "' AND `password` = '" . $db_password . "' LIMIT 1"); if (mysql_num_rows($check) == 1) { $userinfo = mysql_fetch_array($check); setcookie('id', $userinfo['id'], time()+60*60*24*30, "/");//30days setcookie('password', $db_password, time()+60*60*24*30, "/");//30days $ip = $_SERVER['REMOTE_ADDR']; mysql_query("DELETE FROM guests WHERE ip='$ip'"); mysql_query("UPDATE users SET status='1' WHERE id='" . $userinfo['id'] . "'"); header('refresh: 0; url=/'); // Why are we just refreshing the page, there is nothing here! }else { echo 'Bad username and password'; } } }else { echo 'No post data was sent'; } ?> Better version, more efficient. Note the note on the header fresh line, that does not make sense to just refresh the page, but an actual page in there other than this one because this will obviously not output anything on a refresh as there are no echo statements, redirect to a "logged in" page or an index page or something.
×
×
  • 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.