
l3rodey
Members-
Posts
43 -
Joined
-
Last visited
Everything posted by l3rodey
-
Hi everyone, This may seem stupid and dumb but what I am trying to do make sense to me. I need to create a document .xml sitemap. So it's split into 3 this is very basic. <?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"> is the top <url> <loc>' . $URL . '</loc> <changefreq>monthly</changefreq> <priority>0.50</priority> </url> is the middle and </urlset> is the bottom. Makes sense? Top and bottom stay the same I only need one of them and that is it. The middle on the other hand repeats. What I have in PHP is the following: <?php $getURLS = mysql_query("SELECT * FROM urls", $url); while($row = mysql_fetch_array($getURLS)) { $URL = $row['url']; ?> <url> <loc>' . $URL . '</loc> <changefreq>monthly</changefreq> <priority>0.50</priority> </url> <?php } ?> That is the script, I am using and it should repeat it... the problem is I need to create it as an xml document.... not a php where I am running it. so what I have is $fp = fopen("sitemaps/sitemap.xml", "w"); fwrite($fp, $somevariable); fclose($fp); But yeah I don't know how to piece it together so I run a php document and it outputs all my urls from the database into one document. I literally have them all sitting in the database and just need a document to generate the sitemap.xml... It's failing so hard. Please someone help me
-
Hi Josh, What I am doing and how I am doing it is not black hat it sounds black hat but it isn't (should be) or not yet anyways. I might need to look into the file_get_content form, and do a a str_replace. argh more work on this tool then expected 0.0
-
Hi All, I am building a tool which requires a website in an iframe (external) but with wording changes... I want the page to be indexed via Google but not as a duplicate page, So I was thinking of using str_replace(), I was thinking Synonyms for example "str_replace("party", "celebrate")". This way I would have massive library of synonyms and they just rotate randomly. My problem is str_replace isn't working for the content in the iframe. Does anyone know how I can do this? The page is external I am using iframes although if there is a better way I can do that. But I need to change wording within an external page but display on mine, I might be able to use javascript I don't know but I don't think javascript is ran for google...
-
The title is crap sorry I am bad with titles. I have a database which is id domain 1 www.google.com There is a few other tables but they don't matter for this, I am wanting to get the server response from all my websites and setup a cron job. I am able to get it to send me an email when it fails and so on but what I cannot do it get it to repeat for all the urls I can only do one? I have this: <?php function get_contents() { file_get_contents("http://example.com"); var_dump($http_response_header); } get_contents(); var_dump($http_response_header); ?> Which out puts this: array(9) { [0]=> string(15) "HTTP/1.1 200 OK" [1]=> string(35) "Date: Sat, 12 Apr 2008 17:30:38 GMT" [2]=> string(29) "Server: Apache/2.2.3 (CentOS)" [3]=> string(44) "Last-Modified: Tue, 15 Nov 2005 13:24:10 GMT" [4]=> string(27) "ETag: "280100-1b6-80bfd280"" [5]=> string(20) "Accept-Ranges: bytes" [6]=> string(19) "Content-Length: 438" [7]=> string(17) "Connection: close" [8]=> string(38) "Content-Type: text/html; charset=UTF-8" } NULL Which I found on google. So if I get the server response I can do this for one website that's fine what I don't know how to do is have 1 php script as a cron job go through and check every url in my database I will have like 200. and if 1 = say 500 error then to send an email. that is fine but yeah. I think I explained enough. I am bad with arrays as well so I don't even know how to just echo out the server response as in 404, 200, 500 ,301 and so on that's really all I need then I can do if($response == 404){ email }elseif($response == 500){ send a different email } Any help is great help! thanks
-
Hi, I am working on a exit intent software which monitors mouse movement and closes opens a popup upon exit of <html>. The problem is and I do myself and I know a lot of others do is keyboard short cuts. Is there any PHP which monitors keyboard input and can just sort of prevent closure by disabling the keyboard combination? Secondly PHP timer, is there a way of creating a php timer after 30 seconds everything within starts? like when a page is loaded the timer counts upwards when it hits 30 then everything inside { } will run? I don't want my software to be spammy. I want it to be professional tool. So I only want it to display if a user has been on the site for longer then say 30 seconds. Any Ideas?
-
Hmm, I need something like google analytics do they have variables in javascript and it links to another js document, but I don't know javascript I only know PHP so I can only write PHP. Is there a way to go from 1.com javascript to 2.com javascript to 2.com php? I need to check a database using PHP and other settings in PHP. I cannot upload a php script to the site I can only use javascript from 1.com but I can do anything from 2.com if I need.
- 2 replies
-
- php
- javascript
-
(and 2 more)
Tagged with:
-
<?php session_start(); include("header.php"); include("dbconnection.php"); //include("functions/inactive_session_logout.php"); if(!($_SESSION["customerid"])) { /*echo '<p style="color: red;"> This page has been accessed in error.<br> You will be redirected to the login page in 5 seconds.<br> If you are not redirected, please <a href="emplogin.php">Click Here</a> to redirect. </p>'; header("Location: login.php");*/ } $accarray = mysql_query("SELECT * FROM accounts WHERE customers='$_SESSION[customerid]'"); while($arrow = mysql_fetch_array($accarray)) { $acno = $arrow[accno]; $prime = $arrow[primaryacc]; $accbal = $arrow[accountbalance]; } $trans = mysql_query("SELECT * FROM transaction WHERE customers='$_SESSION[customerid]'"); while($rows = mysql_fetch_array($trans)) { $transdate = $rows[transactiondate]; $part = $rows[particulars]; $payee = $rows[payeeid]; $receive = $rows[receiveid]; $dep = $rows[depositac]; $deb = $rows[debitac]; $paystat = $rows[paymentstat]; } $prime = $_POST[primaryacc]; if($prime == "yes") { echo "primary"; } $acc = mysql_query("SELECT * FROM accounts WHERE customers='$_SESSION[customerid]'"); $trans = mysql_query("SELECT * FROM transaction WHERE customers='$_SESSION[customerid]'"); $result = mysql_query("SELECT * FROM customers WHERE customers='$_SESSION[customerid]'"); ?> <link rel="stylesheet" type="text/css" href="css/form_style_view.css" /> <link rel="stylesheet" type="text/css" href="css/loan_nav.css" /> <div id="templatemo_main"> <span class="main_top"></span> <div id="templatemo_content"> <?php if(isset($_POST[submit])) { ?> <h2>Mini Statements</h2> <form id="form1" name="form1" method="post" action=""> <div class="m" style=" width:399px;"> <div style="text-align:center; border:0px; border-bottom:1px solid #000;"> <strong> Balance Details - <?php echo $_SESSION[customername]; ?> - [Details on <?php echo date("d-m-Y"); ?>] </strong> </div> <div class="l" style="border:0px; border-right:1px solid #000; width:130px;"> <strong>Account Number</strong> </div> <div class="r" style="border:0px; border-bottom:1px solid #000;"> <?php echo $acno; ?> <?php echo $prime; ?> </div> <div class="clear"></div> <div class="l" style="border:0px; border-top:1px solid #000; border-right:1px solid #000; width:130px;"> <strong>Account Balance</strong> </div> <div class="r" style="border-top:1px #000 solid; border:0px;"> <?php echo $accbal; ?> </div> <div class="clear"></div> </div> <p> </p> <div class="m" style="width:794px;"> <div style="text-align:center; width:785px;"> <strong>Transaction Made</strong> </div> <div id="nav" style="width:795px; border:0px; background-color:#CCCCCC;"> <div class="col1" style="width:130px; border-left:0px; border-bottom:0px;"> <strong>Transaction Date</strong> </div> <div class="col2" style="width:80px; border-left:0px; border-bottom:0px;"> <strong>Particulars</strong> </div> <div class="col3" style="width:90px; border-left:0px; border-bottom:0px;"> <strong>Payee ID</strong> </div> <div class="col4" style="width:90px; border-left:0px; border-bottom:0px;"> <strong>Receiver ID</strong> </div> <div class="col5" style="width:90px; border-left:0px; border-bottom:0px;"> <strong>Deposits</strong> </div> <div class="col6" style="width:90px; border-left:0px; border-bottom:0px;"> <strong>Withdraws</strong> </div> <div class="col7" style="width:100px; border-left:0px; border-bottom:0px;"> <strong>Balance</strong> </div> <div class="col8" style="width:116px; border-left:0px; border-bottom:0px;"> <strong>Payment Stats</strong> </div> <div class="clear"></div> <?php while($transaction = mysql_fetch_array($trans)) { echo "<div> <div class=\"row1\" style=\"width:130px;\"> $transdate </div> <div class=\"row2\" style=\"width:80px; border-left:0px;\"> $part </div> <div class=\"row3\" style=\"width:90px; border-left:0px;\"> $payee </div> <div class=\"row4\" style=\"width:90px; border-left:0px;\"> $receive </div> <div class=\"row5\" style=\"width:90px; border-left:0px;\"> $dep </div> <div class=\"row6\" style=\"width:90px; border-left:0px;\"> $deb </div> <div class=\"row7\" style=\"width:100px; border-left:0px;\"> $accbal </div> <div class=\"row8\" style=\"width:116px; border-left:0px;\"> $paystat </div> </div>"; } ?> </div> </div> </form> <?php } else { ?> <form id="form1" name="form1" method="POST" action=""> <div class="m" style="width:398px;"> <div style="text-align:center; border-bottom:1px solid #000;"> <strong>Select an Account Number</strong> </div> <div style="border:0px;"> <div class="l" style="width:130px; border:0px;"> <label for="accno"> <strong>Account Number</strong> </label> </div> <div class="r" style="width:264px; border:0px;"> <select name="accno" id="accno"> <option value="">Select Account Number</option> <?php while($rowsacc = mysql_fetch_array($acc)) { echo "<option value='$rowsacc[accno] : $prime'> $rowsacc[accno] : $prime </option>"; } ?> </select> <input type="submit" name="submit" id="submit" value="Submit" /> </div> </div> <div class="clear"></div> </div> </form> <?php } ?> <p> </p> <p> </p> <div class="cleaner_h30"></div> <div class="cleaner_h60"></div> </div><!-- end of content --> <div id="templatemo_sidebar"> <?php include("myaccountssidebar.php"); ?> <div class="cleaner_h40"></div> <h2> </h2> </div> <div class="cleaner"></div> </div><!-- end of main --> <div id="templatemo_main_bottom"></div><!-- end of main --> <?php include("footer.php"); ?> Try this
-
Hi, I am not asking for code, If you provide it thank you but I am happy to do the work myself I am more after the concept and code snippets. My Goal, I have 2 domains for this I will use www.1.com and www.2.com to make it easy. 1.com has a couple lines of javascript and 2 variables 1 being a domain and the other being a unique ID 2.com has a php script which is called by 1.com when the page is loaded (somehow) it will check the Unique ID and the domain that they match in a mySQL database and if they do to run another javascript script. If it does not to just end itself. The problem I have is I know PHP to an average level but Javascript well below average. I need to know how to run the PHP script from an external site 1.com to run a generic PHP script from 2.com and use the variables from 1.com to check the database at 2.com for a match and to either say yes matching display: or not matching deny. If anyone has any ideas on how to do this or something they have done before that would be awesome. I am wanting to to put the javascript on 10 different websites with different variables and for 2.com to just do the checking. for security reasons I need the URL to be checked so if 1.com loads and says the URL is 1.com but infact the user loaded 55.com it needs to be denied so PHP on 2.com needs to know where the request came from which domain... PLEASE HELP
- 2 replies
-
- php
- javascript
-
(and 2 more)
Tagged with:
-
Hi Everyone, I need help converting this if / ifelse to a function, (I am new), if($file_extension == 'unknown'){$doc_extension = 'unknown'; $file_type = 'Unknown';} elseif(($fe=='docx')||($fe=='doc')||($fe=='docm')||($fe=='dotx')||($fe=='dotm')||($fe=='pages')||($fe=='wps')){$doc_extension='docx';$file_type='Word Document';} elseif(($fe=='pdf')||($fe=='pdp')){$doc_extension='pdf';$file_type='PDF';} elseif(($fe=='xlsx')||($fe=='xlsm')||($fe=='xlsb')||($fe=='xltx')||($fe=='xltm')||($fe=='xls')||($fe=='xlt')||($fe=='xls')||($fe=='csv')){$doc_extension='xlsx';$file_type='Excel Document';} elseif(($fe=='zip')||($fe=='zipx')||($fe=='tar')||($fe=='gz')||($fe=='z')||($fe=='cab')||($fe=='rar')||($fe=='bz2')||($fe=='lzh')||($fe=='7z')||($fe=='img')||($fe=='iso')){$doc_extension='zip';$file_type='Zip Folder';} elseif(($fe=='jpg')||($fe=='jpeg')||($fe=='jpe')){$doc_extension='jpg';$file_type='JPEG Image';} elseif(($fe=='png')||($fe=='pns')){$doc_extension='jpg';$file_type='PNG Image';} elseif(($fe=='gif')){$doc_extension='jpg';$file_type='GIF Image';} elseif(($fe=='tiff')||($fe=='tif')){$doc_extension='jpg';$file_type='TIFF/TIF Image';} elseif(($fe=='psb')||($fe=='bmp')||($fe=='rle')||($fe=='dib')||($fe=='eps')||($fe=='iff')||($fe=='tdi')||($fe=='jpf')||($fe=='jpx')||($fe=='jp2')||($fe=='j2c')||($fe=='j2k')||($fe=='jpc')||($fe=='jps')||($fe=='mpo')||($fe=='pcx')||($fe=='raw')||($fe=='pxr')||($fe=='pbm')||($fe=='ppm')||($fe=='pnm')||($fe=='pfm')||($fe=='pam')){$doc_extension='jpg';$file_type='Image File';} elseif(($fe=='mp3')){$doc_extension='mp3';$file_type='MP3';} else { $doc_extension = 'unknown'; $file_type = 'Unknown'; } This goes on for 280lines... But If I get these done I will be able to do the rest, as you can see I am checking what the document file extension is from a database, $file_extension and depending the results, it creates a variable $doc_extension which works like this : class="$doc_extension" and this is a style from .style.css and it also changes $file_type which is printed on the screen, This works fine as a large if/ifelse but I only had the index page of my application done now I am doing directories and every time I make a change to it all of it and it's way long process. so what I want to do is just put <?php functionname();?> or <?php require 'fdsfas.php'; ?> so I can just change it once. If someone could please help that would be mad. Thanks, Brodey
-
Hey all, I have this code: <?php $ip = $_SERVER['REMOTE_ADDR']; $ip = str_replace(".", "", $ip); if(!is_dir("upload/$ip/")){ mkdir("upload/$ip"); } $path= "upload/$ip/".$HTTP_POST_FILES['upl']['name']; if($upl !=none){ if(copy($_FILES['upl']['tmp_name'], $path)){ echo '{"status":"success"}'; } else { echo '{"status":"success"}'; } } echo $ip; ?> Now for notes, this is upload.php and the data is collected from index.php where the upload form is. A couple notes from here: 1. this script + index.php work perfect on apache. 2. I am trying to get this only iis7 on server 2008. 3. $ip does create the folder upload/$ip works the folder is created. But the file itself does not appear like I said this works perfect on a shared host with apache not on my private web server.... I don't know if this is correct but on inetpub I have given the user "everyone" full access so there should be no security unless I am doing it wrong... Any suggestions?
-
Lol, Did it ever work? if not check the software requirement against your server, we don't have code we don't know what your php.ini settings are we don't know if your on IIS or Apache.. Provide files will help... or a website for the requirements...
-
mysql_query or mssql_query depending on your database if it's mysql or micosoft sql for this demo I will us MySQL. <table> <tr> <td>MR</td> <td>Teacher</td> <td>Dr</td> </tr> <tr> <?php $query = mysql_query("SELECT * FROM users WHERE job='Mr' ORDER BY name"); while($row = mysql_fetch_array($collect_folders)){ $name = $row['name']; echo '<td>' . $name . '</td>'; } ?> <?php $query = mysql_query("SELECT * FROM users WHERE job='Teacher' ORDER BY name"); while($row = mysql_fetch_array($collect_folders)){ $name = $row['name']; echo '<td>' . $name . '</td>'; } ?> <?php $query = mysql_query("SELECT * FROM users WHERE job='Dr' ORDER BY name"); while($row = mysql_fetch_array($collect_folders)){ $name = $row['name']; echo '<td>' . $name . '</td>'; } ?> </tr> </table> You will need to make heaps of changes but this will work, surely someone has something better but this does the trick.
-
1. http://forums.macrumors.com/showthread.php?t=962699 2. The top PHP job interview questions, Well personally from experience they don't ask much they handed me paper and say what does this php code do, and they had a bunch of different codes... If your applying for PHP job your best of knowing PHP other wise you will end up getting the job and getting fired for knowing nothing... best of learning it and having the answers no matter what they ask. 3. What are you ASP tags? We cannot know why they are not working without seeing them?
-
function rand_string( $confId ) { $confId = rand(1,1000) } for the second one I have no idea my function knowledge is limited!
-
Hey Mate, Try this you are missing the " . . " <?php if ($_SESSION['username']) { echo "<li><a href='#'><span>" . $_SESSION['username'] . "</span></a> <ul> <li><a href='client/account/logout.php'><span>Logout</span></a></li> <li><a href='client/account/profile.php'><span>Profile</span></a></li> </ul> </li>"; } ?> or Create a variable like this <?php $username = $_SESSION['username']; if ($username) { echo "<li><a href='#'><span>$username</span></a> <ul> <li><a href='client/account/logout.php'><span>Logout</span></a></li> <li><a href='client/account/profile.php'><span>Profile</span></a></li> </ul> </li>"; } ?> Hope this all helped, Also when echoing use ' instead of " single is faster only a small amount but it is faster in php. so instead of " . . " it would become ' . . ' in singles. Let me know if you have any problems! Brodey
-
Thanks mate, I have them stored in a table for example filename, file extension So your saying I could do the following: SELECT extension FROM files WHERE extension = 'jpeg' || 'gif' Sorry I am not php pro, I am newish this is just a project for learning. What I have in more detail is depending on the file type depends on the file type icon. You can see here secure.cloudbankr.com username: guest password: guest and upload you can see the file icon changes depending on the file type. it is one massive if statement. I learnt if statements before arrays which is why it's an if. I only just learnt arrays and I thought well it looks smaller maybe it's faster and better? so it chooses the type from the database and then creates a variable change depending on the file type so in my div class="<?php echo "$type"; ?> and my if is { type = 'jpeg'; } based on the if... I don't see how a mysql query will filter it to make a different variable each time. without running a query each time. which is not faster.
-
I am writting a document management application which is running a very large if statement, similar to if(($filetype == jpeg)||(filetype == gif)){ $type = "Image"; }elseif... and so on it's about 180 lines. The Problem is I can do it in an array as well, an array will be less code. but is it faster? I am talking large amounts my software knows 600 different extensions with 380 different icons assigned to the file type. I need to know for performance which is faster? and array or an if and ifelse? If I could get assistance that would be good. I would test it myself but rewritting as array for no reason if an if statement is the faster of the two. Thanks.