Jump to content

Search the Community

Showing results for tags 'code'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (Dreamweaver, Zend, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

Found 11 results

  1. Hi there, new to the forum Ok so i have a crm and i'm trying to add bits, been pretty succesful at most of it, however i've added a new field "status" and i want to be able to search this field, i've tried copying and changing the existing code, but it doesn't seem to be grabbing it. So here's some exisiting code (that works and searches the field marked "Address" 'address' => array( 'title' => _l('Address:'), 'field' => array( 'type' => 'text', 'name' => 'search[address]', 'value' => isset($search['address'])?$search['address']:'', 'size' => 15, ) ), 'status' => array( 'title' => _l('Status:'), 'field' => array( 'type' => 'text', 'name' => 'search[status]', 'value' => isset($search['status'])?$search['status']:'', 'size' => 15, ) ), I thought a simple name change like above would work, but it doesn't pull anything through, anyone got any ideas?
  2. update super set `name` = REPLACE(`name`, ',' , ' ') I have the following code that removes the comma in a MySQL database column & replaces it with a blank. In the above example, the database is named super & the column is named name. This code works great but currently I'm running the script each day & changing it to also remove periods, question marks, etc. Is there a way I can edit the above code that will not only find & replace the , with a blank space, but edit it so it will find the periods, commas, question mark, exclamation mark, etc all in one run? Please help as I am currently editing the above code to numerous other things to find & replace daily. Thank
  3. Hello, I went to a new job meeting today and the guy there told me that they use abstract classes for testing classes/codes. Well I would create a simple html file and test the classes and functions if they return me the correct values. So why would i need an abstract class for testing purpose? Is there any point that i am missing, or he does not know what he talks about? Thank you in advance for your replies.
  4. Say I have a form field where I input any text(numbers,text,symbols, or mixed). I want to encrypt that input into 16 characters long encryption string that includes at least one uppercase letter, one lowercase letter, one number and one special character? How can that be done? Also I want to decrypt it back to original input as well. Can that be one?
  5. I'm using a theme that supports a Sub-Filter Menu, and I am having a hard time changing a sub-menu title without losing the functions of the actual prompt. For instance the sub-filter menu has Latest, Likes, Comments. However I want for it to say Latest, Hottest, Comments, when I change the Like to Hottest it no longer shows the post with the most likes in order. I believe this is because the 'Likes' is being called from other php files. Is there a way to add a code that will keep the like function, but display my desired Sub-filter menu title at the same time? An example would be something like this <label for="Likes">Hottest</label> Code below: <ul id="filter_subfilter" class="sort"> <?php if (isset($inspire_options_hp['subfilter_show_latest'])) {?><li><a href="#"><?php _e('Latest', 'loc_inspire'); ?></a></li><?php ;} ?> <?php if (isset($inspire_options_hp['subfilter_show_likes'])) {?><li><a href="#"><?php _e('Likes', 'loc_inspire'); ?></a></li><?php ;} ?> <?php if (isset($inspire_options_hp['subfilter_show_comments'])) {?><li><a href="#"><?php _e('Comments', 'loc_inspire'); ?></a></li><?php ;} ?> <?php if (isset($inspire_options_hp['subfilter_show_random'])) {?><li><a href="#"><?php _e('Random', 'loc_inspire'); ?></a></li><?php ;} ?> </ul>
  6. I have requirements from a client for a code repository, or just a file repository, and I'm not sure that I can find one that matches. Here's what's needed: A way to upload files directly, either with FTP or via browser. No git commands, etc. A way to search those files (filenames and text within files) from the browser A way to compare files (preferably between two folder roots and including all subfolders/files) from the browser I think that's it. A bonus would be to upload a zip and be able to unzip it on the server, but that seems like a stretch. Does something like this exist?
  7. <script type="text/javascript"> function listBoxSearch(){ var input = document.getElementById('searchBox'), output = document.getElementById('listBoxF'); if(input.value != ''){ for (var i = 0; i < output.options.length; i++){ if(output.options[i].text.substring(0, input.value.length).toUpperCase() == input.value.toUpperCase()){ output.options[output.options.length] = new Option(output.options[i].innerHTML, output.options[i].text); } } if (output.options.length == 1) { output.selectedIndex = 0; } } } </script> It dosen`t work. It should work like this[DEMO in attached filed] listbox_with_keybord_search.htm
  8. Hi there, what I have been trying to do is add some additional logic.. My problem is I want to stop displaying the month and day after the year 2000? I know I need to add an if and else statement but this is my first actual project and I am a little stuck.. here is the page, it's a plugin for a timeline http://www.llandoveryheritage.org/project-timeline/ And the file is attached below.. any help would be appreciated. The plugin code was too long to just post in here, didn't want to cause any slow loading issues for people on a slow connection.. Thanks and I appreciate any help. annual_archive.php
  9. Sir/ma'am, With the script I'm using to run my website, I've been trying to add an additional feature for the users to add/edit. I'll try to provide as much info as I can, hopefully it'll help. Here is the code I'm using to display the user's unique info from the db. <a class="wallet-edit"><?php echo $_SESSION['simple_auth']['INFO']?></a> That displays the user's info from the column 'INFO' perfectly. It's also a js popup to a menu to where I'm hoping to add a single textbox to edit the INFO. The script uses a similar function to edit the password with a popup. I've tried modifying the code to edit the INFO column but it doesn't work. Here is the default code it has to edit the password. I'm not sure if it can be changed to edit another column or needs a new piece of code for that. // user edit $('body').on('click', '.username-edit', function() { $('#modal').html(' '); var output = '<div class="modal-content"><h5><?php echo lang::get("Change password")?></h5><hr />'; output += '<h5><?php echo lang::get("New password:")?></h5><input type="password" name="password" id="password" value="" class="text ui-widget-content ui-corner-all" />'; output += '<h5><?php echo lang::get("Confirm password:")?></h5><input type="password" name="password2" id="password2" value="" class="text ui-widget-content ui-corner-all" />'; output += '</div>'; output += '<div class="modal-buttons right">'; output += '<button id="confirm-button" type="button" class="nice radius button"><?php echo lang::get("Change")?></button>'; output += '</div>'; output += '<a class="close-reveal-modal"></a>'; $('#modal').append(output); $('#second_modal').hide(); $('#modal').reveal(); $('#confirm-button').click(function(){ $('#password').css('border-color', '#CCCCCC'); $('#password2').css('border-color', '#CCCCCC'); var password = $('#password').val(); var password2 = $('#password2').val(); if(typeof(password) === 'undefined' || password == ''){ $('#password').css('border-color', 'red'); return false; } if(password != password2){ $('#password2').css('border-color', 'red'); return false; } password_data = encodeURIComponent(password); $.post("<?php echo gatorconf::get('base_url')?>", { changepassword: password_data} ).done(function(data) { // flush window.location.href = '<?php echo gatorconf::get('base_url')?>'; }); }); }); If the code above can be edited to work with what I'm trying to do, it of course only needs one textbox and doesn't have to be confirmed by a second input. Please help! Thanks!
  10. Hi I am trying to search an array that comes from a power shell script, the array of strings that returns is ever changing as it receives variables from the script. Therefore I need to use preg_grep to search for the word "not" I am also using another array which inverts this I then need to compare these new two arrays to the original and separate the results $working and not working into a table. I would be most grateful for any advice/solutions. The preg_grep aren't displaying anything. <?php //phpinfo(); ini_set('display_errors', 'On'); error_reporting(0);//E_ALL echo '<html> <style> body { font-family:Calibri,Helvetica,sans-serif; font-size:100%; } </style> <head> <link rel="stylesheet" type="text/css" href="style.css"> <script type="text/javascript"> function uploadJS(){ String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ""); }; var textAreaValue=document.getElementById(\'ServerList\').value; var trimmedTextAreaValue=textAreaValue.trim(); if(trimmedTextAreaValue!="") { document.myForm.submit(); } else{ alert("Server List Text Area is Empty"); } }; var input=document.getElementById(\'fileSelect\').value; if(input!="") { document.myForm.submit(); } else{ alert("You have not selected a file, please select one to proceed."); } var handleFileSelect = function(e) { var files = e.target.files; if(files.length === 1) { document.forms.myForm.filecsv.value = files[0].name; } } }; </script> </head>'; #Upload Code $target = "D:\Web\Upload/"; $target = $target . basename( $_FILES['uploaded']['name']) ; $ok=1; if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else { } if ($uploaded_size > 150000) { echo "Your file is too large.<br>"; $ok=0; } if ($uploaded_type =="text/php") { echo "No PHP files<br>"; $ok=0; } if (!($uploaded_type=="text/csv")) { echo "<br>"; $ok=0; } $target = "upload/"; $target = $target . basename( $_FILES['uploaded']['name']) ; $ok=1; //This is our size condition if ($uploaded_size > 350000) { echo "Your file is too large.<br>"; $ok=0; } //This is our limit file type condition if ($uploaded_type =="text/php") { echo "No PHP files<br>"; $ok=0; } //Here we check that $ok was not set to 0 by an error if ($ok==0) { } //If everything is ok we try to upload it else { if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else { } } #Start of scripts to check Servers in textbox if(isset($_POST['ServerList'])) { //$arry=explode( "\r\n", $_POST['ServerList'] ); $txttrim = trim($_POST['ServerList']); //$textAr = explode("\n", $text); //$textAr1 = array_filter($text, 'trim'); // remove any extra \r characters left behind $txtarea = explode("\n",$txttrim); $txtarea = array_filter($txtarea,'trim'); foreach ($txtarea as $line => $servername) { //$line => $servername; ##check if querying itself.... } echo '<pre>'; $target="D:/Web/Upload/"; $target= $target . basename( $_FILES['uploaded']['name']) ; $csv = $target; //$filename= $_FILES['uploaded']['name']; $output=shell_exec("powershell -Command D:/Web/scripts/PHPfwrules.ps1 $csv < NUL"); echo '<h6>'; print_r($output); $nomatch=preg_grep('/^not/i',$output); echo $nomatch; $match=preg_grep("/not/",$output,PREG_GREP_INVERT); echo $match; if ($working1= array_intersect($output,$match)) { echo"<link rel=stylesheet type=text/css href=style.css> <table class=results> <tr> <th>Server Name</th> <th>Working</th> </tr> <tr> <td>".$servername."</td> <td>".$working1."</td> </tr></table> "; } else if ($notworking1= array_intersect($output,$nomatch)) { echo"<link rel=stylesheet type=text/css href=style.css> <table class=results> <tr> <th>Server Name</th> <th>Not Working</th> </tr> <tr> <td>".$servername."</td> <td>".$notworking1."</td> </tr></table> "; } } echo' <link rel=stylesheet href=dhtmlwindow.css type=text/css /> <link rel=stylesheet type=text/css href=style.css> <script src=js/dhtmlwindow.js></script> <hr /> <table class=results> <tr> <th>Server Name</th> <th>Working</th> <th> Not Working</th> </tr> <tr> <td>'.$servername.'</td> <td>'.$working1.'</td> <td>'.$notworking1.'</td> <td></td> '; echo '</pre>'; echo ' <h3>Firewall Implementation </h3> <h4>Please enter the server below, you can only select one server at a time. </h4> <!--The form--> <form action="fw2.php" method="post" name="myForm" id="myForm" enctype="multipart/form-data"> <textarea name=ServerList id=ServerList> </textarea> <h5>Please select a CSV file.</h5> <input name="uploaded" type="file" /><br /> <input type="submit" value="Submit" /> <br> </html> ' ; ?> Here is the power shell script: #### Set Parameter for the input filename #### Param( [Parameter( # Mandatory = $true, ParameterSetName = '', ValueFromPipeline = $true)] [array]$Filename ) #### Check if files already exist #### if (test-path c:\ec\company\ports\working.txt) { Remove-item c:\etc\company\ports\working.txt } if (test-path c:\etc\company\ports\NOTworking.txt) { Remove-item c:\etc\company\ports\NOTworking.txt } #### Create Directory if it does not exist #### if ((test-path c:\etc\company\ports) -eq $false) { New-Item -ItemType directory -Path C:\etc\company\Ports } #### Output filenames #### #### Declaring the failure variable as an array #### $failure = @() $computer = gc env:computername $outputfileworking = "C:\etc\company\ports\working.txt"; $outputfileNOTworking = "C:\etc\company\ports\NOTworking.txt"; #### Output servername to the output file #### echo "ServerName:$computer" | out-file -filepath $outputfileworking $path = "$Filename" $csv = Import-csv -path $path ForEach($line in $csv) { $destination = $line.destination $protocol = $line.protocol $port = $line.port $result = ./portqry.exe -n $destination -e $port -p $protocol if ($result -like "*: LISTENING*") { Echo "$destination is reachable on port $port using $protocol" } else { Echo "$destination is not reachable on port $port using $protocol" } } if ($failure) { echo "ServerName:$computer" | out-file -filepath $outputfileNOTworking echo $failure | out-file -filepath $outputfileNOTworking -append }
  11. Hi everyone. Pretty desperate, first time that I'm working with php. Learning this language, makes sense, however I can't figure out why my code is not working. Emails are not coming in at all. Additional required info (phone number, first name, last name) should be included in the message. Please help. Thank you everyone. <?php $to = "abcd@abcd.com"; $subject = "From Website Contact Form"; $first = $_REQUEST['first']; $last = $_REQUEST['last']; $email = $_REQUEST['email']; $phone = $_REQUEST['phone']; $MESSAGE_BODY = "Name: " . $_POST["first"] . "\n"; $MESSAGE_BODY = "Name: " . $_POST["last"] . "\n"; $MESSAGE_BODY = "Contact No: " . $_POST["phone"] . "\n"; $MESSAGE_BODY = "Email: " . $_POST["email"] . "\n"; $MESSAGE_BODY = "Requirement: " . nl2br($_POST["message"]) . "\n"; $message = $_REQUEST['message' + 'email' + 'first' + 'last']; $from = $_REQUEST['email']; $headers = "From:" . $from; mail($to, $subject, $MESSAGE_BODY, $headers); echo "Your message has been sent"; ?>
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.