peranha
Members-
Posts
878 -
Joined
-
Last visited
Everything posted by peranha
-
that gives me this Array ( [scheme] => http [host] => www.phpfreaks.com [path] => /forums/index.php/topic,186086.0/topicseen.html ) /forums/index.php/topic,186086.0/topicseen.html How do I get the host portion of the array. I have tried echo parse_url($url, [host]); echo parse_url($url, host); None work. I got it fixed, just going at it wrong. This is what I came up with. echo parse_url($url, PHP_URL_HOST);
-
Anyone know of a way of doing this?
-
Replace certain keywords (array) in a string
peranha replied to maxudaskin's topic in PHP Coding Help
All over the net, just do a google search. -
Replace certain keywords (array) in a string
peranha replied to maxudaskin's topic in PHP Coding Help
// Smilies Replace Code. $smiles = array("D:(","D:D","0:)","|","","|","","","","","","","","???","","",":-X",":-U","",":-(","^-^","00","P)","P:O"); $replacements = array('<img src=smilies/yellow/angry.gif>','<img src=smilies/yellow/evil.gif>','<img src=smilies/yellow/angel.gif>','<img src=smilies/yellow/smile.gif>','<img src=smilies/yellow/rolleyes.gif>','<img src=smilies/yellow/razz.gif>','<img src=smilies/yellow/sad.gif>','<img src=smilies/yellow/smiley.gif>','<img src=smilies/yellow/wink.gif>','<img src=smilies/yellow/cheesy.gif>','<img src=smilies/yellow/grin.gif>','<img src=smilies/yellow/shocked.gif>','<img src=smilies/yellow/cool.gif>','<img src=smilies/yellow/huh.gif>','<img src=smilies/yellow/tongue.gif>','<img src=smilies/yellow/embarrassed.gif>','<img src=smilies/yellow/lipsrsealed.gif>','<img src=smilies/yellow/undecided.gif>','<img src=smilies/yellow/kiss.gif>','<img src=smilies/yellow/cry.gif>','<img src=smilies/yellow/azn.gif>','<img src=smilies/yellow/afro.gif>','<img src=smilies/yellow/eyepatch.gif>','<img src=smilies/yellow/police.gif>'); That is what I use and call it like this $string = str_replace($smiles,$replacements,$string); -
Yeah, I am not sure, I am not strong in SQL, but you can try INNER JOIN to see if that works.
-
Try putting the 1 in '' $sql = "SELECT m.id, m.label, m.link_url, m.parent_id, m.topmenu, m.leftmenu FROM cmsmenu m LEFT JOIN cmspages p ON p.menu_ID = m.id AND p.statusID = '1' ORDER BY m.parent_id, m.orderid ASC"; See what that gives you.
-
I have seen them at a couple Best Buy stores, but cannot seem to find them at bestbuy.com Not sure where else they can be found
-
I was woundering how do I just get the domain from the URL. $SERVER['http_referer'] will give me http://www.phpfreaks.com/forums/index.php?action=post;board=1.0 I just want http://www.phpfreaks.com Anyone know how this can be done with PHP preferably.
-
Any chance of a name change?
peranha replied to deadonarrival's topic in PHPFreaks.com Website Feedback
If you dont want to delete your account just live with the name. -
If you could, post the register page.
-
at the top of the page use <?php not the short version <? try that and see what happens.
-
In the code, I gave you I didnt realize it had echo in it. These should not be there. I fixed it in your code above, try that.
-
Reload user to the success.html page added the following line. header("Location: success.html"); Not sure, but I believe this will work. <?php $name = Trim($_POST['name']); $address = Trim($_POST['address']); $postcode = Trim($_POST['postcode']); $telephone = Trim($_POST['telephone']); $email = Trim($_POST['email']); $dob = Trim($_POST['dob']); $gender = Trim($_POST['gender']); $license_held_since = Trim($_POST['license_held_since']); $no_claims_entitlement = Trim($_POST['no_claims_entitlement']); $any_drivers_under_25 = Trim($_POST['any_drivers_under_25']); $cover_type = Trim($_POST['cover_type']); $registered_country = Trim($_POST['registered_country']); $registration_plate = Trim($_POST['registration_plate']); $make = Trim($_POST['make']); $model = Trim($_POST['model']); $year = Trim($_POST['year']); $engine_size = Trim($_POST['engine_size']); $fuel_type = Trim($_POST['fuel_type']); $password = Trim($_POST['password']); $EmailTo = "mscweb@mscinsure.com"; $Subject = "Motor Quote"; /// Add a subject $Body .= "name:\n$name\n\n"; $Body .= "address:\n$address\n\n"; $Body .= "postcode:\n$postcode\n\n"; $Body .= "telephone:\n$telephone\n\n"; $Body .= "email:\n$email\n\n"; $Body .= "dob:\n$dob\n\n"; $Body .= "gender:\n$gender\n\n"; $Body .= "license held since:\n$license_held_since\n\n"; $Body .= "no claims entitlement:\n$no_claims_entitlement\n\n"; $Body .= "any drivers under 25:\n$any_drivers_under_25\n\n"; $Body .= "cover type:\n$cover_type\n\n"; $Body .= "registered country:\n$registered_country\n\n"; $Body .= "registration plate:\n$registration_plate\n\n"; $Body .= "make:\n$make\n\n"; $Body .= "model:\n$model\n\n"; $Body .= "year:\n$year\n\n"; $Body .= "engine size:\n$engine_size\n\n"; $Body .= "fuel type:\n$fuel_type\n\n"; $Body .= "password:\n$password\n\n"; $Body .= "opt-in:\n$opt-in\n\n"; $success = mail($EmailTo, $Subject, $Body, "From: <$email>"); if ($success){ echo header("Location: success.html");} else{ echo "Error! Your quote has not been submitted! Please phone us on 968 429 129 or 680 525 108";} ?>
-
Session_start() has to be at the beginning of the page for session_destroy() to work as well
-
Added the die statement at the end of the 2nd query to see if there is an error in that one.
-
You are defining friends here $friends = mysql_fetch_array($result); and using friend without the s in the rest of the script. if($friends['1'] != 0){ $empty++; $y++; if($friends['2'] != 0){ $empty++; $y++; if($friends['3'] != 0){ $empty++; $y++; if($friends['4'] != 0){ $empty++; $y++; if($friends['5'] != 0){ $empty++; $y++; } } } } }
-
Yes, agreed, but for a remember me, you will have to use cookies. That is if you want the user to stay logged in even if a browser is closed. That is what I was getting at.
-
That is why I said store a unique key and the username, or something else.
-
Sessions are stored and removed when you restart your browser, so in a session will not work if the user closes the browser. It has to be stored in a cookie on the users machine. Store a user name and a unique key is a cookie, and in the database, and check to see if they are set in the cookie, and they are the same.
-
$rtags = array("<", ">", "'", '"', "?", "/", ":", ";", "{", "}", "[", "]", "(", ")"); I stripped out all these from the user name on registration and login, so your user name will not work again. I didnt take it out of password, since they are hashed anyway. Took < > " ' out of PM, and comments
-
I got it to work, I didnt realize i was defining $username further down the page. thanks for the help, it works great.
-
yes, i know what > is not a tag, but i was woundering how to get rid of a single instance, and how to get rid of " as well. I tried your code, but it doesnt seem to work. // Tags to strip for input. $tags = array("<", ">"); // username to strip tags from. $username = str_replace($tags, "", $_POST['username'] ); Here is what I input "> asdaf Here is what I get from the output. Here is the username you requested : \"> asdaf Not sure where the \ is coming from either.
-
How do you strip special characters from a username, password, other input. here is the code that I currently have, but it doesnt strip "> $username = empty($_POST['username']) ? die ("<b class=red>Enter A User Name</b>") : mysql_real_escape_string(strip_tags(htmlspecialchars($_POST['username']))); You can register with ">name, and it will let you just fine.
-
Ok, I believe that all of Coreye's problems are fixed. Is there anything else. I see that you created a user with ">cor, is this a problem, or not. All HTML is stripped from the registration page.
-
thanks, yeah that work, forgot email was \n.