-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
I guess you could do something like this:~ its just a draft (very quickly written) <?php $SomeData = ""; $RequirePIN = false; if(!empty($_POST['SomeData'])) { //Check if PIN is Req. if($_POST['SomeData'] == "Private") { $RequirePIN = true; } if(!$RequirePIN) { header("LOCATION: display.php?SomeData=".$_POST['SomeData']); } if($RequirePIN && !empty($_POST['PIN'])) { $_SESSION['PIN'] = $_POST['PIN']; //display.php MUST also check the Database PIN with the $_SESSION['PIN'] header("LOCATION: display.php?SomeData=".$_POST['SomeData']); exit; } $SomeData = $_POST['SomeData']; } ?> <form method="POST"> <input type="text" name="SomeData" value="<?php echo $SomeData ?>"> <?php if($RequirePIN) { ?> <input type="text" name="PIN" value="123"> <?php } ?> <input type="submit" value="Submit"> </form>
-
Heehee, awpti read again! remember double quotes are parsed.. singles are not.. so change to singles will work <?php echo '$_server request_uri = ' . $_SERVER['REQUEST_URI']. "<br />"; echo '$_server request_uri = ' . $_SERVER['SERVER_SOFTWARE']. "<br />"; ?> $_server isn't set yet PHP is attempting to parser it.. thus getting blank.. as you don't want this use single quotes EDIT: you could also escape them ie echo "\$_server request_uri = " . $_SERVER['REQUEST_URI']. "<br />";
-
Letting us know the errors may help a little! AndyB as pointed out a problem that need to be resolved..
-
Okay the part i dont get is.. wouldn't you have the javascript prompt you for a security code when "code = ABC" remember i have no idea what code refers to or if ABC is unique to each user or what.. i really need more info.. from what i am reading you enter a code if thats equal to abc you ask for a PIN.. if ABC is static then why submit it.. why not have a JS to add the form element ? if its not static you could use AJAX to validate it
-
change the last line form $result= mysql_query($sql); to $result= mysql_query($sql) or die(mysql_error()); and check any errors, theirs lots of Notices type error but their want kill the script
-
This sounds like a javascript question.. i think.. i am not sure what your asking!!
-
change $rs_query=mysql_query($sql); to $rs_query=mysql_query($sql) or dir("Error in query:'$sql'<br>".mysql_error()); this should give you more info
-
lol, Yeah i saw that on the post and was going to comment on it.. but i have made some donut doughnut mistakes in the past lol
-
Okay First Error I assume your mail domain isn't smtp.my.server.net.. But if you installed "Free SMTP Server" (which i have never used before) on the same PC then your localhost is your SMTP Server.. so in the PHP.INI change SMTP = smtp.my.server.net to SMTP = localhost The other errors may be related so lets resolve one at a time.. you may need to restart your PHP server after the change.. but "Free SMTP Server" should be running (do it have a test option?) Last be not least this isn't really a PHP question..
-
Do you mean this ? <?php $form1= "2"; $form2="gh?"; if ( eregi("\?", $form2) && $form1=="1") { $form2="a"; }elseif (eregi("\?", $form2) && $form1=="2") { $form2="b"; } echo $form2; ?>
-
print '<form enctype="multipart/form-data" method="post">'; to print '<form enctype="multipart/form-data" name="form1" method="post">';
-
Ahhh.. i think we are going to need to see some code
-
Okay well this should work, try this in its own file (make sure you have the JS in the same folder) <?php echo "<SCRIPT LANGUAGE=\"JavaScript\" SRC=\"CalendarPopup.js\"></SCRIPT>"; echo "<SCRIPT LANGUAGE=\"JavaScript\"> var cal = new CalendarPopup(); </SCRIPT>"; echo "<form name=\"form1\">"; echo "Date:<input type=\"text\" name=\"date\" readonly=\"readonly\" />"; echo "<a href=\"#\" onClick=\"cal.select(document.forms['form1'].date,'anchor1','MM/dd/yyyy'); return false;\" NAME=\"anchor1\" ID=\"anchor1\">Date Selector</a>"; echo "</form>"; ?>
-
Wrong Section looks like your missing a quote <meta http-equiv="refresh" content="3">
-
if the problem truly is "Urgent" then you post in the freelance section with an offer.. When you ask for help we need to know the problem.. Now i can see what you want to do but i have no idea what your stuck on.. Do you have a login page ? (third party ?) is their a problem with it ? can you show us the code that has the problem ?
-
Okay this has nothing to do with PHP.. try the HTML/CSS/Javascript section.. but it looks like your missing the form tag.. and a print command try this <?php print '<SCRIPT LANGUAGE="JavaScript" SRC="CalendarPopup.js"></SCRIPT>'; print '<SCRIPT LANGUAGE="JavaScript"> var cal = new CalendarPopup(); </SCRIPT>'; print "<form>"; print 'Date:<input type="text" name="date" readonly="readonly" />'; print '<a href="#" onClick="cal.select(document.forms[\'form1\'].date,\'anchor1\',\'MM/dd/yyyy\'); return false;"NAME="anchor1" ID="anchor1">Date Selector</a>'; print "</form>"; ?>
-
Humm did this a few days ago.. theirs a few changes the Main change you can follow by following $HasFile.. if that makes sense
-
I agree with ranjuvs but just a little security addional (if you wanted) <?php if(isset($_GET['vyb3'])){ $vyb3=$_GET['vyb3']; //Security Addition $allowed = array("main", "about", "ect"); //Security Check if(!in_array($vyb3, $allowed) return die('Error Loading'); $filename = $vyb3 . '.php'; if(file_exists($filename)) { include($filename); } } ?>
-
[SOLVED] Disabling Account using LDAP and PHP
MadTechie replied to wwfc_barmy_army's topic in PHP Coding Help
If you want to disable an account in an Active Directory of Windows, you may try this: (foo.bar should be replaced in "$ldapBase" to the correct domain, e.g. "DC=phpfreaks,DC=com" if your domain is phpfreaks.com) #domctrl = domain controller #domadlogin = domain admin login #domadpw = domain admin password #username = loginname of useraccount (e.g. "john.doe") #enable =1 (if you want to enable it, 0 if it should be disabled) <?php function userchange($username,$enable=1,$domadlogin,$domadpw,$domctrl) { $ldapServer = $domctrl; $ldapBase = 'DC=foo,DC=bar'; $ds = ldap_connect($ldapServer); if (!$ds) {die('Cannot Connect to LDAP server');} $ldapBind = ldap_bind($ds,$domadlogin,$domadpw); if (!$ldapBind) {die('Cannot Bind to LDAP server');} ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); $sr = ldap_search($ds, $ldapBase, "(samaccountname=$username)"); $ent= ldap_get_entries($ds,$sr); $dn=$ent[0]["dn"]; // Deactivate $ac = $ent[0]["useraccountcontrol"][0]; $disable=($ac | 2); // set all bits plus bit 1 (=dec2) $enable =($ac & ~2); // set all bits minus bit 1 (=dec2) $userdata=array(); if ($enable==1) $new=$enable; else $new=$disable; //enable or disable? $userdata["useraccountcontrol"][0]=$new; ldap_modify($ds, $dn, $userdata); //change state $sr = ldap_search($ds, $ldapBase, "(samaccountname=$username)"); $ent= ldap_get_entries($ds,$sr); $ac = $ent[0]["useraccountcontrol"][0]; if (($ac & 2)==2) $status=0; else $status=1; ldap_close($ds); return $status; //return current status (1=enabled, 0=disabled) } // use this to disable an account: // userchange('john.doe@foo.bar',0,'admin@foo.bar', 'secret','domctrl.foo.bar'); // ..but this to enable it: // userchange('john.doe@foo.bar',1,'admin@foo.bar', 'secret','domctrl.foo.bar'); ?> -
Maybe asking in the HTML/CSS help section would be a good starting point!
-
Ermm read last 2 posts (excluding yours)
-
You could have a script to load up the images ie <?php header('Content-Type: image/jpeg'); $img = imagecreatefromjpeg("/private/images/".$_GET['jpg']); imagejpeg($img); imagedestroy($img); ?> however you should check the files before uploading them..
-
any errors ? maybe also echo mysql_affected_rows() to check if any update occured
-
Its just a find and replace.. see str_replace for more details.. any questions just ask