
ignace
Moderators-
Posts
6,457 -
Joined
-
Last visited
-
Days Won
26
Everything posted by ignace
-
You need natsort which applies the "natural order sorting" algorithm. This algorithm addresses this problem.
-
Belgian - a person living in Belgium Beligum doesn't even have such a force (if it has any force at all) I just wanted to know how many Belgian people were on these forums so that we could setup possible meetings, talk about PHP, get a general idea of the knowledge a general belgian PHP developer possesses and start with that knowledge to further educate using presentations. It was just a thought. I didn't knew that having a thorough knowledge of or talking about PHP would be against the law.
-
If you want to add flexibility to your functions you may want to try: function html_profile($id) { $user = user_get_details($id); $post = user_get_posts($id, 'DESC', 1); $post = empty($post) ? array() : $post[0]; $html_status = 'Status: ' . (empty($post) ? '<em>No status</em>' : $post['status'] . ' - ' . date('F j, Y, g:i:a', strtotime($post['posted']))); $html_about = '<strong>About me</strong><br /><em>' . (isset($user['about_me']) ? $user['about_me'] : 'Unknown') . '</em>'; $html_friend = user_is_friend($id, $_SESSION['id']) ? 'Already friends' : (user_has_invite($id, $_SESSION['id']) ? 'Friend request sent' : '<a href="#" onclick="$.facebox.settings.opacity = 0.2; jQuery.facebox({ajax: \'profile/friends/request.php?uid=$id\'})"> Add as a friend</a>'); $html_username = '<em>' . $user['username'] . '</em>'; $html_register_date = '<em>' . date('F j, Y', $user['date']) . '</em>'; $html_last_active_date = '<em>' . date('F j, Y', $user['last_login']) . '</em>'; $html_maritial_status = '<em>' . (isset($user['rel_status']) ? $user['rel_status'] : 'Unknown') . '</em>'; $html_sexual_orientation = '<em>' . (isset($user['orien_status']) ? $user['orien_status'] : 'Unknown') . '</em>'; $html_looking_for = '<em>' . (isset($user['looking_for']) ? $user['looking_for'] : 'Unknown') . '</em>'; return '<div id="profheader" style="padding-top:10px; min-height:150px; border:1px solid black;">' . '<div style="float:right; width:390px; margin-right:10px;">' . '<div style="background:#E1E3DE; padding:4px;">' . $html_status . '</div>' . $html_about . '</div>' . '<div style="text-align:center; width:130px; float:left;">' . '<img src="resize_image.php?file=' . (isset($user['avatar']) ? $user['avatar'] : 'images/avatars/default.jpg') . '&size=120" border="0" />' . $html_friend . '</div>' . '<div style="margin-left:140px; margin-right:400px;">' . '<strong>User Details</strong>' . '<table>' . '<tr><th>Username</th><td>' . $html_username . '</td></tr>' . '<tr><th>Registered on</th></td>' . $html_register_date . '</td></tr>' . '<tr><th>Last active on</th><td>' . $html_last_active_date . '</td></tr>' . '<tr><th>Maritial status</th><td>' . $html_maritial_status . '</td></tr>' . '<tr><th>Sexual orientation</th><td>' . $html_sexual_orientation . '</td></tr>' . '<tr><th>Looking for</th><td>' . $html_looking_for . '</td></tr>' . '</table>' . '</div>' . '</div>'; } function user_get_details($id) { $id = intval($id); if (0 === $id) return array(); $result = mysql_query("SELECT * FROM users WHERE id = $id"); return $result ? mysql_fetch_assoc($result) : array(); } function user_get_posts($id, $sort = 'ASC', $limit = 0) { $id = intval($id); if (0 === $id) return array(); $result = mysql_query("SELECT * FROM user_status WHERE user_id = $id ORDER BY posted $sort"); if (!$result) return array(); $posts = array(); $i = 1; while ($row = mysql_fetch_assoc($result)) { $posts[] = $row; if ($limit > 0 && $i == $limit) break; ++$i; } mysql_free_result($result); return $posts; } function user_get_friends($id, $limit = 0) { $id = intval($id); if (0 === $id) return array(); $result = mysql_query("SELECT * FROM friends WHERE user_id = $id"); if (!$result) return array(); $friends = array(); $i = 1; while ($row = mysql_fetch_assoc($result)) { $friends[] = $row; if ($limit > 0 && $i == $limit) break; ++$i; } mysql_free_result($result); return $friends; } function user_is_friend($user_id, $friend_id, $table_rows = array()) { $user_id = intval($user_id); $friend_id = intval($friend_id); if ($user_id < 1 || $friend_id < 1) return false; if (!empty($table_rows)) { $key = key($table_rows); if (!is_integer($key)) { return isset($row['user_id']) && isset($row['friend_id']) && $user_id == $row['user_id'] && $friend_id == $row['friend_id']; } else foreach ($table_rows as $row) { if (isset($row['user_id']) && isset($row['friend_id'])) { if ($user_id == $row['user_id'] && $friend_id == $row['friend_id']) return true; } } return false; } else { $result = mysql_query("SELECT user_id FROM friends WHERE user_id = $user_id AND friend_id = $friend_id"); return $result ? true : false; } } function user_has_invite($user_id, $friend_id, $table_rows = array()) { $user_id = intval($user_id); $friend_id = intval($friend_id); if ($user_id < 1 || $friend_id < 1) return false; if (!empty($table_rows)) { $key = key($table_rows); if (!is_integer($key)) { return isset($row['user_id']) && isset($row['friend_id']) && $user_id == $row['user_id'] && $friend_id == $row['friend_id'] && $row['status'] == 0; } else foreach ($table_rows as $row) { if (isset($row['user_id']) && isset($row['friend_id'])) { if ($user_id == $row['user_id'] && $friend_id == $row['friend_id'] && $row['status'] == 0) return true; } } return false; } else { $result = mysql_query("SELECT status FROM friend_requests WHERE user_id = $user_id AND friend_id = $friend_id AND status = 0"); return $result ? true : false; } }
-
SELECT * FROM table WHERE contact_next > now() ORDER BY contact_next Add a LIMIT if you want to limit the number of rows returned
-
$body = ''; $dash = str_repeat('=', 70); while ($row = mysql_fetch_assoc($result)) { $message = $row['date'] . PHP_EOL . $row['time'] . PHP_EOL . $row['sport'] . ' - ' . $row['visitor'] . ' at ' . $row['home'] . ' ' . $row['ump1'] . ' ' . $row['ump2'] . ' ' . $row['ump3'] . ' ' . $row['ump4'] . ' ' . $row['ump5'] . PHP_EOL . $row['field'] . PHP_EOL . $row['notes'] . PHP_EOL . $dash . PHP_EOL; $body = $body . $message . PHP_EOL; } $status = mail($to, $subject, $body, $headers); echo 'Mail', (!$status ? ' not ' : ''), 'sent';
-
Yes. <img src="images.php?image_id=<id>" width="<width>" height="<height>"> images.php must echo out the contents of the BLOB field
-
That and a missing ' in the query
-
By using $_REQUEST['dropdown'] as <select name="dropdown">
-
how to make a CSV file from emails in a database
ignace replied to kevinkhan's topic in PHP Coding Help
Try: function array2csv($array, $separator = ',') { return implode($separator, array_values($array)); } $query = 'SELECT * FROM user'; $result = mysql_query($query); $lines = array(); $include_headers = true; while ($row = mysql_fetch_assoc($result)) { if ($include_headers) { $lines[] = array2csv(array_keys($row)); $include_headers = false; } $lines[] = array2csv($row); } if (false === file_put_contents('CSV.txt', implode(PHP_EOL, $lines))) { echo '<p>Failed to write CSV data</p>'; } Notice the PHP_EOL I was kinda hoping file_put_contents would do this as I passed an array apparently not -
What do you want to accomplish and what is lastfs & lastfsend
-
error_reporting(E_ALL); ini_set('display_errors', 1); In your script and error_reporting = E_ALL display_errors = On in your php.ini
-
how to make a CSV file from emails in a database
ignace replied to kevinkhan's topic in PHP Coding Help
Have you tried mine? -
Rename your $result and $row in your inner-while loop
-
SELECT u.email, c.country FROM user_detail u JOIN country c ON u.country = c.id
-
Have you looked at these possible solutions? http://www.opensource-it.com/enterprise_solutions/open_source_video_conferencing I tried: "video conferencing open-source" as search query
-
how to make a CSV file from emails in a database
ignace replied to kevinkhan's topic in PHP Coding Help
function array2csv($array, $separator = ',') { return implode($separator, array_values($array)); } $query = 'SELECT * FROM user'; $result = mysql_query($query); $lines = array(); $include_headers = true; while ($row = mysql_fetch_assoc($result)) { if ($include_headers) { $lines[] = array2csv(array_keys($row)); $include_headers = false; } $lines[] = array2csv($row); } if (false === file_put_contents('CSV.txt', $lines)) { echo '<p>Failed to write CSV data</p>'; } -
Read here what the possible problems can be http://php.net/manual/en/function.flush.php
-
This subject has been discussed before here and here
-
Doesn't MSN and Google Chat provide this functionality I know that you can have video conferencing on Google Chat through the Gmail interface
-
1) the ID's expire (they are not PK) 2) the actual filename and it's location remains hidden (the actual file does not have avira_antivir_personal_en.exe as a name rather something like QTRJNQYUijqp+YTUQ9QJytQ through headers it's accomplished to show up the file as avira_antivir_personal_en.exe)
-
count how many times the same username is in the database
ignace replied to CBG's topic in PHP Coding Help
The while makes me believe he wants to know how many times each username occurs which leads to: SELECT count(*) AS username_count, username FROM db GROUP BY username -
Acessing PHP Application From Local Server
ignace replied to shiningworld_4u's topic in Applications
In normal circumstances people on your network can see your website if they type in http://<your-lan-ip> -
Acessing PHP Application From Local Server
ignace replied to shiningworld_4u's topic in Applications
192.168.1.4 is your locan-ip or LAN-IP you need your WAN-IP for this to work http://www.whatismyipaddress.com -
Oeps my bad I replied a bit to hasty. I had thought about it before I suggested the time2dec() using an extra column but forgot that MySQL does not sort by column but by row.
-
Your website has been most likely been cracked and a cracker added the extra code whereby your website is now part of a cracker's network remove all unknown code at once (go over all files).