-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
try this <?php $data= 'some data width="100" blar'; if (preg_match('/width="(\d+)"/', $data, $regs)) { echo "Width = ".$regs[1]; }else{ echo "no width found"; } ?>
-
http://www.phpeasystep.com/workshopview.php?id=6
-
Is there a way to see who is linking to images on my site?
MadTechie replied to phpnoobie9's topic in PHP Coding Help
I can see some referring sites with host log, just wondering if it's possible to track an actual image being displayed at a website. OR create a script to display the images on their site ie display.php?image=hello.jpg <?php $private = "/hiddenfolder/" //sql write to log file readfile($private.$_GET['image']); ?> -
when sending use encodeURIComponent("blar&blar"); or update the ajax to use post instead of get
-
Secure Image Captcha Installation (Please help)
MadTechie replied to apaunganhote's topic in PHP Coding Help
oops comment out the last } } else { echo "<center>Sorry, the code you entered was invalid. <a href=\"javascript:history.go(-1)\">Go back</a> to try again.</center>"; } //} //REMOVE -
maybe this if(isset($_POST['submit'])) { $question_Desc = $_POST['question_Desc']; $question_EndDate = $_POST['question_EndDate']; $question_Week = $_POST['question_Week']; $query = "INSERT INTO question (question_Desc, question_Week, question_Correct_Answer, question_EndDate, module_Code) VALUES ('$question_Desc', $question_Week, 0, '$question_EndDate', '$module')"; $check = mysql_query($query) if($check) { $msg = "Succeeded adding the question to the database"; }else{ $msg = "Failed adding the question to the database"; } echo "<script type='text/javascript'>\n var divid = document.getElementById('notify');\n divid.style.display = 'block';\n divid.innerHTML = '$msg';\n </script>\n"; }
-
was their a question in that ? ??? see manual die AKA exit do you have some sample code ?
-
strange, have you tried $test = mysql_select_db("wrong_db_name_here"); if(!$test) { die("Woops! There was an error.")); }
-
Secure Image Captcha Installation (Please help)
MadTechie replied to apaunganhote's topic in PHP Coding Help
try this quick example <html> <head> <title>Securimage Test Form</title> </head> <body> <?php //if (empty($_POST)) { //Remove ?> <form method="POST"> Username:<br /> <input type="text" name="username" /><br /> Password:<br /> <input type="text" name="password" /><br /> <!-- pass a session id to the query string of the script to prevent ie caching --> <img src="securimage_show.php?sid=<?php echo md5(uniqid(time())); ?>"><br /> <input type="text" name="code" /><br /> <input type="submit" value="Submit Form" /> </form> <?php // } else { //form is posted //remove include("securimage.php"); $img = new Securimage(); $valid = $img->check($_POST['code']); if($valid == true) { echo "<center>Thanks, you entered the correct code.</center>"; } else { echo "<center>Sorry, the code you entered was invalid. <a href=\"javascript:history.go(-1)\">Go back</a> to try again.</center>"; } } ?> </body> </html> -
try this <?php //VERY START of the page session_start(); if(isset($_POST['pass'])) { $_SESSION['access'] = false; $passwordd = $_POST['pass']; if($passwordd == "SecurePassword")//your password { $_SESSION['access'] = true; header("Location: access.php"); } echo "Invalid password"; } ?> echo "<html><center><body bgcolor='black'><img src='headert.jpg'><br /> <br /> <font color='red' size ='5'>Password required for access:</font> <form method='POST'><input type='password' maxlength='20' name='pass'><br /> <br /> <input type='submit' value='Login!' name='login'></form></body></center></html>"; <?php //VERY START of the page session_start(); if(!$_SESSION['access']) { header("Location: start.php"); } echo "your in "; //reset of the page ?>
-
Is there a way to see who is linking to images on my site?
MadTechie replied to phpnoobie9's topic in PHP Coding Help
if its being displayed via a php script (your side) then yes, really need more info.. about what you want exactly! -
you could do this on the callback (PHP side) depends on the code.. <?php $data = "hello & world"; $data = rawurlencode($data); // hello%20%26%20world echo $data; ?> then on the javascript side use decodeURIComponent ie <script type="text/javascript"> var test1="hello%20%26%20world"; document.write(decodeURIComponent(test1)); </script>
-
sure <?php $mHost = ini_get('SMTP'); //Gets SMTP (out going mail servers domain/ip) from the php.ini file $mPort = ini_get('smtp_port'); //Gets SMTP port (out going mail servers port) from the php.ini file probably (port 110) $fp = fsockopen($mHost, $mPort, $errno, $errstr, 30); //Connects to the mail server (wait a max of 30 seconds) if (!$fp) //if their was a connection then the server and port are open so should be okay { die("Mail Server down"); } ?> of course the mail server could be open on that server and the port be okay but another problems could mess things up, but then your need to add more tests, something like <?php $data = ""; while (!feof($fp)) { $data .= fgets($fp, 128); } //check $data for messages etc ?>
-
AJAX was using GET then
-
it could until i see something i can't say, before returning it to the ajax (for the callback) try using urlencode see if that helps (again i am guessing here, without seeing anything i can't do much more)
-
mail($to, $subject, $message, $headers); will return false if it fails maybe this!! before mailing! <?php $mHost = ini_get('SMTP'); $mPort = ini_get('smtp_port'); $fp = fsockopen($mHost, $mPort, $errno, $errstr, 30); if (!$fp) { die("Mail Server down"); } ?>
-
need some sample code really.. if your posting via GET that could be the reason..
-
Is there a way to see who is linking to images on my site?
MadTechie replied to phpnoobie9's topic in PHP Coding Help
try checking the host logs, -
you could try a javascript solution, if you know the fields to post then have the form with the fields and change the action to the remote path and then have JS submit it
-
Okay this isn't a php problem but Probably a setting in IE, you could try resetting IE See here, it could also be a firewall/ antivirus OR install firefox (personally i think its safer and better), download here
-
depends how your redirecting, but simply put no.. you could use CURL or fsockets to make a connection to another site with the POST, if you control the site you have a fw more options but as you said you can't use sessions i guess their remote
-
as with any application when you write it you design it with plugins in-mind, or with a API manual.. as you write the system workout how you want others to add their own code then add that into the system.. a plugin is a addon (like an extra encryption or something that the currect system doesn't have) a Module is self-contained component of a system, which has a well-defined interface.
-
not a php problem in anyways! but in anycase you forgot to embed it object is IE embed is others <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="" id="myFlashMovie" width=481 height=86> <param name=movie value="flips2.swf"> <embed play=false swliveconnect="true" name="myFlashMovie" src="flips2.swf" quality=high bgcolor=#FFFFFF width=481 height=86 type="application/x-shockwave-flash" ....> </embed > </object >
-
change $query = "SELECT `cat_id` FROM `categories` WHERE `cat_name` = $which_one"; to $query = "SELECT `cat_id` FROM `categories` WHERE `cat_name` = '$which_one' "; or $query = "SELECT `cat_id` FROM `categories` WHERE `cat_name` LIKE '%$which_one%' ";
-
Heres a quick example that may help (untested but i think its sound) <?php //create an instance of the ADO connection object $conn = new COM ("ADODB.Connection") or die("Cannot start ADO"); //define connection string, specify database driver $rs= "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=c:folder\emp.mdb"; //updated //Open the connection to the database // $conn->open($connStr);//removed $conn->ConnectionString = $connStr ; //updated $conn->Open(); # Sql table $table = "my_sql_table"; $sql = "SELECT * FROM $table"; $rs->Open($sql, $conn); $assoc_array = array(); $index = 0; # Iterate through our result while (!$rs->EOF) { for( $x = 0; $x < $rs->Fields->Count; $x++ ) { $assoc_array[ $index ][ $rs->Fields[$x]->Name ] = $rs->Fields[$x]->Value; } # Move cursor to next row in recordset $rs->MoveNext(); $index++; } # Print the array echo "<pre>"; print_r($assoc_array); echo "</pre>"; # Close the connection and the recordset $rs->Close(); $conn->Close(); EDIT: made a few updates