premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
Should it be $_POST of logout or $_GET? Alternatively you can use $_REQUEST['logout'] and that checks for both and if that is set then the code runs. Since this is a logout page, I think that would be kosher. How do they logout from every other page? A button or a link with ?logout=true at the end? setcookie("ID_my_site", false); setcookie("Key_my_site", false); I would also use that for your logout cookies, as setting the value to false attempts to destroy to cookie.
-
Cookie problem and yes i don't have any tags before the setcookie
premiso replied to trasseli's topic in PHP Coding Help
Make sure there are no whitespaces before the <?php If there are none, then yes. Try saving it using Notepad and see what happens. Bad: <?php Good: <?php -
[SOLVED] Issue with Email Validation String
premiso replied to monkeytooth's topic in PHP Coding Help
eregi is being depreciated. I would avoid using it: <?php $pattern = '/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\@([a-z0-9])' . '(([a-z0-9-])*([a-z0-9]))+' . '(\.([a-z0-9])([-a-z0-9_-])?([a-z0-9])+)+$/i'; var_dump(preg_match ($pattern, "email-address_to.validate@host.tld")); ?> Give that a try and see if that helps out at all. EDIT: If on a linux host I would look into also utilizing checkdnsrr to validate the host (everything after the @). -
If you have the field as being "female" why not see if it is null, if it is null then they are male, if it has a value (not null) they are male....? As far as the answer what to check against...I have no clue. I have never used bit, instead I would do a TINYINT(1) that way it can be a 1 or a 0 and boom, problem is solved. I believe bit is binary, and I have never really worked closely with binary information.
-
replace all words in a paragraph with content from database
premiso replied to scarhand's topic in PHP Coding Help
$article = str_replace(" " . $words . " ", $synonyms, $article); Will make it only replace words that have a space before and after (this may not be what you want due to periods etc.) For a more advanced replace, look into preg_replace. -
Thats the key. It is annoying as all hell.
-
I think the best approach would be to use str_word_count Then when you get the array of words, loop through them with foreach <?php $string = "This is a string of words in a string sting of the next string to be a string"; $words = str_word_count($string, 1); foreach ($words as $word) { $countArray[$word]++; } print_r($countArray); ?>
-
As long as your mysql table is setup that way: $result = mysql_query("SELECT `colname` FROM `tablename` WHERE `somecol` = 'someval' LIMIT 1"); $val = mysql_result($result, 0); echo "Value returned $val"; If you plan on returning more than one row, look into mysql_fetch_assoc or mysql_fetch_row. They have examples.
-
You would have to install mysql on the php server. If you are using odbc, then chances are the mysql extension has not been installed. Check the php.ini for the php_mysql extension, uncomment it if it is commented out. I am not too familiar with IIS, so yea. But that is most likely the base of the error. Also make sure you have the actual MySQL database installed (since you posted the mysql version I take it you do).
-
Simple answer, it would have to popup in a new window. That window would play the song un-interrupted while the user browses. Better yet, they can even close the window if it gets annoying to them!
-
Generally you should put the picture in a directory then put the file information in a DB. It is not "good" practice to put images in the DB. Although if that sounds preferable you would use the BLOB data type. For more on how to read them back to the page readfile and header for that part.
-
Javascript, not html or php. If you want php to check it (it would require a pagereload). if (!isset($_POST['otherdata']) || ($_POST['otherdata'] != "Yes" && $_POST['otherdata'] != "No")) { echo "Required field missing."; } But you probably want Javascript instead.
-
Use file_exists before unlink If it exists try to unlink, if not then it got deleted at some point in time.
-
The problem you have with this, is php can be inside strings etc. Doing this would make a mess of posts. Granted users are lazy, it still needs to rely on them, if they do not, they suffer the consequences, hence not being helped by certain people etc.
-
EMail verification may work to thwart bots from making up addresses. But chances are the email they use is sent to a server that can parse that and answer the email. Even if you get bots taken care of, you still have to worry about actual humans spamming, which is near impossible to stop. You have to be active in clearing it out etc. You can setup alerts by keywords etc, but yea. Welcome to the disappointment of Mal-Bot use.
-
urlencode This will encode the text to be added to a url.
-
SHA1 is not technically encryption. It is a one way hash. Just remove the AES_ENCRYPT and use sha1 with a good salt and you should be fine.
-
Me too...time to go and get a breakfast burrito, I am starving!
-
Well see in my job I am basically paid to be on call. When I get a call I devote my full attention to that, or side projects etc. The problem is I do them to fast or I fix the users issue very fast and efficiently. That is what landed me this job, and I actually tried to browsing other sites for a while and just sitting here finding stuff to do. But I ran out of stuff to do within the first month and every day took forever to get over with. Thus I just browse forums and actually make the day go by much faster. My job is still priority #1 when I actually have something to do
-
Not really. Webmails can only see the file. They do not know what directory it comes from. This is true with all uploading forms. None of the know from where that file came, this is a security restriction. Create your own Upload in script in PHP and you may get a better idea of what I am telling you.
-
I wish...if you call "being at work" as "under the influence"
-
Wow premiso it was almost like you read my mind. I was about to post here and clicked reply then saw 2 new posts and you mentioned my name and I hadnt even posted yet lol. edit: oh yeah meant to say I think you were referring to Maq lol. The weirder thing it was Neil I meant to say....whoops. I must have saw your name on viewers and just did it by mistake. Sorry about that neil.
-
PHP defaults to the servers time. It cannot find out the users local without javascript. Just using date should do that for you.
-
You never changed what neil pointed out. foreach($rows as $row) { echo "<li>$row->title ($row->publish_up)</li>"; //$i = 0; $Authors[$i]= "$row->created_by"; echo "Author's id: $row->created_by"; $i++; } That should increment it.
-
That code essentially includes a file in the path of lists/miscpx.html to make it more "dynamic". Without the proper code, that could be a very bad thing allowing your site to be hacked. As far as the # in the url, maybe look into the urlencode function at php.net. Get data has to "flow" so as such spaces turn into %20 and other items are changed as well. EDIT: To further clarify, you do not have to post from a form to set get data. I can set it to be anything by typing it in the browser or adding it to a link on a website. http://www.google.com/search?q=test should run a google search on "test". That is why GET data is for, so you can bookmark/link a site and go right to that page, vs having to just goto google.com and re-type it in.