PHP - Ultimate Challenge On Browsers
Hi
If any one has any spare time or is intrigued in any way. I am constructing a website forum like the one you use. This one requires a log on. It works in FF 6.0, Opera Safari and Chrome but not in IE 8.0. I have filled in the passwords(s) extra security. http://www.des-otoole.co.uk/streetangels/ Many thanks if you can work it out. You just need to push the button (login) Similar TutorialsHi guys,
I’d appreciate a little guidance but I’m gonna struggle to explain what the problem is first… so apologies in advance.
$drawOrder is an array of 1 to 10 letters that are drawn at random
Array
(
[101] => C
[102] => F
[103] => D
[104] => J
[105] => B
[106] => H
[107] => I
[108] => G
[109] => E
[110] => A
)
$bestOrder contains the same values as $drawOrder but the letters are given a priority.
Array
(
[0] => A
[1] => B
[2] => C
[3] => D
[4] => E
[5] => F
[6] => G
[7] => H
[8] => I
[9] => J
)
$bestPossibleOrder – I want this to contain the closest order possible to $bestOrder based on the draw order and 3 letter draw limit
Array
(
[101] => C
[103] => D
[105] => B
[102] => F
[106] => H
[108] => G
[109] => E
[110] => A
[107] => I
[104] => J
)
$availableLetters contains 3 letters that are drawn according to $drawOrder.
Array
(
[101] => C
[102] => F
[103] => D
)
add “[101] => C” to $bestPossibleOrder array
remove “[2] => C” from the $bestOrder array because the letters are not always unique
add “[104] => J “ to $availableLetters because it is next in the draw order.
Array
(
[102] => F
[103] => D
[104] => J
)
add “[103] => D” to my $bestPossibleOrder array
remove “[103] => D” from the $bestOrder array because the letters are not always unique
add “[102] => B“ to $availableLetters because it is next in the draw order.
Array
(
[102] => F
[104] => J
[102] => B
)
Repeat the process until all letters are in the $bestPossibleOrder array
Array
(
[101] => C
[103] => D
[105] => B
[102] => F
[106] => H
[108] => G
[109] => E
[110] => A
[107] => I
[104] => J
)
I’ve attached what I’ve written so far but I’m not sure if it’s a good approach
<?php $BR = "<br />"; echo "best order:" . $BR; $bestOrder = array("A","B","C","D","E","F","G","H","I","J"); print ("<pre>" . print_r($bestOrder, true) . "</pre>"); echo "draw order:" . $BR; $drawOrder = shuffle_assoc($bestOrder); $drawOrder = array_combine(range(101,(count($bestOrder)+100)),$drawOrder);// $drawOrder array keys have to start from 101 print ("<pre>" . print_r($drawOrder, true) . "</pre>"); echo "available Letters (FIRST DRAW):" . $BR; $availableLetters = array_slice($drawOrder, 0, 3,true); print ("<pre>" . print_r($availableLetters, true) . "</pre>"); $numberToPick = selectNextNumber($bestOrder,$availableLetters); echo "The key with the closest letter to best order is [" . $numberToPick . "]"; function selectNextNumber($bestOrder,$availableLetters){ for ($x = 0; $x <= count($bestOrder); $x++){ $numberToPick = array_search($bestOrder[$x], $availableLetters); if ($numberToPick !== false) { //unset($bestOrder[$x]); //print ("<pre>" . print_r($bestOrder, true) . "</pre>"); return $numberToPick; } } } function shuffle_assoc($list) { if (!is_array($list)) return $list; $keys = array_keys($list); shuffle($keys); $random = array(); foreach ($keys as $key) { $random[$key] = $list[$key]; } return $random; }
Hi, My code below only allows me to search exact terms and therefore does not allow for spelling mistakes of names etc. Please can somebody advise how I can alter the code below to allow a user to search part of the search criteria and still retrieve results e.g. a search for "business" would return "business analysis", "business architecture" and so on. Any help would be greatly appreciated. $sql="SELECT DISTINCT First_Name, Last_Name, l.Resource_ID FROM ((resource l inner join resource_skill ln on l.Resource_ID = ln.Resource_ID) inner join skill n on ln.Skill_ID = n.Skill_ID) WHERE First_Name LIKE '$fname' OR Last_Name LIKE '$lname' OR Skill_Name LIKE '$skill'"; Thanks a lot! Paul How effective is Captcha anymore? How does using Captcha compare to using a Challenge Question like "2 + 3 = ??" I am creating a form on my website where users can e-mail me their comments - although my e-mail is hidden - and I don't want this to become a spam-magnet?! Debbie Hey guys. Sorry to start asking questions being such a new member but this just suddenly came up. I have a php script that needs to send binary data to another php script via HTTP. The data can be transferred through the methods GET and POST, preferably POST and preferably not as a file. The problem is that I have tried a number of ways to do this but every time the data seems to be corrupted. Some bytes stay the same but others disappear or change. I guess that they transfer through ASCII mode instead of BINARY but couldn't find any way to fix this. Any help would be deeply appreciated. Cheers. Hi All! First post here - I'm a bit of a self taught PHP junkie I'm having some issues with the following php/MySQL code. The issue is with Internet Explorer (surprise, surprise) I have setup an if statement so that the long description field in the form comes up as a text area (based on the max-length property of the mySQL field.), while the shorter fields come up as text fields. The issue is that in IE, none of the shorter fields preceding the Long Description Text Field show up - ie. the form is lacking a couple of necessary fields. Works perfectly well in Firefox. <form id="addprod" name="addprod" action="" method="get" enctype="multipart/form-data"> <?php require_once($_SERVER['DOCUMENT_ROOT'].'/resources/db/viewer_connect.php'); $table = 'products'; $fieldQuery = "SELECT * from $table"; $result = mysql_db_query($dbname,$fieldQuery) or die('<span class="body_text">Query Error: '.mysql_error().'</span>'); $i = 0; $prInfo = array('PROD_ID'=>'Product ID', 'PROD_NAME'=>'Product Name', 'PROD_DESC_SHORT'=>'Product Description (Short)', 'PROD_DESC_LONG'=>'Product Description (Long)', 'MODEL_1'=>'Model 1', 'MODEL_2'=>'Model 2', 'MODEL_3'=>'Model 3', 'MODEL_4'=>'Model 4', 'MODEL_5'=>'Model 5', 'RRP_1'=>'Model 1 RRP($)', 'RRP_2'=>'Model 2 RRP($)', 'RRP_3'=>'Model 3 RRP($)', 'RRP_4'=>'Model 4 RRP($)', 'RRP_5'=>'Model 5 RRP($)', 'PROD_IMG'=>'Main Image', 'IMAGE_2'=>'Image 2', 'IMAGE_3'=>'Image 3'); while ($i < mysql_num_fields($result)) { $meta = mysql_fetch_field($result, $i); if (!$meta) { echo "No information available<br />\n"; } if($meta->max_length<=256){ if($meta->name=='PROD_IMG'||$meta->name=='IMAGE_2'||$meta->name=='IMAGE_3'){ echo '<p class="body_text"><label for="'.$meta->name.'">'.$prInfo[$meta->name].':<input name="'.$meta->name.'" type="file" size="50" maxlength="'.$meta->max_length.'" /></label></p>'; } else{ echo '<p class="body_text"><label for="'.$meta->name.'">'.$prInfo[$meta->name].':<input name="'.$meta->name.'" type="text" size="50" maxlength="'.$meta->max_length.'" /></label></p>'; } } else{ echo '<p class="body_text" style="line-height:150px; vertical-align:top;"><label for="'.$meta->name.'">'.$prInfo[$meta->name].':<textarea name="'.$meta->name.'" cols="50" rows="10" /></p>'; } $i++; } mysql_free_result($result); ?> <p class="body_text"><input type="submit" value="Add New Record" /><input type="reset" value="Clear Form" /></p> </form> Any thoughts would be awesome!! Thanks in advance, Tim Hi All Thanks in advance for your help. I want to have to following query string Type=myparam&Username=dazd&Password=nk98830&id=0&Cols_Returned=numfrom,sentdata But my code returns the following Type=myparam&Username=dazd&Password=nk98830&id=0&Cols_Returned=%2F%22numfrom%2F%22%2C%2F%22sentdata%2F%22 Below is the code: $data= array( "Type"=> "myparam", "Username" => "dazd", "Password" => "nk98830", "id" => "0", "Cols_Returned" => '/"numfrom/",/"sentdata/"' ) ; //This contains data that you will send to the server. $data = http_build_query($data); //builds the post string ready for posting echo "The Query String is "; echo $data; Regards LOL note the topic is a pun at Help Vampires... I actually have an unchallenging question. I'm trying to echo out a column in a MySQL table. I'm getting one field echoing, but not the others: I'm using this code style, but I've made a small mistake somewhere at the end, I've tried many combinations trying to fix it, but haven't succeeded.. $query = "select email from newsletters"; $result = mysql_query($query); $row = mysql_fetch_array($result); foreach ($row as $email) {echo $email;} I got the argument foreach() straight out of the manual and copied the syntax style exactly as was demonstrated in the example, but its still not working. What have I done wrong? I have several images created with a Kodak electronic camera and my iPhone. All images are displayed with the correct orientation (portrait or landscape) in the HTML code. The HTML code is wrapped inside a brief PHP code to enable password entry, and the PHP code is uploaded to my Web site along with the images. I have examined the images on my Web site using Web browsers in Windows 10 and Apple MacBook Air. The orientation is incorrect for at least one of the images in each browser -- Internet Explorer, Firefox, Chrome and Safari. Although a majority of the images are oriented correctly, incorrect rotation occurs for some of the phone and Kodak images. I shall provide more information to anyone who can provide me with help and suggestions, which will be much appreciated. Thank you spruce18b
Hi! Top I'm creating a learning tool where people can paste in information and learn about random subjects.
Ideally for a desktop view eg. widescreen, a browser/search engine is on the left, and the interface is on the right.
So I need to embed a browser, I have tried to embed Google but I think, obviously, that they do not permit that.
I have seen possible alternatives like Chromium or Mozilla not firefox, something else "Gecko?"
Anyway, aside from not knowing what a browser is... for example how else can you access a website without a browser, SSH right? But it's about parsing / interpreting the languages correctly...
So what options do I have? Or should I just optimize the website to be used split screen with a browser in a separate tab? (Currently what I'm doing).
I have a Create new account page. The form is in page named Register.php and once user submit it, it will go to Confirm.php, where it validates the field if everything is correct shows the " Account Created " Message. In Chrome. The error message is shown in Register.php and once all fields are filled then only will show confirm.php. But in Mozilla, it goes to Confirm.php and shows a blank page. My code for Register.php is : Code: [Select] <div class="signup_form"> <form action="confirm.php" method="post" > <?php session_start(); if(isset($_SESSION['error'])) { echo '<p>'.$_SESSION['error']['username'].'</p>'; echo '<p>'.$_SESSION['error']['email'].'</p>'; echo '<p>'.$_SESSION['error']['password'].'</p>'; unset($_SESSION['error']); } ?> <p> <font size="3" face="arial" color="gray"> <label for="username"><b> UserName*</b> </label> </font> <input name="username" type="text" id="username" input style="height:33px" size = "50" size="30"/> </p> <p> <font size="3" face="arial" color="gray"> <label for="email"><b> E-mail Address*</b> </label> </font> <input name="email" type="text" id="email" input style="height:33px" size = "50" size="30"/> </p> <p> <font size="3" face="arial" color="gray"> <label for="password"><b> Password*</b> </label> </font> <input name="password" type="password" id="password" input style="height:33px" size = "50" size="30"/> </p> <p> <input name="submit" type="image" src="images/submit.gif" value="submit"/> </p> </form> </div> and for Confirm.php code is : Code: [Select] <?php session_start(); include('configdb.php'); if(isset($_POST['submit'])) { if($_POST['username'] == '') { $_SESSION['error']['username'] = "User Name is required."; } if($_POST['email'] == '') { $_SESSION['error']['email'] = "E-mail is required."; } else { if(preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/", $_POST['email'])) { $email= $_POST['email']; $sql1 = "SELECT * FROM user WHERE email = '$email'"; $result1 = mysqli_query($mysqli,$sql1) or die(mysqli_error($mysqli)); if (mysqli_num_rows($result1) > 0) { $_SESSION['error']['email'] = "This Email is already used."; } } else { $_SESSION['error']['email'] = "Your email is not valid."; } } if($_POST['password'] == '') { $_SESSION['error']['password'] = "Password is required."; } if(isset($_SESSION['error'])) { header("Location: register.php"); exit; } else { $username = $_POST['username']; $email = $_POST['email']; $password = $_POST['password']; $sql2 = "INSERT INTO users (username, email, password) VALUES ('$username', '$email', '$password')"; $result2 = mysqli_query($mysqli,$sql2) or die(mysqli_error()); if($result2) { echo '<div>Your account is now active. You may now <a href="login.php">Log in</a></div>'; We are trying to capture customer details & redirecting the customer to payment gateway page and, after succesful transaction from payment gateway we are facing a problem for different browsers. Ideally after successful transaction the page should redirect to order confirmation page but it is redirecting to our cart page.In IE7 it is working fine but in mozilla firefox it is redireting to cart page.On analyzing we found that session is not persisting in firefox. Please help we have stuck here Suggest something if you have faced similar issue with different browsers. |