Jump to content

Search the Community

Showing results for tags 'PHP'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Found 982 results

  1. Looking code for simple php website. Logo, menu, three pages. I got code for menu but stuck on logo and how to create three pages and how to upload on hosting account. Code for menu. <html><body><a href="url">Home</a> - <a href="url/about.php">About Us</a> - <a href="url/contact.php">Contact Us</a> - <a href="url/privacy.php">Privacy</a> <br /><html><body>
  2. <?php// Simple HTML DOM Parserinclude('simple_html_dom.php');$html = file_get_html('http://lifelearning.xtreemhost.com/'); foreach ($html->getElementsByTagName("ul",0)->getElementsByTagName("li") as $li){echo $li->plaintext; // works; but return the whole nodeValues (From "Point 1" to "Reference") echo $li->childNodes(0)->nodeValue; // return nothingecho "<br />";}?> <ul><li>Point 1 <ul> <li>Point 1.1</li> <li>Point 1.2</li> <pre class="CodeDisplay"> some codes </pre> <li>Reference: <a href="link.html" target="_blank">link</a></li> </ul> </li> </ul> I want to just thru PHP get the plain text of the first li ("Point 1").How can I do that in PHP?
  3. Hello, my config is : windows server 2008 R2, WAMPP, PHP 5.3.0 with SOAP extension enabled. when i use __soapCall, i obtain this error on screen : Wrong Version this is the code (i use local copy of WSDL - service.xml) : $header = new SoapHeader("...."); $file = 'http://www.mysite/service.xml';try {$soapclient = new SoapClient(null, array( 'location' => $file, 'uri' => "http://www.mysite/", 'trace' => 1));$soapclient->__setSOAPHeaders(array($header));} catch (SoapFault $e) { // error }...$parameters = array(...); $params=array(null, new SoapParam($parameters, 'parameters'));$services = $soapclient->__soapCall("myWebService", $params); if you have a idea ? the call of __soapCall is it correct ? problem with SOAP and windows server 2008 ? problem with version of DLL ? .... Thanks you in advance, FM
  4. Mudsaf

    jQuery GET method PHP

    Hello, im wondering how does jQuery get method work. Since it should not reload the page again? I've seen this, but how to example make this more automated whitout refreshing "http://mudsaf.info/games/index.php". $.ajax({ url: url, data: data, success: success, dataType: dataType});
  5. Hi, I'd like some help please, if its possible. I have created two functions in order to display some messages when is set a $_GET after a redirect. Here's the code: function display(){if(isset($_GET['cnf_upd']) && $_GET['cnf_upd'] == '1'){ $value = "The update was successful!"; $type = "confirm"; construct_the_div($value, $type);}if(isset($_GET['err_upd']) && $_GET['err_upd'] == '1'){ $value = "The Update failed."; $type = "error"; construct_the_div($value, $type);}if(isset($_GET['cnf_del']) && $_GET['cnf_del'] == '1'){ $value = "Deleted completely."; $type = "confirm"; construct_the_div($value, $type);}if(isset($_GET['err_del']) && $_GET['err_del'] == '1'){ $value = "Unable to delete."; $type = "error"; construct_the_div($value, $type);}}function construct_the_div($value, $type){// creating a div to display the message results$div = "<div class=\"{$type}Msg\">\n";$div .= "<p>{$value}</p>\n";$div .= "</div><!-- end of {$type}Msg -->\n";echo $div;} What I'd like to make is to try to improve the display function, as it gets longer and longer, so that there whould be only one (or two at most) if statement(s). So the value of the GET will be dynamicly inside if condition and also if it has the preffix 'cnf_' it wil be a 'confirmMsg' and if it has the preffix 'err_' it wil be a 'errorMsg'. Is it possible to make something like this???
  6. Nice to be with you everyone! I have a problem: How to convert numbers to strings using PHP. Try this, $number=11; to convert in string? Thank you.
  7. Hello,I need your help on the following:I had a page that I want to make it password protected using Javascript which is fine, but I want to be able to change the password when I login to that page, is that possible? Thanks
  8. Here is the problem. I'm trying to upload a file that contains a list of to be processed files, I then check the files using a perl script that runs an Rscript. I'm using those same files for subsequent processing. Everything is working fine on our site, but it gives a time out on someone elses site. The Rscript does not give feedback until it has finished running and starts processing. The results of the Rscript sends information back to the browser and to the php script. But in that time, the connection may already have been broken, giving a TCP time out error, especially for large data sets. I have the following files:index.php: form to upload a list of files and set some settingsparams.php: generates a unique folder, calls a perl (find.pl) script to generate the Rscript, the results from the Rscript are saved in the unique folder and are then used to call the processing script. After the Rscript has returned it's value, the browser will supply the settings page, which is needed to go the results page.find.pl: runs an Rscript to find information I need to keep the connection open so that the results can be send to the browser after the Rscript has finished running. I have used the following which I got from someone else with some modification, but this didn't work as the header('Location:') needs to come before anything else, but I first need to generate a unique userID that can be used to generate the unique folder, so it still keeps hanging. extra line in params.php header("Location:Load_array_type.php?folder=$userid"); // If I don't use different file to keep connection open Please wait! <?php// Add this code into you html page which the message " Pleasse wait while reading array types ! "// This html page is called after the user press submit (providing text file with cel files and starting R script)// These are additions that I had to make$userid=$_GET['folder']; #date['U'] // date['U']: I originally generated the unique userID here, but that meant that it would be regenerated everytime this page loaded, and this would mean that I would never get a message that said the Rscript finished running$project_name = $_POST['project_name'];$readfile=file("../master_files/configuration.conf");$path;for ($k=0; $k<=count($readfile)-1; $k++){ $fields = split("\t",$readfile[$k]); if ($fields[0]=="PATH"){ $path = $fields[1]; $path = str_replace(PHP_EOL,null,$path); }}$folder = $path."scratch/$userid/";$inputfolder = $path."scratch/$userid/input/"; // Set variables$statusRefresh = 5000; // set time for Auto-reload in milliseconds$arrayTypes = "path/filename_arrayTypes"; // file name, in which R script writes the array types (file must be finished, if you write cel by cel, then you need a small text file, which is saved when finished.) This needs the unique userID generated by params.php$thisPage = "Load_array_type.php?folder=$userid"; // name of the wait page $nextPage = "params.php"; // relative path and name of page with settings // Check if file with array types is saved$isFinished = file_exists($arrayTypes); echo "<form name='form1' enctype='multipart/form-data' method='post' action='$thisPage'></form>"; // Auto-reload while runningif ($isFinished) { // If finisched go to settings header("Location: $nextPage"); exit();}else { // If not finisched reload page in x seconds (as specified above) echo "<script language='JavaScript' type='text/javascript'>\n"; echo "var t = setTimeout('document.form1.submit();',$statusRefresh);\n"; // Change 'form1' to your name of the form echo "</script>\n";}?> I have also tried the following javascript, but this goes to a blank page, and doesn't open the settings page which I need to get to the results page. JAVASCRIPT:function keepMeAlive(imgName) { myImg = document.getElementById(imgName); if (myImg) myImg.src = myImg.src.replace(/\?.*$/, '?' + Math.random());}window.setInterval("keepMeAlive('keepAliveIMG')", 100000);HTML:echo "<script type="text/javascript" src="javascript.js"></script>";echo "<img id='keepAliveIMG' width='1' height='1' src='../master_files/Picture1.png?' />"; Thanks for your help.
  9. I'm probably too damaged of working with C# and LinQ, so havn't done a real SQL sentance since my work in Java.I have two tables, which are combined with a PK and FK. Table_MyCust with PK CustID and Table_CustApartments which contain CustID as FK.I want to make a XML document with PHP, where there is a node for each MyCust row, and for each MyCust there is a CustApartments for each apartment that have the current CustID as FK. In C# I've do something like the following: XElement xml = new XElement("customers", from p in DatabaseConnection.Custs orderby p.CustName select new XElement("customer", new XAttribute("customerName", p.CustName), new XElement("Addresses", (from l in p.Aparts.Distinct() orderby l.Street where l.Street != null && !l.Postal.Equals("1010") select new XElement("Address", (string)l.Street); ))); But how does I do in PHP? Does you create a SQL sentance with some kind of a join operation? Or do you create two SQL statments, and check for equals on the PK and FK while running through all the rows? I'm not sure whats the 'correct' way to do in PHP, since I'm fairly new to PHP scripting yet.
  10. donking13

    qoute form

    hi good day, I want to build a qoute form for my website. so far the php work without the html, but when i integrated the code. I didn't work, I just want to test it before I completely finish everything. I'm new to php but I have 1 year experience with html and css. below is the html part <html><head></head><body><form action="connect.php" method="get">Domain Name: <input type="text" name="1stText" value=""> Tip: www.websitealfred.com or websitealfred<br/><br/>How many pages: <input type="number" name="pages" value="text"><br/><br/>Purpose of the website: <br/><BLOCKQUOTE> <input type="checkbox" name="purpose" value="1"> Blog<br/><input type="checkbox" name="purpose" value="2"> Business<br/><input type="checkbox" name="purpose" value="3"> Community<br/><input type="checkbox" name="purpose" value="4"> Portfolio<br/><input type="checkbox" name="purpose" value="5"> Ecommerce<br/> </BLOCKQUOTE><br/><br/>Category of the website: <br/> <BLOCKQUOTE><select name="categories"> <option Value="1">Gaming</option> <option Value="2">Sports</option> <option Value="3">Food/Restaurant</option> <option Value="4">Health Care</option> <option Value="5">Events/Parties</option> <option Value="6">Clothing/Shopping/Apparel</option> <option Value="7">Travel</option> <option Value="8">Cars</option> <option Value="9">Movies</option> <option Value="10">School/Learning</option> </select></BLOCKQUOTE> <br/><br/> <input type="submit" value="Submit"></body></html> here is the php part <?php$page = $_GET("pages");$purpose = $_GET("purpose");$hostDom = 2;$qoute; function myPage(){global $page,$qoute; if($page <= 5) { $qoute = $qoute + 3000; } } function myPurpose(){global $purpose,$qoute; if($purpose == 4) { $qoute = $qoute + 3500; } } function myhostDom(){global $hostDom,$qoute; if($hostDom == 1) { $qoute = $qoute + 1000; } else if($hostDom == 2) { $qoute = $qoute + 3000; } } myPage();myPurpose();myhostDom();echo $qoute;?> it's not showing anything, ignore the $hostdom and myhostDom. I just want to see if the myPage and myPurpose works. Thanks you for your time.
  11. Mudsaf

    PHP Config edit

    Is it possible to edit certain part of PHP config page and get the certain value from it. Example i have config file (i know it would not work since no actual code but i think you will get my point here). So im wondering is it possible change CONSTRUCTION = false part to true with PHP whitout editing rest of the file or keeping rest of the file same? OLD 1: SQL2: SQL-DB-SELECT3: SECURITY4: CONSTRUCTION = false5: FOOTER = "© 2012" . $website NEW 1: SQL2: SQL-DB-SELECT3: SECURITY4: CONSTRUCTION = true5: FOOTER = "© 2012" . $website
  12. hello everyone, I've got a server set up as my web host. It has Apache installed and PHP (both are the most recent version). for the database I have a different server these two machines (the web host and the database server) are connected through a peer to peer connection. Now I've learned that I need to use my database servers IP address as the host address for my database connection script but are there any other settings I need to change in the php.ini in order to make this work?
  13. Hello Everyone, I have different entries in a log file in the form: ================================================[Jan 27 2012 12:10:35] - ID2PDF v.2.6 (ID2PDF.jsx)General options: [default] (ID2PDF_options.xml)================================================Loaded options from XML file: 'path/to/file/some_file.xmlextendedPrintPDF startedextendedPrintPDF: Error: Unsaved documents have no full name.; line: 332================================================[Jan 27 2012 12:12:57] - ID2PDF v.2.6 (ID2PDF.jsx)General options: [default] (ID2PDF_options.xml)================================================Error opening document: path/to/file/some_file1: Error: Either the file does not exist, you do not have permission, or the file may be in use byanother application; line: 190Error opening document: path/to/file/some_file2: Error: Either the file does not exist, you do not have permission, or the file may be in use byanother application; line: 190 I want to grab the time in the first line of the record (I can manage that with a RegEx, alright!) and then compare it with the time of the next entry (in this case, with Jan 27 12:12:57). And if the second time is greater than the first, I want to read the rest of the text file and do a bunch of other things.Is it possible to do this?NOTE: The entries may have records of any number of lines, but each entry is separated by the === delimiter.
  14. Hello..I suggest that w3schools has a lesson concerning OOP in PHP..Coz i think it is also important in PHP programming
  15. I'm having a problem and i'd like some help please. I have made a script for creating an image with PHP using GD library, but the problem is when i preview it on the Firefox it shows me an error in Firebug: "Image corrupt or truncated:localhost/my_scripts/images.php". NOTE: this is not an error displayed from PHP, it seems more like an error comming from the browser.I have checked my code for syntaxes many times, i have also tried out and other gd functions, like imagegif, imagettftext etc etc but didn't have any effect. Here's my code: <?php//$image = @imagecreate(200, 20)or die("Cannot Initialize new GD image stream");$image = imagecreate(200, 20);$background = imagecolorallocate($image,0,0,0);$foreground = imagecolorallocate($image,255,255,255);imagestring($image,5,5,1,"This is a Test",$foreground);header("Content-type: image/jpeg");imagejpeg($image);imagedestroy($image);?> GD library is enabled i've already checked that in phpinfo(), and I have also tried to preview it and on Chrome and looks the same. Any ideas what i might doing wrong or why happens this? and how can i fix this error??
  16. Hello I have example database where is (Few values added) ID, SUBJECT, NAME1, Hello world, Mudsaf2, Hello world2, Mudsaf Then i get the data from sql with query (querys and row works perfectly <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script><script src="http://malsup.github.com/jquery.form.js"></script> <script> // wait for the DOM to be loaded $(document).ready(function() { // bind 'myForm' and provide a simple callback function $('#removepost').ajaxForm(function() { alert("Something happened"); }); }); </script> <?php$query = "blablaablla"... untill while ($row = mysql_fetch_array($result)) { echo "<form id='removepost' method='post' action='script/removepost.php'> <input type='hidden' readonly='readonly' name='id' id='id' value='1' /> <input type='submit' name='submit' id='submit' value='Remove'></form>" . $row['SUBJECT']; } ?> The form works perfectly, but doesn't work with jQuery. http://malsup.com/jquery/form/ <--- This method doesn't work So im wondering is it possible to get that script work OR where do i link the jQuery files. So currenctly it goes to script/removepost.php, but it should stay at same page and let jQuery run the script whitout page refreshing/moving to action file. Should the form be changed from id to class and in jquery the #removepost to .removepost?
  17. Hello, im currently trying to update my workplace website navigation, but i cant figure out how-to make Hidden page with required group on Website baker 2.6.7. If you have any experience about website baker please inform me. I have tried also in the demo of website baker online. Demo http://www.websitebaker2.org/en/home/online-demo.php
  18. Hi All I have a bizzar issue which is driving me nuts. I was running a php server on my pc to test my code with no issues - now moved it to the host server and get this issue when try to parse xml: Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : Start tag expected, '<' not found in /websites/123reg/LinuxPackage22/tr/ad/in/tradingbay.co/public_html/Lib/Functions.php on line 154 here is my code: $TDurl = "http://api.tradedoubler.com".$Version.$module.$Format.$TDParams.$Token;print $TDurl;$TDResponse = @file_get_contents($TDurl);$TDParsed_Xml = simplexml_load_string($TDResponse);
  19. Happy new year all, I am hoping that someone can help me with a problem I'm having. I'm using a mysql foreach query to retrieve certain data from the database. However I'm only able to get one set of information per row. Could you please advise me of where the best place is to start reseaching. If I have not explained myself clearly I can provide more information as required. I look forward to hearing from you guys soon. RegardsMatthias
  20. Hello everybody, so im wondering how to make "Download" that is secured and users cannot go just with direct link like /downloads/file1.rar. I'd like that no SQL-storing would be there.
  21. Hello, im not sure should i add this to "SQL" category since this is bit more sql-related but any fix to this. I have timestamp field in my database and it has worder ORDER BY Desc so far from oldest to newest and now at 2013 it doesn't work like that. SELECT * FROM ms_news ORDER BY newsDate DESC LIMIT 0, 1 Last 2 values Code displays this 2013-01-03 01:48:05 Should display this 2013-01-04 01:03:53 At year 2012 it worked from oldest to newest so im not sure does the 2013 year mess the desc somehow. Blargh fixed, had taken the value from Date and not Datetime
  22. Hello. I am experimenting with PHP and MYSQL because I am new at it. I am trying to use AJAX to create a query into a database that I have. It isn't working. I'm sure I've made a mistake but I cant seem to find it. Someone please look over my code and see if there is something I am missing. I know my database is working because I use it to log in. It has to be in my code. The results I get from this is blank. The AJAX does call on the PHP correctly because I do get an echo back, but only because the $results isn't working. query/users.php <?phpinclude('includes/config.inc');$sql = "SELECT * FROM user";$result = mysql_query($sql,$con);if($result){echo "Username <br>";}else{echo "Nothing Found: ". mysql_error();}while($row = mysql_fetch_array($result)){echo $row['username'];echo "<br>";}mysql_close($con);?> /includes/config.ini //Real info has been removed for security <?php$hostname = 'hostname';$dbname = 'databank';$username = 'username';$password = 'password';$con = mysql_connect($hostname, $username, $password) or DIE('Connection failed');mysql_select_db($dbname, $con) or DIE("Database isnt available");?> admin.php <?phpsession_start();include('includes/config.inc');if (!isset($_SESSION['username'])) {header('Location: index.php');}?><script type="text/javascript">function q(url){if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); }else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("q").innerHTML=xmlhttp.responseText; } }xmlhttp.open("GET",url,true);xmlhttp.send();}</script><HTML><head><link rel="stylesheet" type="text/css" href="../css/secure.css"><title>Admin Page</title></head><body><table> <tr> <td class='seven'></td> <td class='fi'>Welcome: <?php echo $_SESSION['username']?> </td> <td class='fi'><a href="logout.php">Logout</a></td> </tr></table>This is the ADMIN page<br><input value="Get Users" type="submit" onclick="q('query/users.php')"><div id="q"></div></body></HTML>
  23. Hello, Im just wondering does it strain website server if i check if port is open and server is running. So basically i have 1 php page that is has selection for example "Sitefriends" and then when user refreshes the webpage check if the website port is open and server is up (This is because my sitefriend server isn't on always) and im wondering does it make their server slower or something if test their port openings?
  24. ok i designed a multipart recruitment time editor for this site and tested and it worked fine 4 days ago no edits since then and now it is not working. here is the error: it comes up in ** elseif($p == "Schedule_TMH") { ** after submitting the data. Here is the primary code:<?phpif(checkLogin(MEMBER_NAME, MEMBER_PASS) AND checkRank(MEMBER_RANK, $pid)) {include("include/classes/class_global.php");if($p == "") {echo "<table align='center' border='1' cellspacing='0' cellpadding='3' width='600' bordercolor='FFCC33'><tr><td bordercolor='FFCC33' class='titles' align='center'><b>Manage: Ten Minutes of ######</b></td></tr><tr><td bordercolor='FFCC33' style='border-top-width: 0px' class='main'><br><blockquote>This Shows all Trial Members who are in TMH Stage, reguardless if they have passed, failed, not been scheduled, or are awaiting thier TMH. Note that changing thier TMH times, weather by schuduling them or re-scheduling them, will result in a PM to that Trial Member informing on this.<br><br>";$query = "SELECT * FROM {$dbprefix}requestjoin WHERE ip_check != '0' AND elite_check != '0' AND screenname_check != '0' AND next_stage != '0' AND completed_tmh = '0' ORDER BY tmh_time_int ASC";$result = mysql_query($query) or die(mysql_error());while($row = mysql_fetch_array($result)){extract($row);foreach($row AS $key => $value) { ${$key} = addslashes(textFilter($value)); }if($tmh_time_int == 0) { $tmh_time_info = "<font color='green'> - TMH not Scheduled</font>"; $Console_Manage_tmh = "<a href='console.php?pid=$pid&p=Schedule_TMH&join_id=$id&name=$name'>| Schedule TMH |</a>"; }elseif($tmh_time_int == 1) { $tmh_time_info = "<font color='green'> - TMH at $tmh_time</font>"; $Console_Manage_tmh = "<a href='console.php?pid=$pid&p=Passed_TMH&join_id=$id'>| Passed TMH |</a><a href='console.php?pid=$pid&p=Schedule_TMH&join_id=$id&name=$name'>| Re-Schedule TMH |</a><a href='console.php?pid=$pid&p=Failed_TMH&join_id=$id'>| Failed TMH |</a>"; } echo "<tr><td class='main' align='center' width='600'><br><b>$name</b>$tmh_time_info<br><br>$Console_Manage_tmh<br><br></td</tr>";}echo "</blockquote></td></tr></table>";} /// THIS IS WHERE THE ERROR COMES UP ///elseif($p == "Schedule_TMH") {if($submit) {if($tmh_time1 != "USED") {$recruits_id = getMemberInfo("id", $name);$rec_timezone = getMemberInfo("timezone", $name);$new_time = getConvertedTime("converted", $rec_timezone, $tmh_time1);$message1 = "Your TMH time has been changed to $new_time on $this_saturday. Disreguard all other messages reguarding your TMH time. Please be online ready to go 10 minutes prior to this time. Also it is best that you update your profile and re-read the rules of the clan.";$query = "INSERT INTO {$dbprefix}privatemessages (sender_id, receiver_id, datesent, subject, message, status, originalpm_id) VALUES ('$memid', '$recruits_id', '$time', 'Your TMH Time', '$message1', '1', '$original')";$result = mysql_query($query)or die(mysql_error());$query = "UPDATE {$dbprefix}requestjoin SET tmh_time_int = '1', tmh_time = '$tmh_time1' WHERE id = '$join_id'";$result = mysql_query($query)or die(mysql_error());echo "<table width='400' border='0' align='center'><tr><td class='main' width='400' border='3' bordercolor='#FFCC33'>$tmh_success</td></tr></table>"; }else {echo "<table width='400' border='0' align='center'><tr><td class='main' width='400' border='3' bordercolor='#FFCC33'>$tmh_sorry</td></tr></table>";}}elseif(!$submit) {if($mem_timezone_id == 3) {$time_options = "<option value='$pm3'>10:00am - $pm3USED</option><option value='$pm35'>10:30am - $pm35USED</option><option value='$pm4'>11:00am - $pm4USED</option><option value='$pm45'>11:30am - $pm45USED</option><option value='$pm5'>12:00pm - $pm5USED</option><option value='$pm55'>12:30pm - $pm55USED</option><option value='$pm6'>1:00pm - $pm6USED</option><option value='$pm65'>1:30pm - $pm65USED</option><option value='$pm7'>2:00pm - $pm7USED</option><option value='$pm75'>2:30pm - $pm75USED</option>";$contact = "";}elseif($mem_timezone_id == 4) {$time_options = "<option value='$pm3'>11:00am - $pm3USED</option><option value='$pm35'>11:30am - $pm35USED</option><option value='$pm4'>12:00pm - $pm4USED</option><option value='$pm45'>12:30pm - $pm45USED</option><option value='$pm5'>1:00pm - $pm5USED</option><option value='$pm55'>1:30pm - $pm55USED</option><option value='$pm6'>2:00pm - $pm6USED</option><option value='$pm65'>2:30pm - $pm65USED</option><option value='$pm7'>3:00pm - $pm7USED</option><option value='$pm75'>3:30pm - $pm75USED</option>";$contact = "";}elseif($mem_timezone_id == 5) {$time_options = "<option value='$pm3'>12:00pm - $pm3USED</option><option value='$pm35'>12:30pm - $pm35USED</option><option value='$pm4'>1:00pm - $pm4USED</option><option value='$pm45'>1:30pm - $pm45USED</option><option value='$pm5'>2:00pm - $pm5USED</option><option value='$pm55'>2:30pm - $pm55USED</option><option value='$pm6'>3:00pm - $pm6USED</option><option value='$pm65'>3:30pm - $pm65USED</option><option value='$pm7'>4:00pm - $pm7USED</option><option value='$pm75'>4:30pm - $pm75USED</option>";$contact = "";}elseif($mem_timezone_id == 6) {$time_options = "<option value='$pm3'>1:00pm - $pm3USED</option><option value='$pm35'>1:30pm - $pm35USED</option><option value='$pm4'>2:00pm - $pm4USED</option><option value='$pm45'>2:30pm - $pm45USED</option><option value='$pm5'>3:00pm - $pm5USED</option><option value='$pm55'>3:30pm - $pm55USED</option><option value='$pm6'>4:00pm - $pm6USED</option><option value='$pm65'>4:30pm - $pm65USED</option><option value='$pm7'>5:00pm - $pm7USED</option><option value='$pm75'>5:30pm - $pm75USED</option>";$contact = "";}elseif($mem_timezone_id == 7) {$time_options = "<option value='$pm3'>2:00pm - $pm3USED</option><option value='$pm35'>2:30pm - $pm35USED</option><option value='$pm4'>3:00pm - $pm4USED</option><option value='$pm45'>3:30pm - $pm45USED</option><option value='$pm5'>4:00pm - $pm5USED</option><option value='$pm55'>4:30pm - $pm55USED</option><option value='$pm6'>5:00pm - $pm6USED</option><option value='$pm65'>5:30pm - $pm65USED</option><option value='$pm7'>6:00pm - $pm7USED</option><option value='$pm75'>6:30pm - $pm75USED</option>";$contact = "";}elseif($mem_timezone_id == 8) {$time_options = "<option value='$pm3'>3:00pm - $pm3USED</option><option value='$pm35'>3:30pm - $pm35USED</option><option value='$pm4'>4:00pm - $pm4USED</option><option value='$pm45'>4:30pm - $pm45USED</option><option value='$pm5'>5:00pm - $pm5USED</option><option value='$pm55'>5:30pm - $pm55USED</option><option value='$pm6'>6:00pm - $pm6USED</option><option value='$pm65'>6:30pm - $pm65USED</option><option value='$pm7'>7:00pm - $pm7USED</option><option value='$pm75'>7:30pm - $pm75USED</option>";$contact = "";}elseif($mem_timezone_id == 9) {$time_options = "<option value='$pm3'>4:00pm - $pm3USED</option><option value='$pm35'>4:30pm - $pm35USED</option><option value='$pm4'>5:00pm - $pm4USED</option><option value='$pm45'>5:30pm - $pm45USED</option><option value='$pm5'>6:00pm - $pm5USED</option><option value='$pm55'>6:30pm - $pm55USED</option><option value='$pm6'>7:00pm - $pm6USED</option><option value='$pm65'>7:30pm - $pm65USED</option><option value='$pm7'>8:00pm - $pm7USED</option><option value='$pm75'>8:30pm - $pm75USED</option>";$contact = "";}elseif($mem_timezone_id == 10) {$time_options = "<option value='$pm3'>4:30pm - $pm3USED</option><option value='$pm35'>5:00pm - $pm35USED</option><option value='$pm4'>5:30pm - $pm4USED</option><option value='$pm45'>6:00pm - $pm45USED</option><option value='$pm5'>6:30pm - $pm5USED</option><option value='$pm55'>7:00pm - $pm55USED</option><option value='$pm6'>7:30pm - $pm6USED</option><option value='$pm65'>8:00pm - $pm65USED</option><option value='$pm7'>8:30pm - $pm7USED</option><option value='$pm75'>9:00pm - $pm75USED</option>";$contact = "";}elseif($mem_timezone_id == 11) {$time_options = "<option value='$pm3'>5:00pm - $pm3USED</option><option value='$pm35'>5:30pm - $pm35USED</option><option value='$pm4'>6:00pm - $pm4USED</option><option value='$pm45'>6:30pm - $pm45USED</option><option value='$pm5'>7:00pm - $pm5USED</option><option value='$pm55'>7:30pm - $pm55USED</option><option value='$pm6'>8:00pm - $pm6USED</option><option value='$pm65'>8:30pm - $pm65USED</option><option value='$pm7'>9:00pm - $pm7USED</option><option value='$pm75'>9:30pm - $pm75USED</option>";$contact = "";}elseif($mem_timezone_id == 12) {$time_options = "<option value='$pm3'>6:00pm - $pm3USED</option><option value='$pm35'>6:30pm - $pm35USED</option><option value='$pm4'>7:00pm - $pm4USED</option><option value='$pm45'>7:30pm - $pm45USED</option><option value='$pm5'>8:00pm - $pm5USED</option><option value='$pm55'>8:30pm - $pm55USED</option><option value='$pm6'>9:00pm - $pm6USED</option><option value='$pm65'>9:30pm - $pm65USED</option><option value='$pm7'>10:00pm - $pm7USED</option><option value='$pm75'>10:30pm - $pm75USED</option>";$contact = "";}elseif($mem_timezone_id == 13) {$time_options = "<option value='$pm3'>7:00pm - $pm3USED</option><option value='$pm35'>7:30pm - $pm35USED</option><option value='$pm4'>8:00pm - $pm4USED</option><option value='$pm45'>8:30pm - $pm45USED</option><option value='$pm5'>9:00pm - $pm5USED</option><option value='$pm55'>9:30pm - $pm55USED</option><option value='$pm6'>10:00pm - $pm6USED</option><option value='$pm65'>10:30pm - $pm65USED</option><option value='$pm7'>11:00pm - $pm7USED</option><option value='$pm75'>11:30pm - $pm75USED</option>";$contact = "";}else {$time_options = "An ERROR Occured";$contact = "<br>Contact:<br>$OpsComm_tmh<br>";}echo "<form action='console.php?pid=$pid&p=Schedule_TMH&join_id=$join_id&name=$name' method='post'><table width='600' border='1' bordercolor='#000000' align='center'><tr><td class='main' width='600' border='1' bordercolor='#FFCC33' align='center'><select name='tmh_time1' class='form'>$time_options</select>$contact</td></tr><tr><td class='titles' align='center' width='600' border='2' bordercolor='#FFCC33'><br><br><input type='submit' name='submit' value='Submit Time' class='apps_formbutton'></td></tr></table></form>"; }}elseif($p == "Passed_TMH") {$query = "UPDATE {$dbprefix}requestjoin SET tmh_time_int = '2' WHERE id = '$join_id'";$result = mysql_query($query)or die(mysql_error());echo "<table width='400' border='0' align='center'><tr><td class='main' width='400' border='3' bordercolor='#FFCC33'>$tmh_success2</td></tr></table>"; }elseif($p == "Failed_TMH") {$query = "UPDATE {$dbprefix}requestjoin SET tmh_time_int = '3' WHERE id = '$join_id'";$result = mysql_query($query)or die(mysql_error());echo "<table width='400' border='0' align='center'><tr><td class='main' width='400' border='3' bordercolor='#FFCC33'>$tmh_success3</td></tr></table>"; }}else {echo "<table align='center' border='0' cellspacing='0' cellpadding='0' width='550'><tr><td class='main' align='center'><img src='images/restrictedarea.png' border='0'></td></tr></table>";} ?> here is the global.php file: <?phpinclude("include/classes/class_member.php");include("include/classes/class_tmh.php");include("include/classes/class_recruitment.php");include("include/classes/class_staff.php");$tmh_message = "Choose a time to do your Evaluation.<br><br>These times are auto made to ($mem_timezone) timezone. If this timezone is wrong then go to \"Edit Profile\" in \"Your Account\" and select the correct timezone.<br><br><b>* NOTE *</b><br>If a time frame says \"Used\" then you cannot choose that time as we have someone else there; if you cannot do any of these times then contact:<br>$OpsComm_tmh<br>";$tmh_sorry = "Sorry you Picked a Used time.<br><br>Questions? - Comments? - Problems?<br><b>Contact:</b><br>$OpsComm_tmh<br><br>"; $tmh_success = "Update Complete: Time Selected..<br><br>Questions? - Comments? - Problems?<br><b>Contact:</b><br>$OpsComm_tmh<br><br>";$tmh_success2 = "Update Complete: Recruit has Passed Ten Minutes of ######..<br><br><a href='console.php'>| Your Account |</a><a href='console.php?pid=$pid'>| Manage: TMH Home |</a><br><br>";$tmh_success3 = "Update Complete: Recruit has Failed Ten Minutes of ######..<br><br><a href='console.php'>| Your Account |</a><a href='console.php?pid=$pid'>| Manage: TMH Home |</a><br><br>";$this_saturday = date('l jS F (Y-m-d)', strtotime('this Saturday'));?> here is the class_tmh.php: <?php$time_3 = countTMHtimes("3:00pm EST");$time_35 = countTMHtimes("3:30pm EST");$time_4 = countTMHtimes("4:00pm EST");$time_45 = countTMHtimes("4:30pm EST");$time_5 = countTMHtimes("5:00pm EST");$time_55 = countTMHtimes("5:30pm EST");$time_6 = countTMHtimes("6:00pm EST");$time_65 = countTMHtimes("6:30pm EST");$time_7 = countTMHtimes("7:00pm EST");$time_75 = countTMHtimes("7:30pm EST"); if($time_3 != 1) { $pm3 = "3:00pm EST"; $pm3USED = "Open"; } else { $pm3 = "USED"; $pm3USED = "Used"; }if($time_35 != 1) { $pm35 = "3:30pm EST"; $pm35USED = "Open"; } else { $pm35 = "USED"; $pm35USED = "Used"; }if($time_4 != 1) { $pm4 = "4:00pm EST"; $pm4USED = "Open"; } else { $pm4 = "USED"; $pm4USED = "Used"; }if($time_45 != 1) { $pm45 = "4:30pm EST"; $pm45USED = "Open"; } else { $pm45 = "USED"; $pm45USED = "Used"; }if($time_5 != 1) { $pm5 = "5:00pm EST"; $pm5USED = "Open"; } else { $pm5 = "USED"; $pm5USED = "Used"; }if($time_55 != 1) { $pm55 = "5:30pm EST"; $pm55USED = "Open"; } else { $pm55 = "USED"; $pm55USED = "Used"; }if($time_6 != 1) { $pm6 = "6:00pm EST"; $pm6USED = "Open"; } else { $pm6 = "USED"; $pm6USED = "Used"; }if($time_65 != 1) { $pm65 = "6:30pm EST"; $pm65USED = "Open"; } else { $pm65 = "USED"; $pm65USED = "Used"; }if($time_7 != 1) { $pm7 = "7:00pm EST"; $pm7USED = "Open"; } else { $pm7 = "USED"; $pm7USED = "Used"; }if($time_75 != 1) { $pm75 = "7:30pm EST"; $pm75USED = "Open"; } else { $pm75 = "USED"; $pm75USED = "Used"; }?> and lastly here is the function from the functions page: function getConvertedTime($needed, $timezone, $s_time) {global $dbprefix;$query = "SELECT * FROM {$dbprefix}timezone_convert WHERE tz = '$timezone' AND convert = '$s_time'";$result = mysql_query($query) or die(mysql_error());$row = mysql_fetch_array($result);@extract($row); return $$needed;}
  25. Hello, im wondering can i prevent brute-force attacks from my webpage example creating this. This should work if the user doesn't close and re-open the page after attempts are out, but i have no idea how brute-force does it. Login page <?php session_start();if(isset($_SESSION['login_attempt']) && $_SESSION['login_attempt'] < 6) {} else {//Form here}?> Login confirm page <?phpsession_start();if (isset($_SESSION['Rights']) && $_SESSION['login_attempt'] < 6) {header("Location: index.php");} elseif (isset($_POST['password']) && isset($_POST['username']) && $_SESSION['login_attempt'] < 6) {//LOGIN SCRIPT HERE} elseif ($rows > 0) { //user has logged in correctly//FEW SESSIONS TO STORE DATA} else { if (!isset($_SESSION['login_attempt'])) {$_SESSION['login_attempt'] = 1;} else {$_SESSION['login_attempt'] = $_SESSION['login_attempt'] + 1;}if ($_SESSION['login_attempt'] < 6) {echo (5 - $_SESSION['login_attempt']) . " attempts left";}}}?> Read more about brute-force here http://en.wikipedia.org/wiki/Brute-force_attack Read more about SQL-injections here (This prevention is MUST-have to SQL-based webpage) http://en.wikipedia.org/wiki/SQL_injection
  • Create New...