PHP - Noob Quest About Conditionals
Hi
Sorry, realise this is a bit of a noob question but can someone explain why this if statement uses multiple parenthesis? Is this a good way of grouping conditionals and when should you use it? Code: [Select] if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 20000)) Similar TutorialsI'm new to PHP and I'm having trouble doing what I'd like to do with it. I'm working with WordPress and the Thematic framework, creating a child theme to exhibit the artwork of a friend. The background to this project, my working with PHP can be found here. I'm basically trying to create a function that applies CSS to a particular part of the site (in this case the div id "hentry",) changing the background image of the div to the featured image of that particular post. The function should also detect whether the page is showing a single page or post, so it should style these pages differently by making the background image = none. What is the best way to say... If more than two of these if's are satisfied, do this... Code: [Select] if ((isset($_POST['credentials'])) && ($_POST['credentials'] != $r['credentials'])) { $details = ''; update_user_actions(2, $details); } if ((isset($_POST['specialties'])) && ($_POST['specialties'] != $r['specialties'])) { $details = ''; update_user_actions(3, $details); } if ((isset($_POST['personalweb'])) && ($_POST['personalweb'] != $r['personalweb'])) { $details = $_POST['personalweb']; update_user_actions(4, $details); } I have a method where the operator condition started getting too long and was becoming difficult to understand and troubleshoot. private function validateCallbackRequest():self { if($this->params->xyz < 3 || isset($this->x->bla['hi']) || soOnAndSoOnAndSoOn) { throw new Exception('Invalid params'); } return $this; } I could break it into sections, but would rather not duplicate all the exception throwing. private function validateCallbackRequest():self { if($this->params->xyz < 3 || isset($this->x->bla['hi'])) { throw new Exception('Invalid params'); } if(soOnAndSoOnAndSoOn) { throw new Exception('Invalid params'); } return $this; } I could assign variables, but don't really care for this all that much. private function validateCallbackRequest():self { $initialStuff=$this->params->xyz < 3 || isset($this->x->bla['hi']); $otherStuff=soOnAndSoOnAndSoOn; if($initialStuff || $otherStuff) { throw new Exception('Invalid params'); } return $this; }
Any recommendations? Please bear with me. In an html file there is an <!-- BEGIN poll --> ..... <!-- END poll --> I need to draw a separation hr between all rows escept the first one. I believe I need a counter. Please show me how to do this. Thank you. Hello, I'm new to this forum, and I have just spend half an hour typing out my question as complete as possible, and just before I wanted to hit the "Post" button, I pressed "why not?" out of curiousity @ Read the rules before you post! We will NOT edit/delete your content (why not?)! so I lost everything I wrote. Anyway. I'll shortly retype it all: I'm a Dutch student - therefore my English isn't that good, I'm sorry for that - and for school, I have to make a website. It has to include a CMS system, a search-box, a contactform, Google Analytics and Google Maps. In the meantime, I don't even seem to be able to write 3 php lines properly. When I tried to, and uploaded my work, my site (www.amstel-webdesign.nl) told me: Parse error: syntax error, unexpected T_STRING in /home/amstelwd/domains/amstel-webdesign.nl/public_html/index.php on line 119 Hereunder, please find the source: Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Amstel webdesign & graphics</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <!-- header start --> <div id="header"> <ul> <li><a href="">Homepage</a></li> <li><a href="">Over ons</a></li> <li><a href="">Webdesign</a></li> <li><a href="">Graphics</a></li> <li><a href="">Prijzen</a></li> <li><a href="">Contact</a></li> </ul> </div> <!-- header end --> <!-- body start --> <div id="body"> <div class="left"> <a href="#" title="Over ons"><img src="images/hobby_profession.png" alt="Onze hobby is ons beroep geworden..." width="780" height="305" border="0" /></a><br class="spacer" /> <br class="spacer" /> <h2><span>Home</span>page</h2><br /> <br /> <p>Is het niet ieders droom om van je hobby je werk te maken? Wij, webdesigners van Amstelland, zijn erin geslaagd die droom waar te maken. Als kleine jongetjes vonden wij het al leuk om met computers te spelen, inmiddels doen wij dat als werk. Maar dat betekent niet dat wij ons werk niet serieus nemen. Juist omdat wij zo van webdesign houden, zullen wij er alles aan doen om ervoor te zorgen dat het u aan niets ontbreekt. Wij zijn toegewijde professionals die plezier hebben in hun werk. En dat merkt u ook! Wij zijn niet vies van zware opdrachten of lastige problemen, we zien het als een uitdaging... </p> <p>Heeft u al een website, dan kunt u deze gratis door ons laten testen. Wij testen op een aantal essentiële onderdelen van uw site. U krijgt snel een kort, duidelijk en uiteraard vrijblijvend rapport, met daarin eventueel te verbeteren punten. Daarna heeft u de mogelijkheid om ons de punten in kwestie te laten verbeteren, en de website te laten onderhouden, tegen een scherp tarief. Heeft u interesse in een dergelijke test, maakt u dan een afspraak met ons. Als u het contactformulier invult, te vinden onder de menuknop <a href="">contact</a>, dan nemen wij zo spoedig mogelijk contact met u op. <br /> </p> </div> <div class="right"> <h2><span>Diensten</span></h2><br /> <ul> <li><a href="#">Webdesign </a></li> <li><a href="#">Consultancy </a></li> <li><a href="#">Onderhoud </a></li> <li><a href="#">CMS </a></li> <li><a href="#">SEO </a></li> <li><a href="#">Webshop ontwikkeling </a></li> <li><a href="#">Contactformulier ontwikkeling </a></li> <li><a href="#">Zoekfunctie ontwikkeling </a></li> <li><a href="#">Google Analytics </a></li> <li><a href="#">Google Maps </a></li> <li><a href="#">Mobiel </a></li> <li><a href="#">Huisstijl ontwikkeling </a></li> <li><a href="#">Drukwerk </a></li> <li><a href="#">Vertalingen </a></li> </ul> <br /><br /> <form method="post" action="#" name="search" class="search"> <label><span>Zoek</span>functie</label> <br class="spacer" /> <input name="search" type="text" id="search" /> <a href="#" title="Advance search">Geavanceerd zoeken</a><input name="" type="image" src="images/search_btn.gif" title="Search" class="searchBtn"/> </form> <form method="post" action="#" name="login" class="login"> <h2><span>Log-</span>in</h2><br class="spacer" /> <label>Naam</label><br class="spacer" /> <input name="name" type="text" id="name" /><br class="spacer" /> <label>Wachtwoord</label><br class="spacer" /> <input name="password" type="password" id="password" /><br class="spacer" /> <input name="" type="image" src="images/login_btn.gif" title="Login" class="loginBtn" /> </form><br class="spacer" /> </div> <br class="spacer" /></div> <!-- body end --> <!-- footer start --> <div id="footer"> <div class="footer"> <div id="nav_left"> <a href="" title="Home">Home</a> <br /> <a href="" title="Over ons">Over ons</a> <br /> <a href="" title="Webdesign">Webdesign</a> <br /> <a href="" title="Graphics">Graphics</a> <br /> <a href="" title="Prijzen">Prijzen</a> <br /> <a href="" title="Contact">Contact</a> <br class="spacer" /> </div> <div id="nav_center"> <a href="">Webdesign</a> <br /> <a href="">Consultancy</a> <br /> <a href="">Onderhoud</a> <br /> <a href="" title="Content Management System">CMS</a> <br /> <a href="" title="Search Engine Optimization / Zoekmachine Optimalisatie">SEO</a> <br /> <a href="">Webshop ontwikkeling</a> </div> <div id="nav_right"> <a href="">Google Analytics</a> <br /> <a href="">Google Maps</a> <br /> <a href="">Mobiel</a> <br /> <a href="">Huisstijl ontwikkeling</a> <br /> <a href="">Drukwerk</a> <br /> <a href="">Vertalingen</a> </div> </div> </div> <!-- footer end --> </body> </html> The php part is marked in red (I hope)... And line 119 is echo ("Amstel_webdesign_graphics" date ("Y")) Could someone please tell me what I'm doing wrong, and what it's all supposed to be? Before I uploaded my index.html with the php lines, my piece was xhtml 1.0 strict and had a valid CSS. I left part of the footer out, so if that created any mistakes (a </div> too many or not enough or such), it probably has nothing to do with the php fail. Thanks so much in advance. Anthony Hi there I'm new in the php coding and I just don't undestand most of all database settings etc... so I have something to do but I don't know exactly how so here is the thing: The disciplines are separated into modules. A module contains lectures and more than 1 group that gets exercises and practical training. The necessary number of the hours of a module is formed of the sum of the hours of lectures, exercises and practical training, multiplied by the numbers of the groups. The site has to give the possibility of: - Writing into new modules and lecturers. - Defining the number of groups (lectures, exercises, practical training) for a module. - Appropriating of groups and lecturers. - Visualizing the list of modules/lecturers. if you can help with advices or whatever you can I'll be very thankfull So I'm trying to learn PHP so that I can work with the SteamAPI.
I have previous coding experience (C, Java) and I'm uncertian on why my script isn't working.
API: https://github.com/a...teamweb-php-api
Error:
Parse error: syntax error, unexpected '[' in index.php on line 51
Line 51:
$parameters = ['key' => STEAM_WEB_API_KEY];From what I've understood, the script is trying to create an array called "parameters" and inside it's trying to create a variable called "key" which is going to hold the constant "STEAM_WEB_API_KEY". This constant is suppose to be loaded from a file called "steamwebapi_config.php" which looks like the following: <?php /** * Steam Web PHP API */ const STEAM_WEB_API_KEY = 'your steam api key that is given by vavle';I didn't attach my actual key in the script above for obvious reasons. I have no idea how to fix this issue nor what is casuing it. Again, I'm not experienced with PHP and I'd appreciate any help you guys can give me! Thanks to anyone who helps. I had a developer working on stuff for my site and he died before he got to the uploader. I am not a programmer. I can alter a few basic things, but this is beyond me. I found this basic uploader that I could edit the locations, file types, etc. It is missing one area of functionality that I need, the ability to define how many upload fields through a variable (which is set in an earlier form). So for example $fields = "3" then 3 upload fields appear with descriptions set by variables (for examples sake...front and then upload area, back and then upload area, misc. and upload area). I know this might not make a lot of sense. If you need any clarification please contact me. Any help would be much appreciated! well, here's my problem, im new to php, i currently working on this mini online shop the picture will explain it well, i've managed to create the receipt per shop but i cant do the receipt of the overall shopping here is my code: <html> <head> <title>My Shop 4</title> <script type="text/javascript"> function gohome() { window.open("receipt.php","_self"); } function changeshop() { window.open("home.html","_self"); } </script> </head> <body> <form action="" method="POST"> <input type="checkbox" name="prod1" id="prod1"\ value=10>Product 1 10.00php<br> <input type="checkbox" name="prod2" id="prod2"\ value=20>Product 2 20.00php<br> <input type="checkbox" name="prod3" id="prod3"\ value=30>Product 3 30.00php<br> <input type="checkbox" name="prod4" id="prod4"\ value=40>Product 4 40.00php<br> <input type="checkbox" name="prod5" id="prod5"\ value=50>Product 5 50.00php<br> <input type="submit" name="submit" id="submit" value="Buy!!"><br> <?php $det = 4; require("../Labphp/lab.php"); shop($det); ?> </form> </body> </html> and here's the php part <?php $total = 0; $total3 = 0; $total4 = 0; $recent ="HAHAHA"; global $total,$total3,$total4,$recent; ?> <?php function shop($num) { $value1 = $_POST['prod1']; $value2 = $_POST['prod2']; $value3 = $_POST['prod3']; $value4 = $_POST['prod4']; $value5 = $_POST['prod5']; $sum=0; $sum = $value1 + $value2 + $value3 + $value4 + $value5; if($sum!=0) { echo "Selected Products<br>"; echo "Product Name       Price<br>"; if($value1==true) { echo "Product 1              10.php<br>"; } if($value2==true) { echo "Product 2              20.php<br>"; } if($value3==true) { echo "Product 3              30.php<br>"; } if($value4==true) { echo "Product 4              40.php<br>"; } if($value5==true) { echo "Product 5              50.php<br>"; } echo "Total                     $sum php<br>"; if($num==4) { $total4=$sum; $recent.="Shop 4                  $total4 php<br>"; } else if($num==3) { $total3=$sum; $recent.="Shop 3                  $total3 php<br>"; } $total = $total4 + $total3; echo "$recent              $total"; echo "<input type='button' name='go' id='go' value='Choose Another Shop' onclick='javascript:changeshop();'>"; echo "<input type='button' name='end' id='end' value='End Shopping' onclick='javascript:gohome();'>"; } } function getshopping() { return $recent; } ?> the receipt code <?php require("../Labphp/lab.php"); ?> <html> <head> <title>Official Receipt</title> </head> <body <?php echo $_REQUEST["'$recent'"]; ?> </body> </html> Hi all i have a silly noob question.... When i directly query my database with the following i get the exact result i want....... Code: [Select] SELECT * FROM posts WHERE postTopic=3 AND postSubject=business; However when i try this using the following PHP....... $sql = "SELECT * FROM posts WHERE postTopic =" . mysql_real_escape_string($_GET['id']) . "AND postSubject='" . $_SESSION[forum] . "'"; I get no result I also get the correct results from $sql = "SELECT * FROM posts WHERE postTopic =" . mysql_real_escape_string($_GET['id']) . "; and $sql = "SELECT * FROM posts WHERE postSubject='" . $_SESSION[forum] . "'"; mysql_real_escape_string($_GET['id']) is an integer and $_SESSION[forum] is a string. I know this has something to do with the manner in which the query is passed with the AND and the string but i can't for the life of my work out where i am going wrong. Thanks for any help. Hi guys, forum noob here. I'm very new to php and i'm trying to build a simple food order shopping cart. I'm using DW as a crutch at the moment just to get a feeling of how php works. I have a page where a user can select food extras to add to thier food item using checkboxes. heres the recordset for getting extras. $colname_rs_addedextras = "1"; if (isset($_GET['idfooditem'])) { $colname_rs_addedextras = $_GET['idfooditem']; } mysql_select_db($database_dbconnect, $dbconnect); $query_rs_addedextras = sprintf("SELECT extra.idextra, extra.extraName, extra.extraPrice, addedextras.extraFree FROM addedextras, extra WHERE fooditemID = %s AND addedextras.extraID = extra.idextra", GetSQLValueString($colname_rs_addedextras, "int")); $rs_addedextras = mysql_query($query_rs_addedextras, $dbconnect) or die(mysql_error()); $row_rs_addedextras = mysql_fetch_assoc($rs_addedextras); $totalRows_rs_addedextras = mysql_num_rows($rs_addedextras); Here is the code i'm strugling with. // Submit to Order Form ///////////////////////////// if (isset($_POST["addtoorderButton"])) { mysql_query("INSERT INTO cart(cookieID, customerID, fooditemID, foodItemName, foodItemPrice) VALUES('$cookieID', '$customerID', '$fooditemID', '$foodItemName', '$foodItemPrice' ) ") or die(mysql_error()); if ($_POST['checkbox'] != NULL) { $cart_id = mysql_insert_id(); foreach($_POST['checkbox'] as $key => $value) { $extraName = $row_rs_addedextras['extraName']; $extraPrice = $row_rs_addedextras['extraPrice']; $extraFree = $row_rs_addedextras['extraFree']; //echo $key; mysql_query("INSERT INTO cartextras(cartID, cookieID, extraName, extraID, extraPrice, extraFree) VALUES('$cart_id', '$cookieID', '$extraName', '$key', '$extraPrice', '$extraFree') ") or die(mysql_error()); } } } The code kinda works, I just can't figure out how to add the extraPrice and extraFree also. Any kind of guidence would be very apprieated as I have been trying to figure this out for a couple of days now, wanted to figure it out by myself because I think to learn faster that way. I get to errors below and cannot figure out what im doign wrong i've tryed diffrent ways and have even rewritten this couple times (#1error) not sure how to re query and echo out the array?? (#2error) gives me error on line 14 if i echo anything past (echo $row['name']."|user1:". $row['user1']. "|user2:". $row['user2']. ->this Code: [Select] <?php $conn = mysql_connect("localhost", "root", ""); if (!$conn) { echo "Unable to connect to DB: " . mysql_error(); } if (!mysql_select_db("register_db")) { echo "Unable to select mydbname: " . mysql_error(); exit; } $result = mysql_query("SELECT * FROM register_vote WHERE name = '{$_POST['user']}'"); if (!$result) { echo "Could not successfully run query ($sql) from DB: " . mysql_error(); exit; } =========================(#1error)========================================== //THIS IS THE CODE I'M HAVING ISSUES WITH if (mysql_num_rows($result) == 0) { mysql_query("INSERT INTO register_vote (name) VALUES ('$_POST[user]')"); //need it to the query new results after insert //then // echo $row['name']."|user1:". $row['user1']. "|user2:". $row['user2']. "|user3:". $row['user3']; }================================================= (#2error)=================================== while ($row = mysql_fetch_array($result)) { echo $row['name']."|user1:". $row['user1']. "|user2:". $row['user2']. "|user3:". $row['user3']; } //when I put anything past $row['user2']. it gives me error on line 14 mysql_free_result($result); ?> Ok, I am sure this is really simple for all of you, but I have very little experience with php. I haven't sat down to learn php yet, but I will when I have more free time. In the meantime I have the following issue: The site is http://astoryaday.fromyay.com/ I have all the stories in the /stories/ directory, all named 20110504.html, 201105005.html, etc. Every day I write another story, I name it following that pattern, and drop it into the /stories/ folder. I only want the newest story displayed on the page. So I wrote a little script that is: Code: [Select] <?php $files = glob("stories/*.html"); sort($files); $newest = array_pop($files); include($newest); ?> Now, what I want to do, is in the footer, put an Archive that will look like this: -2012 --January ---03 ---02 ---01 -2011 --December ---31 ---30 And upon clicking on the dates, the story from that day will replace the story that is currently included. Any help of how to get this done would be appreciated! Thanks Ok so heres the deal, my friend wrote this for me, hes currently unavailable and i messed it up a bit. http://pastebin.com/k937xDve < there is the code. all i did is add the Code: [Select] target="name" onclick="window.open('http://www.web-hosting-service.org/green-certified.php?greensite=.$domain.','name','height=255,width=250,toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no'); return false;" bit. and now i get the error Parse error: syntax error, unexpected T_STRING in seal-generator.php Hi guys! Total noob here that needs a bit of help creating a form. I have gotten this piece of code and want people to optin with Name and email. Let me send the code first: Request for PHP language: <?php $apiUrl = "https://udimi.com/api/affgen/addref"; $headers = [ "Content-Type: application/json", "Auth: MY AUTH CODE HERE" ]; $referral = [ 'fullname' => 'Referral Fullname', 'email' => 'refemail@domain.com' ]; $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => $apiUrl, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => false, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => json_encode($referral), CURLOPT_HTTPHEADER => $headers ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } Success JSON response (HTTP status code: 200): {"error": false} Failed JSON response (HTTP status code: 200): {"error": "Pass identity verification and earn a commission as Udimi affiliate."} POST fields: fullname: required, 2-25 chars, only English letters. email: required So I figured I need to create a html file with a simple form, so I created this: <fieldset> <legend>Form</legend> <form action="test.php" method="post"> <label>Full Name: </label><input type="text" name="fullname" /><br /> <label>Email: </label><input type="text" name="email" /><br /> <input type="submit" name="submit" value="submit" /> </form> </fieldset> The problem is that I got it populate something when entering the form but the name was "Referral Fullname" as the code and the email was "refemail..." as the code. It did not grab my input. Any pointers here? Should I approach it in another way? Hi. I'm currently taking a class in PhP and I'm having issues getting my code to work. I "borrowed" part of the code from elsewhere (but I fully understand each line - which is really the point of learning) I'm hoping a second set of eyes might help on what's wrong: I'm running Wamp Server v2.0 on my local PC to test the scripts... I'm sure I'm probably going to have more then just this error with the script, but it's hard to move forward when you're stuck spinning your wheels. Any help would be greatly appreciated... and any suggestions as to a better way to approach this would be welcome as well. I am here to learn after all Here's the error I'm getting: Notice: Undefined variable: fname in C:\Web Server\wamp\www\daystoxmas.php on line 8 Please return to the main page and enter your First Name. Here's the HTML Code: <!DOCTYPE html PUBLIC "-//W3C/DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/ xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Days to Christmas Form</title> </head> <body> <div><p><h1>Days to Christmas Form</h1></p> <p>- Programmed by: Michael Custance</p> <form action="daystoxmas.php" method="post"> <p>First Name: </select><input type="text" name="fname" size="20" /></p> <p>Last Name: </select><input type="text" name="lname" size="20" /></p> <p>E-mail Address: <input type="text" name="email" size=20 /></p> For Christmas gift ideas, click here! <input type="submit" name="Submit" value="Christmas Gift Page" /> </form> </body> </html> And here's the PhP Form: <HTML> <HEAD> <TITLE>daystoxmas.php</TITLE></HEAD> <BODY> <?php if ($fname) { print ("Good "); if (date("A") == "AM") { print ("morning, "); } elseif ( (date("H") >= 12 ) and (date("H") < 18) ) { print ("afternoon, "); } else { print ("evening, "); } print ("$FirstName<P>"); $Christmas = mktime(0, 0, 0, 12, 25, date('Y')); $today = mktime(); $seconds_to_christmas = $Christmas - $today; $days_to_christmas = $seconds_to_christmas / 86400; $days_to_christmas = floor($days_to_christmas); $temp_remainder = $seconds_to_christmas - ($days_to_christmas * 86400); $hours = floor($temp_remainder / 3600); $temp_remainder = $temp_remainder - ($hours * 3600); $minutes = round($temp_remainder / 60, 0); echo '<p>There is ' . $days_to_christmas . ' days and ' . $hours . ' hours and ' . $minutes . ' minutes until Christmas</p>'; } else { print ("Please return to the main page and enter your First Name."); } ?> </BODY> </HTML> But how do I check input to make sure that the input has to be seperated by commas and has to be a integer like "1,2,3,4,5" is correct if a user puts "1,:25,,l2@" or something funky, I can error out Thanks also is there a php function that does this already? and is this way safe? im trying to store comma seperated id's I'm sorry if this seems like a stupid question, but I'm having trouble with this encryption and I'm a real noob at PHP. This is for a registration form going into a mysql DB for integration with a gaming server that must use a Whirlpool Salt Hash encryption. These are the variables for my form: userPassword userName userEmail This was my original encryption script (MD5) Code: [Select] $_POST['userPassword'] = md5($_POST['userPassword']); This is the function that I am given to integrate into my website system: Code: [Select] function encryptPassword($password) { $salt = substr(hash('whirlpool', uniqid(rand(), true)), 0, 12); $hash = hash('whirlpool', $salt . $password); $saltPos = (strlen($password) >= strlen($hash) ? strlen($hash) : strlen($password)); return substr($hash, 0, $saltPos) . $salt . substr($hash, $saltPos); } I've tried inserting the variable $_POST['userPassword'] in place for $password, but it gives me errors... I'm stuck here, could someone show me how to properly integrate this? I think the problem isn't getting the password into the function but catching the returned variable Sorry for my noobishnness, -Nolam EDIT: I'm also given this for the login page to check the hash. If you could help me with this it would be greatly appreciated to. Thanks!!! Code: [Select] function checkPassword($realPass, $checkPass) { //check for old encryption (md5 or whirlpool) if (strlen($realPass) == 32 || strlen($realPass) == 128) { $hash = (strlen($realPass) == 32 ? md5($checkPass) : hash('whirlpool', $checkPass)); if ($realPass == $hash) { // change password to new encryption? return true; } else return false; } // xAuth 2 encryption $saltPos = (strlen($checkPass) >= strlen($realPass) ? strlen($realPass) : strlen($checkPass)); // extract salt $salt = substr($realPass, $saltPos, 12); $hash = hash('whirlpool', $salt . $checkPass); return substr($hash, 0, $saltPos) . $salt . substr($hash, $saltPos) == $realPass; } OK so sorry if my understandings a bit off, but if a I want to introduce a class into my doc is the best way to fo this with the include() function? I work with PHP and I'm not good with JS.
I want to use a Twitter Boostrap tab funnction: http://getbootstrap....avascript/#tabs
I need some guidance how it uses the JS code mentioned.
The code below taken from the Bootstrap page is obvious enough:
$('#myTab a').click(function (e) { e.preventDefault() $(this).tab('show') })What I do not understand is how I am required to use the following code in the context of the previous code. Ok, I get that I have to choose one option, but I don't get how they fit together and I do not get how I can have 5-7 tabs and how they will be highlighted one after the other as per the given example on the Bootstrap page : $('#myTab a[href="#profile"]').tab('show') // Select tab by name $('#myTab a:first').tab('show') // Select first tab $('#myTab a:last').tab('show') // Select last tab $('#myTab li:eq(2) a').tab('show') // Select third tab (0-indexed)Many thanks for all your help ! |