Rewrite php script – Code Review Stack Exchange

I have written one script in PHP which is defined here:

Click Here to See Code

I am improving the code quality and readability. For example splitting it into multiple functions, use PHP predefined variables, use PSR naming conventions etc.

class nextcrontime{
//Get Single argument passed
function calculate_next_cron(){
    If(isset($_GET('time')) && !empty($_GET('time'))){
        //Read config.txt file
        $read_txt_file = fopen ("config.txt", "r");
        $splitime = explode(":", $_GET('time'));
        // Loop Content from config.txt line by line and perform required actions
        while (!feof ($read_txt_file)) {
            $line = fgets($read_txt_file, 4096);
            $list = explode(" ", $line);
            if($list(0) != '*' && $list(1)=='*'){
                $newtime = $splitime(0).":".$list(0);
                if(strtotime($newtime) >=  strtotime($_GET('time'))){
                    echo $newtime." ".'Today'." ".$list(2);
                    $time = date('Y-m-d H:i', strtotime($newtime) + 60*60);
                    if (date("Y-m-d") > $time) {
                        echo date("H:i", strtotime($time))." ".'Today'." ".$list(2);
                        echo date("H:i", strtotime($time))." ".'Tomorrow'." ".$list(2);
        echo "Please Pass Time in HH:MM format. Example > php-cgi -f Index.php time=16:10.";
    //Close File Handler
    fclose ($read_txt_file);

I write 1000 words article that’s seo optimized and a quality one for your businesses and blogs site for $5

I write 1000 words article that’s seo optimized and a quality one for your businesses and blogs site

I will compose a stunning article for your blog or web. In the event that you are searching for an expert and experienced writer, you are in the correct spot. I compose a wide range of content for your site, online store or blog: articles, item portrayals, plans, digital books … I additionally offer my administrations as an editor.

Why me?

1. I have long periods of experience.

2.My composing is proficient.

3. Search engine optimized Articles.

4. 24 hours delivery

On the off chance that you have any inquiries contact me now. I anticipate working with you! Request NOW and don’t waste time! Much obliged to you!


plugin development – rewrite URL based on selected taxonomy for post page

I have a taxonomy called “group”, and their values like “red”, “blue”, “green” (these are generating dynamic” no any fixed group value.

during post publish I am selecting “Group” for each post. 1 group for each post.

I want to add a rewrite URL for the post if the taxonomy is “red” or “blue” or “green” then the URL of that post should come like

"" or "" or ""

add_action( 'init', 'create_group_tax' );
function create_group_tax() {
             array( 'label' => 'Group', 
                    'hierarchical' => true


also, I want to make it regex rule “'^red/((^/)*)/?'” dynamic with selected taxonomy,this time just to make a test i added it as a static string.

result : Page not found. Nothing here – http://localhost/wordpress/red/my-test/

what do you suggest to do this?

functions – Hook to Rewrite Menu items titles on saving menu

Ok I have the following code in WordPress functions.php. To replace all menu title with “test”. This is working fine. But i want to have this functionality only when I save the menu on the menu admin page in the backend. I can’t seem to find the right hook to do that?

That way its called only once (and rewritten). Hope some one can point me in the right direction?

function update_menu_link($items){
        foreach($items as $item){
                  $item->title = 'test';
        return $items;

add_filter('wp_nav_menu_objects', 'update_menu_link', 10,2);

How to re-write this program for Python 3.7 where program will ask for the number of sides for your shape, then draw the shape?

I was trying to do an exercise where the program will ask for the number of sides for your shape, then draw the shape. I copied out the code exactly from the book, but it is outdated and was wondering how to make this work for Python 3.8?

import turtle
sides = int(input("Enter the number of sides for your shape: "))

angle = 360.0 / sides
length = 400.0 / sides

for side in range(sides):

python 3.x – How to rewrite this program in a more easier way?

def alphabetlist():
    print("alphabet1 = (a,b,c,d,e,f)")
    print("alphabet2 = (g,h,i,j,k,l)") 
    print("alphabet3 = (m,n,o,p,q,r)") 
    print("alphabet4 = (s,t,u,v,w,x)")
    print("alphabet5 = (y,z)")
print("Guess a word.")
print("Now i will try to figure out the word you guessed.")
totalletters=int(input("total number of letters in your guessed words are: "))
def chooselist(x):
    if x == 1:
    elif x == 2:
    elif x == 3:
    elif x == 4:
    elif x == 5:
list=( )
def listtranspose(w):
    if w == 1:
    elif w == 2:
    elif w == 3:
    elif w == 4:
    elif w == 5:
alphabet1 = ("a","b","c","d","e","f")
alphabet2 = ("g","h","i","j","k","l") 
alphabet3 = ("m","n","o","p","q","r") 
alphabet4 = ("s","t","u","v","w","x")
alphabet5 = ("y","z")
step_1=( );h=0
while totalletters>h:
    print("your letter is from which list 1,2,3,4,5")
    x = int(input())
print("***n  1    2    3    4    5    6   ")
while totalletters>g:
while totalletters>e:
    print("choose from these lists again now 1,2,3,4,5,6")
print("the word you guessed is: ",end=" ")
for i in range(0,len(list),1):

This program is a word guessing game. The user thinks of a word and this program guesses it. through a series of list I want to know if there are other ways to write this, more easily actually I get all the functions used but not the next part

apache 2.2 – Rewrite userdir for users that changed the username

This seems simple, but I wasn’t able to do it.

I have a user that changed his username from givenname to name, and now I need to rewrite, changing the URL on the clients, to avoid 404 errors on ~givenname.

I thought I could do something like this:

RewriteBase /~givenname/
RewriteRule ^givenname$ name$ (R)

But I was unable to do this.

I’m aware that mod_userdir looks for specific user info on Unix files (/etc/passwd) or whatever is specified on /etc/nsswitch.conf, but there’s a way to trick it and redirect to the new username?


PS: I’m running a little old Apache 2.2.16 server.

permalinks – Default Post post type and custom post type rewrite slugs

So, currently, my blog page is at /blog/ and I also have 2 custom post types. What I’m trying to get is to have all the posts/archives of the Post post type show under /blog/, and for one of the custom post type to use “/” as a rewrite slug. That way, I could get,, which are the custom post types, and if I go to post archive for December of 2020, it would show under /blog/2020/12/.

I’ve tried that, as I said, by setting /blog/%postname%/ under my wp admin permalink settings, and using 'rewrite' => array( 'slug' => '/', 'with_front' => false ), with register_post_type for my custom post type. That works for blog posts, but my custom post type posts show 404, with proper url though.

integration – How to rewrite this normal derivative in a sphere as a radial derivative?

I’ve come across the following line of working in a set of notes on the mean value theorem for harmonic functions:
$$int_{partial B_r(x)} frac{partial u}{partial nu}, dS = r^{n-1} int_{partial B_1(0)} frac{partial u}{partial r}(x+ry) , dS(y)$$
What I don’t understand is how the two derivatives are converted into one another. The $r^{n-1}$ seems to come from the Jacobian determinant $(=r^n)$ and the factor of $frac{1}{r}$ which appears in the normal vector to the ball of radius $r$. I think this should leave you with an integrand of $nabla u cdot (x+ry)$ but I’m not sure how this is equivalent to the integrand in the expression above. Any help is greatly appreciated.

Nginx proxy_pass rewrite URL and Headers

Solved, the problem is regex only match path or


not parameter or query string


to solve the problem I change the URL to


and here the config

location ~ ^/app/((^/)+)/(.*){
    proxy_pass https://$2$is_args$args;
    proxy_set_header  Cookie myCookie=$1;