PHP - Force Lower Case
i want to make a simple forced lower case form but i got stuck on it
to begin with i want to everything user's write and submit convert to lowercase
am i using the right code? i'm not sure about using preg_match in this situation but i dont know what else to do
don't be harsh with me i'm noob <?php if(isset($_GET['user'])&&!empty($_GET['user'])) { $user = $_GET['user']; if (preg_match('$englishUpperAlphabet'//English alphabet Upper case array//',$user)){ $user = mb_strtolower($user); echo $user; } else{ echo 'none'; }} ?> <form action="t.php" action="GET"> name: <input type="text" name="user" > <br> <input type="submit" value="submit" > </form> Similar TutorialsI mostly if not always name my classes with the first letter capitalized.
I typically use enable autoloading as follows. I don't know when I started converting the class name to under-case. As such, however, I need to make the filenames undercase.
Is this the correct approach?
spl_autoload_register(function ($class) { $class=strtolower($class); if(file_exists(__DIR__.DIRECTORY_SEPARATOR.'classes'.DIRECTORY_SEPARATOR.$class.'.php')) { require_once __DIR__.DIRECTORY_SEPARATOR.'classes'.DIRECTORY_SEPARATOR.$class.'.php'; } }); Hi, I wonder if some one could help me. I am trying to set up a few rules to make sure that users create safe passwords on my site: I have the below check which makes sure that the user enters a word of at least 8 charachters long: Code: [Select] if( strlen($password) < $MaxPwdLength ){ $errmsg_arr[] = 'Password must be at least 8 charachters long '; $errflag = true; } Does anyone know how I could write an if function to make sure that the ser is entereing a password with at least one capital and one lower case letter in. Hope you can help. Thanks Ed Im displaying scores from my database from highest to lowest but 10 always comes out first. Why? Hello, I've got what should be a simple solution here. I've tried many things but it just won't work for me. This is what I have. I've got a wysiwyg editor setup to write to a file called news.php. The file that has the editor is edit/index.php. It's just a simple textarea. The textarea is supposed to include news.php. For some reason, it won't let me include that file that is in a lower directory. The file that writes to news.php is called edit/write.php. edit/write.php doesn't write to news.php instead it writes to edit/news.php. The only reason I want to include the lower directory is so that I can put a .htaccess password protection on the edit directory. I'll include some code below. Code: (edit/index.php) [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr"> <head> <title>Editing News</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <script type="text/javascript" src="nicEdit.js"></script> <script type="text/javascript"> bkLib.onDomLoaded(function() { nicEditors.allTextAreas() }); </script> <form method="post" action="write.php"> <p> <textarea name="content" style="width:100%;height:1000px;"><?php include '../news.php';?></textarea> <input type="submit" value="Save" /> </p> </form> </body> </html> Code: (edit/write.php) [Select] <?php $File = "../news.php"; $Handle = fopen($File, 'w'); $Data = $_POST['content']; fwrite($Handle, $Data); fclose($Handle); header("Location: index.php"); ?> index.php is just a simple include news.php. Am I missing an easy step? Any help would be great!! Thanks! Hi, I am tryng to use the gd functions in php to output an image of a lower quality and save it as another image: Code: [Select] header('Content-Type: image/jpeg'); $im = @imagecreatefromjpeg('SDC10424.JPG'); imagejpeg($im, null, 50);// this line lowers the image quality imagedestroy($im); but the problem is how to save it? I tried file_put_contents, but it didnt work, like fileputcontents("test.jpg", $im); Is there any way to access a variable that is not assigned until further down the page eg: echo $myname; $myname = 'batman'; // clearly my real name which is why I am so poor at coding Thanks Hi, I have the following code: Code: [Select] case "Twitter"; echo 'Twitter gadget will show here'; break; I need to make it so it's like this: Code: [Select] case "Twitter" AND $member['top'] == "1" echo "Twitter Gadget will show here"; break; I need to add a IF onto the CASE is it possible? Thank you. hey guys im having a few problems with my query if anyone can please help...the two problems im having is
1.the total price returning as 00106. price = 100.00 and p_and_p = 6.00 in the database...im after a figure that looks like 106.00
2. @category will be a parameter like :category which will be binded to a value like 'al'l, 'videos', 'dvd's', but if the parameter is ALL i dont want to join my categories table allowing it to select all rows regardless of the category
any help, pointer would be truly appreciated...thank you
SELECT @category := 'Videos', i.item_id, i.title, i.price, i.p_and_p, SUM(i.price + i.p_and_p) AS `total_price`, i.listing, i.condition, CONVERT_TZ(DATE_ADD(i.start_date_time, INTERVAL concat(i.listing_duration) DAY), '+00:00', u.time_zone) AS `end_date_time` FROM items i LEFT JOIN sub_categories sc ON sc.sub_category_id = i.sub_category_id CASE @category != 'All' THEN LEFT JOIN categories c ON c.name = 'Videos' END CASE JOIN users u WHERE u.user_id = '7' AND MATCH (i.title, i.description) AGAINST ('bla' IN BOOLEAN MODE) AND i.start_date_time < NOW() AND DATE_ADD(i.start_date_time, INTERVAL concat(i.listing_duration) DAY) >= NOW() GROUP BY i.i Anyone know how to force URL with SSL with www.
<rewrite> <rules> <rule name="Redirect to HTTPS" stopProcessing="true"> <match url="(.*)" /> <conditions><add input="{HTTPS}" pattern="^OFF$" /> </conditions> <action type="Redirect" url="https://www.site.com/{R:0}" redirectType="SeeOther" /> </rule> </rules> </rewrite>Please check the sample. I'm trying to force a NULL value into the database with a hidden value and I can't seem to get it to work. Any suggestions? <input type="hidden" name="inactive" value=""/> I also tried here too: $sql="UPDATE product SET inactive='NULL' WHERE id = '$item_id'"; Is there a way so when someone loads your website that it forces them to load it in a different browser? How do I make the username and password checking CASE SENSITIVE? $result=sprintf("SELECT * FROM db WHERE username = '%s' AND watchword ='%s'", mysql_real_escape_string($username), mysql_real_escape_string($password)); Thanks. Bickey. i've read and seen there are variations of what im trying to achieve but havent seen a exact example...what im trying to do is put a where clause in my query depending on if a set variable has a value
CASE WHEN (@category_id IS NOT NULL) THEN LEFT JOIN sub_categories sc ON sc.sub_category_id = i.sub_category_id JOIN categories c ON c.category_id = sc.category_id AND c.category_id = :category_id ENDis this possible or have i just got the syntax wrong somewhere...thank you guys can i do something like this? Code: [Select] <?php switch ($i) { case 0: echo "i equals 0";?> ////////////// html stuff //////// <?php break; case 1: echo "i equals 1"; ?> ///////////////////html stuff////////////// <?php break; case 2: echo "i equals 2"; ?> ////////////html stuff/////////////// <?php break; } ?> I need to make the following code work without case sensitivity. For example, if this was processed, I would like for $message to be changed from "Stupid is not a nice word. Ugly is not nice either." to "unintelligent is not a nice word. unattractive is not nice either." For my purposes, I don't care that the capitalization changes, I just need the $goodwords to be replaced with the $badwords regardless of capitalization. Any ideas here? Code: [Select] <?php $message = "Stupid is not a nice word. Ugly is not nice either."; $badwords = array("stupid", "ugly"); $goodwords = array("unintelligent", "unattractive" ); $message = str_replace($badwords, $goodwords, $message); ?> hi, i just wanted to know... $arr[0] $arr[1] $arr[2] also this $arr[1] would be called a value, but how are the numbers 0,1 and 2 called? are that keys? didn't know where else to post this question. <?php $totalcreditstd = $row_rsCreditPurchaseMoney['SUM(quantity)']; $totalcreditsdollar = $totalcreditstd * $Mutliplier; echo $totalcreditsdollar; ?> I'm using the above calculation to display a total amount. Problem is that if the calculation total is 7.5 I want it to show up as 7.50 I want to force the second number. How can I do that? Thanks. Is there any way to have php filter out negitive numbers where it counts it as zero instead? so the math im doing in a string can never go negitive been looking online for a hour cant seem to find anything that does this. I am not a programmer, but I'm a webmaster facing a problem. I have a website and people are hotlinking to my .swf files. I do not want to stop all hotlinking though, instead is what I want to do, and want to know if it's possible to do, is this: Can I get it so that people that hotlink to flash files, get an ad before the flash loads, without editing the "real" .swf? For example: 1. I post the actual .swf file to my site. 2. Then someone embeds a direct link to that .swf file on their site or blog, etc. 3. My server, when serving .swf files realizes when the .swf file isn't coming from my domain. 4. It makes the direct .swf embed be an embed to a wrapper (I think is what it would be called) type of flash file that has an ad and a start button. 5. The real .swf file is loaded on the external domain once the start button is clicked in the "wrapper". Few questions: 1. So again, my question is this, is something like this possible, so I can gain some money from those sites ALREADY hotlinking to the .swf files on my server? 2. If this isn't possible to get on already previous hotlinked .swf files, is something like the example mentioned above possible from a new start, so that when people link to an .swf file on my site, they think they're getting the file, but in reality they're getting the wrapper that displays the ad first, and then it calls the real .swf file? 3.I am not currently looking for a programmer to do this work, but I am interested in a rough estimate so I can make plans on how I should proceed for my current problem. Thanks for any input you can provide me with on this subject. Sorry if this is more about flash programming than php programming, I don't know how it would be programmed. hello dear php-experts on my notebook an Akoya P 6512 15" AMD Athlon X2 P320, 2,10 GHz, 4 GB that runs OpenSuse 13.1 i want to prepare the new installation of opensuse 13.1 but i cannot boot from a my DVD with the openSuse 13.2 b. my cd with the Gparted i tried out to enter the boot menu with f 2 - and subesquently editing the boot-device f 10 and switching the boot device nothing works - i have no glue what i can do now ? note : i run the following BIOS American Megatrends version 02.61 i need your help now - should i do a bios ubdate or what? many thanks for any and all help |