premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
Yea, just preference, whoever echo is proven to be faster than print. Since I bench tested that and found that out I only use echo and tend to use ' over " for a similiar reason. Although it does not speed it up noticeably I figure anything helps =)
-
Nice, glad you got it working and posted the example =) I guess I mis-understood the question, I was under the impression that you were parsing text in like a blog or essay form and highlighting that....
-
I have something against smoking. Just because someone would like to get lung cancer doesn't mean I want to as well. Some morons in Denmark even created a bloody "Smokers Party" fighting to get their "right" to infest my lungs with their chemical garbage. If you check out the "English version" on that site then you'll see that they "will fight for mutual respect in the public space", which is quite obviously hypocritical. How are they respecting non-smokers by forcing them into passive smoking? Insofar people smoke outdoors, in a room specifically designed for smoking, or another place where other people aren't forced to breath toxic fumes then I have no problems with smoking. Alcohol and narcotics is different though. This will not have a direct effect on other people (except if you due to the intoxication of those substances harm other people). I would agree the obnoxious smokers who do not care where they light up and do not even think to ask first, bug me. But there are smokers who ask if you mind or not. All of my friends ask me first cause some days I care others I do not, but it is the courtesy of asking me and respecting my answer and I always thank them for it. But the jerks who just light up whenever and wherever they are...yea.
-
Honestly, I used to smoke a long time ago, quit cause of the wife. Does it make you dumber, not necessarily. Does constant smoking cause your thought process to slow down? Yea. But that does not mean you are dumber/stupid. Drinking makes you much more stupider imho. When I was smoking I could still code, I just couldn't code high, the screen going back and forth on me with a white page wasnt good. But I could still code and figure out problems as I always could. Smoking too much can cause problems, what too much of anything can cause problems. Too much gaming takes away from your ability to socially interact with people around you, not in cyberspace. Too much eating causes obesity which leads to more problems. Too much drinking causes liver problems etc. The key with life is moderation. The problem is some people cannot moderate certain substances, thus addiction is born. I have nothing against smokers, drinkers, or druggies. As long as they do not try to force me to do something I do not want and do not put my life or my families life in danger, do what you want. I think a DUI should be a felony the 2nd offense, whether you are driving after smoking a joint or drinking. But yea to state that someone is stupid just because they smoke is ignorant imo. Just my 2cents.
-
strtotime
-
Gevans, the entire code is there.
-
How do I turn firstname and last name to full name? *Source Attached*
premiso replied to joshuaceo's topic in PHP Coding Help
<?php $con = mysql_connect("localhost","crown_brownu","asdfasdf"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("crown_brownies", $con); $password=md5($_POST[password]); $sql="INSERT INTO users (newsletters, updates, fname, lname, login, password, company, address1, address2, city, state, province, zip, country, email, email_mode, level, phone) VALUES ('$_POST[newsletters]','$_POST[updates]','$_POST[fname]','$_POST[lname]','$_POST[login]','$password','$_POST[company]','$_POST[address1]','$_POST[address2]','$_POST[city]','$_POST[state]','$_POST[province]','$_POST[zip]','$_POST[country]','$_POST[email]','$_POST[email_mode]','$_POST[level]','$_POST[phone]')"; $res1 = mysql_query($sql); if (!mysql_error()) { $sql="INSERT INTO users_shipping (is_primary, name, company, address1, address2, city, state, province, zip, country) VALUES ('$_POST[is_primary]','{$_POST[fname]} {$_POST[lname]}','$_POST[company]','$_POST[address1]','$_POST[address2]','$_POST[city]','$_POST[state]','$_POST[province]','$_POST[zip]','$_POST[country]')"; $res2 = mysql_query($sql); }else { die('Error: ' . mysql_error()); } if (!mysql_error()){ die('Error: ' . mysql_error()); } echo "1 user added"; ?> -
How do I turn firstname and last name to full name? *Source Attached*
premiso replied to joshuaceo's topic in PHP Coding Help
$password=md5($_POST[password]); $sql="INSERT INTO users (newsletters, updates, fname, lname, login, password, company, address1, address2, city, state, province, zip, country, email, email_mode, level, phone) VALUES ('$_POST[newsletters]','$_POST[updates]','$_POST[fname]','$_POST[lname]','$_POST[login]','$password','$_POST[company]','$_POST[address1]','$_POST[address2]','$_POST[city]','$_POST[state]','$_POST[province]','$_POST[zip]','$_POST[country]','$_POST[email]','$_POST[email_mode]','$_POST[level]','$_POST[phone]')"; $res1 = mysql_query($sql); if (!mysql_error()) { $sql="INSERT INTO users_shipping (is_primary, name, company, address1, address2, city, state, province, zip, country) VALUES ('$_POST[is_primary]','{$_POST[fname]} {$_POST[lname]}','$_POST[company]','$_POST[address1]','$_POST[address2]','$_POST[city]','$_POST[state]','$_POST[province]','$_POST[zip]','$_POST[country]')"; $res2 = mysql_query($sql); } if (!mysql_error()) -
Not sure if this would work but: <?php preg_replace("/" . $search . "/i", "<b style=\"color:#0000FF;\">$1</b>",$title); ?> Not 100% sure but looking into the preg_replace you can actually call what was found using the $1 etc.
-
How you have it is fine, since SESSION is a global variable.
-
Just thought I would let you know, they are 2 different backends, one is a forum the other is probably a CMS. It is hard to integrate two systems not related to each other for a dual login purpose.
-
ZIP: {$city}, {$state} {$zip} That part I do not think is right. Try replacing it with the above. EDIT: Dont feel too bad, I missed it too along with a few others =)
-
How about removing the exit statement?
-
[SOLVED] Wierd Validation errors, session ID
premiso replied to DeanWhitehouse's topic in PHP Coding Help
As long as your host allows. And if you have a file, such as config, included on every page definitely the way to go if .htaccess does not work. -
I see. Well it seems you may have some issues with your server, or the file that is including the above file. Since this is being included I would not use the DIE for the else as it would kill the script always if post is not set, but to test the page itself by calling thatpage.php see if that die is printed, if it is than the problem lies on the other page. Can you post the code that includes the above file?
-
Google does wonders http://www.google.com/search?hl=en&q=301+redirect+htaccess&btnG=Google+Search
-
Reading will help. http://www.faqs.org/rfcs/rfc822.html That is the standard for an email address, which is why I referred you to the below function. The function will check that the email is valid by the actual standards of an email address, exactly what you want isn't it? <?php function is_valid_email_address($email){ $no_ws_ctl = "[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]"; $alpha = "[\\x41-\\x5a\\x61-\\x7a]"; $digit = "[\\x30-\\x39]"; $cr = "\\x0d"; $lf = "\\x0a"; $crlf = "($cr$lf)"; $obs_char = "[\\x00-\\x09\\x0b\\x0c\\x0e-\\x7f]"; $obs_text = "($lf*$cr*($obs_char$lf*$cr*)*)"; $text = "([\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f]|$obs_text)"; $obs_qp = "(\\x5c[\\x00-\\x7f])"; $quoted_pair = "(\\x5c$text|$obs_qp)"; $wsp = "[\\x20\\x09]"; $obs_fws = "($wsp+($crlf$wsp+)*)"; $fws = "((($wsp*$crlf)?$wsp+)|$obs_fws)"; $ctext = "($no_ws_ctl|[\\x21-\\x27\\x2A-\\x5b\\x5d-\\x7e])"; $ccontent = "($ctext|$quoted_pair)"; $comment = "(\\x28($fws?$ccontent)*$fws?\\x29)"; $cfws = "(($fws?$comment)*($fws?$comment|$fws))"; $cfws = "$fws*"; $atext = "($alpha|$digit|[\\x21\\x23-\\x27\\x2a\\x2b\\x2d\\x2f\\x3d\\x3f\\x5e\\x5f\\x60\\x7b-\\x7e])"; $atom = "($cfws?$atext+$cfws?)"; $qtext = "($no_ws_ctl|[\\x21\\x23-\\x5b\\x5d-\\x7e])"; $qcontent = "($qtext|$quoted_pair)"; $quoted_string = "($cfws?\\x22($fws?$qcontent)*$fws?\\x22$cfws?)"; $word = "($atom|$quoted_string)"; $obs_local_part = "($word(\\x2e$word)*)"; $obs_domain = "($atom(\\x2e$atom)*)"; $dot_atom_text = "($atext+(\\x2e$atext+)*)"; $dot_atom = "($cfws?$dot_atom_text$cfws?)"; $dtext = "($no_ws_ctl|[\\x21-\\x5a\\x5e-\\x7e])"; $dcontent = "($dtext|$quoted_pair)"; $domain_literal = "($cfws?\\x5b($fws?$dcontent)*$fws?\\x5d$cfws?)"; $local_part = "($dot_atom|$quoted_string|$obs_local_part)"; $domain = "($dot_atom|$domain_literal|$obs_domain)"; $addr_spec = "($local_part\\x40$domain)"; $done = 0; while(!$done){ $new = preg_replace("!$comment!", '', $email); if (strlen($new) == strlen($email)){ $done = 1; } $email = $new; } # # now match what's left # return preg_match("!^$addr_spec$!", $email) ? 1 : 0; } ?> I removed most of the comments, if you want the original comments also see the page. That code essentially validates any input against the rules laid out in the above document. Read that document to figure out what this function is actually checking.
-
$toAddress="carlos@allstate.com, address2@email.com"; mail Or look up the CC/BCC parts of the mail function.
-
Well theres your answer right there. The page will not load on it's own cause for the first if statement there is no else....try this: <?php if (isset($_POST['Submit']) && $_POST['Submit'] == "Submit") { foreach ($_POST as $key => $val) { $_POST[$key] = trim(stripslashes($val)); } $to = "xxx.xxx@xxx.com"; // send the form here $concerning = $_POST['concerning']; $name = $_POST['name']; $email = $_POST['email']; $address = $_POST['address']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; $phone = $_POST['phone']; $student_type = $_POST['student_type']; $major = $_POST['major']; $information = $_POST['information']; $captcha = $_POST['captcha']; $errors .= (empty($concerning)) ? "<br />Please choose what this is concerning." : FALSE; $errors .= (empty($name)) ? "<br />Please fill in your name." : ""; $errors .= (empty($email)||!preg_match("/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*(([,]|[,])\s*\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)*$/", $email)) ? "<br />Please fill in your email address." : FALSE; $errors .= (empty($student_type)) ? "<br />Please choose a student type." : FALSE; $errors .= (empty($captcha)||!(strtolower($captcha=="BUZZ"))) ? "<br />Please type the correct word." : FALSE; if (!$errors) { $msg = "Concerning: {$concerning}\nName: {$name}\nEmail: {$email}\nAddress: {$address}\nCity, State ZIP: {$city, $state $zip}\nPhone: {$phone}\nStudent Type: {$student_type}\nMajor: {$major}\nInformation: {$information}\n"; $headers .= "From: {$name} <{$email}>\r\n"; $subject = "The Advisor - Contact Form"; ini_set(sendmail_from, $email); $bool = mail($to, $subject, $msg, $headers); ini_restore(sendmail_from); if ($bool) { header("Location: thankyou.php"); exit; } else { DIE ("Something happened that wasn't supposed to. Please send an email to {$to} and tell me that you got this message."); } } }else { DIE("This was not submitted via a form, page is intentionally blank."); } ?>
-
So you are not including require.php on your index page? if (!function_exists("upd")) { function upd($input){ print ("<br /> <table width=\"30%\" align=\"center\" class=\"tbl\"> <tr><td align=\"center\" class=\"hdr\">Update</td></tr> <tr><td align=\"center\" class=\"tbl\">".$input."</td></tr> </table>"); } }
-
Why would you not allow '+' (plus) or '.' period? those are perfectly acceptable characters for an email - a period is a very common character for an email. But, you can modify it if you wish. This shoudl do it as you asked, but I havent tested it: function is_email($email) { $formatTest = '/^[a-z0-9][-\w]+@[-a-z\d]{2,}(\.[-a-z\d]{2,})*\.[a-z]{2,6}$/i'; $lengthTest = '/^(.{1,64})@(.{4,255})$/'; return (preg_match($formatTest, $email) && preg_match($lengthTest, $email)); } I think that is a completely different topic, he is just trying to use this topic to answer a different question.
-
Do some debugging: if (!$errors) { echo 'here0'; $msg = "Concerning: {$concerning}\nName: {$name}\nEmail: {$email}\nAddress: {$address}\nCity, State ZIP: {$city, $state $zip}\nPhone: {$phone}\nStudent Type: {$student_type}\nMajor: {$major}\nInformation: {$information}\n"; $headers .= "From: {$name} <{$email}>\r\n"; $subject = "The Advisor - Contact Form"; echo 'here1'; ini_set(sendmail_from, $email); echo 'here2'; $bool = mail($to, $subject, $msg, $headers); echo 'here3'; ini_restore(sendmail_from); echo 'here4'; if ($bool) { echo 'here5'; header("Location: thankyou.php"); exit; } else { echo 'here6'; DIE ("Something happened that wasn't supposed to. Please send an email to {$to} and tell me that you got this message."); } } } ?> And see where it stops and go from there. Where it stops it means the line below is the culprit
-
[SOLVED] constant refresh in IE 5/6 after login.
premiso replied to daydreamer's topic in PHP Coding Help
Code would be very helpful, and necessary for you to get your questioned answered. -
If this function upd($input){ print ("<br /> <table width=\"30%\" align=\"center\" class=\"tbl\"> <tr><td align=\"center\" class=\"hdr\">Update</td></tr> <tr><td align=\"center\" class=\"tbl\">".$input."</td></tr> </table>"); } Is the same as the one in the require, just remove that...