-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
can you post your latest code
-
If you was going to use RegEx, this would be simpler! <?php //Get the URI (from the address bar) #$str = $_SERVER['REQUEST_URI']; $str = 'http://www.sitename.com/articles/2007/10/article-title-name/2'; preg_match_all('%/([^/]*)%i', $str, $result, PREG_PATTERN_ORDER); $bits = $result[1]; echo $bits[5]; ?>
-
php sending mails to mailing list show strange headers
MadTechie replied to santos's topic in PHP Coding Help
are you sending from the same domain the php server is on ? or do you have a Sender Policy Framework (SPF)? if so add an SPF record in your DNS zone file to allow the sending from the php severs IP. -
[SOLVED] how can I protect my database configuration file?
MadTechie replied to shedokan's topic in PHP Coding Help
a simple check will be okay, <?php //make sures its .php not .php.inc if(!IN_MySystemName) { die("Access Denied"); } //Config settings (not echoing) $password="Blar"; etc ?> <?php define("IN_MySystemName", true); include "config.php" ?> you could encrypted it as well (if you feel the need, but that becomes a pain If they get FTP access then your stuffed.. the most common problems are things like SQL Injection.. -
php sending mails to mailing list show strange headers
MadTechie replied to santos's topic in PHP Coding Help
Either Update the PHP.INI file, or if you don't have direct access to the server ini_set what part do you not understand ? -
Anyway substitute for onLoad() javascript method in PHP
MadTechie replied to ManOnScooter's topic in PHP Coding Help
~Sighs~.. Using AJAX.. See here -
Few fixes <?php if($row) { $time = date("D d F Y H:i:s"); $ip = $_SERVER['REMOTE_ADDR']; mysql_query("INSERT INTO `user_logs` (`userid`,`ip`,`time`) VALUES ('{$row['id']}','$ip','$time')"); mysql_query("DELETE FROM `guests` WHERE `ip` = '$ip' "); if(!isset($_POST['staylogged'])) { $_SESSION["user"] = $row['username']; } else { setcookie("user", $row['username'], time()+(3600*24*1)); //1 day (change 1 to suite) } ?> <?php if($_SESSION['user']) { $query = mysql_query("SELECT * FROM `users` WHERE `username` = '{$_SESSION['user']}'"); $user = mysql_fetch_array($query); $logged = true; } if($_COOKIE['user']) { $query = mysql_query("SELECT * FROM `users` WHERE `username` = '{$_COOKIE['user']}'"); $user = mysql_fetch_array($query); $logged = true; } ?>
-
i think he means <?php //Get the URI (from the address bar) $str = $_SERVER['REQUEST_URI']; //+GingerRobot code $bits = explode('/',$str); echo $bits[4];//the article name //(changed to 4 as REQUEST_URI skips the http://) ?>
-
maybe try using stream_get_contents and cycle throught the page in X bytes, also use flush to output the curently steamed bytes
-
try ALTER TABLE SISTOCK CHANGE COLUMN CAMERAMODEL CAMERAMODEL ENUM ('', 'INSTOCK', 'BACKORDER','SERVICE','OBSOLETE') NOT NULL;
-
I hear of many IIS problems.. also Around and around we go..
-
[SOLVED] Populate Combo Box based on the value of another one!
MadTechie replied to khalidorama's topic in PHP Coding Help
try this <?php echo "please click to choose brand:"; echo "<select name=\"combo\" onchange=\"submit();\">"; for($i=0; $i < $rows; $i++) { $id =mysql_result($result,$i,"id"); $name =mysql_result($result,$i,"name"); $sel = ($_REQUEST['combo'] == $i)?"selected=\"selected\"":""; //ADDED echo "<option value=\"$id\" $sel>$name</option>"; //UPDATED }; echo "</select>"; ?> -
your need to use AJAX Read up on Ajax, Ajax freaks tut,
-
php sending mails to mailing list show strange headers
MadTechie replied to santos's topic in PHP Coding Help
your need to change the account your sending from.. thats the behalf of..account ini_set -
Looking at the memory size.. it would seam to be a PECL problem, or a problem in the script.. do you have the lastes version of php_printer.dll? also are you trying the same test on the new server compared to the old one ? any other printing issules on the new server ?
-
[SOLVED] multiple mysql row deletion via checkboxes
MadTechie replied to scarhand's topic in PHP Coding Help
as an idea.. why not <form method="post"> <?php $showshoutsql = mysql_query("SELECT * FROM shouts ORDER BY $sortshout $ordershout"); $showshoutcount = mysql_num_rows($showshoutsql); if (isset($_POST['removeselected'])) { for ($i = 0; $i < $showshoutcount; $i++) { $chex = $_POST['chex$i']; echo "$chex <br />"; } } $n=0; while ($row = mysql_fetch_array($showshoutsql)) { echo "<input type=\"checkbox\" value=\"$id\" name=\"chex$n\"> \n"; $n++; } ?> <br /> <input name="removeselected" type="submit" value="Remove Selected"> </form> EDIT: WooHoo re-writing the JS is much better, -
check the memory.. on the new server check the memory setting in the php.ini file ie
-
[SOLVED] multiple mysql row deletion via checkboxes
MadTechie replied to scarhand's topic in PHP Coding Help
IMO i think this is javascript problem.. (if you can use an array in your javascript) not a PHP one, sure we can suggest "workarounds" but why not just fix the fault ! -
really depends on the SMTP provider,
-
PDF Upload to MYSQL: not a valid stream resource
MadTechie replied to ddicicco's topic in PHP Coding Help
the file isn't uploading.. check your timeouts, -
Either write a parse. or maybe use COM's to extract the text
-
Its just a way of working out the pro's and con's.. yeah microseconds.. running once isn't a problem... but you may not run it once.. you may need to use it on a database with millions records.. and that may only be part of a routine thats run hourly.. in that case.. your at the point of security vs usability or even durability.. without knowing exactly what its going to be used for we can only look at the pro's and cons
-
i know what your trying to do.. but you have add them into a form.. with a submit button.. that submit button will have no effect.. $_POST["username"]=$username; will work with an include but NOT on a post (that the submit button will perform).. Ok see example <?php } else { $error = array(); //ErrorArray if ($first_name == "") { $error[] = "You must enter a firstname"; } if ($surname == "") { $error[] = "You must enter a surname"; } if ($email_address == "") { $error[] = "You must enter an email address"; } //SNIPP.... ?> You have the following errors: <br /> <?php //Display errors foreach($error as $e) { echo "$e<br>"; } ?>
-
true also, an old saying "it doesn't matter how strong the front door is, if the windows left open" you are the weakest link.. good bye
-
Ouch.. i don't believe i missed that..