PHP - Control Load Order? Of Site
I'm trying to control the load order of the browser. The default load order is from top to bottom.
Well I have a table that is made in html with more code bellow the table. My php data that I put inside the html table is Code: [Select] <?php include("table/table.php"); ?> that grabs the data that will go into my html table. Well the problem I'm having is that the rest of the table with stuff under the table won't load till the php is done being processed. This makes my site look weird for 4 seconds and is the reason why I want to load the php content last. Is there a way to do this with php or javascript? Similar TutorialsHello: I have a question. I use to - when I was doing Classic ASP - make a single navigation file to include all aspects of site navigation. I'm trying to do that now in PHP, but keep getting errors. Can some set me straight (I am assuming what I want to do can be done in PHP). I have my myNav.php file (in an "include" subfolder): Code: [Select] <?php function showLinks() <script type="text/javascript" src="include/spNewWindow.js"></script> <script type="text/javascript" src="include/openSesame.js"></script> <link rel="stylesheet" type="text/css" href="include/StyleSheet.css" /> ?> <?php function showTopMenu() <a href="#">Link 1</a><br /> <a href="#">Link 2</a><br /> <a href="#">Link 3</a><br /> ?> This is the myPage.php I am trying to pull it in to: Code: [Select] <?php include('include/myNav.php'); ?> <html> <head> <title></title> <?php echo $showLinks; ?> </head> <body> <div id="myMenu"> <?php echo $showTopMenu; ?> </div> ... REST OF SITE, ETC ... </body> </html> However, this is not working at all. I have figured out how to make files for each individual aspect - Menu, Footer, META tags, etc - but I would like to do this with one file as shown above. Is this possible? Thanks! Hi,
In reference to my first attached image, I have a form which displays two SELECT/drop-down fields (labeled "Store Name" and "Item Description".....and both of which pull-in values from two separate lookup/master tables, in addition to providing an additional option each for "NEW STORE" and "NEW ITEM").
Now, when first-run, and/or if "NEW STORE" and "NEW ITEM" are not selected from the drop-down's then the two fields in green ("New Store Name" and "New Item Name" are hidden, by means of the following code:
<div class="new-store-container" id="new-store-container" name="new-store-container" style="display:none;"> <div class="control-group"> <div class="other-store" id="new_store_name"> <?php echo standardInputField('New Store Name', 'new_store_name', '', $errors); ?> </div> </div> </div>Conversely, if "NEW STORE" and/or "NEW ITEM" are selected from the two drop-down's then one (or both) of the "New Name" fields are unhidden by means of the following two pieces of code, one PHP and the second JS: <select class="store-name" name="store_id" id="store_id" onclick="toggle_visibility('store_id','new-store-container')"> <?php echo $store_options; ?> <?php if($values['store_id'] == "OTH") { echo "<option value='OTH' selected> <<<--- NEW STORE --->>> </option>"; } else { echo '<OPTION VALUE="OTH"> <<<--- NEW STORE --->>> </OPTION>'; } ?> </select> function toggle_visibility(fieldName, containerName) { var e = document.getElementById(fieldName); var g = document.getElementById(containerName); if (e.value == 'OTH') { if(g.style.display == 'none') g.style.display = 'block'; else g.style.display = 'none'; } }All of that is working just fine. The problem I'm having is that when I click the "Create" button, after having left any one of the form fields blank, the two "New Name" fields are hidden again, which I don't want to happen i.e. I want them to remain visible (since the values of "store_id" and/or "item_id" are "OTH"), so that the user can enter values into one or both of them, without havng to click on the drop-down a second time in order to execute the "on-click" code. The second attached image shows how the fields are hidden, after clicking "Create". How can I achieve that? It would be greate if someone could cobble-up the required code and provide it to me, since I'm relatively new to this. Thanks much. Snap1.png 26.14KB 0 downloads Snap2.png 149.47KB 0 downloads Illl show you the files and maybe someone can help me figure out whats going on. Lil more about the script When explore.php is opened it selects a random approved link out of the database and posts it within the iframe. Explore.php also calls random.php which has a nice little menubar. When the explore.php is originally clicked on everything works great a random site is selected and ran inside the iframe and the javascript menubar is loaded above the iframe. The issue is i cant get this to happen again. In the menu bar i have a hyperlink that loads Code: [Select] <li><a href="http://localhost/Stumble/explore.php" rel="gotsubmenu[selected]">JavaScript Kit</a></li>But when i click this link it just opens the page behind the iframe instead of in the iframe like it does when the explore.php is originally loaded. So i guess i need a lil help figuring out how i can make the random approved site load in the iframe by clicking a hyper link located in the menubar Thanks for your time Random.php Code: [Select] <?php /** * @author moeller * @copyright 2011 */ ?> <html> <head> <link rel="stylesheet" type="text/css" href="mouseovertabs.css" /> <script src="mouseovertabs.js" type="text/javascript"> /*********************************************** * Mouseover Tabs Menu- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com) * This notice MUST stay intact for legal use * Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more ***********************************************/ </script> </head> <body> <div id="mytabsmenu" class="tabsmenuclass"> <ul> <li><a href="http://localhost/Stumble/explore.php" rel="gotsubmenu[selected]">JavaScript Kit</a></li> <li><a href="http://www.cssdrive.com" rel="gotsubmenu">CSS Drive</a></li> <li><a href="http://localhost/Stumble/explore.php">No Sub Menu</a></li> </ul> </div> <div id="mysubmenuarea" class="tabsmenucontentclass"> <!--1st link within submenu container should point to the external submenu contents file--> <a href="submenucontents.htm" style="visibility:hidden">Sub Menu contents</a> </div> <script type="text/javascript"> //mouseovertabsmenu.init("tabs_container_id", "submenu_container_id", "bool_hidecontentsmouseout") mouseovertabsmenu.init("mytabsmenu", "mysubmenuarea", true) </script> </body> </html> explore.php Code: [Select] <?php /** * @author Brent Moeller * @copyright 2011 */ include ('functions.php'); db_connect(); $result = mysql_query("SELECT * FROM slinks where approval='1' ORDER BY RAND() LIMIT 1") or die(mysql_error()); ?> <html> <head> <title>DizzyUrl Discovery Engine</title> </head> <frameset rows="80,*" BORDERCOLOR="green" BORDER="3"> <frame src="random.php" name="surfbar" marginwidth="O" marginheight="0" NORESIZE SCROLLING="no" /> <frame src="<?php while ($row = mysql_fetch_array($result)){ print $row["url"];}?> " name="random" marginwidth="O" marginheight="0" noresize scrolling="auto" /> </frameset> <noframes> <body><p>This Browser does not support Frames.</p></body> </noframes> </html> hiii all, i want to show the database field (alise name) as the url after index.php when page or site loads first time. how i can achieve it? please help.... thanks in advance
Hi everyone. I'm very new into self learning programming. Presently I'm trying to develop a simple basic Robot that would only Place a Market Order every seconds and it will cancel the Order every followed seconds. Using the following library: It would place Trade Order at a ( Price = ex.com api * Binance api Aggregate Trades Price) I have already wrote the api to call for xe.com exchange rate with php <?php $auth = base64_encode("username:password"); $context = stream_context_create([ "http" => [ "header" => "Authorization: Basic $auth" ] ]); $homepage = file_get_contents("https://xecdapi.xe.com/v1/convert_from?to=NGN&amount=1.195", false, $context ); $json = json_decode($homepage, TRUE); foreach ($json as $k=>$to){ echo $k; // etc }; ?> And also for the Binance Aggregate Price in JavaScript
<script> var burl = "https://api3.binance.com"; var query = '/api/v3/aggTrades'; query += '?symbol=BTCUSDT'; var url = burl + query; var ourRequest = new XMLHttpRequest(); ourRequest.open('GET',url,true); ourRequest.onload = function(){ console.log(ourRequest.responseText); } ourRequest.send(); </script>
My problem is how to handle these two api responds and also the functions to use them to place a trade and cancel it. I'm having a problem and need an answer to why its happening and how to prevent it. Scenario: I begin load my home page which starts with a session_start(); .... Before it FULLY completes loading I try to navigate to another page and BOOM, that page will not load and any other page that begins with session_start(); will not load unless I close and restart the entire browser or wait about 10 minutes.... I will note my website makes ajax calls every 5 seconds or so, but I use setTimeout for them. Any help??? Thanks ahead! I've got. I have several "sites" located in my html directory, and each has a "general" access point and an "administrator" access point:
/var/www/html/site1/index.php /var/www/html/site1/administrator/index.php /var/www/html/site2/index.php /var/www/html/site2/administrator/index.php /var/www/html/site3/index.php /var/www/html/site3/administrator/index.phpAll sites are similar except that data will be specific to site1, site2, or site3, etc. Users who log onto /var/www/html/siteX/index.php are totally unrelated to those who logon to /var/www/html/siteX/administrator/index.php, will have different logon credentials, are stored in different DB tables, and each should have their own session. If a user logs off of either the general or administrator site, it should not effect the other site even if they were previously logged on to both on the same PC (and of course not effect other sites). When a user logs off, I would like to destroy their previous cookie and associated session. Users for either will only use https. I am using Apache to rewrite https://www.mysite.com/ to https://mysite.com/. While I named the administrator site "administrator" above, the administrator user has the ability to change the directory name. I am thinking I need to use session_set_cookie_params to specify where I wish the session cookie to be stored since /var/www/html/siteX/administrator/index.php is a sub-directory to /var/www/html/siteX/index.php, but am not really sure. Sorry for the cryptic post, but I am not very well versed in this subject. How would you recommend setting up cookies/sessions for this scenario? Thank you Hi, My first post here is a cry for help I have a Windows 2003 server running IIS6/PHP5, the server hosts multiple web sites. The problem is include files that are for site A are showing on site B (each site having its own includes as part of the site files in its own site folder), though not every time, its very random, sometimes the correct includes show, sometimes ones from another site on the same server. This only occurs where the include files for both sites have the same name, such as 'inc-header.php' for example. I can only assume PHP is caching includes and because they have the same name is showing the wrong one on other sites sometimes, if I rename them to something unique then the problem goes away, but its not a practical solution to rename all include files to unique names so I find myself looking for a 'real' fix. I have a feeling its to do with the include_path in the php.ini, but right now its disabled with a semi-colon, and I don't want to set one as I have no global includes, all includes are site specific. Any help would be very much appreciated! Phil now i use this code to show where the visitors came from to my site. <?php $referer=$_SERVER['HTTP_REFERER']; echo $referer; ?> now, i want to show the 5 latest vistors referer's site url on my site ? Not sure if I'm trying to achieve something totally crazy here, or if this is something pretty standard. Didn't have much luck with searching as I'm not fully down with all the terms. (A) I have one site providing an RSS feed. (B) I have one site I want to search, once for each of the items in the feed A. (C) I want the results of the search in (B) to be displayed on page (C). So for example, the feed on (A) says; apples bananas oranges cheese I want site (B) to search for each of those terms (by passing the item in the feed (A) to the ?search= part of the URL of that page) and then show the results from THAT search on page C. Bit of a complex one, let me know if you need me to clarify. Thanks for any help! All, I have a script I wrote that works off a local machine directory, scans it for .html files and uploads those to the server. This works fine in test on my machine with WAMP installed and running localhost, but the activities are for reading/posting the files into my WordPress website and when I move the script to the host, the directory listings are now always the directory on the host machine and I have not figured out how to transfer the directory control back to the local machine. I captured the local directory setting into a 'tools' table I installed into the host MySQL DB. I have searched online for a good example of how to do this, both in the PHP libraries and the JavaScript libraries and have not found a good solution yet. I'm sure there is an example out there, but sure I just do not have the right keywords to find it, so would appreciate a link from anyone who has knowledge on where such a resource might be. Thanks! OMR Hi, I have a question. is that code below made a problem in google search, mean if I put this codes in header did google find my homepage? header( 'Cache-Control: no-store, no-cache, must-revalidate' ); header( 'Cache-Control: post-check=0, pre-check=0', false ); header( 'Pragma: no-cache' ); header( 'Expires: Mon, 26 Jul 1997 05:00:00 GMT' ); header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' ); Thnx. T I am running Apache with the PHP module installed on Debian Linux. My goal is to launch a binary in a background process and then feed it commands via fifo. The binary I need to launch has a config file which lives in the home directory of the apache user (in my case the user name apache is started with is www-data). www-data's home dir was the web root so I changed it to /home/www-data. I also change the shell from /bin/sh to /bin/bash for www-data. Neither of these changes are present when I load a php file from a browser. This script: Code: [Select] <?php echo "User: " . exec('whoami') . "<br>"; echo "Shell: " . exec('ps -p $$ | grep sh') . "<br>"; ?> Outputs this: Code: [Select] User: www-data Shell: 9179 ? 00:00:00 sh Also if I execute the binary it does seem to read the config file which is in the www-data users directory. I have set the home dir and the web root to be owned by www-data and it's read and writeable. How do I get php to execute the binary so it has access to the users home directory and uses the bash shell? Are there any other ways to launch and control a binary on a unix system via php? In my project. I wanted an option that was going to give me more control over what my users can and could not do. I fount a ACL Sample and well the guy that made this must have been drunk. Any way I been working with it and putting it together so that it will work. The problem is that when I view the users current permissions it doesn't seem to display then right. Blow is the code i have in a switch that I use to manage each users permissions. The $_GET['uid'] gets the users id from the URL in the admin section. Code: (php) [Select] case "manage": //$userACL = new ACL($_GET['uid']); $userACL = new ACL($_GET['uid']); echo '<h2>Managing '.$userACL->getUsername($_GET['uid']).'</h2>'; echo '... Some form to edit user info ...'; echo '<h5>Roles for user: (<a href="users.php?action=roles&uid='.$_GET['uid'].'">Manage Roles</a>)</h5>'; echo '<ul>'; $roles = $userACL->getUserRoles($_GET['uid']); foreach ($roles as $k => $v) { echo "<li>" . $userACL->getRoleNameFromID($v) . "</li>"; } echo '</ul>'; echo '<h6>Permissions for user: (<a href="users.php?action=perms&uid='.$_GET['uid'].'">Manage Permissions</a>)</h6>'; echo '<ul>'; //$uparms = $userACL->getAllPerms($_GET['uid']); //$uPerms = $userACL->getUserPerms($_GET['uid']); //$aPerms = $userACL->getAllPerms('full'); $aPerms = $userACL->perms; //foreach ($perms as $k => $v) foreach($aPerms as $k => $v) { //echo 'fdfdsfsd :'. $v['value']; //if ($v['value'] == false) { continue; } if($v['value']) { // if (!$v['value']) { continue; } echo "<li>" . $v['Name'] . ' : Allowed </li>'; //if ($v['inheritted']) { echo " (inheritted)"; } } else { echo "<li>" . $v['Name'] . ' : Deny </li>'; } echo "</li>"; } echo '</ul>'; break; If any one needs any extra info. Please let me know. Hi guys! First of all I'd like to thank you for reading my question. I think it's a basic one indeed! I've started to learn php and wanted to code a small game in html + php. The principle is basic: I generate two random numbers between 1 and 10, $a and $b. I keep its sum in $result=$a+$b I echo them to the screen and ask the user to input their sum in an html form input field with a submit button. When I receive the value from the html form I want to compare if the user input is equal to the sum of the two numbers presented. What happens is that when I hit the submit button the browser reads all the code again and generates two new numbers $a and $b and I cannot compare if what the user inputted is true or not because the browser reads all the file. My question is how can I control the flow of the program to avoid it. Any tips for a newby like me? i have homework about this but i don't know how to make it work, after a few hours it stuck with every login will go to same place i must create 4 id : 1.owner : can access all page , edit all id 2.chasier : report any item out, only access item out page (item.php) 3.warehouse : add item from purchasing department, add new item, get notification from chasier, tell purchasing department to buy item 4.purchasing department : get notification from warehouse, sent report to warehouse after add stock or add new item login.php Code: [Select] <table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <form name="form1" method="post" action="cek_login.php"> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td colspan="3"><strong>Login </strong></td> </tr> <tr> <td width="78">Username</td> <td width="6">:</td> <td width="294"><input name="username" type="text" id="username"></td> </tr> <tr> <td>Password</td> <td>:</td> <td><input name="password" type="text" id="password"></td> </tr> <tr> <td> </td> <td> </td> <td><input type="submit" name="Submit" value="Login"></td> </tr> </table> </td> </form> </tr> </table> cek_login.php Code: [Select] <?php $host="localhost"; $username="root"; $password=""; $db_name="shop_system"; $tbl_name="members"; mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $username=$_POST['username']; $password=$_POST['password']; $usertype=$_GET['usertype']; $username = stripslashes($username); $password = stripslashes($password); $username = mysql_real_escape_string($username); $password = mysql_real_escape_string($password); $sql="SELECT * FROM $tbl_name WHERE username='$username' and password='$password' "; $result=mysql_query($sql); $count=mysql_num_rows($result); if($count==1){ session_register("username"); session_register("password"); header("location:sukses.php"); } else { echo "Wrong Username or Password"; } ?> sukses.php Code: [Select] <? session_start(); if(!session_is_registered(myusername)){ header("location:main_login.php"); } ?> <html> <body> Login Successful </body> </html> I have a number of Forms which I want to control the input, for example prevent people from using numbers or ensure that people use specific characters. For example "Your password must contain a capital letter and at least one number". Does anyone know what code I should use to do this. I'm currently running a classified ads site and planning to display my own content from database combined with and external site rss. So here is what i got right now after the db query for the jobs ads (procedural php),
while ($row = mysqli_fetch_array($results, MYSQLI_ASSOC)){ echo '<div class="media margin-none"> <a class="pull-left bg-inverse innerAll text-center" href="#"><img src="'.$foto.'" share_alt="" width="100" height="100"></a> <div class="media-body innerAll"> <h4 class="media-heading innerT"> <a href="' . $row['title'] .'-da' . $row['id_ad'] . '" class="text-inverse">'. $remuneracion .' ' . substr(ucfirst(strtolower($row['title'])), 0, 53) . '</a> <small class="pull-right label label-default"><i class="fa fa-fw fa-calendar-o"></i> ' . $row['date_created'] . '</small></h4> <p>' . substr(ucfirst(strtolower($row['description'])), 0, 80) . ' ...</p>'; echo '</div> </div> <div class="col-separator-h"></div>'; } echo pagination($statement,$per_page,$page, $url_filtros, $filtros); ?>it is the while loop that i use to display ads from my database, what could be the best way to display (in this same loop?) other site's rss feed so i can show my content combined with the external rss? Thanks Transferring data from sub-domain.site.com Reading sub-domain.site.com What is this all about? I'm going to put all .. images into a separate sub-domain eg: images.site.com. This would create a folder inside my public_HTML called "images" Now when sites have that Transferring data, and Reading... is this .. something relating to what I want. Facebook also does it, and they get their images for the site from a sub domain, how is it all done? I'm not sure if its entirely PHP, but I hope someone can help. Thanks |