-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
Coughs strtolower
-
If you want it to run every 30 minutes, then your put 30 in the minutes box! 30 * * * * /path/to/myphpscript.php
-
You can write a login script in any programming language! here's one for PHP4 (its a little dated but will get you started) http://www.evolt.org/article/PHP_Login_System_with_Admin_Features/17/60384/index.html
-
preg_match('%<li class="points">.*?<strong>(\d+)</strong>\s*</li>%s', file_get_contents('http://www.website.com/page.php'), $regs)); echo $regs[1];
-
Where is this data coming from ? you could always compile the data into an array ie <?php //Data from your source! $tmp = array( array(123,'John',10), array(456,'Fred',20), array(123,'John',30) ); $myArray = array(); //put data into array foreach($tmp as $t){ //New computer $serial = $t[0]; $Client = $t[1]; $Cost = $t[2]; if(!isset($myArray[$serial])) $myArray[$serial] = array('repairs' => 0, 'Client' => $Client, 'Cost' => 0); //add data $myArray[$serial]['repairs']++; $myArray[$serial]['Cost'] += $Cost; } //display data foreach($myArray as $serial => $a) { echo "[$serial] -> {$a['Client']} Spent \${$a['Cost']} on {$a['repairs']} repairs<br />\n"; } ?>
-
If you want to create something that interacts with the clients machine your need to use a client side script, however it breaks many security rules, so your need to use something like ActiveX
-
oops missed that reply!
-
1. please use code tags, 2. your have a open tag for a form then another open tag for a form.. remove the first one <td colspan="2"><form name="form1" id="form1" method="post" action=""> <div align="center"> <form action="<?php echo $logoutAction ?>" method="post"><input type="submit" name="Submit" value="Logout" /> </form></td> should be <td colspan="2"> <div align="center"> <form action="<?php echo $logoutAction ?>" method="post"><input type="submit" name="Submit" value="Logout" /> </form></td> 3. view source to check the action has doLogout=true
-
Well your serialized value is wrong! as lemmin stated it should be a:2:{i:0;s:4:"Test";i:1;s:12:"Another Test";} and to get the result you don't need to do a loop try this echo implode(", ", unserialize($radio));
-
Okay.. first off this is more of a hack, I will re-write this whole thing correctly but for now I have received quite a few PM's telling me that the code above doesn't work in IE8 this is true, it due to the use of innerHTML, Now normally I would use JSON to pass arrays between PHP & JS but as i have stated this is just a quick hack, if your updating code then the only real change is the 20 lines below if(xmlHttp.readyState==4) (lines 159-179) Now what is does it rebuild the dropdown box, using a Regular Expression to extra the options data from the html passed back from PHP, Hope it helps <?php /* -- SQL Data -- -- Table structure for table `list1` -- CREATE TABLE `list1` ( `ID` mediumint( NOT NULL auto_increment, `Name` varchar(15) NOT NULL, PRIMARY KEY (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ; -- -- Dumping data for table `list1` -- INSERT INTO `list1` (`ID`, `Name`) VALUES (1, 'Dogs'), (2, 'Trees'), (3, 'Apples'); -- -------------------------------------------------------- -- -- Table structure for table `list2` -- CREATE TABLE `list2` ( `ID` mediumint( NOT NULL auto_increment, `List1Ref` mediumint( NOT NULL, `Name` varchar(20) NOT NULL, PRIMARY KEY (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ; -- -- Dumping data for table `list2` -- INSERT INTO `list2` (`ID`, `List1Ref`, `Name`) VALUES (1, 1, 'Sleep in'), (2, 1, 'Bark at'), (3, 2, 'Grow'), (4, 2, 'Are'), (5, 3, 'are coloured'), (6, 3, 'Taste'); -- -------------------------------------------------------- -- -- Table structure for table `list3` -- CREATE TABLE `list3` ( `ID` mediumint( NOT NULL auto_increment, `List2Ref` mediumint( NOT NULL, `Name` varchar(20) NOT NULL, PRIMARY KEY (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ; -- -- Dumping data for table `list3` -- INSERT INTO `list3` (`ID`, `List2Ref`, `Name`) VALUES (1, 1, 'Baskets'), (2, 1, 'on the couch'), (3, 2, 'Cats'), (4, 2, 'Postmen'), (5, 3, 'slowly'), (6, 4, 'green'), (7, 5, 'Red'), (8, 5, 'Green'), (9, 6, 'Nice'), (10, 6, 'Not nice'); */ $hostname = "localhost"; $username = "root"; $password = ""; ?> <?php $dbh = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); $selected = mysql_select_db("ajax_test",$dbh); if( isset($_GET['ajax']) ) { //In this if statement switch($_GET['ID']) { case "LBox2": $query = sprintf("SELECT * FROM list2 WHERE List1Ref=%d",$_GET['ajax']); break; case "LBox3": $query = sprintf("SELECT * FROM list3 WHERE List2Ref=%d",$_GET['ajax']); break; } $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_assoc($result)) { echo "<option value='{$row['ID']}'>{$row['Name']}</option>\n"; } mysql_close($dbh); exit; //we're finished so exit.. } if (!$result = mysql_query("SELECT * FROM list1")) { echo "Database is down"; } //for use with my FIRST list box $List1 = ""; while ($row = mysql_fetch_assoc($result)) { $List1 .= "<option value='{$row['ID']}'>{$row['Name']}</option>\n"; } ?> <!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>Simple Dymanic Drop Down</title> <script language="javascript"> function ajaxFunction(ID, Param) { //link to the PHP file your getting the data from //var loaderphp = "register.php"; //i have link to this file var loaderphp = "<?php echo $_SERVER['PHP_SELF'] ?>"; //we don't need to change anymore of this script var xmlHttp; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); }catch(e){ // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); }catch(e){ try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }catch(e){ alert("Your browser does not support AJAX!"); return false; } } } xmlHttp.onreadystatechange=function() { if(xmlHttp.readyState==4) { //the line below reset the third list box incase list 1 is changed var sSelect = document.getElementById(ID); for(options in sSelect.options) sSelect.remove(options); var opt = document.createElement("option"); sSelect.options.add(opt); var data = xmlHttp.responseText; results = data.split('\n'); for(r in results){ var d = results[r]; match = d.match(/<option value='(.*?)'>([^<]*)<\/option>/); if (match != null) { var opt = document.createElement("option"); opt.value= match[1]; opt.text = match[2]; sSelect.options.add(opt); } } } } xmlHttp.open("GET", loaderphp+"?ID="+ID+"&ajax="+Param,true); xmlHttp.send(null); } </script> </head> <body> <!-- OK a basic form--> <form method="post" enctype="multipart/form-data" name="myForm" target="_self"> <table border="0"> <tr> <td> <!-- OK here we call the ajaxFuntion LBox2 refers to where the returned date will go and the this.value will be the value of the select option --> <select name="list1" id="LBox1" onchange="ajaxFunction('LBox2', this.value);"> <option value=''></option> <?php echo $List1; ?> </select> </td> <td> <select name="list2" id="LBox2" onchange="ajaxFunction('LBox3', this.value);"> <option value=''></option> <!-- OK the ID of this list box is LBox2 as refered to above --> </select> </td> <td> <select name="list3" id="LBox3"> <option value=''></option> <!-- OK the ID of this list box is LBox3 Same as above --> </select> </td> </tr> </table> <input type="submit" name="Submit" value="Submit" /> </form> </body> </html> any problems feel free to PM me
-
add some , in your values ie $sql="INSERT INTO`dtherren`.`auto`(`name`,`last`,`mi`,`add`,`add2`,`city`,`state`,`zip`,`email`,`hp`,`cp`,`work`,`password`,`make`,`model`,`color`,`plate`,`make2`,`model2`,`color2`,`plate2`,`make3`,`model3`,`color3`,`plate3`) VALUES ('{$name}','{$last}','{$mi}','{$add}','{$add2}','{$city}','{$state}','{$zip}','{$email}','{$hp}','{$cp}','{$work}','{$password}','{$make}','{$model}','{$color}','($plate)','{$make2}','{$model2}','{$color2}','($plate2)','{$make3}','{$model3}','{$color3}','($plate3)')"; EDIT: infact your overwriting that $sql.. so it will have no effect!
-
can you post the full code
-
try '/<\?php \$_B=__FILE__;\$_C=\'([^\']*?)\';eval\(base64_decode\(\'([^\']*?)\'\)\);\?>/' __FILE__ is magic
-
It means some business have X proxies internally and (hence the IP is also the same) but each proxy may handle the USER_AGENT transaction differently, however unless they are set-up badly this shouldn't cause a problem as the it should only switch proxies when either the domain changes(no effect on you then), connection is closed(again no effect), a proxy is overloaded or fails(this is too close to how a session hi-jack would work so i wouldn't worry)
-
The User-Agent header is basically the browsers info (send from client) but can be changed, Personally I would use HTTP_USER_AGENT as an extra check along with the clients IP, while its true proxies can alter this info, it should remain the same for the duration of the connection, a new connection could to thought another proxy and even if that had the same external IP but changed the User agent then its consider a new connection thus a re-login is required.. as a side note.. i don't see the need to MD5 the HTTP_USER_AGENT if your only keeping it in a session
-
Explain what you mean but this as its contradicts itself,
-
I skipped this post earlier because it was unclear but I think he has a string and wants to workout the encoding method form that! /*No Comment*/
-
Totally agree with you xsist10, but i would also trim the song to 30 seconds
-
Maybe try some benchmarking yourself! I'll guess and say file_get_contents
-
Flash could open the file as a resource for so the flash player will be downloaded but the resource will remain in mostly memory.
-
okay.. just say you have 3 files on your server Hello1.mp3, Hello2.mp3 & Hello3.mp3 ie / /Hello1.mp3 /public_html/ /public_html/tester.php /public_html/Hello2.mp3 /public_html/tester/ /public_html/tester/Hello3.mp3 now to play Hello2.mp3 you do http://domain.com/Hello2.mp3 and to play Hello3.mp3 you do http://domain.com/tester/Hello2.mp3 but you can't play Hello1.mp3 as its not in the public folder.. Right ? But if tester.php was <?php header("contents-type: audio/mp3"); readfile('/Hello1.mp3'); ?> then opening tester.php would infact open Hello1.mp3 but with the bonus of PHP being in control.. so no direct downloads As for the token.. just say we goto page1.php and on page 1 we have a <?php session_start(); $_SESSION['token'] = md5(uniqid(mt_rand(), true)); echo "tester.php?file=madtechie.mp3&token=465f7846abce"; ?> and tester.php checks the token like this <?php session_start(); if($_GET['token'] != $_SESSION['token']) die("ERROR"); $_SESSION['token'] = "VOID"; //remove token we are done header("contents-type: audio/mp3"); readfile('/'.$_GET['file']);//YOUR NEED TO FILTER $_GET['file'] ?> Now if the token is different then we get nothing