-
Posts
16,734 -
Joined
-
Last visited
-
Days Won
9
Everything posted by PFMaBiSmAd
-
Getting Users From A Table And Displaying Them?
PFMaBiSmAd replied to CoreDestroyer's topic in PHP Coding Help
You haven't' actually asked a php coding help question (the forum where you posted this) and the question you did ask, if something is possible, was addressed. Exactly on which part of doing this, you listed three main things (grab the username and profile picture; make it display on a page; when you click it, have it go to their profile), do you need help with an error, a problem, or a coding question you had when you tried to do them? -
Form processing code should check if a form has actually been submitted before using any of the form data. You should also be filtering/validating all external data, such as the $_POST data, before using it. Also, you have the following logic in a couple of places - if ($_SESSION['loggedin'] == true) { $_SESSION['loggedin'] = true; If you have just tested if a variable is true, it's a waste of processing time to set it to the same value that you already know it contains.
-
When developing and debugging php code, you need to have php's error_reporting set to E_ALL and display_errors set to ON to get php to help you by reporting and displaying all the errors it detects. For runtime errors in your main file, you can set the two setting in your code by adding the following - ini_set("display_errors", "1"); error_reporting(-1);
-
Parse Error: Syntax Error, Unexpected '}' In .............
PFMaBiSmAd replied to suckatcoding's topic in PHP Coding Help
The problem is likely the use of lazy-way short opening <? tags. -
Reply #17 suggested a way of doing read/unread for a PM system - http://forums.phpfreaks.com/topic/269278-creating-a-simple-mail-box-for-a-forum/#entry1384098
-
If you installed php manually, so that all the .dll files are present, under Windows, that's all you normally need to do.
-
What operating system are you using and what method did you originally use to install php, as those determine how to install a php extension.
-
If you have a basic forum, you already have most of what you need for a PM system. When someone writes a new PM, that's the same as starting a new topic in a forum. Replies to the PM are the same as replies/posts under that topic. The only real coding difference is that the topic/posts are private and can only be seen by the sender and recipient. Posts where the current member is the sender are displayed in his/her outbox. Posts where the current member is the recipient are displayed in his/her inbox.
-
You shouldn't be opening a mysql connection, executing one query, then closing the mysql connection inside your function. Contacting the mysql server and making a connection is a relatively time consuming process. You should make a connection near the start of any script that needs it, use that connection for the duration of your script's execution, then either let php close the connection when the script ends or close it yourself in you have a reason to do so before your script ends.
-
Help Joining These Queries (A Cron Job That Is Destroying My Site)
PFMaBiSmAd replied to acidpunk's topic in PHP Coding Help
Without seeing all your existing logic, there's no way we can specifically help. For example, you are selecting jewel_attack,jewel_hp,jewel_eph,jewel_critical,jewel_aph,jewel_max, and jewel_cap. How are you using those values? You are also selecting all the levels. How are you using those values? -
I've found that actually running your code, assuming there is error checking and error reporting logic to display any sql errors and any php detected errors, is a good way of finding table and column names that are actually referenced by the code. You would still need to determine the actual data type for each column.
-
Test My Website Builder For Vulnrabilities
PFMaBiSmAd replied to deathadder's topic in Beta Test Your Stuff!
I hope that doesn't mean that you found there was a typo in the password because they are stored in your database table in plain text? -
Help Joining These Queries (A Cron Job That Is Destroying My Site)
PFMaBiSmAd replied to acidpunk's topic in PHP Coding Help
^^^ You wouldn't even have the owner test in the WHERE clause, as that implies you are doing this all inside of a loop of $userid's. -
I edited your first post in this thread to add the forum's code tags and the forum software trashed your code by displaying all the underlying wysiwyg bbcode tags as being code. If any of your code is needed for reference with future questions in this thread, please repost the relevant part of your code.
-
A) You need an exit; statement after your header() redirect to prevent the remainder of the logic on your page from running while the browser performs the redirect. B) Are you sure $_POST['image-upload-post'] exists? If you are using an image for a submit button or your form is invalid html, it might not exist in some browsers.
-
2012-10-07 is a subtraction math expression and equals 1995, i.e. SET completiondate=1995. Literal date vales are strings and must be enclosed within single-quotes. $sql = "UPDATE needs SET completiondate='$datetoset' WHERE ID=$id"; You also need to validate/cast the $id before putting it into the query statement to prevent sql injection and to prevent sql errors when $id is not supplied at all.
-
In case your question had to do with $HTTP_POST_FILES not working or producing a bunch of errors, you should be using $_FILES
-
I just testing something like what is going on here. When you don't use an alias for the sum() term and the WHERE clause is false, there won't be any rows in the result set. mysql_num_rows would == 0. When you do use an alias for the sum() term and the WHERE clause is false, you get one row in the result set and the value for the fetched alias field is a null.
-
Your IDE is probably running php through the command line, and not the web server. Request methods, post, get,... are specific to making http requests.
-
Output started on line 1 of your file, when you have nothing in the file before the <?php tag, is likely due to the BOM characters. See the last reply in the sticky post concerning header errors - http://forums.phpfreaks.com/topic/1895-header-errors-read-here-before-posting-them/
-
The following example shows (untested) how to query for the rows you want in the order that you want them, then how to close out a previous section and output a new heading anytime a value in your data changes - <?php $ecss=$_GET['ecs']; $date1=$_GET['date1']; $date2=$_GET['date2']; require '../config.php'; mysql_select_db("learn_sym"); $query = "SELECT * FROM clients WHERE ecs= '$ecss' and date BETWEEN '$date1' AND '$date2' ORDER BY agency,date"; $result = mysql_query($query) or die(mysql_error()); $last_heading = null; while ($row = mysql_fetch_array($result)){ if($last_heading != $row['agency']){ // new heading detected if($last_heading != null){ // not the first one, close out the previous section echo"</ul><br />"; } // agency changed, output a new heading echo"<ul style='width:800px; margin:0 auto 0;'> <h4 style='margin:0 10px 0; padding:0;'>"; if (!empty($row['agency'])){echo $row['agency'];} else {echo "Unknown";} echo"</h4>"; $last_heading = $row['agency']; } // output the data under each heading echo"<p style='margin:4px 0 0 15px;'> <span class='blue'>Name:</span> ".$row['fname'].",".$row['lname']." - <span class='blue'>Seen On:</span> ".$row['date']." <span class='blue'>Email:</span> ";if(!empty($row['email'])){echo $row['email'];}else{echo"N/A";}echo" <span class='blue'>Phonenumber:</span> ";if(!empty($row['cell_phone'])){echo $row['cell_phone'];}else{echo $row['home_phone'];}echo" </p> <p style='margin:4px 0 0 15px; background-color:#f3f3f2;'> <span class='blue'>Services: </span>"; if (!empty($row['want_serv_1'])){echo"FASFSA Completion, ";} if (!empty($row['want_serv_4'])){echo"Admissions Application Assistance, ";} if (!empty($row['want_serv_5'])){echo"Career and Academic Advising/Testing, ";} if (!empty($row['want_serv_2'])){echo"Scholarship Search Information, ";} if (!empty($row['want_serv_3'])){echo"Loan Default Assistance, ";} if (!empty($row['want_serv_6'])){echo"Financial Literacy Education,";}echo" </p> <p style='margin:4px 0 0 15px;'> <span class='blue'>FASA: </span>"; if (!empty($row['fasfsa_amt'])){$fa = $row['fasfsa_amt'];} if (isset($fa)){$tf = $fa; echo"$".$tf; } else{echo"N/A";}echo" <span class='blue'>Grants: </span>"; if (!empty($row['stgrants_amt'])){$sg = $row['stgrants_amt'];} if (!empty($row['logrants_amt'])){$lg = $row['logrants_amt'];} if (isset($sg)&&isset($lg)){$tg = $sg + $lg; echo"$".$tg; } else{echo"N/A";}echo" <span class='blue'>scholarships: </span>"; if (!empty($row['stscol_amt'])){$ss = $row['stscol_amt'];} if (!empty($row['priscol_amt'])){$ps = $row['priscol_amt'];} if (isset($ss)&&isset($ps)){$ts = $ss + $ps; echo"$".$ts; } else{echo"N/A";}echo" <span class='blue'>Loans: </span>"; if (!empty($row['subloan_amt'])){$sl = $row['subloan_amt'];} if (!empty($row['unsubloan_amt'])){$ul = $row['unsubloan_amt'];} if (isset($sl)&&isset($ul)){$tl = $sl + $ul; echo"$".$tl; } else{echo"N/A";}echo" <strong><span class='blue'>Total: </span></strong>"; if (isset($tf)||isset($tg)||isset($ts)||isset($tl)){$gt = $tf + $tg + $ts + $tl; echo"$".$gt; } else{echo"N/A";}echo" </p> <div style='border-bottom:1px solid skyblue;padding-bottom:10px;'></div>"; } // close out the last section, if any if($last_heading != null){ echo"</ul><br />"; } ?>
-
Include Keywods Description And Title For Each Page Differently
PFMaBiSmAd replied to slayboy's topic in PHP Coding Help
AND post all the code for ONE file in ONE set of [ code ] [ /code ] tags. -
Any chance you have a cookie named 'cid' that is overriding the get 'cid' value, since $_REQUEST combines get, post, and cookie (in that order, by default.) edit: never mind, the forum's lack of real post notification strikes again.
-
Web pages can get requested two times for a handful of different reasons - 1) The browser requests it twice, either due to debugging plug-ins, the character encoding set in the browser that is different from the character encoding set in the page, even something to do with fetching the favicon then fetching a page again. 2) You have some javascript on the page that is requesting your page that causes it to be requested twice, such as submitting a form using javascript and also letting the browser submit the form. 3) You are including the code twice on the server or including/running it inside of a loop. 4) You have URL rewriting that causes the page to be requested for both the original request and also for the rewritten request. If I remember correctly this involves something about a trailing slash / or lack of on the url. 5) Your web server is behind a proxy server at your hosting company and is being sent two requests. Since most of these things are out of your control, you normally detect and prevent duplicate data submission in your code on the server.