-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
Okay, Lets say you have a folder structure like this +folder1 +folder2 +public_html +classes login.php logout.php +html_files index.php config.php and config.php held this <?php $database = "myDB"; $DBUser = "root"; $DBPass = "hidden:p"; ?> Now http://www.mydomain.com/ will open http://www.yourdomain.com/index.php but they could do this http://www.yourdomain.com/config.php Now if PHP is running fine then no problems, BUT as by Daniel Says:
-
Okay create a file for displaying the videos ie video.php Now your going to pass the ID for the video you wish to play Now playing a video will be the same as linking to the file directly but instead of doing src="myvideo.mpg" you will use src="video.php?ID=99" Now the video.php file does a query to find the correct video record (ie WHERE ID = {$_GET[iD]}) and echos the blob, and thats it..
-
Heres an example <?php $browser = new COM("InternetExplorer.Application"); $handle = $browser->HWND; $browser->Visible = true; $browser->Navigate("http://www.libgd.org"); /* Still working? */ while ($browser->Busy) { com_message_pump(4000); } $im = imagegrabwindow($handle, 0); $browser->Quit(); imagepng($im, "iesnap.png"); imagedestroy($im); ?>
-
if you don't mind inline PHP then i could create a class, then your just enter <?php echo showAd(); ?> in the places you want an ad to appear your also need <?php include "AdClass.php"; ?> or something at the start of the page if thats okay i'll write one for you
-
Hi haku, My Chinese friend 徐曌 (Rick) says Also we were playing with some Chinese today and found some characters where missing ie comma's to resolved this we used \p{Common} to check only Chinese was entered this is what we used for Chinese $subject = "這是中文測試,这是中文测试哦。"; <?php if (preg_match('/^[\p{Han}\p{Common}]+$/iu', $subject)) { echo "ok"; } else { echo "failed"; } ?> This is the correct way of dealing with Unicode instead of just adding the characters, I hope this helps
-
Your need to change the Apache service to 'Allow service to interact with desktop', and then control a browser (IE, FF, etc) via a COM make it full screen, tell it to go to the URL and then use imagegrabscreen, to grab the screenshot <?php header('Content-Type: image/png'); $im = imagegrabscreen(); imagepng($im); imagedestroy($im); ?>
-
is the problem only related to that app? for example does this work ? <?php $output = shell_exec('ls '); echo "<pre>$output</pre>"; ?>
-
Just a quick thought, but would it not be easier to do $categories = array('Media' => array('Audio','Video'), 'Software'=>array('Freeware', 'Open-Source') ) then have function checkboxes($mainarray, $numval=''){ $form = '<table border="0" width="500px">'; foreach($mainarray as $mk=> $array) { echo $mk; //example $categories = $this->generate($array); //.... EDIT: added example for category name
-
if you look in php.ini or phpinfo(); look for that should give you the path to the error logs
-
when you used system() or exec() did you enter the full path to the VZCtl ? (sorry i don't use VZCtl) also have you checked the error logs ?
-
You have a field in the screenshots table called show, correct ? Well Show is a MySQL reserved word (meaning it has a special meaning) So you can't use it the way you are trying to use it. so to tell MySQL its a field you add the back ticks ` think if it this way, just say i have a field called SELECT and i ENTER SELECT SELECT from table MySQL would be quite confused so i would need to do this SELECT `SELECT` from table So either rename the field you have called "show" to "ShowIT" (for example) or change the query to the one in my last post
-
-
show is a reserved word change the field name or back tick it ie $insert = mysql_query ("INSERT INTO `screenshots`(login,link,ip,date,name,decp,`show`) VALUES ('$login','$link','$ip','$fdate','$name','$dscp','$show') ") or die(mysql_error());
-
Thats an encoding issue, check your using the same encoding on the MySQL as you are on the HTML pages
-
[SOLVED] using REGEX to avoid preg_replace of links
MadTechie replied to SchweppesAle's topic in Regex Help
can you click topic solved please -
I would guess you have a session problem, turn on error reporting or add error_reporting(E_ALL); to the start of the page if you get some header errors read here
-
What was you expecting ? i assume the number mean after X chars from the left So A. <-- . = After #1 A.B. <-- . = After #3 A.B.C <-- after 4 no change A.B.C. <-- after 5 add one which is the same as adding after 4
-
This line $login = mysql_query("SELECT * FROM `users` WHERE `user` = '$user' AND `pass` = '$pass`"); //selects info from our table if the row has the same user and pass that our form does in both login.php and protect.php is slightly wrong change to $login = mysql_query("SELECT * FROM `users` WHERE `user` = '$user' AND `pass` = '$pass' "); //selects info from our table if the row has the same user and pass that our form does (note the last ' instead of `)
-
Sure.. however I hope your aware this will use up a lot of space in the tables and generally I wouldn't recommend it (but theirs always exceptions) Basically you want to store the data in a blob, ie $data = readfile("myFile.mov"); $SQL = "INSERT into table Set myBLOB = $data"; this article is a little out dated but should at least show you the whole idea http://www.devarticles.com/c/a/MySQL/Blobbing-Data-With-PHP-and-MySQL/
-
if you have myphpadmin it shouldn't be hard, just a SQL statement, but i'll really need more info!
-
Yes, or increase the number of ad's, let me explain what's happing you have 5 ads, and 4 on a page, the page loads Ad 1 loads up and is added to a list to not display again Ad 2 loads up and is added to a list to not display again Ad 3 loads up and is added to a list to not display again Ad 4 loads up and is added to a list to not display again same page reload, Ad 1 gets removed from the list BUT Theirs only 2 ads allowed (as the other 3 are still locked) theirs a 50% chance of the same ad being used, (of course if you only had 4ad's theirs 100% chance) What that code does is release all ad's when the page loads, Because your using iFrames it makes the whole task a little harder as each page is independent
-
RegEx isn't required here, so i posted a non-regEx version as well $patient = "smith, john"; if (preg_match('/(.*?),/sim', $patient, $regs)) { $fName = $regs[1]; } echo $fName; //OR echo substr($patient, 0, strrpos($patient, ",")); hope they helps (oh both are untested)
-
Anti-Bump: Plus you have a solution already!
-
If you add more ad your see they do shuffle around, you could add the re-shuffle to the page display itself, for example (please note this must be a PHP file) <?php session_start(); $_SESSION["Ad"] = array(); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=big5"> <title>Random Ad Sample</title> </head> <script language="JavaScript"> <!-- function color_selected(c) { document.getElementById("color_value").value = c; } // --> </script> <body> <p align="center"><strong><font color="#336699" size="+1">Fla<font color="#FFCC00">s</font>h-here.com Random Ad Example</font></strong></p> <p> </p> <iframe marginwidth="0" marginheight="0" width="468" height="60" scrolling="no" frameborder=0 src="randomad.php?ID=Top"></iframe> <iframe marginwidth="0" marginheight="0" width="468" height="60" scrolling="no" frameborder=0 src="randomad.php?ID=Left"></iframe> <iframe marginwidth="0" marginheight="0" width="468" height="60" scrolling="no" frameborder=0 src="randomad.php?ID=Right"></iframe> <iframe marginwidth="0" marginheight="0" width="468" height="60" scrolling="no" frameborder=0 src="randomad.php?ID=Bottom"></iframe> <table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td><div align="center"><font color="#666666">© 2003 Flash-here.com (contact: <a href="http://www.flash-here.com">web</a>, <a href="mailto:support@flash-here.com">email</a>)</font></div></td> </tr> </table> </body> </html>
-
Just reviewed and found bug, and made a few tweaks.. <?php /* Please note for using more than one add per page your need to give each ad a unqiue ID (see the ?ID=x) You can also add a lifespan but adding &life=x this mean that THIS advert space will not that the same advert got X turns (see third example) */ /* SAMPLE <iframe marginwidth="0" marginheight="0" width="468" height="60" scrolling="no" frameborder=0 src="randomad.php?ID=Top"></iframe> <iframe marginwidth="0" marginheight="0" width="468" height="60" scrolling="no" frameborder=0 src="randomad.php?ID=Left"></iframe> <iframe marginwidth="0" marginheight="0" width="468" height="60" scrolling="no" frameborder=0 src="randomad.php?ID=Right&life=10"></iframe> */ $adfile = "ads.txt"; //Add file header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Cache-Control: no-cache"); header("Pragma: no-cache"); session_start(); // load the file that contain the ads $ID = (int)(!empty($_GET['ID']))?$_GET['ID']:1; $ads = file(dirname(__FILE__)."/$adfile"); array_unique($ads);//Remove identcial Ads if(isset($_SESSION["Ad"]) && is_array($_SESSION["Ad"])) { foreach(array_keys($_SESSION["Ad"]) as $saveAd) { if($saveAd == $ID) $_SESSION["Ad"][$saveAd]['Life']--; if($_SESSION["Ad"][$saveAd]['Life']==0) { unset($_SESSION["Ad"][$saveAd]); continue; } unset($ads[$_SESSION["Ad"][$saveAd]['Display']]); } } $c = array_rand($ads); if(is_int($c)) $_SESSION["Ad"][$ID]['Display'] = $c; $_SESSION["Ad"][$ID]['Life']=(int)(!empty($_GET['life']))?$_GET['life']:1; echo $ads[$_SESSION["Ad"][$ID]['Display']]; ?> depending on the number of ad's you have and the amount per page they may not shuffle very well, (ie with 4 ads and 3 per page they only move 1 step, but it should be fine, If you want to allow them to reshuffle then you could add this on the page (not in the randomad.php file) will reset them session_start(); $_SESSION["Ad"] = array(); *what i mean by reshuffle is if you have 4 ads and 4 per page no ads will move from box to box, but the code above will resolve that