QuickOldCar
Staff Alumni-
Posts
2,972 -
Joined
-
Last visited
-
Days Won
28
Everything posted by QuickOldCar
-
I see you have a function called getUserAvatar($row['username']) In that function I would just do a check if the image exists is their value, else display a default user image that you create To me this reminds them every day that they never uploaded an image. something like... $user_image_location = "/images/$username.png"; if (file_exists($user_image_location)) { $user_avatar = $user_image_location; } else { $user_avatar = "/images/default-user-avatar.png"; } The way I do this all myself is that i just pull the users table and all info. I have a user_avatar field, at user creation I insert my default-user-avatar.png as their image If they decide to upload their own, their new image name is updated in the database or can leave the field empty and if not empty and file_exists....display their image
-
You should use auto increment for the id values on insert http://dev.mysql.com/doc/refman/5.6/en/example-auto-increment.html If were to update into a certain id, then you should specify the id, but not leave it blank.
-
I'm sorry, I wasn't aware that the large image was supposed to be a hyperlink. You are correct that the large image href links work in IE, but not in firefox.
-
works just fine in latest firefox version for me although the images did take longer to load, but they did
-
Here's just something simple I did using preg_match to see if showpic.php exists in the url, and if does find the u and a values. <?php $url = "http://www.test.com/showpic.php?do=showpic&u=89165&a=34933"; if (preg_match("/showpic.php/i",$url)) { echo "yes <br />"; parse_str($url, $values); $a_value = $values['a']; $u_value = $values['u']; echo "a is $a_value <br />"; echo "u is $u_value <br />"; } else { echo "not showpic.php"; } ?> result is: yes a is 34933 u is 89165
-
You should convert your datetime into a more user friendly format upon display. Users uploaded video's, birthday, and anywhere else are going to display it.
-
$_SERVER['REMOTE_ADDR'] should get the visiting ip address
-
Forum Search engin to search keywords in database in php
QuickOldCar replied to neel_1708's topic in PHP Coding Help
Alexv's suggestion is a good one, fulltext in boolean mode is the way to go. http://dev.mysql.com/doc/refman/5.6/en/fulltext-search.html requires the MyISAM table type, InnoDB not supported Another alternative is sphinx. http://sphinxsearch.com/about/sphinx/ Or even Lucene http://lucene.apache.org/java/docs/index.html -
Well after writing that function, which is useful for what I did it for. I do believe you would like to append your sites url to an assigned vidid. It's better to just on displaying to append your sites domain/location just on display. Less data in database, may switch domains or the file locations. Really is no need to do that unless you yourself will be doing it your self from different domains. but can do this if what i said is correct. $vidID = "hxxp://xxx.mysitehere.com/index.php?vid=" . $_REQUEST['vidID'];
-
Are you asking why the link starts with hxxp://? To answer that, is people out there that do hxxp:// versus any proper protocol like http://,https,etc... to show that it's link but hide that it is a link for bots or chats. I for one do not this at all. If it's you that are pasting the links as hxxp in this forum..not sure why are doing that. I'm not sure where you are getting this data from, but you can run these through a case insensitive string replace function to change hxxp to http. //list of urls $url_array = array("hxxps://xxx.mysitehere.com/index.php?vid=vidID", "hxxps://mysitehere.com/index.php?vid=vidID","hxxp://xxx.mysitehere.com/index.php?vid=vidID", "hxxp://mysitehere.com/index.php?vid=vidID"); //replace function function replaceHxxp($url){ $url = str_ireplace(array("hxxps://xxx.","hxxps://","hxxp://xxx.","hxxp://"), array("https://www.","https://","http://www.","http://"), trim($url)); return $url; } //looping urls through the function foreach($url_array as $urls){ echo replaceHxxp($urls) . "<br />"; } results of the urls would now be: https://www.mysitehere.com/index.php?vid=vidID https://mysitehere.com/index.php?vid=vidID http://www.mysitehere.com/index.php?vid=vidID http://mysitehere.com/index.php?vid=vidID You should also look into sanitizing/escaping any data inserted into mysql Some reading material for you. http://php.net/manual/en/function.mysql-real-escape-string.php http://php.net/manual/en/function.urlencode.php http://www.php.net/manual/en/function.urldecode.php http://www.php.net/manual/en/function.rawurlencode.php http://www.php.net/manual/en/function.rawurldecode.php
-
place this the top of your page to see errors <?php ini_set('display_errors',1); error_reporting(E_ALL); ?> you can also try posting your entire code here to try to help more the mysql connect code i never saw ...exclude your credentials show your current form,process/results pages please
-
I think this should work echo "<td class='newstitle' align='left' valign='top' bgcolor='#D6D6D6'>".hyperlink($row['ArticleDescription'])."</td></tr>";
-
No matter what I do image stays black (GD) help!
QuickOldCar replied to Spring's topic in PHP Coding Help
My advice is to see if your image paths are accessable, a changed permissions maybe? -
look closer, it's not the same in a few ways
-
A form structure goes along the line of this. <form action="process.php" method="post"> <select name="Persons"> <?php while($rows=mysql_fetch_array($result)){ ?> <option value="<?php echo $rows['id']; ?>"><?php echo $rows['FirstName']; ?></option> <?php } ?> </select> <input type="submit" value="Go!" /> </form>
-
Are there any free keyloggers out there that apply to Mac?
QuickOldCar replied to Tinney's topic in Miscellaneous
You can also take a look at opendns http://www.opendns.com/home-solutions/ -
I think would have to explain better of what you wish to do, also some current code that you have.
-
help with php (str & replace code)
QuickOldCar replied to houssam_ballout's topic in PHP Coding Help
does this help? <?php $text = "Hello\\n Hello\\\n Hello\\ Hello\\x "; $new_text = str_replace(array("\n","\\n")," <br />",$text); $new_text = stripslashes($new_text); //$new_text = str_replace("<br />","\n",$new_text);//reason to be \n ? echo "$new_text"; ?> -
Yes vimeo has issues with their autoplay always working, even the embed codes from their site do not work. see my example here http://get.blogdns.com/test/vimeoembed.php You can obtain the multi-media embed script from here. http://webcodingeasy.com/PHP-classes/Get-information-about-video-and-images-from-link BTW, I made a better google and youtube embed script, just ask me.
-
Using fulltext search is a better option. http://dev.mysql.com/doc/refman/5.6/en/fulltext-search.html I could see doing something like this. $data = mysql_query("SELECT * FROM plantae WHERE common_name_english LIKE '$item' AND common_name_english LIKE '% $item' AND common_name_english LIKE '$item %'"); I did this simple function to only display results as you stated. <?php $search_term = "elm"; $results = array("elm","chinese elm","Elmendorf's onion","engelman's spruce","Elm tree"); function excludeWithin($search_term,$words){ $search_term =strtolower(trim($search_term)); $words =strtolower(trim($words)); if($search_term == $words || preg_match("/ $search_term/",$words) || preg_match("/$search_term /",$words)){ return $words; } } foreach($results as $result){ if(excludeWithin($search_term,$result) != ""){ echo $result."<br />"; } } ?> Results would be: elm chinese elm Elm tree
-
<?php $string = trim("012345678912"); if(substr($string,7) != " "){ $string = substr_replace($string," ", 7, -strlen($string)); } echo $string; ?>
-
<?php $file="hello.xml"; $fileExt = end(explode(".",$file)); echo $fileExt; ?>
-
http://php.net/manual/en/function.highlight-file.php and also http://www.php.net/manual/en/function.highlight-string.php
-
Basically you should try doing a repair on the table through phpmyadmin. I feel you should also paginate your results on display. Less results per page. I'm guessing you are outputting roughly 1,000 results on a single page. You could also try raising your memory limit in php.ini, but that's not the better solution.
-
I know nothing about this, but this may help you. http://cmusphinx.sourceforge.net/wiki/